summaryrefslogtreecommitdiff
path: root/firmware/timer.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2009-01-05 00:00:29 +0000
committerMichael Sevakis <jethead71@rockbox.org>2009-01-05 00:00:29 +0000
commite2876ee4e2ff260e616863b2c54004516743e766 (patch)
tree4abaff62e18b6a15302391c45eb60ab5174ee4dd /firmware/timer.c
parent6d5823f964d8cc2b030d7a713d355f3132e41c45 (diff)
downloadrockbox-e2876ee4e2ff260e616863b2c54004516743e766.tar.gz
rockbox-e2876ee4e2ff260e616863b2c54004516743e766.zip
Gigabeat S: Get timer API working. metronome will work now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19676 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/timer.c')
-rw-r--r--firmware/timer.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/firmware/timer.c b/firmware/timer.c
index a11cd10b7e..e9f11b6ae7 100644
--- a/firmware/timer.c
+++ b/firmware/timer.c
@@ -35,6 +35,15 @@ static int base_prescale;
35static long SHAREDBSS_ATTR cycles_new = 0; 35static long SHAREDBSS_ATTR cycles_new = 0;
36#endif 36#endif
37 37
38#ifndef __TIMER_SET
39/* Define these if not defined by target to make the #else cases compile
40 * even if the target doesn't have them implemented. */
41#define __TIMER_SET(cycles, set) false
42#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
43 int_prio, timer_callback) false
44#define __TIMER_UNREGISTER(...)
45#endif
46
38/* interrupt handler */ 47/* interrupt handler */
39#if CONFIG_CPU == SH7034 48#if CONFIG_CPU == SH7034
40void IMIA4(void) __attribute__((interrupt_handler)); 49void IMIA4(void) __attribute__((interrupt_handler));
@@ -245,10 +254,6 @@ static bool timer_set(long cycles, bool start)
245 cycles_new = cycles; 254 cycles_new = cycles;
246 255
247 return true; 256 return true;
248#elif (CONFIG_CPU == IMX31L)
249 /* TODO */
250 (void)cycles; (void)start;
251 return false;
252#else 257#else
253 return __TIMER_SET(cycles, start); 258 return __TIMER_SET(cycles, start);
254#endif /* CONFIG_CPU */ 259#endif /* CONFIG_CPU */
@@ -319,9 +324,6 @@ bool timer_register(int reg_prio, void (*unregister_callback)(void),
319 CGU_PERI |= CGU_TIMER1_CLOCK_ENABLE; /* enable peripheral */ 324 CGU_PERI |= CGU_TIMER1_CLOCK_ENABLE; /* enable peripheral */
320 VIC_INT_ENABLE |= INTERRUPT_TIMER1; 325 VIC_INT_ENABLE |= INTERRUPT_TIMER1;
321 return true; 326 return true;
322#elif CONFIG_CPU == IMX31L
323 /* TODO */
324 return false;
325#else 327#else
326 return __TIMER_REGISTER(reg_prio, unregister_callback, cycles, 328 return __TIMER_REGISTER(reg_prio, unregister_callback, cycles,
327 int_prio, timer_callback); 329 int_prio, timer_callback);
@@ -359,7 +361,7 @@ void timer_unregister(void)
359 TIMER1_CONTROL &= 0x10; /* disable timer 1 (don't modify bit 4) */ 361 TIMER1_CONTROL &= 0x10; /* disable timer 1 (don't modify bit 4) */
360 VIC_INT_EN_CLEAR = INTERRUPT_TIMER1; /* disable interrupt */ 362 VIC_INT_EN_CLEAR = INTERRUPT_TIMER1; /* disable interrupt */
361 CGU_PERI &= ~CGU_TIMER1_CLOCK_ENABLE; /* disable peripheral */ 363 CGU_PERI &= ~CGU_TIMER1_CLOCK_ENABLE; /* disable peripheral */
362#elif CONFIG_CPU == S3C2440 || CONFIG_CPU == DM320 364#else
363 __TIMER_UNREGISTER(); 365 __TIMER_UNREGISTER();
364#endif 366#endif
365 pfn_timer = NULL; 367 pfn_timer = NULL;