diff options
-rw-r--r-- | firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c | 13 |
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 @@ | |||
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "adc.h" | 26 | #include "adc.h" |
27 | #include "adc-target.h" | 27 | #include "adc-target.h" |
28 | #include "system-target.h" | ||
28 | 29 | ||
29 | static struct mutex adc_mtx SHAREDBSS_ATTR; | 30 | static struct mutex adc_mtx SHAREDBSS_ATTR; |
30 | 31 | ||
@@ -41,24 +42,24 @@ unsigned short adc_scan(int channel) | |||
41 | 42 | ||
42 | if ((IPOD_HW_REVISION >> 16) == 1) | 43 | if ((IPOD_HW_REVISION >> 16) == 1) |
43 | { | 44 | { |
44 | int i, j; | 45 | int i; |
45 | unsigned pval = GPIOB_OUTPUT_VAL; | 46 | unsigned pval = GPIOB_OUTPUT_VAL; |
46 | 47 | ||
47 | GPIOB_OUTPUT_VAL = pval | 0x04; /* B2 -> high */ | 48 | GPIOB_OUTPUT_VAL = pval | 0x04; /* B2 -> high */ |
48 | for (i = 32; i > 0; --i); | 49 | udelay(2); |
49 | 50 | ||
50 | GPIOB_OUTPUT_VAL = pval; /* B2 -> low */ | 51 | GPIOB_OUTPUT_VAL = pval; /* B2 -> low */ |
51 | for (i = 200; i > 0; --i); | 52 | udelay(10); |
52 | 53 | ||
53 | for (j = 0; j < 8; j++) | 54 | for (i = 0; i < 8; i++) |
54 | { | 55 | { |
55 | GPIOB_OUTPUT_VAL = pval | 0x02; /* B1 -> high */ | 56 | GPIOB_OUTPUT_VAL = pval | 0x02; /* B1 -> high */ |
56 | for (i = 8; i > 0; --i); | 57 | udelay(1); |
57 | 58 | ||
58 | data = (data << 1) | ((GPIOB_INPUT_VAL & 0x08) >> 3); | 59 | data = (data << 1) | ((GPIOB_INPUT_VAL & 0x08) >> 3); |
59 | 60 | ||
60 | GPIOB_OUTPUT_VAL = pval; /* B1 -> low */ | 61 | GPIOB_OUTPUT_VAL = pval; /* B1 -> low */ |
61 | for (i = 320; i > 0; --i); | 62 | udelay(15); |
62 | } | 63 | } |
63 | } | 64 | } |
64 | else if ((IPOD_HW_REVISION >> 16) == 2) | 65 | else if ((IPOD_HW_REVISION >> 16) == 2) |