changeset 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 f03d68f18d7f
children 04f894424a8c
files include/pru_rtaudio_bin.h pru_rtaudio.p
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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,
--- 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