From 1bb8657a8f1a3145ae0d66068f142008012da1cb Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 1 Sep 2006 06:13:33 +0000 Subject: [PATCH] Fixed an off-by-one error in the portalplayer timer handling. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10837 a1c6a512-1295-4272-9138-f99709370657 --- firmware/kernel.c | 2 +- firmware/timer.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/firmware/kernel.c b/firmware/kernel.c index b4123fe3ca..889f950252 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c @@ -392,7 +392,7 @@ void tick_start(unsigned int interval_in_ms) TIMER1_CFG = 0x0; TIMER1_VAL; /* enable timer */ - TIMER1_CFG = 0xc0000000 | (interval_in_ms*1000); + TIMER1_CFG = 0xc0000000 | (interval_in_ms*1000 - 1); /* unmask interrupt source */ CPU_INT_EN = TIMER1_MASK; #else diff --git a/firmware/timer.c b/firmware/timer.c index fd9bee2488..8523805890 100644 --- a/firmware/timer.c +++ b/firmware/timer.c @@ -55,7 +55,7 @@ void TIMER2(void) TIMER2_VAL; /* ACK interrupt */ if (cycles_new > 0) { - TIMER2_CFG = 0xc0000000 | cycles_new; + TIMER2_CFG = 0xc0000000 | (cycles_new - 1); cycles_new = 0; } if (pfn_timer != NULL) @@ -151,7 +151,7 @@ static bool timer_set(long cycles, bool start) TCN1 = 0; /* reset the timer */ TER1 = 0xff; /* clear all events */ #elif CONFIG_CPU == PP5020 || CONFIG_CPU == PP5002 - if (cycles > 0x1fffffff) + if (cycles > 0x20000000) return false; if (start) @@ -163,7 +163,7 @@ static bool timer_set(long cycles, bool start) } } if (start || (cycles_new == -1)) /* within isr, cycles_new is "locked" */ - TIMER2_CFG = 0xc0000000 | cycles; /* enable timer */ + TIMER2_CFG = 0xc0000000 | (cycles - 1); /* enable timer */ else cycles_new = cycles;