summaryrefslogtreecommitdiff
path: root/firmware/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/timer.c')
-rw-r--r--firmware/timer.c31
1 files changed, 3 insertions, 28 deletions
diff --git a/firmware/timer.c b/firmware/timer.c
index 8cd165bd35..077176b96f 100644
--- a/firmware/timer.c
+++ b/firmware/timer.c
@@ -30,18 +30,6 @@ static int timer_prio = -1;
30void SHAREDBSS_ATTR (*pfn_timer)(void) = NULL; /* timer callback */ 30void SHAREDBSS_ATTR (*pfn_timer)(void) = NULL; /* timer callback */
31void SHAREDBSS_ATTR (*pfn_unregister)(void) = NULL; /* unregister callback */ 31void SHAREDBSS_ATTR (*pfn_unregister)(void) = NULL; /* unregister callback */
32 32
33#ifndef __TIMER_SET
34/* Define these if not defined by target to make the #else cases compile
35 * even if the target doesn't have them implemented. */
36#define __TIMER_SET(cycles, set) false
37#if NUM_CORES > 1
38#define __TIMER_START(int_prio, core) false
39#else
40#define __TIMER_START(int_prio) false
41#endif
42#define __TIMER_STOP()
43#endif
44
45static bool timer_set(long cycles, bool start) 33static bool timer_set(long cycles, bool start)
46{ 34{
47 return __TIMER_SET(cycles, start); 35 return __TIMER_SET(cycles, start);
@@ -49,17 +37,12 @@ static bool timer_set(long cycles, bool start)
49 37
50/* Register a user timer, called every <cycles> TIMER_FREQ cycles */ 38/* Register a user timer, called every <cycles> TIMER_FREQ cycles */
51bool timer_register(int reg_prio, void (*unregister_callback)(void), 39bool timer_register(int reg_prio, void (*unregister_callback)(void),
52 long cycles, int int_prio, void (*timer_callback)(void) 40 long cycles, void (*timer_callback)(void)
53 IF_COP(, int core)) 41 IF_COP(, int core))
54{ 42{
55 if (reg_prio <= timer_prio || cycles == 0) 43 if (reg_prio <= timer_prio || cycles == 0)
56 return false; 44 return false;
57 45
58#if CONFIG_CPU == SH7034
59 if (int_prio < 1 || int_prio > 15)
60 return false;
61#endif
62
63 if (!timer_set(cycles, true)) 46 if (!timer_set(cycles, true))
64 return false; 47 return false;
65 48
@@ -68,18 +51,10 @@ bool timer_register(int reg_prio, void (*unregister_callback)(void),
68 timer_prio = reg_prio; 51 timer_prio = reg_prio;
69 52
70#if NUM_CORES > 1 53#if NUM_CORES > 1
71 return __TIMER_START(int_prio, core); 54 return __TIMER_START(core);
72#else 55#else
73 return __TIMER_START(int_prio); 56 return __TIMER_START();
74#endif 57#endif
75
76 /* Cover for targets that don't use all these */
77 (void)reg_prio;
78 (void)unregister_callback;
79 (void)cycles;
80 /* TODO: Implement for PortalPlayer and iFP (if possible) */
81 (void)int_prio;
82 (void)timer_callback;
83} 58}
84 59
85bool timer_set_period(long cycles) 60bool timer_set_period(long cycles)