# HG changeset patch # User Giulio Moro # Date 1437997495 -3600 # Node ID b697e82ebb25059cc6c3f6238c591f26b10f9c65 # Parent f03d68f18d7fd08afe0474c84901d543e315798a PRU now checks for McASP underrun and resets if detects it. diff -r f03d68f18d7f -r b697e82ebb25 include/pru_rtaudio_bin.h --- a/include/pru_rtaudio_bin.h Mon Jul 27 11:33:08 2015 +0100 +++ b/include/pru_rtaudio_bin.h Mon Jul 27 12:44:55 2015 +0100 @@ -630,7 +630,8 @@ 0x79000002, 0x0b10eee7, 0xf1c03d82, - 0xcf05e2ff, + 0xd500e29d, + 0xcf05e2fe, 0x10e7e7fb, 0x240208fc, 0x00fcfdfc, @@ -751,13 +752,13 @@ 0x0104f3f3, 0x1504f8f8, 0x0101e1e1, - 0x6ee9e178, + 0x6ee9e177, 0x79000004, 0x1504f8f8, 0x0102e1e1, - 0x6ee9e174, + 0x6ee9e173, 0x0101eaea, - 0x6eebea71, + 0x6eebea70, 0x10f0f0e2, 0x10f1f1f0, 0x10e2e2f1, @@ -786,7 +787,7 @@ 0x00e1e3e3, 0xe1002382, 0xf1003982, - 0x5700e244, + 0x5700e243, 0x240000fb, 0xe1443d9b, 0xc901f80c, diff -r f03d68f18d7f -r b697e82ebb25 pru_rtaudio.p --- a/pru_rtaudio.p Mon Jul 27 11:33:08 2015 +0100 +++ b/pru_rtaudio.p Mon Jul 27 12:44:55 2015 +0100 @@ -145,6 +145,7 @@ #define MCASP_RFIFOCTL 0x1008 #define MCASP_RFIFOSTS 0x100C +#define MCASP_XSTAT_XUNDRN_BIT 0 // Bit to test if there was an underrun #define MCASP_XSTAT_XDATA_BIT 5 // Bit to test for transmit ready #define MCASP_RSTAT_RDATA_BIT 5 // Bit to test for receive ready @@ -853,6 +854,7 @@ // Wait for McASP XSTAT[XDATA] to set indicating we can write more data MCASP_WAIT_XSTAT: LBBO r2, reg_mcasp_addr, MCASP_XSTAT, 4 + QBBS START, r2, MCASP_XSTAT_XUNDRN_BIT // if underrun occurred, reset the PRU QBBC MCASP_WAIT_XSTAT, r2, MCASP_XSTAT_XDATA_BIT MCASP_REG_WRITE_EXT MCASP_XBUF, r7