comparison pru_rtaudio.p @ 19:c98863e63174 matrix_gpio

Renamed matrixGpio to digital and matrix to analog
author Giulio Moro <giuliomoro@yahoo.it>
date Thu, 30 Apr 2015 16:58:41 +0100
parents 670be80463a3
children 6d64ee8c0754
comparison
equal deleted inserted replaced
18:31503d9de101 19:c98863e63174
79 #define COMM_LED_ADDRESS 24 // Which memory address to find the status LED on 79 #define COMM_LED_ADDRESS 24 // Which memory address to find the status LED on
80 #define COMM_LED_PIN_MASK 28 // Which pin to write to change LED 80 #define COMM_LED_PIN_MASK 28 // Which pin to write to change LED
81 #define COMM_FRAME_COUNT 32 // How many frames have elapse since beginning 81 #define COMM_FRAME_COUNT 32 // How many frames have elapse since beginning
82 #define COMM_USE_SPI 36 // Whether or not to use SPI ADC and DAC 82 #define COMM_USE_SPI 36 // Whether or not to use SPI ADC and DAC
83 #define COMM_NUM_CHANNELS 40 // Low 2 bits indicate 8 [0x3], 4 [0x1] or 2 [0x0] channels 83 #define COMM_NUM_CHANNELS 40 // Low 2 bits indicate 8 [0x3], 4 [0x1] or 2 [0x0] channels
84 #define COMM_USE_MATRIX_GPIO 44 // Whether or not to use MATRIX_GPIO 84 #define COMM_USE_DIGITAL 44 // Whether or not to use DIGITAL
85 85
86 #define MCASP0_BASE 0x48038000 86 #define MCASP0_BASE 0x48038000
87 #define MCASP1_BASE 0x4803C000 87 #define MCASP1_BASE 0x4803C000
88 88
89 #define MCASP_PWRIDLESYSCONFIG 0x04 89 #define MCASP_PWRIDLESYSCONFIG 0x04
179 179
180 // Flags for the flags register 180 // Flags for the flags register
181 #define FLAG_BIT_BUFFER1 0 181 #define FLAG_BIT_BUFFER1 0
182 #define FLAG_BIT_USE_SPI 1 182 #define FLAG_BIT_USE_SPI 1
183 #define FLAG_BIT_MCASP_HWORD 2 // Whether we are on the high word for McASP transmission 183 #define FLAG_BIT_MCASP_HWORD 2 // Whether we are on the high word for McASP transmission
184 #define FLAG_BIT_USE_MATRIX_GPIO 3 184 #define FLAG_BIT_USE_DIGITAL 3
185 /*#define FLAG_BIT_MATRIX_GPIO_BUFFER 4 //Whether we are using buffer located at 185 /*#define FLAG_BIT_DIGITAL_BUFFER 4 //Whether we are using buffer located at
186 // 0: MEM_MATRIX_GPIO_BASE or 186 // 0: MEM_DIGITAL_BASE or
187 */ // 1: MEM_MATRIX_GPIO_BASE + 512 187 */ // 1: MEM_DIGITAL_BASE + 512
188 // Registers used throughout 188 // Registers used throughout
189 189
190 // r1, r2, r3 are used for temporary storage 190 // r1, r2, r3 are used for temporary storage
191 #define MEM_MATRIX_GPIO_BASE 0x11000 //Base address for MATRIX_GPIO : Shared RAM + 0x400 191 #define MEM_DIGITAL_BASE 0x11000 //Base address for DIGITAL : Shared RAM + 0x400
192 #define MEM_MATRIX_GPIO_BUFFER1_OFFSET 0x400 //Start pointer to MATRIX_GPIO_BUFFER1, which is 256 words after. 192 #define MEM_DIGITAL_BUFFER1_OFFSET 0x400 //Start pointer to DIGITAL_BUFFER1, which is 256 words after.
193 // 256 is the maximum number of frames allowed 193 // 256 is the maximum number of frames allowed
194 194
195 #define reg_matrix_gpio_current r6 // Pointer to current storage location of MATRIX_GPIO 195 #define reg_digital_current r6 // Pointer to current storage location of DIGITAL
196 #define reg_num_channels r9 // Number of SPI ADC/DAC channels to use 196 #define reg_num_channels r9 // Number of SPI ADC/DAC channels to use
197 #define reg_frame_current r10 // Current frame count in SPI ADC/DAC transfer 197 #define reg_frame_current r10 // Current frame count in SPI ADC/DAC transfer
198 #define reg_frame_total r11 // Total frame count for SPI ADC/DAC 198 #define reg_frame_total r11 // Total frame count for SPI ADC/DAC
199 #define reg_dac_data r12 // Current dword for SPI DAC 199 #define reg_dac_data r12 // Current dword for SPI DAC
200 #define reg_adc_data r13 // Current dword for SPI ADC 200 #define reg_adc_data r13 // Current dword for SPI ADC
212 #define reg_comm_addr r25 // Memory address for communicating with ARM 212 #define reg_comm_addr r25 // Memory address for communicating with ARM
213 #define reg_spi_addr r26 // Base address for SPI 213 #define reg_spi_addr r26 // Base address for SPI
214 // r27, r28 used in macros 214 // r27, r28 used in macros
215 #define reg_mcasp_addr r29 // Base address for McASP 215 #define reg_mcasp_addr r29 // Base address for McASP
216 216
217 // MATRIX_GPIO new code starts here 217 // DIGITAL new code starts here
218 //0 P8_07 36 0x890/090 66 gpio2[2] 218 //0 P8_07 36 0x890/090 66 gpio2[2]
219 //1 P8_08 37 0x894/094 67 gpio2[3] 219 //1 P8_08 37 0x894/094 67 gpio2[3]
220 //2 P8_09 39 0x89c/09c 69 gpio2[5] 220 //2 P8_09 39 0x89c/09c 69 gpio2[5]
221 //3 P8_10 38 0x898/098 68 gpio2[4] 221 //3 P8_10 38 0x898/098 68 gpio2[4]
222 //4 P8_11 13 0x834/034 45 gpio1[13] 222 //4 P8_11 13 0x834/034 45 gpio1[13]
247 #define reg_gpio2_oe r3 247 #define reg_gpio2_oe r3
248 #define reg_gpio2_cleardataout r4 248 #define reg_gpio2_cleardataout r4
249 #define reg_gpio2_setdataout r5 249 #define reg_gpio2_setdataout r5
250 #define reg_gpio1_cleardataout r7 250 #define reg_gpio1_cleardataout r7
251 #define reg_gpio1_setdataout r8 251 #define reg_gpio1_setdataout r8
252 #define reg_matrix_gpio r27 //will first contain matrixGpioOut from render() and matrixGpioIn to render() later 252 #define reg_digital r27 //will first contain digitalOut from render() and digitalIn to render() later
253 //aliases 253 //aliases
254 #define reg_gpio1_datain reg_gpio1_oe 254 #define reg_gpio1_datain reg_gpio1_oe
255 #define reg_gpio2_datain reg_gpio2_oe 255 #define reg_gpio2_datain reg_gpio2_oe
256 256
257 .macro SET_GPIO1_BITS 257 .macro SET_GPIO1_BITS
258 .mparam gpio_num_bit, matrix_gpio_bit 258 .mparam gpio_num_bit, digital_bit
259 SET_GPIO_BITS reg_gpio1_oe, reg_gpio1_setdataout, reg_gpio1_cleardataout, gpio_num_bit, matrix_gpio_bit, reg_matrix_gpio 259 SET_GPIO_BITS reg_gpio1_oe, reg_gpio1_setdataout, reg_gpio1_cleardataout, gpio_num_bit, digital_bit, reg_digital
260 .endm 260 .endm
261 .macro SET_GPIO2_BITS 261 .macro SET_GPIO2_BITS
262 .mparam gpio_num_bit, matrix_gpio_bit 262 .mparam gpio_num_bit, digital_bit
263 SET_GPIO_BITS reg_gpio2_oe, reg_gpio2_setdataout, reg_gpio2_cleardataout, gpio_num_bit, matrix_gpio_bit, reg_matrix_gpio 263 SET_GPIO_BITS reg_gpio2_oe, reg_gpio2_setdataout, reg_gpio2_cleardataout, gpio_num_bit, digital_bit, reg_digital
264 .endm 264 .endm
265 .macro READ_GPIO1_BITS 265 .macro READ_GPIO1_BITS
266 .mparam gpio_num_bit, matrix_gpio_bit 266 .mparam gpio_num_bit, digital_bit
267 READ_GPIO_BITS reg_gpio1_datain, gpio_num_bit, matrix_gpio_bit, reg_matrix_gpio 267 READ_GPIO_BITS reg_gpio1_datain, gpio_num_bit, digital_bit, reg_digital
268 .endm 268 .endm
269 .macro READ_GPIO2_BITS 269 .macro READ_GPIO2_BITS
270 .mparam gpio_num_bit, matrix_gpio_bit 270 .mparam gpio_num_bit, digital_bit
271 READ_GPIO_BITS reg_gpio2_datain, gpio_num_bit, matrix_gpio_bit, reg_matrix_gpio 271 READ_GPIO_BITS reg_gpio2_datain, gpio_num_bit, digital_bit, reg_digital
272 .endm 272 .endm
273 273
274 .macro READ_GPIO_BITS 274 .macro READ_GPIO_BITS
275 .mparam gpio_data, gpio_num_bit, matrix_gpio_bit, matrix_gpio 275 .mparam gpio_data, gpio_num_bit, digital_bit, digital
276 QBBC DONE, matrix_gpio, matrix_gpio_bit //if the pin is set as an output, nothing to do here 276 QBBC DONE, digital, digital_bit //if the pin is set as an output, nothing to do here
277 SET r30.t14 277 SET r30.t14
278 QBBC CLEAR, gpio_data, gpio_num_bit 278 QBBC CLEAR, gpio_data, gpio_num_bit
279 SET matrix_gpio, matrix_gpio_bit+16 279 SET digital, digital_bit+16
280 QBA DONE 280 QBA DONE
281 CLEAR: 281 CLEAR:
282 CLR matrix_gpio, matrix_gpio_bit+16 282 CLR digital, digital_bit+16
283 QBA DONE 283 QBA DONE
284 DONE: 284 DONE:
285 CLR r30.t14 285 CLR r30.t14
286 .endm 286 .endm
287 287
288 .macro SET_GPIO_BITS 288 .macro SET_GPIO_BITS
289 .mparam gpio_oe, gpio_setdataout, gpio_cleardataout, gpio_num_bit, matrix_gpio_bit, matrix_gpio //sets the bits in GPIO_OE, GPIO_SETDATAOUT and GPIO_CLEARDATAOUT 289 .mparam gpio_oe, gpio_setdataout, gpio_cleardataout, gpio_num_bit, digital_bit, digital //sets the bits in GPIO_OE, GPIO_SETDATAOUT and GPIO_CLEARDATAOUT
290 //Remember that the GPIO_OE Output data enable register behaves as follows for each bit: 290 //Remember that the GPIO_OE Output data enable register behaves as follows for each bit:
291 //0 = The corresponding GPIO pin is configured as an output. 291 //0 = The corresponding GPIO pin is configured as an output.
292 //1 = The corresponding GPIO pin is configured as an input. 292 //1 = The corresponding GPIO pin is configured as an input.
293 QBBS SETINPUT, matrix_gpio, matrix_gpio_bit 293 QBBS SETINPUT, digital, digital_bit
294 CLR gpio_oe, gpio_num_bit //if it is an output, configure pin as output 294 CLR gpio_oe, gpio_num_bit //if it is an output, configure pin as output
295 QBBC CLEARDATAOUT, matrix_gpio, matrix_gpio_bit+16 // check the output value. If it is 0, branch 295 QBBC CLEARDATAOUT, digital, digital_bit+16 // check the output value. If it is 0, branch
296 SET gpio_setdataout, gpio_num_bit //if it is 1, set output to high 296 SET gpio_setdataout, gpio_num_bit //if it is 1, set output to high
297 QBA DONE 297 QBA DONE
298 CLEARDATAOUT: 298 CLEARDATAOUT:
299 SET gpio_cleardataout, gpio_num_bit // set output to low 299 SET gpio_cleardataout, gpio_num_bit // set output to low
300 QBA DONE 300 QBA DONE
304 DONE: 304 DONE:
305 .endm 305 .endm
306 306
307 .macro PROCESS_GPIO1_BITS 307 .macro PROCESS_GPIO1_BITS
308 //- sets appropriate bits for output in reg_gpio1_oe, reg_gpio1_cleardataout, reg_gpio1_data 308 //- sets appropriate bits for output in reg_gpio1_oe, reg_gpio1_cleardataout, reg_gpio1_data
309 //- sets appropriate bits in reg_matrix_gpio to reflect the input values 309 //- sets appropriate bits in reg_digital to reflect the input values
310 .mparam gpio_num_bit, matrix_gpio_bit 310 .mparam gpio_num_bit, digital_bit
311 // params to SET_GPIO_BITS gpio_oe, gpio_setdataout, gpio_cleardataout, gpio_num_bit, matrix_gpio_bit, matrix_gpio //sets the bits in GPIO_OE, GPIO_SETDATAOUT and GPIO_CLEARDATAOUT 311 // params to SET_GPIO_BITS gpio_oe, gpio_setdataout, gpio_cleardataout, gpio_num_bit, digital_bit, digital //sets the bits in GPIO_OE, GPIO_SETDATAOUT and GPIO_CLEARDATAOUT
312 SET_GPIO_BITS reg_gpio1_oe, reg_gpio1_setdataout, reg_gpio1_cleardataout, gpio_num_bit, matrix_gpio_bit, reg_matrix_gpio 312 SET_GPIO_BITS reg_gpio1_oe, reg_gpio1_setdataout, reg_gpio1_cleardataout, gpio_num_bit, digital_bit, reg_digital
313 READ_GPIO_BITS reg_gpio1_oe, reg_gpio1_datain, gpio_num_bit, matrix_gpio_bit, reg_matrix_gpio 313 READ_GPIO_BITS reg_gpio1_oe, reg_gpio1_datain, gpio_num_bit, digital_bit, reg_digital
314 .endm 314 .endm
315 315
316 .macro PROCESS_GPIO2_BITS 316 .macro PROCESS_GPIO2_BITS
317 //- sets appropriate bits for output in reg_gpio2_oe, reg_gpio2_cleardataout, reg_gpio2_data 317 //- sets appropriate bits for output in reg_gpio2_oe, reg_gpio2_cleardataout, reg_gpio2_data
318 //- sets appropriate bits in reg_matrix_gpio to reflect the input values 318 //- sets appropriate bits in reg_digital to reflect the input values
319 .mparam gpio_num_bit, matrix_gpio_bit 319 .mparam gpio_num_bit, digital_bit
320 SET_GPIO_BITS reg_gpio2_oe, reg_gpio2_setdataout, reg_gpio2_cleardataout, gpio_num_bit, matrix_gpio_bit, reg_matrix_gpio 320 SET_GPIO_BITS reg_gpio2_oe, reg_gpio2_setdataout, reg_gpio2_cleardataout, gpio_num_bit, digital_bit, reg_digital
321 READ_GPIO_BITS reg_gpio2_oe, reg_gpio2_datain, gpio_num_bit, matrix_gpio_bit, reg_matrix_gpio 321 READ_GPIO_BITS reg_gpio2_oe, reg_gpio2_datain, gpio_num_bit, digital_bit, reg_digital
322 .endm 322 .endm
323 323
324 QBA START // when first starting, go to START, skipping this section. 324 QBA START // when first starting, go to START, skipping this section.
325 325
326 MATRIX_GPIO: 326 DIGITAL:
327 //reg_matrix_gpio is now the input word passed in render(), one word per frame 327 //reg_digital is now the input word passed in render(), one word per frame
328 //[31:16]: data(1=high, 0=low), [15:0]: direction (0=output, 1=input) ) 328 //[31:16]: data(1=high, 0=low), [15:0]: direction (0=output, 1=input) )
329 //Preparing the gpio_oe, gpio_cleardataout and gpio_setdataout for each module 329 //Preparing the gpio_oe, gpio_cleardataout and gpio_setdataout for each module
330 330
331 //load current status of GPIO_OE in reg_gpioX_oe 331 //load current status of GPIO_OE in reg_gpioX_oe
332 MOV reg_gpio1_oe, GPIO1 | GPIO_OE 332 MOV reg_gpio1_oe, GPIO1 | GPIO_OE
334 LBBO reg_gpio1_oe, reg_gpio1_oe, 0, 4 334 LBBO reg_gpio1_oe, reg_gpio1_oe, 0, 4
335 //GPIO1-start 335 //GPIO1-start
336 //process oe and datain and prepare dataout for GPIO1 336 //process oe and datain and prepare dataout for GPIO1
337 LDI reg_gpio1_setdataout, 0 337 LDI reg_gpio1_setdataout, 0
338 LDI reg_gpio1_cleardataout, 0 338 LDI reg_gpio1_cleardataout, 0
339 //map GPIO_MATRIX to gpio1 pins, affects reg_gpio1_oe, reg_gpio1_cleardataout, reg_gpio1_data, reg_matrix_gpio 339 //map GPIO_ANALOG to gpio1 pins, affects reg_gpio1_oe, reg_gpio1_cleardataout, reg_gpio1_data, reg_digital
340 SET_GPIO1_BITS 13, 4 340 SET_GPIO1_BITS 13, 4
341 SET_GPIO1_BITS 12, 5 341 SET_GPIO1_BITS 12, 5
342 SET_GPIO1_BITS 28, 6 342 SET_GPIO1_BITS 28, 6
343 SET_GPIO1_BITS 18, 7 343 SET_GPIO1_BITS 18, 7
344 SET_GPIO1_BITS 15, 8 344 SET_GPIO1_BITS 15, 8
357 //takes ...ns to go through the next two instructions 357 //takes ...ns to go through the next two instructions
358 LBBO reg_gpio2_oe, reg_gpio1_oe, 0, 4 358 LBBO reg_gpio2_oe, reg_gpio1_oe, 0, 4
359 //process oe and datain and prepare dataout for GPIO2 359 //process oe and datain and prepare dataout for GPIO2
360 LDI reg_gpio2_setdataout, 0 360 LDI reg_gpio2_setdataout, 0
361 LDI reg_gpio2_cleardataout, 0 361 LDI reg_gpio2_cleardataout, 0
362 //map GPIO_MATRIX to gpio2 pins, affects reg_gpio2_oe, reg_gpio2_cleardataout, reg_gpio2_data, reg_matrix_gpio 362 //map GPIO_ANALOG to gpio2 pins, affects reg_gpio2_oe, reg_gpio2_cleardataout, reg_gpio2_data, reg_digital
363 SET_GPIO2_BITS 2, 0 363 SET_GPIO2_BITS 2, 0
364 SET_GPIO2_BITS 3, 1 364 SET_GPIO2_BITS 3, 1
365 SET_GPIO2_BITS 5, 2 365 SET_GPIO2_BITS 5, 2
366 SET_GPIO2_BITS 4, 3 366 SET_GPIO2_BITS 4, 3
367 SET_GPIO2_BITS 1, 11 367 SET_GPIO2_BITS 1, 11
413 //reversing the order of the two lines above will swap the performances between the GPIO modules 413 //reversing the order of the two lines above will swap the performances between the GPIO modules
414 //i.e.: the first line will always take 145ns/185ns and the second one will always take 95ns/130ns, 414 //i.e.: the first line will always take 145ns/185ns and the second one will always take 95ns/130ns,
415 //regardless of whether the order is gpio1-gpio2 or gpio2-gpio1 415 //regardless of whether the order is gpio1-gpio2 or gpio2-gpio1
416 JMP r28.w0 // go back to ADC_WRITE_GPIO 416 JMP r28.w0 // go back to ADC_WRITE_GPIO
417 417
418 // MATRIX_GPIO new code ends here 418 // DIGITAL new code ends here
419 419
420 420
421 // Bring CS line low to write to DAC 421 // Bring CS line low to write to DAC
422 .macro DAC_CS_ASSERT 422 .macro DAC_CS_ASSERT
423 MOV r27, DAC_CS_PIN 423 MOV r27, DAC_CS_PIN
501 ADC_WAIT_FOR_FINISH 501 ADC_WAIT_FOR_FINISH
502 ADC_RX out 502 ADC_RX out
503 ADC_CS_UNASSERT 503 ADC_CS_UNASSERT
504 .endm 504 .endm
505 505
506 // Complete ADC write+read with chip select and also performs IO for matrix_gpio 506 // Complete ADC write+read with chip select and also performs IO for digital
507 .macro ADC_WRITE_GPIO 507 .macro ADC_WRITE_GPIO
508 .mparam in, out, do_gpio 508 .mparam in, out, do_gpio
509 ADC_CS_ASSERT 509 ADC_CS_ASSERT
510 ADC_TX in 510 ADC_TX in
511 QBBC GPIO_DONE, reg_flags, FLAG_BIT_USE_MATRIX_GPIO //skip if MATRIX_GPIO is disabled 511 QBBC GPIO_DONE, reg_flags, FLAG_BIT_USE_DIGITAL //skip if DIGITAL is disabled
512 AND r27, do_gpio, 0x3 // only do a MATRIX_GPIO every 2 SPI I/O 512 AND r27, do_gpio, 0x3 // only do a DIGITAL every 2 SPI I/O
513 QBNE GPIO_DONE, r27, 0 513 QBNE GPIO_DONE, r27, 0
514 //from here to GPIO_DONE takes 1.8us, while usually ADC_WAIT_FOR_FINISH only waits for 1.14us. 514 //from here to GPIO_DONE takes 1.8us, while usually ADC_WAIT_FOR_FINISH only waits for 1.14us.
515 //TODO: it would be better to split the MATRIX_GPIO stuff in two parts: 515 //TODO: it would be better to split the DIGITAL stuff in two parts:
516 //- one taking place during DAC_WRITE which sets the GPIO_OE 516 //- one taking place during DAC_WRITE which sets the GPIO_OE
517 //- and the other during ADC_WRITE which actually reads DATAIN and writes CLEAR/SET DATAOUT 517 //- and the other during ADC_WRITE which actually reads DATAIN and writes CLEAR/SET DATAOUT
518 //reg_matrix_gpio is actually r27, so do not use r27 from here to ... 518 //reg_digital is actually r27, so do not use r27 from here to ...
519 LBBO reg_matrix_gpio, reg_matrix_gpio_current, 0, 4 519 LBBO reg_digital, reg_digital_current, 0, 4
520 JAL r28.w0, MATRIX_GPIO 520 JAL r28.w0, DIGITAL
521 SBBO reg_matrix_gpio, reg_matrix_gpio_current, 0, 4 521 SBBO reg_digital, reg_digital_current, 0, 4
522 //..here you can start using r27 again 522 //..here you can start using r27 again
523 ADD reg_matrix_gpio_current, reg_matrix_gpio_current, 4 //increment pointer 523 ADD reg_digital_current, reg_digital_current, 4 //increment pointer
524 GPIO_DONE: 524 GPIO_DONE:
525 ADC_WAIT_FOR_FINISH 525 ADC_WAIT_FOR_FINISH
526 ADC_RX out 526 ADC_RX out
527 ADC_CS_UNASSERT 527 ADC_CS_UNASSERT
528 .endm 528 .endm
597 MOV reg_flags, 0 597 MOV reg_flags, 0
598 598
599 // Default number of channels in case SPI disabled 599 // Default number of channels in case SPI disabled
600 LDI reg_num_channels, 8 600 LDI reg_num_channels, 8
601 601
602 // Find out whether we should use MATRIX_GPIO 602 // Find out whether we should use DIGITAL
603 LBBO r2, reg_comm_addr, COMM_USE_MATRIX_GPIO, 4 603 LBBO r2, reg_comm_addr, COMM_USE_DIGITAL, 4
604 QBEQ MATRIX_GPIO_FLAG_CHECK_DONE, r2, 0 604 QBEQ DIGITAL_FLAG_CHECK_DONE, r2, 0
605 SET reg_flags, reg_flags, FLAG_BIT_USE_MATRIX_GPIO 605 SET reg_flags, reg_flags, FLAG_BIT_USE_DIGITAL
606 // SET reg_flags, reg_flags, FLAG_BIT_MATRIX_GPIO_BUFFER //set the flag, so that in WRITE_ONE_BUFFER we will start from buffer0 606 // SET reg_flags, reg_flags, FLAG_BIT_DIGITAL_BUFFER //set the flag, so that in WRITE_ONE_BUFFER we will start from buffer0
607 MATRIX_GPIO_FLAG_CHECK_DONE: 607 DIGITAL_FLAG_CHECK_DONE:
608 // Find out whether we should use SPI ADC and DAC 608 // Find out whether we should use SPI ADC and DAC
609 LBBO r2, reg_comm_addr, COMM_USE_SPI, 4 609 LBBO r2, reg_comm_addr, COMM_USE_SPI, 4
610 QBEQ SPI_FLAG_CHECK_DONE, r2, 0 610 QBEQ SPI_FLAG_CHECK_DONE, r2, 0
611 SET reg_flags, reg_flags, FLAG_BIT_USE_SPI 611 SET reg_flags, reg_flags, FLAG_BIT_USE_SPI
612 612
793 MOV reg_mcasp_dac_current, reg_mcasp_buf0 // McASP: set current DAC pointer 793 MOV reg_mcasp_dac_current, reg_mcasp_buf0 // McASP: set current DAC pointer
794 LSL reg_mcasp_adc_current, reg_frame_total, r2 // McASP ADC: starts (N/2)*2*2*bufsize beyond DAC 794 LSL reg_mcasp_adc_current, reg_frame_total, r2 // McASP ADC: starts (N/2)*2*2*bufsize beyond DAC
795 LSL reg_mcasp_adc_current, reg_mcasp_adc_current, 1 795 LSL reg_mcasp_adc_current, reg_mcasp_adc_current, 1
796 ADC reg_mcasp_adc_current, reg_mcasp_adc_current, reg_mcasp_dac_current 796 ADC reg_mcasp_adc_current, reg_mcasp_adc_current, reg_mcasp_dac_current
797 MOV reg_frame_current, 0 797 MOV reg_frame_current, 0
798 QBBS MATRIX_GPIO_BASE_CHECK_SET, reg_flags, FLAG_BIT_BUFFER1 //check which buffer we are using for MATRIX_GPIO 798 QBBS DIGITAL_BASE_CHECK_SET, reg_flags, FLAG_BIT_BUFFER1 //check which buffer we are using for DIGITAL
799 // if we are here, we are using buffer0 799 // if we are here, we are using buffer0
800 MOV r2, 0 //so adjust offset appropriately 800 MOV r2, 0 //so adjust offset appropriately
801 QBA MATRIX_GPIO_BASE_CHECK_DONE 801 QBA DIGITAL_BASE_CHECK_DONE
802 MATRIX_GPIO_BASE_CHECK_SET: //if we are here, we are using buffer1 802 DIGITAL_BASE_CHECK_SET: //if we are here, we are using buffer1
803 MOV r2, MEM_MATRIX_GPIO_BUFFER1_OFFSET //so adjust offset appropriately 803 MOV r2, MEM_DIGITAL_BUFFER1_OFFSET //so adjust offset appropriately
804 MATRIX_GPIO_BASE_CHECK_DONE: 804 DIGITAL_BASE_CHECK_DONE:
805 MOV reg_matrix_gpio_current, MEM_MATRIX_GPIO_BASE 805 MOV reg_digital_current, MEM_DIGITAL_BASE
806 ADD reg_matrix_gpio_current, reg_matrix_gpio_current, r2 806 ADD reg_digital_current, reg_digital_current, r2
807 807
808 CLR r30.t15 808 CLR r30.t15
809 WRITE_LOOP: 809 WRITE_LOOP:
810 // Write N channels to DAC from successive values in memory 810 // Write N channels to DAC from successive values in memory
811 // At the same time, read N channels from ADC 811 // At the same time, read N channels from ADC