summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2010-08-20 22:21:07 +0000
committerJens Arnold <amiconn@rockbox.org>2010-08-20 22:21:07 +0000
commit0a080891e7b5849df2686df504c15b008ba8cc73 (patch)
tree8ce9b18d1200fb1bcc52d5dc2c2ccea4a1901b30 /firmware
parent43ccc1eef7a7dae532e36e5ee3fdd144637eb279 (diff)
downloadrockbox-0a080891e7b5849df2686df504c15b008ba8cc73.tar.gz
rockbox-0a080891e7b5849df2686df504c15b008ba8cc73.tar.bz2
rockbox-0a080891e7b5849df2686df504c15b008ba8cc73.zip
iPod 1st Gen: Fix battery ADC not working due to the EABI compiler optimizing the delay loops away. Use udelay() instead, not wasting CPU time when the CPU is not boosted.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27850 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c b/firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c
index cfeb78d198..37c719f2b1 100644
--- a/firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c
+++ b/firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c
@@ -25,6 +25,7 @@
#include "kernel.h"
#include "adc.h"
#include "adc-target.h"
+#include "system-target.h"
static struct mutex adc_mtx SHAREDBSS_ATTR;
@@ -41,24 +42,24 @@ unsigned short adc_scan(int channel)
if ((IPOD_HW_REVISION >> 16) == 1)
{
- int i, j;
+ int i;
unsigned pval = GPIOB_OUTPUT_VAL;
GPIOB_OUTPUT_VAL = pval | 0x04; /* B2 -> high */
- for (i = 32; i > 0; --i);
+ udelay(2);
GPIOB_OUTPUT_VAL = pval; /* B2 -> low */
- for (i = 200; i > 0; --i);
+ udelay(10);
- for (j = 0; j < 8; j++)
+ for (i = 0; i < 8; i++)
{
GPIOB_OUTPUT_VAL = pval | 0x02; /* B1 -> high */
- for (i = 8; i > 0; --i);
+ udelay(1);
data = (data << 1) | ((GPIOB_INPUT_VAL & 0x08) >> 3);
GPIOB_OUTPUT_VAL = pval; /* B1 -> low */
- for (i = 320; i > 0; --i);
+ udelay(15);
}
}
else if ((IPOD_HW_REVISION >> 16) == 2)