mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Remove the TIMER_* macros and declare target-specific functions in timer.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21559 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
89ccd5c145
commit
c5dedd7d76
26 changed files with 44 additions and 208 deletions
|
|
@ -31,7 +31,7 @@ void INT_TIMER1(void)
|
|||
TIMER1_INTCLR = 0; /* clear interrupt */
|
||||
}
|
||||
|
||||
bool __timer_set(long cycles, bool start)
|
||||
bool timer_set(long cycles, bool start)
|
||||
{
|
||||
if (start)
|
||||
{
|
||||
|
|
@ -53,14 +53,14 @@ bool __timer_set(long cycles, bool start)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool __timer_start(void)
|
||||
bool timer_start(void)
|
||||
{
|
||||
CGU_PERI |= CGU_TIMER1_CLOCK_ENABLE; /* enable peripheral */
|
||||
VIC_INT_ENABLE |= INTERRUPT_TIMER1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void __timer_stop(void)
|
||||
void timer_stop(void)
|
||||
{
|
||||
TIMER1_CONTROL &= 0x10; /* disable timer 1 (don't modify bit 4) */
|
||||
VIC_INT_EN_CLEAR = INTERRUPT_TIMER1; /* disable interrupt */
|
||||
|
|
|
|||
|
|
@ -21,19 +21,6 @@
|
|||
#ifndef TIMER_TARGET_H
|
||||
#define TIMER_TARGET_H
|
||||
|
||||
bool __timer_set(long cycles, bool set);
|
||||
bool __timer_start(void);
|
||||
void __timer_stop(void);
|
||||
|
||||
#define TIMER_FREQ (24000000 / 16)
|
||||
|
||||
#define __TIMER_SET(cycles, set) \
|
||||
__timer_set(cycles, set)
|
||||
|
||||
#define __TIMER_START() \
|
||||
__timer_start()
|
||||
|
||||
#define __TIMER_STOP(...) \
|
||||
__timer_stop()
|
||||
|
||||
#endif /* TIMER_TARGET_H */
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void pitc_handler(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool __timer_set(long cycles, bool start)
|
||||
bool timer_set(long cycles, bool start)
|
||||
{
|
||||
if (cycles < 1000) /* Max value on PITC?? */
|
||||
{
|
||||
|
|
@ -67,7 +67,7 @@ bool __timer_set(long cycles, bool start)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool __timer_start(void)
|
||||
bool timer_start(void)
|
||||
{
|
||||
bool retval = true;
|
||||
volatile unsigned long pimr = 0;
|
||||
|
|
@ -101,7 +101,7 @@ bool __timer_start(void)
|
|||
return retval;
|
||||
}
|
||||
|
||||
void __timer_stop(void)
|
||||
void timer_stop(void)
|
||||
{
|
||||
volatile unsigned long pimr = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,17 +25,4 @@
|
|||
/* timer is based on PCLK and minimum division is 2 */
|
||||
#define TIMER_FREQ (49156800/2)
|
||||
|
||||
bool __timer_set(long cycles, bool set);
|
||||
bool __timer_start(void);
|
||||
void __timer_stop(void);
|
||||
|
||||
#define __TIMER_SET(cycles, set) \
|
||||
__timer_set(cycles, set)
|
||||
|
||||
#define __TIMER_START() \
|
||||
__timer_start()
|
||||
|
||||
#define __TIMER_STOP(...) \
|
||||
__timer_stop()
|
||||
|
||||
#endif /* TIMER_TARGET_H */
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ static void stop_timer(bool clock_off)
|
|||
}
|
||||
}
|
||||
|
||||
bool _timer_set(long cycles, bool start)
|
||||
bool timer_set(long cycles, bool start)
|
||||
{
|
||||
/* Maximum cycle count expressible in the cycles parameter is 2^31-1
|
||||
* and the modulus counter is capable of 2^32-1 and as a result there is
|
||||
|
|
@ -86,7 +86,7 @@ bool _timer_set(long cycles, bool start)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool _timer_start(void)
|
||||
bool timer_start(void)
|
||||
{
|
||||
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ bool _timer_start(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
void _timer_stop(void)
|
||||
void timer_stop(void)
|
||||
{
|
||||
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||
/* Halt timer if running - stop module clock */
|
||||
|
|
|
|||
|
|
@ -24,17 +24,4 @@
|
|||
/* timer is based on ipg_clk */
|
||||
#define TIMER_FREQ (66000000)
|
||||
|
||||
bool _timer_set(long cycles, bool set);
|
||||
bool _timer_start(void);
|
||||
void _timer_stop(void);
|
||||
|
||||
#define __TIMER_SET(cycles, set) \
|
||||
_timer_set(cycles, set)
|
||||
|
||||
#define __TIMER_START() \
|
||||
_timer_start()
|
||||
|
||||
#define __TIMER_STOP(...) \
|
||||
_timer_stop()
|
||||
|
||||
#endif /* TIMER_TARGET_H */
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ void TIMER1_ISR(void)
|
|||
TIMER1.clr = 1; /* clear the interrupt */
|
||||
}
|
||||
|
||||
bool __timer_set(long cycles, bool start)
|
||||
bool timer_set(long cycles, bool start)
|
||||
{
|
||||
if (start)
|
||||
{
|
||||
|
|
@ -68,14 +68,14 @@ bool __timer_set(long cycles, bool start)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool __timer_start(void)
|
||||
bool timer_start(void)
|
||||
{
|
||||
irq_set_int_handler(IRQ_TIMER1, TIMER1_ISR);
|
||||
irq_enable_int(IRQ_TIMER1);
|
||||
return true;
|
||||
}
|
||||
|
||||
void __timer_stop(void)
|
||||
void timer_stop(void)
|
||||
{
|
||||
TIMER1.ctrl &= ~0x80; /* disable timer 1 */
|
||||
irq_disable_int(IRQ_TIMER1);
|
||||
|
|
|
|||
|
|
@ -21,19 +21,6 @@
|
|||
#ifndef TIMER_TARGET_H
|
||||
#define TIMER_TARGET_H
|
||||
|
||||
bool __timer_set(long cycles, bool start);
|
||||
bool __timer_start(void);
|
||||
void __timer_stop(void);
|
||||
|
||||
#define TIMER_FREQ 3000000
|
||||
|
||||
#define __TIMER_SET(cycles, set) \
|
||||
__timer_set(cycles, set)
|
||||
|
||||
#define __TIMER_START() \
|
||||
__timer_start()
|
||||
|
||||
#define __TIMER_STOP(...) \
|
||||
__timer_stop()
|
||||
|
||||
#endif /* TIMER_TARGET_H */
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static void stop_timer(void)
|
|||
INTPND = TIMER0_MASK;
|
||||
}
|
||||
|
||||
bool __timer_set(long cycles, bool start)
|
||||
bool timer_set(long cycles, bool start)
|
||||
{
|
||||
bool retval = false;
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ bool __timer_set(long cycles, bool start)
|
|||
return retval;
|
||||
}
|
||||
|
||||
bool __timer_start(void)
|
||||
bool timer_start(void)
|
||||
{
|
||||
bool retval = true;
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ bool __timer_start(void)
|
|||
return retval;
|
||||
}
|
||||
|
||||
void __timer_stop(void)
|
||||
void timer_stop(void)
|
||||
{
|
||||
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||
stop_timer();
|
||||
|
|
|
|||
|
|
@ -25,17 +25,4 @@
|
|||
#define TIMER_FREQ (49156800/2)
|
||||
#define TIMER234_PRESCALE 21
|
||||
|
||||
bool __timer_set(long cycles, bool set);
|
||||
bool __timer_start(void);
|
||||
void __timer_stop(void);
|
||||
|
||||
#define __TIMER_SET(cycles, set) \
|
||||
__timer_set(cycles, set)
|
||||
|
||||
#define __TIMER_START() \
|
||||
__timer_start()
|
||||
|
||||
#define __TIMER_STOP(...) \
|
||||
__timer_stop()
|
||||
|
||||
#endif /* TIMER_TARGET_H */
|
||||
|
|
|
|||
|
|
@ -24,17 +24,4 @@
|
|||
/* timers are based on XIN (12Mhz) */
|
||||
#define TIMER_FREQ (12000000)
|
||||
|
||||
bool __timer_set(long cycles, bool set);
|
||||
bool __timer_start(void);
|
||||
void __timer_stop(void);
|
||||
|
||||
#define __TIMER_SET(cycles, set) \
|
||||
__timer_set(cycles, set)
|
||||
|
||||
#define __TIMER_START() \
|
||||
__timer_start()
|
||||
|
||||
#define __TIMER_STOP(...) \
|
||||
__timer_stop()
|
||||
|
||||
#endif /* TIMER_TARGET_H */
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
/* Use the TC32 counter [sourced by Xin:12Mhz] for this timer, as it's the
|
||||
only one that allows a 32-bit counter (Timer0-5 are 16/20 bit only). */
|
||||
|
||||
bool __timer_set(long cycles, bool start)
|
||||
bool timer_set(long cycles, bool start)
|
||||
{
|
||||
#warning function not implemented
|
||||
|
||||
|
|
@ -37,14 +37,14 @@ bool __timer_set(long cycles, bool start)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool __timer_start(void)
|
||||
bool timer_start(void)
|
||||
{
|
||||
#warning function not implemented
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void __timer_stop(void)
|
||||
void timer_stop(void)
|
||||
{
|
||||
#warning function not implemented
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,17 +24,4 @@
|
|||
/* Timer is based on PCK_TCT (set to 2Mhz in system.c) */
|
||||
#define TIMER_FREQ (2000000)
|
||||
|
||||
bool __timer_set(long cycles, bool set);
|
||||
bool __timer_start(void);
|
||||
void __timer_stop(void);
|
||||
|
||||
#define __TIMER_SET(cycles, set) \
|
||||
__timer_set(cycles, set)
|
||||
|
||||
#define __TIMER_START() \
|
||||
__timer_start()
|
||||
|
||||
#define __TIMER_STOP(...) \
|
||||
__timer_stop()
|
||||
|
||||
#endif /* TIMER_TARGET_H */
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
static const int prescale_shifts[] = {1, 2, 3, 4, 5, 10, 12};
|
||||
|
||||
bool __timer_set(long cycles, bool start)
|
||||
bool timer_set(long cycles, bool start)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ bool __timer_set(long cycles, bool start)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool __timer_start(void)
|
||||
bool timer_start(void)
|
||||
{
|
||||
int oldstatus = disable_interrupt_save(IRQ_STATUS);
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ bool __timer_start(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
void __timer_stop(void)
|
||||
void timer_stop(void)
|
||||
{
|
||||
int oldstatus = disable_interrupt_save(IRQ_STATUS);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void TIMER2(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool __timer_set(long cycles, bool start)
|
||||
bool timer_set(long cycles, bool start)
|
||||
{
|
||||
if (cycles > 0x20000000 || cycles < 2)
|
||||
return false;
|
||||
|
|
@ -67,7 +67,7 @@ bool __timer_set(long cycles, bool start)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool __timer_start(IF_COP_VOID(int core))
|
||||
bool timer_start(IF_COP_VOID(int core))
|
||||
{
|
||||
/* unmask interrupt source */
|
||||
#if NUM_CORES > 1
|
||||
|
|
@ -79,7 +79,7 @@ bool __timer_start(IF_COP_VOID(int core))
|
|||
return true;
|
||||
}
|
||||
|
||||
void __timer_stop(void)
|
||||
void timer_stop(void)
|
||||
{
|
||||
TIMER2_CFG = 0; /* stop timer 2 */
|
||||
CPU_INT_DIS = TIMER2_MASK;
|
||||
|
|
|
|||
|
|
@ -28,25 +28,7 @@
|
|||
#error "PP specific header"
|
||||
#endif
|
||||
|
||||
bool __timer_set(long cycles, bool start);
|
||||
bool __timer_start(IF_COP_VOID(int core));
|
||||
void __timer_stop(void);
|
||||
|
||||
/* Portalplayer chips use a microsecond timer. */
|
||||
#define TIMER_FREQ 1000000
|
||||
|
||||
#define __TIMER_SET(cycles, set) \
|
||||
__timer_set(cycles, set)
|
||||
|
||||
#if NUM_CORES > 1
|
||||
#define __TIMER_START(core) \
|
||||
__timer_start(core)
|
||||
#else
|
||||
#define __TIMER_START() \
|
||||
__timer_start()
|
||||
#endif
|
||||
|
||||
#define __TIMER_STOP(...) \
|
||||
__timer_stop()
|
||||
|
||||
#endif /* TIMER_TARGET_H */
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void TIMER0(void)
|
|||
pfn_timer();
|
||||
}
|
||||
|
||||
bool __timer_set(long cycles, bool start)
|
||||
bool timer_set(long cycles, bool start)
|
||||
{
|
||||
int oldlevel;
|
||||
unsigned int divider=cycles, prescaler=0;
|
||||
|
|
@ -82,7 +82,7 @@ static void stop_timer(void)
|
|||
IO_CLK_MOD2 &= ~CLK_MOD2_TMR0; //disable TIMER0 clock
|
||||
}
|
||||
|
||||
bool __timer_start(void)
|
||||
bool timer_start(void)
|
||||
{
|
||||
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ bool __timer_start(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
void __timer_stop(void)
|
||||
void timer_stop(void)
|
||||
{
|
||||
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||
stop_timer();
|
||||
|
|
|
|||
|
|
@ -24,17 +24,4 @@
|
|||
/* timer is based on PCLK and minimum division is 2 */
|
||||
#define TIMER_FREQ (27000000)
|
||||
|
||||
bool __timer_set(long cycles, bool set);
|
||||
bool __timer_start(void);
|
||||
void __timer_stop(void);
|
||||
|
||||
#define __TIMER_SET(cycles, set) \
|
||||
__timer_set(cycles, set)
|
||||
|
||||
#define __TIMER_START() \
|
||||
__timer_start()
|
||||
|
||||
#define __TIMER_STOP(...) \
|
||||
__timer_stop()
|
||||
|
||||
#endif /* TIMER_TARGET_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue