Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

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