summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/kernel.c2
-rw-r--r--firmware/timer.c6
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)
392 TIMER1_CFG = 0x0; 392 TIMER1_CFG = 0x0;
393 TIMER1_VAL; 393 TIMER1_VAL;
394 /* enable timer */ 394 /* enable timer */
395 TIMER1_CFG = 0xc0000000 | (interval_in_ms*1000); 395 TIMER1_CFG = 0xc0000000 | (interval_in_ms*1000 - 1);
396 /* unmask interrupt source */ 396 /* unmask interrupt source */
397 CPU_INT_EN = TIMER1_MASK; 397 CPU_INT_EN = TIMER1_MASK;
398#else 398#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)
55 TIMER2_VAL; /* ACK interrupt */ 55 TIMER2_VAL; /* ACK interrupt */
56 if (cycles_new > 0) 56 if (cycles_new > 0)
57 { 57 {
58 TIMER2_CFG = 0xc0000000 | cycles_new; 58 TIMER2_CFG = 0xc0000000 | (cycles_new - 1);
59 cycles_new = 0; 59 cycles_new = 0;
60 } 60 }
61 if (pfn_timer != NULL) 61 if (pfn_timer != NULL)
@@ -151,7 +151,7 @@ static bool timer_set(long cycles, bool start)
151 TCN1 = 0; /* reset the timer */ 151 TCN1 = 0; /* reset the timer */
152 TER1 = 0xff; /* clear all events */ 152 TER1 = 0xff; /* clear all events */
153#elif CONFIG_CPU == PP5020 || CONFIG_CPU == PP5002 153#elif CONFIG_CPU == PP5020 || CONFIG_CPU == PP5002
154 if (cycles > 0x1fffffff) 154 if (cycles > 0x20000000)
155 return false; 155 return false;
156 156
157 if (start) 157 if (start)
@@ -163,7 +163,7 @@ static bool timer_set(long cycles, bool start)
163 } 163 }
164 } 164 }
165 if (start || (cycles_new == -1)) /* within isr, cycles_new is "locked" */ 165 if (start || (cycles_new == -1)) /* within isr, cycles_new is "locked" */
166 TIMER2_CFG = 0xc0000000 | cycles; /* enable timer */ 166 TIMER2_CFG = 0xc0000000 | (cycles - 1); /* enable timer */
167 else 167 else
168 cycles_new = cycles; 168 cycles_new = cycles;
169 169