comparison 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
comparison
equal deleted inserted replaced
187:d7148d21aaa5 188:c706be7daad7
381 //i.e.: the first line will always take 145ns/185ns and the second one will always take 95ns/130ns, 381 //i.e.: the first line will always take 145ns/185ns and the second one will always take 95ns/130ns,
382 //regardless of whether the order is gpio1-gpio2 or gpio2-gpio1 382 //regardless of whether the order is gpio1-gpio2 or gpio2-gpio1
383 JMP r28.w0 // go back to ADC_WRITE_AND_PROCESS_GPIO 383 JMP r28.w0 // go back to ADC_WRITE_AND_PROCESS_GPIO
384 384
385 .macro HANG //useful for debugging 385 .macro HANG //useful for debugging
386 DALOOP: 386 DALOOP:
387 set r30.t14 387 set r30.t14
388 clr r30.t14 388 clr r30.t14
389 QBA DALOOP 389 QBA DALOOP
390 .endm 390 .endm
391 391
478 .macro ADC_WRITE_GPIO 478 .macro ADC_WRITE_GPIO
479 .mparam in, out, do_gpio 479 .mparam in, out, do_gpio
480 ADC_CS_ASSERT 480 ADC_CS_ASSERT
481 ADC_TX in 481 ADC_TX in
482 QBBC GPIO_DONE, reg_flags, FLAG_BIT_USE_DIGITAL //skip if DIGITAL is disabled 482 QBBC GPIO_DONE, reg_flags, FLAG_BIT_USE_DIGITAL //skip if DIGITAL is disabled
483 QBLT CASE_4_OR_8_CHANNELS, reg_num_channels, 2
484 CASE_2_CHANNELS:
485 AND r27, reg_frame_current, 0x1
486 QBNE GPIO_DONE, r27, 0
487 JMP DO_GPIO
488 CASE_4_OR_8_CHANNELS:
483 AND r27, do_gpio, 0x3 // only do a DIGITAL every 2 SPI I/O 489 AND r27, do_gpio, 0x3 // only do a DIGITAL every 2 SPI I/O
484 QBNE GPIO_DONE, r27, 0 490 QBNE GPIO_DONE, r27, 0
491 DO_GPIO:
485 //from here to GPIO_DONE takes 1.8us, while usually ADC_WAIT_FOR_FINISH only waits for 1.14us. 492 //from here to GPIO_DONE takes 1.8us, while usually ADC_WAIT_FOR_FINISH only waits for 1.14us.
486 //TODO: it would be better to split the DIGITAL stuff in two parts: 493 //TODO: it would be better to split the DIGITAL stuff in two parts:
487 //- one taking place during DAC_WRITE which sets the GPIO_OE 494 //- one taking place during DAC_WRITE which sets the GPIO_OE
488 //- and the other during ADC_WRITE which actually reads DATAIN and writes CLEAR/SET DATAOUT 495 //- and the other during ADC_WRITE which actually reads DATAIN and writes CLEAR/SET DATAOUT
489 //r27 is actually r27, so do not use r27 from here to ... 496 //r27 is actually r27, so do not use r27 from here to ...