diff pru_rtaudio.p @ 283:bfe2e929304b prerelease

Updated PRU code -- same idea for muxes 4-7
author andrewm
date Tue, 17 May 2016 18:31:43 +0100
parents 5b490c00488f
children c6a15a8dee02
line wrap: on
line diff
--- a/pru_rtaudio.p	Tue May 17 17:54:35 2016 +0100
+++ b/pru_rtaudio.p	Tue May 17 18:31:43 2016 +0100
@@ -582,6 +582,28 @@
      MOV reg_pru1_mux_pins, r28       // Move back to r30 to propagate to pins
 DONE:
 .endm
+
+// Multiplexer Capelet: Increment channel on muxes 4-7
+.macro MUX_INCREMENT_4_TO_7
+     MOV r28, FLAG_MASK_MUX_CONFIG
+     AND r28, reg_flags, r28             // Check flags
+     QBEQ DONE, r28, 0                   // Skip if disabled
+     LSR r28, r28, FLAG_BIT_MUX_CONFIG0
+     AND r27, reg_pru1_mux_pins, 0x38    // Current mux channel in r30 bits 5-3
+     ADD r27, r27, 8            // Increment channel (+1 LSB starting at bit 3)
+     AND r27, r27, 0x38         // Mask to 8 channels
+     QBEQ UPDATE, r28, 0x03
+     AND r27, r27, 0x18         // Mask to 4 channels
+     QBEQ UPDATE, r28, 0x02
+     AND r27, r27, 0x08         // Mask to 2 channels
+UPDATE:
+     MOV r28, 0xFFFFFFC7
+     AND r28, reg_pru1_mux_pins, r28  // Mask out bits 5-3 of r30
+     OR  r28, r28, r27                // Combine with new value
+     MOV reg_pru1_mux_pins, r28       // Move back to r30 to propagate to pins
+DONE:
+.endm
+
 	
 START:
      // Load useful registers for addressing SPI
@@ -1021,6 +1043,9 @@
      QBNE MUX_0_3_DONE, r1, 3    // Change mux settings for ch0-3 after reading ch. 3
      MUX_INCREMENT_0_TO_3
 MUX_0_3_DONE:
+     QBNE MUX_4_7_DONE, r1, 7    // Change mux settings for ch4-7 after reading ch. 7
+     MUX_INCREMENT_4_TO_7
+MUX_4_7_DONE:
 	
      // Toggle the high/low word for McASP control (since we send one word out of
      // 32 bits for each pair of SPI channels)