forked from len0rd/rockbox
Rename TIMER_REGISTER macro to TIMER_START and TIMER_UNREGISTER to TIMER_STOP to reflect what they does exactly.
registering and unregistering are handled by the non target-specific functions of timer.c Remove arguments from the new TIMER_START since they are unused by targets git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21553 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
15e40dd3a6
commit
e0640c3c4b
17 changed files with 68 additions and 78 deletions
|
|
@ -53,14 +53,14 @@ bool __timer_set(long cycles, bool start)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool __timer_register(void)
|
bool __timer_start(void)
|
||||||
{
|
{
|
||||||
CGU_PERI |= CGU_TIMER1_CLOCK_ENABLE; /* enable peripheral */
|
CGU_PERI |= CGU_TIMER1_CLOCK_ENABLE; /* enable peripheral */
|
||||||
VIC_INT_ENABLE |= INTERRUPT_TIMER1;
|
VIC_INT_ENABLE |= INTERRUPT_TIMER1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __timer_unregister(void)
|
void __timer_stop(void)
|
||||||
{
|
{
|
||||||
TIMER1_CONTROL &= 0x10; /* disable timer 1 (don't modify bit 4) */
|
TIMER1_CONTROL &= 0x10; /* disable timer 1 (don't modify bit 4) */
|
||||||
VIC_INT_EN_CLEAR = INTERRUPT_TIMER1; /* disable interrupt */
|
VIC_INT_EN_CLEAR = INTERRUPT_TIMER1; /* disable interrupt */
|
||||||
|
|
|
||||||
|
|
@ -22,19 +22,18 @@
|
||||||
#define TIMER_TARGET_H
|
#define TIMER_TARGET_H
|
||||||
|
|
||||||
bool __timer_set(long cycles, bool set);
|
bool __timer_set(long cycles, bool set);
|
||||||
bool __timer_register(void);
|
bool __timer_start(void);
|
||||||
void __timer_unregister(void);
|
void __timer_stop(void);
|
||||||
|
|
||||||
#define TIMER_FREQ (24000000 / 16)
|
#define TIMER_FREQ (24000000 / 16)
|
||||||
|
|
||||||
#define __TIMER_SET(cycles, set) \
|
#define __TIMER_SET(cycles, set) \
|
||||||
__timer_set(cycles, set)
|
__timer_set(cycles, set)
|
||||||
|
|
||||||
#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
|
#define __TIMER_START() \
|
||||||
int_prio, timer_callback) \
|
__timer_start()
|
||||||
__timer_register()
|
|
||||||
|
|
||||||
#define __TIMER_UNREGISTER(...) \
|
#define __TIMER_STOP(...) \
|
||||||
__timer_unregister()
|
__timer_stop()
|
||||||
|
|
||||||
#endif /* TIMER_TARGET_H */
|
#endif /* TIMER_TARGET_H */
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ bool __timer_set(long cycles, bool start)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool __timer_register(void)
|
bool __timer_start(void)
|
||||||
{
|
{
|
||||||
bool retval = true;
|
bool retval = true;
|
||||||
volatile unsigned long pimr = 0;
|
volatile unsigned long pimr = 0;
|
||||||
|
|
@ -101,7 +101,7 @@ bool __timer_register(void)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __timer_unregister(void)
|
void __timer_stop(void)
|
||||||
{
|
{
|
||||||
volatile unsigned long pimr = 0;
|
volatile unsigned long pimr = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,16 @@
|
||||||
#define TIMER_FREQ (49156800/2)
|
#define TIMER_FREQ (49156800/2)
|
||||||
|
|
||||||
bool __timer_set(long cycles, bool set);
|
bool __timer_set(long cycles, bool set);
|
||||||
bool __timer_register(void);
|
bool __timer_start(void);
|
||||||
void __timer_unregister(void);
|
void __timer_stop(void);
|
||||||
|
|
||||||
#define __TIMER_SET(cycles, set) \
|
#define __TIMER_SET(cycles, set) \
|
||||||
__timer_set(cycles, set)
|
__timer_set(cycles, set)
|
||||||
|
|
||||||
#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
|
#define __TIMER_START() \
|
||||||
int_prio, timer_callback) \
|
__timer_start()
|
||||||
__timer_register()
|
|
||||||
|
|
||||||
#define __TIMER_UNREGISTER(...) \
|
#define __TIMER_STOP(...) \
|
||||||
__timer_unregister()
|
__timer_stop()
|
||||||
|
|
||||||
#endif /* TIMER_TARGET_H */
|
#endif /* TIMER_TARGET_H */
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ bool _timer_set(long cycles, bool start)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _timer_register(void)
|
bool _timer_start(void)
|
||||||
{
|
{
|
||||||
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||||
|
|
||||||
|
|
@ -104,7 +104,7 @@ bool _timer_register(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _timer_unregister(void)
|
void _timer_stop(void)
|
||||||
{
|
{
|
||||||
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||||
/* Halt timer if running - stop module clock */
|
/* Halt timer if running - stop module clock */
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,16 @@
|
||||||
#define TIMER_FREQ (66000000)
|
#define TIMER_FREQ (66000000)
|
||||||
|
|
||||||
bool _timer_set(long cycles, bool set);
|
bool _timer_set(long cycles, bool set);
|
||||||
bool _timer_register(void);
|
bool _timer_start(void);
|
||||||
void _timer_unregister(void);
|
void _timer_stop(void);
|
||||||
|
|
||||||
#define __TIMER_SET(cycles, set) \
|
#define __TIMER_SET(cycles, set) \
|
||||||
_timer_set(cycles, set)
|
_timer_set(cycles, set)
|
||||||
|
|
||||||
#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
|
#define __TIMER_START() \
|
||||||
int_prio, timer_callback) \
|
_timer_start()
|
||||||
_timer_register()
|
|
||||||
|
|
||||||
#define __TIMER_UNREGISTER(...) \
|
#define __TIMER_STOP(...) \
|
||||||
_timer_unregister()
|
_timer_stop()
|
||||||
|
|
||||||
#endif /* TIMER_TARGET_H */
|
#endif /* TIMER_TARGET_H */
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ bool __timer_set(long cycles, bool start)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool __timer_register(void)
|
bool __timer_start(void)
|
||||||
{
|
{
|
||||||
bool retval = true;
|
bool retval = true;
|
||||||
|
|
||||||
|
|
@ -122,7 +122,7 @@ bool __timer_register(void)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __timer_unregister(void)
|
void __timer_stop(void)
|
||||||
{
|
{
|
||||||
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||||
stop_timer();
|
stop_timer();
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,16 @@
|
||||||
#define TIMER234_PRESCALE 21
|
#define TIMER234_PRESCALE 21
|
||||||
|
|
||||||
bool __timer_set(long cycles, bool set);
|
bool __timer_set(long cycles, bool set);
|
||||||
bool __timer_register(void);
|
bool __timer_start(void);
|
||||||
void __timer_unregister(void);
|
void __timer_stop(void);
|
||||||
|
|
||||||
#define __TIMER_SET(cycles, set) \
|
#define __TIMER_SET(cycles, set) \
|
||||||
__timer_set(cycles, set)
|
__timer_set(cycles, set)
|
||||||
|
|
||||||
#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
|
#define __TIMER_START() \
|
||||||
int_prio, timer_callback) \
|
__timer_start()
|
||||||
__timer_register()
|
|
||||||
|
|
||||||
#define __TIMER_UNREGISTER(...) \
|
#define __TIMER_STOP(...) \
|
||||||
__timer_unregister()
|
__timer_stop()
|
||||||
|
|
||||||
#endif /* TIMER_TARGET_H */
|
#endif /* TIMER_TARGET_H */
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,16 @@
|
||||||
#define TIMER_FREQ (12000000)
|
#define TIMER_FREQ (12000000)
|
||||||
|
|
||||||
bool __timer_set(long cycles, bool set);
|
bool __timer_set(long cycles, bool set);
|
||||||
bool __timer_register(void);
|
bool __timer_start(void);
|
||||||
void __timer_unregister(void);
|
void __timer_stop(void);
|
||||||
|
|
||||||
#define __TIMER_SET(cycles, set) \
|
#define __TIMER_SET(cycles, set) \
|
||||||
__timer_set(cycles, set)
|
__timer_set(cycles, set)
|
||||||
|
|
||||||
#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
|
#define __TIMER_START() \
|
||||||
int_prio, timer_callback) \
|
__timer_start()
|
||||||
__timer_register()
|
|
||||||
|
|
||||||
#define __TIMER_UNREGISTER(...) \
|
#define __TIMER_STOP(...) \
|
||||||
__timer_unregister()
|
__timer_stop()
|
||||||
|
|
||||||
#endif /* TIMER_TARGET_H */
|
#endif /* TIMER_TARGET_H */
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,14 @@ bool __timer_set(long cycles, bool start)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool __timer_register(void)
|
bool __timer_start(void)
|
||||||
{
|
{
|
||||||
#warning function not implemented
|
#warning function not implemented
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __timer_unregister(void)
|
void __timer_stop(void)
|
||||||
{
|
{
|
||||||
#warning function not implemented
|
#warning function not implemented
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,16 @@
|
||||||
#define TIMER_FREQ (2000000)
|
#define TIMER_FREQ (2000000)
|
||||||
|
|
||||||
bool __timer_set(long cycles, bool set);
|
bool __timer_set(long cycles, bool set);
|
||||||
bool __timer_register(void);
|
bool __timer_start(void);
|
||||||
void __timer_unregister(void);
|
void __timer_stop(void);
|
||||||
|
|
||||||
#define __TIMER_SET(cycles, set) \
|
#define __TIMER_SET(cycles, set) \
|
||||||
__timer_set(cycles, set)
|
__timer_set(cycles, set)
|
||||||
|
|
||||||
#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
|
#define __TIMER_START() \
|
||||||
int_prio, timer_callback) \
|
__timer_start()
|
||||||
__timer_register()
|
|
||||||
|
|
||||||
#define __TIMER_UNREGISTER(...) \
|
#define __TIMER_STOP(...) \
|
||||||
__timer_unregister()
|
__timer_stop()
|
||||||
|
|
||||||
#endif /* TIMER_TARGET_H */
|
#endif /* TIMER_TARGET_H */
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ bool __timer_set(long cycles, bool start)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool __timer_register(void)
|
bool __timer_start(void)
|
||||||
{
|
{
|
||||||
int oldstatus = disable_interrupt_save(IRQ_STATUS);
|
int oldstatus = disable_interrupt_save(IRQ_STATUS);
|
||||||
|
|
||||||
|
|
@ -73,7 +73,7 @@ bool __timer_register(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __timer_unregister(void)
|
void __timer_stop(void)
|
||||||
{
|
{
|
||||||
int oldstatus = disable_interrupt_save(IRQ_STATUS);
|
int oldstatus = disable_interrupt_save(IRQ_STATUS);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ static void stop_timer(void)
|
||||||
IO_CLK_MOD2 &= ~CLK_MOD2_TMR0; //disable TIMER0 clock
|
IO_CLK_MOD2 &= ~CLK_MOD2_TMR0; //disable TIMER0 clock
|
||||||
}
|
}
|
||||||
|
|
||||||
bool __timer_register(void)
|
bool __timer_start(void)
|
||||||
{
|
{
|
||||||
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ bool __timer_register(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __timer_unregister(void)
|
void __timer_stop(void)
|
||||||
{
|
{
|
||||||
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||||
stop_timer();
|
stop_timer();
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,16 @@
|
||||||
#define TIMER_FREQ (27000000)
|
#define TIMER_FREQ (27000000)
|
||||||
|
|
||||||
bool __timer_set(long cycles, bool set);
|
bool __timer_set(long cycles, bool set);
|
||||||
bool __timer_register(void);
|
bool __timer_start(void);
|
||||||
void __timer_unregister(void);
|
void __timer_stop(void);
|
||||||
|
|
||||||
#define __TIMER_SET(cycles, set) \
|
#define __TIMER_SET(cycles, set) \
|
||||||
__timer_set(cycles, set)
|
__timer_set(cycles, set)
|
||||||
|
|
||||||
#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
|
#define __TIMER_START() \
|
||||||
int_prio, timer_callback) \
|
__timer_start()
|
||||||
__timer_register()
|
|
||||||
|
|
||||||
#define __TIMER_UNREGISTER(...) \
|
#define __TIMER_STOP(...) \
|
||||||
__timer_unregister()
|
__timer_stop()
|
||||||
|
|
||||||
#endif /* TIMER_TARGET_H */
|
#endif /* TIMER_TARGET_H */
|
||||||
|
|
|
||||||
|
|
@ -79,14 +79,14 @@ bool __timer_set(long cycles, bool start)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool __timer_register(void)
|
bool __timer_start(void)
|
||||||
{
|
{
|
||||||
__tcu_start_counter(1);
|
__tcu_start_counter(1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __timer_unregister(void)
|
void __timer_stop(void)
|
||||||
{
|
{
|
||||||
unsigned int old_irq = disable_irq_save();
|
unsigned int old_irq = disable_irq_save();
|
||||||
__tcu_stop_counter(1);
|
__tcu_stop_counter(1);
|
||||||
|
|
|
||||||
|
|
@ -27,17 +27,16 @@
|
||||||
#define TIMER_FREQ (CFG_EXTAL) /* For full precision! */
|
#define TIMER_FREQ (CFG_EXTAL) /* For full precision! */
|
||||||
|
|
||||||
bool __timer_set(long cycles, bool set);
|
bool __timer_set(long cycles, bool set);
|
||||||
bool __timer_register(void);
|
bool __timer_start(void);
|
||||||
void __timer_unregister(void);
|
void __timer_stop(void);
|
||||||
|
|
||||||
#define __TIMER_SET(cycles, set) \
|
#define __TIMER_SET(cycles, set) \
|
||||||
__timer_set(cycles, set)
|
__timer_set(cycles, set)
|
||||||
|
|
||||||
#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
|
#define __TIMER_START() \
|
||||||
int_prio, timer_callback) \
|
__timer_start()
|
||||||
__timer_register()
|
|
||||||
|
|
||||||
#define __TIMER_UNREGISTER(...) \
|
#define __TIMER_STOP(...) \
|
||||||
__timer_unregister()
|
__timer_stop()
|
||||||
|
|
||||||
#endif /* __TIMER_H_ */
|
#endif /* __TIMER_H_ */
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,8 @@ static long SHAREDBSS_ATTR cycles_new = 0;
|
||||||
/* Define these if not defined by target to make the #else cases compile
|
/* Define these if not defined by target to make the #else cases compile
|
||||||
* even if the target doesn't have them implemented. */
|
* even if the target doesn't have them implemented. */
|
||||||
#define __TIMER_SET(cycles, set) false
|
#define __TIMER_SET(cycles, set) false
|
||||||
#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
|
#define __TIMER_START() false
|
||||||
int_prio, timer_callback) false
|
#define __TIMER_STOP(...)
|
||||||
#define __TIMER_UNREGISTER(...)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* interrupt handler */
|
/* interrupt handler */
|
||||||
|
|
@ -288,8 +287,7 @@ bool timer_register(int reg_prio, void (*unregister_callback)(void),
|
||||||
irq_enable_int(IRQ_TIMER1);
|
irq_enable_int(IRQ_TIMER1);
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
return __TIMER_REGISTER(reg_prio, unregister_callback, cycles,
|
return __TIMER_START();
|
||||||
int_prio, timer_callback);
|
|
||||||
#endif
|
#endif
|
||||||
/* Cover for targets that don't use all these */
|
/* Cover for targets that don't use all these */
|
||||||
(void)reg_prio;
|
(void)reg_prio;
|
||||||
|
|
@ -321,7 +319,7 @@ void timer_unregister(void)
|
||||||
TIMER1.ctrl &= ~0x80; /* disable timer 1 */
|
TIMER1.ctrl &= ~0x80; /* disable timer 1 */
|
||||||
irq_disable_int(IRQ_TIMER1);
|
irq_disable_int(IRQ_TIMER1);
|
||||||
#else
|
#else
|
||||||
__TIMER_UNREGISTER();
|
__TIMER_STOP();
|
||||||
#endif
|
#endif
|
||||||
pfn_timer = NULL;
|
pfn_timer = NULL;
|
||||||
pfn_unregister = NULL;
|
pfn_unregister = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue