summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-08-28 06:47:26 +0000
committerJens Arnold <amiconn@rockbox.org>2006-08-28 06:47:26 +0000
commitbb5fbf7c3092fe5847c1d730c88f0892c16ce5c6 (patch)
tree21ecdccac46721568092cab186858bddc8b3ec83 /firmware
parentad19af7a750cbf54f0b460fa3506328317623a32 (diff)
Fix broken backlight fading on ipod. The timer period setting must not be delayed if timer_set_period() is called from within the isr.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10779 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/timer.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/firmware/timer.c b/firmware/timer.c
index ab1a9ecddf..fd9bee2488 100644
--- a/firmware/timer.c
+++ b/firmware/timer.c
@@ -59,7 +59,13 @@ void TIMER2(void)
cycles_new = 0;
}
if (pfn_timer != NULL)
+ {
+ cycles_new = -1;
+ /* "lock" the variable, in case timer_set_period()
+ * is called within pfn_timer() */
pfn_timer();
+ cycles_new = 0;
+ }
}
#endif /* CONFIG_CPU */
@@ -155,11 +161,9 @@ static bool timer_set(long cycles, bool start)
pfn_unregister();
pfn_unregister = NULL;
}
- cycles_new = 0;
- TIMER2_CFG = 0;
- TIMER2_VAL;
- TIMER2_CFG = 0xc0000000 | cycles; /* enable timer */
}
+ if (start || (cycles_new == -1)) /* within isr, cycles_new is "locked" */
+ TIMER2_CFG = 0xc0000000 | cycles; /* enable timer */
else
cycles_new = cycles;