diff pru_rtaudio.p @ 188:c706be7daad7

Fixed misbehaviour of GPIO when -C2: the GPIO buffer was being processed at double sampling rate and so for the second part of the buffer, it was just processing zeros. Closes #1532.
author Giulio Moro <giuliomoro@yahoo.it>
date Wed, 20 Jan 2016 15:35:48 +0000
parents 31ca45939a0c
children 33e0e4831763
line wrap: on
line diff
--- a/pru_rtaudio.p	Tue Jan 19 02:54:13 2016 +0000
+++ b/pru_rtaudio.p	Wed Jan 20 15:35:48 2016 +0000
@@ -383,7 +383,7 @@
 JMP r28.w0 // go back to ADC_WRITE_AND_PROCESS_GPIO
 
 .macro HANG //useful for debugging
-DALOOP: 
+DALOOP:
     set r30.t14
     clr r30.t14
 QBA DALOOP
@@ -480,8 +480,15 @@
      ADC_CS_ASSERT
      ADC_TX in
      QBBC GPIO_DONE, reg_flags, FLAG_BIT_USE_DIGITAL //skip if DIGITAL is disabled
+     QBLT CASE_4_OR_8_CHANNELS, reg_num_channels, 2
+CASE_2_CHANNELS:
+     AND r27, reg_frame_current, 0x1
+     QBNE GPIO_DONE, r27, 0
+     JMP DO_GPIO
+CASE_4_OR_8_CHANNELS:
      AND r27, do_gpio, 0x3 // only do a DIGITAL every 2 SPI I/O
      QBNE GPIO_DONE, r27, 0 
+DO_GPIO:
 //from here to GPIO_DONE takes 1.8us, while usually ADC_WAIT_FOR_FINISH only waits for 1.14us.
 //TODO: it would be better to split the DIGITAL stuff in two parts:
 //- one taking place during DAC_WRITE which sets the GPIO_OE