Mercurial > hg > beaglert
comparison pru_rtaudio.p @ 100:b697e82ebb25
PRU now checks for McASP underrun and resets if detects it.
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 27 Jul 2015 12:44:55 +0100 |
parents | 472e892c6e41 |
children | 31ca45939a0c |
comparison
equal
deleted
inserted
replaced
99:f03d68f18d7f | 100:b697e82ebb25 |
---|---|
143 #define MCASP_WFIFOCTL 0x1000 | 143 #define MCASP_WFIFOCTL 0x1000 |
144 #define MCASP_WFIFOSTS 0x1004 | 144 #define MCASP_WFIFOSTS 0x1004 |
145 #define MCASP_RFIFOCTL 0x1008 | 145 #define MCASP_RFIFOCTL 0x1008 |
146 #define MCASP_RFIFOSTS 0x100C | 146 #define MCASP_RFIFOSTS 0x100C |
147 | 147 |
148 #define MCASP_XSTAT_XUNDRN_BIT 0 // Bit to test if there was an underrun | |
148 #define MCASP_XSTAT_XDATA_BIT 5 // Bit to test for transmit ready | 149 #define MCASP_XSTAT_XDATA_BIT 5 // Bit to test for transmit ready |
149 #define MCASP_RSTAT_RDATA_BIT 5 // Bit to test for receive ready | 150 #define MCASP_RSTAT_RDATA_BIT 5 // Bit to test for receive ready |
150 | 151 |
151 // Constants used for this particular audio setup | 152 // Constants used for this particular audio setup |
152 #define MCASP_BASE MCASP0_BASE | 153 #define MCASP_BASE MCASP0_BASE |
851 // Every 2 channels we send one audio sample; this loop already | 852 // Every 2 channels we send one audio sample; this loop already |
852 // sends exactly two SPI channels. | 853 // sends exactly two SPI channels. |
853 // Wait for McASP XSTAT[XDATA] to set indicating we can write more data | 854 // Wait for McASP XSTAT[XDATA] to set indicating we can write more data |
854 MCASP_WAIT_XSTAT: | 855 MCASP_WAIT_XSTAT: |
855 LBBO r2, reg_mcasp_addr, MCASP_XSTAT, 4 | 856 LBBO r2, reg_mcasp_addr, MCASP_XSTAT, 4 |
857 QBBS START, r2, MCASP_XSTAT_XUNDRN_BIT // if underrun occurred, reset the PRU | |
856 QBBC MCASP_WAIT_XSTAT, r2, MCASP_XSTAT_XDATA_BIT | 858 QBBC MCASP_WAIT_XSTAT, r2, MCASP_XSTAT_XDATA_BIT |
857 | 859 |
858 MCASP_REG_WRITE_EXT MCASP_XBUF, r7 | 860 MCASP_REG_WRITE_EXT MCASP_XBUF, r7 |
859 | 861 |
860 // Same idea with ADC: even iterations, load the sample into the low word, odd | 862 // Same idea with ADC: even iterations, load the sample into the low word, odd |