From 47ab95904efe238568e4cc66f0d3aacd9e7a8c10 Mon Sep 17 00:00:00 2001 From: Tobias Diedrich Date: Tue, 23 Mar 2010 05:02:37 +0000 Subject: Add handler for audio irq. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25299 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/adc-as3514.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'firmware/target/arm/adc-as3514.c') diff --git a/firmware/target/arm/adc-as3514.c b/firmware/target/arm/adc-as3514.c index 9c2a421441..77d65455fb 100644 --- a/firmware/target/arm/adc-as3514.c +++ b/firmware/target/arm/adc-as3514.c @@ -37,6 +37,18 @@ unsigned short adc_read(int channel) { unsigned char buf[2]; + /* + * The AS3514 ADC will trigger an interrupt when the conversion + * is finished, if the corresponding enable bit in IRQ_ENRD2 + * is set. + * Previously the code did not wait and this apparently did + * not pose any problems, but this should be more correct. + * Without the wait the data read back may be completely or + * partially (first one of the two bytes) stale. + */ + ascodec_wait_adc_finished(); + + /* Read data */ if (ascodec_readbytes(AS3514_ADC_0, 2, buf) >= 0) { -- cgit v1.2.3