diff options
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c | 4 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-target.h | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c index 4129d34ec7..d23fb432d6 100644 --- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c +++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c | |||
@@ -233,12 +233,12 @@ int button_read_device(void) | |||
233 | CCU_IO &= ~(1<<12); | 233 | CCU_IO &= ~(1<<12); |
234 | 234 | ||
235 | GPIOB_PIN(0) = 1<<0; | 235 | GPIOB_PIN(0) = 1<<0; |
236 | udelay(10); | 236 | udelay(4); |
237 | 237 | ||
238 | gpiod6 = GPIOD_PIN(6); | 238 | gpiod6 = GPIOD_PIN(6); |
239 | 239 | ||
240 | GPIOB_PIN(0) = 0; | 240 | GPIOB_PIN(0) = 0; |
241 | udelay(5); | 241 | udelay(2); |
242 | 242 | ||
243 | if (GPIOC_PIN(1) & 1<<1) | 243 | if (GPIOC_PIN(1) & 1<<1) |
244 | btn |= BUTTON_DOWN; | 244 | btn |= BUTTON_DOWN; |
diff --git a/firmware/target/arm/as3525/system-target.h b/firmware/target/arm/as3525/system-target.h index ee46e7c7a5..38e2028f65 100644 --- a/firmware/target/arm/as3525/system-target.h +++ b/firmware/target/arm/as3525/system-target.h | |||
@@ -66,15 +66,15 @@ static inline void udelay(unsigned usecs) | |||
66 | int end; | 66 | int end; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * we're limited to 1.5us multiplies due to the odd timer frequency (1.5MHz), | 69 | * we're limited to 0.666us multiplies due to the odd timer frequency (1.5MHz), |
70 | * to avoid calculating which is safer (need to round up for small values) | 70 | * to avoid calculating which is safer (need to round up for small values) |
71 | * and saves spending time in the divider we have a lut for | 71 | * and saves spending time in the divider we have a lut for |
72 | * small us values, it should be roughly us*2/3 | 72 | * small us values, it should be roughly us*3/2 |
73 | **/ | 73 | **/ |
74 | static const unsigned char udelay_lut[] = | 74 | static const unsigned char udelay_lut[] = |
75 | { | 75 | { |
76 | 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, | 76 | 0, 2, 3, 5, 6, 8, 9, 11, 12, 14, |
77 | 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, | 77 | 15, 17, 18, 20, 21, 23, 24, 26, 27, 29, |
78 | }; | 78 | }; |
79 | 79 | ||
80 | 80 | ||
@@ -82,7 +82,7 @@ static inline void udelay(unsigned usecs) | |||
82 | /* we don't want to handle multiple overflows, so limit the numbers | 82 | /* we don't want to handle multiple overflows, so limit the numbers |
83 | * (if you want to wait more than a tick just poll current_tick, or | 83 | * (if you want to wait more than a tick just poll current_tick, or |
84 | * call sleep()) */ | 84 | * call sleep()) */ |
85 | if (UNLIKELY(usecs >= TIMER_PERIOD)) | 85 | if (UNLIKELY(usecs >= (TIMER_PERIOD*2/3))) |
86 | panicf("%s(): %d too high!", __func__, usecs); | 86 | panicf("%s(): %d too high!", __func__, usecs); |
87 | if (UNLIKELY(usecs <= 0)) | 87 | if (UNLIKELY(usecs <= 0)) |
88 | return; | 88 | return; |
@@ -92,7 +92,7 @@ static inline void udelay(unsigned usecs) | |||
92 | } | 92 | } |
93 | else | 93 | else |
94 | { /* to usecs */ | 94 | { /* to usecs */ |
95 | int delay = usecs * 2 / 3; /* us * 1.5 = us*timer_period */ | 95 | int delay = usecs * 3 / 2; /* us * 0.666 = us*timer_period */ |
96 | end = now - delay; | 96 | end = now - delay; |
97 | } | 97 | } |
98 | 98 | ||