Incorrect handling of AT91RM9200 timer overflow
PATCH 1/1 Incorrect handling of AT91RM9200 timer overflow
Hi,
the AT91RM9200 timer functions are confusing apples with bananas.
When the (16-bit) timer overflows, we have lost exactly 2^16 counts (or a multiple thereof, but we currently can't catch that situation), but get_timer_raw() instead adds the (unrelated) conversion factor to milliseconds, causing udelay() to potentially return too early.
The patch below fixes this.
Cheers
Anders
CHANGELOG:
Fix incorrect handling of at91rm9200 timer overflow in get_timer_raw() Patch by Anders Larsen, 11 Nov 2005
---
cpu/arm920t/at91rm9200/interrupts.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
cpu/arm920t/at91rm9200/interrupts.c +1 -1
@@ -108,7 +108,7 @@ ulong get_timer_raw (void) timestamp += now - lastinc; }else {/* we have an overflow ... */ - timestamp += now +TIMER_LOAD_VAL - lastinc; + timestamp += now +0x10000 - lastinc; } lastinc = now;
PATCH 1/1 Incorrect handling of AT91RM9200 timer overflow
Wolfgang,
Quoted 9 lines
the AT91RM9200 timer functions are confusing apples with bananas.
When the (16-bit) timer overflows, we have lost exactly 2^16 counts (or a multiple thereof, but we currently can't catch that situation), but
get_timer_raw()instead adds the (unrelated) conversion factor to milliseconds, causingudelay()to potentially return too early.The patch below fixes this.
Quoted 8 lines
Cheers
AndersCHANGELOG:
Fix incorrect handling of at91rm9200 timer overflow inget_timer_raw()Patch by Anders Larsen, 11 Nov 2005Signed-off-by Anders Larsen <[email protected]>
Makes sense. Please apply.
--
Steven