Remove int_prio argument from timer_register, and move the only use for it into alpine_cdc plugin, since this plugin is only built on SH7034

Also remove it from TIMER_START()

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21558 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2009-06-29 14:29:46 +00:00
parent b955dff268
commit 89ccd5c145
25 changed files with 42 additions and 68 deletions

View file

@ -128,12 +128,12 @@ void* plugin_get_buffer(size_t *buffer_size);
#define PLUGIN_MAGIC 0x526F634B /* RocK */ #define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */ /* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 156 #define PLUGIN_API_VERSION 157
/* update this to latest version if a change to the api struct breaks /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */ new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 156 #define PLUGIN_MIN_API_VERSION 157
/* plugin return codes */ /* plugin return codes */
enum plugin_status { enum plugin_status {
@ -461,8 +461,8 @@ struct plugin_api {
void (*cpucache_invalidate)(void); void (*cpucache_invalidate)(void);
#endif #endif
bool (*timer_register)(int reg_prio, void (*unregister_callback)(void), bool (*timer_register)(int reg_prio, void (*unregister_callback)(void),
long cycles, int int_prio, long cycles, void (*timer_callback)(void)
void (*timer_callback)(void) IF_COP(, int core)); IF_COP(, int core));
void (*timer_unregister)(void); void (*timer_unregister)(void);
bool (*timer_set_period)(long count); bool (*timer_set_period)(long count);

View file

@ -231,11 +231,13 @@ void timer_set_mode(int mode)
if (mode == TM_RX_TIMEOUT) if (mode == TM_RX_TIMEOUT)
{ {
rb->timer_register(1, NULL, gTimer.timeout, 11, timer4_isr IF_COP(, CPU)); rb->timer_register(1, NULL, gTimer.timeout, timer4_isr IF_COP(, CPU));
IPRD = (IPRD & 0xFF0F) | 11 << 4; /* interrupt priority */
} }
else if (mode == TM_TRANSMIT) else if (mode == TM_TRANSMIT)
{ {
rb->timer_register(1, NULL, gTimer.transmit, 14, timer4_isr IF_COP(, CPU)); rb->timer_register(1, NULL, gTimer.transmit, timer4_isr IF_COP(, CPU));
IPRD = (IPRD & 0xFF0F) | 14 << 4; /* interrupt priority */
} }
else else
{ {

View file

@ -109,7 +109,7 @@ int I_GetTime (void)
void I_Init (void) void I_Init (void)
{ {
#if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) && !defined(RB_PROFILE) #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) && !defined(RB_PROFILE)
rb->timer_register(1, NULL, TIMER_FREQ/TICRATE, 1, doomtime IF_COP(, CPU)); rb->timer_register(1, NULL, TIMER_FREQ/TICRATE, doomtime IF_COP(, CPU));
#endif #endif
I_InitSound(); I_InitSound();
} }

View file

@ -648,11 +648,10 @@ void grey_show(bool enable)
#endif #endif
#if NUM_CORES > 1 #if NUM_CORES > 1
rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE,
1, _timer_isr, _timer_isr,
(_grey_info.flags & GREY_ON_COP) ? COP : CPU); (_grey_info.flags & GREY_ON_COP) ? COP : CPU);
#else #else
rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, 1, rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, _timer_isr);
_timer_isr);
#endif #endif
#endif /* !SIMULATOR */ #endif /* !SIMULATOR */
rb->screen_dump_set_hook(grey_screendump_hook); rb->screen_dump_set_hook(grey_screendump_hook);

View file

@ -910,7 +910,7 @@ enum plugin_status plugin_start(const void* parameter)
#endif /* CONFIG_CODEC != SWCODEC */ #endif /* CONFIG_CODEC != SWCODEC */
calc_period(); calc_period();
rb->timer_register(1, NULL, TIMER_FREQ/1024, 1, timer_callback IF_COP(, CPU)); rb->timer_register(1, NULL, TIMER_FREQ/1024, timer_callback IF_COP(, CPU));
draw_display(); draw_display();

View file

@ -162,7 +162,7 @@ int plugin_main(void)
rb->cpu_boost(true); rb->cpu_boost(true);
#endif #endif
/* The actual frequency is twice the displayed value */ /* The actual frequency is twice the displayed value */
rb->timer_register(1, NULL, TIMER_FREQ * 5 / scan_rate, 1, rb->timer_register(1, NULL, TIMER_FREQ * 5 / scan_rate,
timer_isr IF_COP(, CPU)); timer_isr IF_COP(, CPU));
while (!done) while (!done)

View file

@ -562,10 +562,10 @@ int SeekTo(int fd, int nPos)
gPlay.bVideoUnderrun = false; gPlay.bVideoUnderrun = false;
/* start display interrupt */ /* start display interrupt */
#if FREQ == 12000000 /* Ondio speed kludge */ #if FREQ == 12000000 /* Ondio speed kludge */
rb->timer_register(1, NULL, gPlay.nFrameTimeAdjusted, 1, rb->timer_register(1, NULL, gPlay.nFrameTimeAdjusted,
timer4_isr IF_COP(, CPU)); timer4_isr IF_COP(, CPU));
#else #else
rb->timer_register(1, NULL, gFileHdr.video_frametime, 1, rb->timer_register(1, NULL, gFileHdr.video_frametime,
timer4_isr IF_COP(, CPU)); timer4_isr IF_COP(, CPU));
#endif #endif
} }
@ -748,10 +748,10 @@ int PlayTick(int fd)
{ /* start the video */ { /* start the video */
#if FREQ == 12000000 /* Ondio speed kludge */ #if FREQ == 12000000 /* Ondio speed kludge */
rb->timer_register(1, NULL, rb->timer_register(1, NULL,
gPlay.nFrameTimeAdjusted, 1, timer4_isr); gPlay.nFrameTimeAdjusted, timer4_isr);
#else #else
rb->timer_register(1, NULL, rb->timer_register(1, NULL,
gFileHdr.video_frametime, 1, timer4_isr); gFileHdr.video_frametime, timer4_isr);
#endif #endif
} }
} }

View file

@ -2438,11 +2438,10 @@ void thread_wait(struct thread_entry *thread)
\param thread \param thread
\description \description
bool timer_register(int reg_prio, void (*unregister_callback)(void), long cycles, int int_prio, void (*timer_callback)(void) IF_COP(, int core)) bool timer_register(int reg_prio, void (*unregister_callback)(void), long cycles, void (*timer_callback)(void) IF_COP(, int core))
\param reg_prio \param reg_prio
\param unregister_callback \param unregister_callback
\param cycles \param cycles
\param int_prio
\param core \param core
\param timer_callback \param timer_callback
\return \return

View file

@ -332,7 +332,7 @@ static void backlight_dim(int value)
if (bl_timer_active) if (bl_timer_active)
return ; return ;
if (timer_register(0, backlight_release_timer, 2, 0, backlight_isr if (timer_register(0, backlight_release_timer, 2, backlight_isr
IF_COP(, CPU))) IF_COP(, CPU)))
{ {
#ifdef _BACKLIGHT_FADE_BOOST #ifdef _BACKLIGHT_FADE_BOOST

View file

@ -41,7 +41,7 @@
#define TIMER_FREQ CPU_FREQ #define TIMER_FREQ CPU_FREQ
#endif #endif
bool timer_register(int reg_prio, void (*unregister_callback)(void), bool timer_register(int reg_prio, void (*unregister_callback)(void),
long cycles, int int_prio, void (*timer_callback)(void) long cycles, void (*timer_callback)(void)
IF_COP(,int core)); IF_COP(,int core));
bool timer_set_period(long cycles); bool timer_set_period(long cycles);
#ifdef CPU_COLDFIRE #ifdef CPU_COLDFIRE

View file

@ -140,7 +140,7 @@ void profile_thread_started(int current_thread) {
if (profiling < PROF_ERROR) { if (profiling < PROF_ERROR) {
/* After we de-mask, if profiling is active, reactivate the timer */ /* After we de-mask, if profiling is active, reactivate the timer */
timer_register(0, profile_timer_unregister, timer_register(0, profile_timer_unregister,
TIMER_FREQ/10000, 0, profile_timer_tick IF_COP(, 0 ) ); TIMER_FREQ/10000, profile_timer_tick IF_COP(, 0 ) );
} }
} }
} }
@ -169,7 +169,7 @@ void profstart(int current_thread) {
pfds[0].self_pc = 0; pfds[0].self_pc = 0;
memset(indices,0,INDEX_SIZE * sizeof(unsigned short)); memset(indices,0,INDEX_SIZE * sizeof(unsigned short));
timer_register( timer_register(
0, profile_timer_unregister, TIMER_FREQ/10000, 0, profile_timer_tick IF_COP(, 0 ) ); 0, profile_timer_unregister, TIMER_FREQ/10000, profile_timer_tick IF_COP(, 0 ) );
profiling = PROF_ON; profiling = PROF_ON;
} }

View file

@ -30,7 +30,7 @@ void __timer_stop(void);
#define __TIMER_SET(cycles, set) \ #define __TIMER_SET(cycles, set) \
__timer_set(cycles, set) __timer_set(cycles, set)
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
__timer_start() __timer_start()
#define __TIMER_STOP(...) \ #define __TIMER_STOP(...) \

View file

@ -32,7 +32,7 @@ void __timer_stop(void);
#define __TIMER_SET(cycles, set) \ #define __TIMER_SET(cycles, set) \
__timer_set(cycles, set) __timer_set(cycles, set)
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
__timer_start() __timer_start()
#define __TIMER_STOP(...) \ #define __TIMER_STOP(...) \

View file

@ -31,7 +31,7 @@ void _timer_stop(void);
#define __TIMER_SET(cycles, set) \ #define __TIMER_SET(cycles, set) \
_timer_set(cycles, set) _timer_set(cycles, set)
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
_timer_start() _timer_start()
#define __TIMER_STOP(...) \ #define __TIMER_STOP(...) \

View file

@ -30,7 +30,7 @@ void __timer_stop(void);
#define __TIMER_SET(cycles, set) \ #define __TIMER_SET(cycles, set) \
__timer_set(cycles, set) __timer_set(cycles, set)
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
__timer_start() __timer_start()
#define __TIMER_STOP(...) \ #define __TIMER_STOP(...) \

View file

@ -32,7 +32,7 @@ void __timer_stop(void);
#define __TIMER_SET(cycles, set) \ #define __TIMER_SET(cycles, set) \
__timer_set(cycles, set) __timer_set(cycles, set)
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
__timer_start() __timer_start()
#define __TIMER_STOP(...) \ #define __TIMER_STOP(...) \

View file

@ -31,7 +31,7 @@ void __timer_stop(void);
#define __TIMER_SET(cycles, set) \ #define __TIMER_SET(cycles, set) \
__timer_set(cycles, set) __timer_set(cycles, set)
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
__timer_start() __timer_start()
#define __TIMER_STOP(...) \ #define __TIMER_STOP(...) \

View file

@ -39,10 +39,10 @@ void __timer_stop(void);
__timer_set(cycles, set) __timer_set(cycles, set)
#if NUM_CORES > 1 #if NUM_CORES > 1
#define __TIMER_START(int_prio, core) \ #define __TIMER_START(core) \
__timer_start(core) __timer_start(core)
#else #else
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
__timer_start() __timer_start()
#endif #endif

View file

@ -31,7 +31,7 @@ void __timer_stop(void);
#define __TIMER_SET(cycles, set) \ #define __TIMER_SET(cycles, set) \
__timer_set(cycles, set) __timer_set(cycles, set)
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
__timer_start() __timer_start()
#define __TIMER_STOP(...) \ #define __TIMER_STOP(...) \

View file

@ -31,7 +31,7 @@ void __timer_stop(void);
#define __TIMER_SET(cycles, set) \ #define __TIMER_SET(cycles, set) \
__timer_set(cycles, set) __timer_set(cycles, set)
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
__timer_start() __timer_start()
#define __TIMER_STOP(...) \ #define __TIMER_STOP(...) \

View file

@ -33,7 +33,7 @@ void __timer_stop(void);
#define __TIMER_SET(cycles, set) \ #define __TIMER_SET(cycles, set) \
__timer_set(cycles, set) __timer_set(cycles, set)
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
__timer_start() __timer_start()
#define __TIMER_STOP(...) \ #define __TIMER_STOP(...) \

View file

@ -71,9 +71,9 @@ bool __timer_set(long cycles, bool start)
return true; return true;
} }
bool __timer_start(int int_prio) bool __timer_start(void)
{ {
IPRD = (IPRD & 0xFF0F) | int_prio << 4; /* interrupt priority */ IPRD = (IPRD & 0xFF0F) | 1 << 4; /* interrupt priority */
or_b(0x10, &TSTR); /* start timer 4 */ or_b(0x10, &TSTR); /* start timer 4 */
return true; return true;
} }

View file

@ -24,7 +24,7 @@
#include "config.h" #include "config.h"
bool __timer_set(long cycles, bool start); bool __timer_set(long cycles, bool start);
bool __timer_start(int int_prio); bool __timer_start(void);
void __timer_stop(void); void __timer_stop(void);
#define TIMER_FREQ CPU_FREQ #define TIMER_FREQ CPU_FREQ
@ -32,8 +32,8 @@ void __timer_stop(void);
#define __TIMER_SET(cycles, set) \ #define __TIMER_SET(cycles, set) \
__timer_set(cycles, set) __timer_set(cycles, set)
#define __TIMER_START(int_prio) \ #define __TIMER_START() \
__timer_start(int_prio) __timer_start()
#define __TIMER_STOP(...) \ #define __TIMER_STOP(...) \
__timer_stop() __timer_stop()

View file

@ -30,18 +30,6 @@ static int timer_prio = -1;
void SHAREDBSS_ATTR (*pfn_timer)(void) = NULL; /* timer callback */ void SHAREDBSS_ATTR (*pfn_timer)(void) = NULL; /* timer callback */
void SHAREDBSS_ATTR (*pfn_unregister)(void) = NULL; /* unregister callback */ void SHAREDBSS_ATTR (*pfn_unregister)(void) = NULL; /* unregister callback */
#ifndef __TIMER_SET
/* Define these if not defined by target to make the #else cases compile
* even if the target doesn't have them implemented. */
#define __TIMER_SET(cycles, set) false
#if NUM_CORES > 1
#define __TIMER_START(int_prio, core) false
#else
#define __TIMER_START(int_prio) false
#endif
#define __TIMER_STOP()
#endif
static bool timer_set(long cycles, bool start) static bool timer_set(long cycles, bool start)
{ {
return __TIMER_SET(cycles, start); return __TIMER_SET(cycles, start);
@ -49,17 +37,12 @@ static bool timer_set(long cycles, bool start)
/* Register a user timer, called every <cycles> TIMER_FREQ cycles */ /* Register a user timer, called every <cycles> TIMER_FREQ cycles */
bool timer_register(int reg_prio, void (*unregister_callback)(void), bool timer_register(int reg_prio, void (*unregister_callback)(void),
long cycles, int int_prio, void (*timer_callback)(void) long cycles, void (*timer_callback)(void)
IF_COP(, int core)) IF_COP(, int core))
{ {
if (reg_prio <= timer_prio || cycles == 0) if (reg_prio <= timer_prio || cycles == 0)
return false; return false;
#if CONFIG_CPU == SH7034
if (int_prio < 1 || int_prio > 15)
return false;
#endif
if (!timer_set(cycles, true)) if (!timer_set(cycles, true))
return false; return false;
@ -68,18 +51,10 @@ bool timer_register(int reg_prio, void (*unregister_callback)(void),
timer_prio = reg_prio; timer_prio = reg_prio;
#if NUM_CORES > 1 #if NUM_CORES > 1
return __TIMER_START(int_prio, core); return __TIMER_START(core);
#else #else
return __TIMER_START(int_prio); return __TIMER_START();
#endif #endif
/* Cover for targets that don't use all these */
(void)reg_prio;
(void)unregister_callback;
(void)cycles;
/* TODO: Implement for PortalPlayer and iFP (if possible) */
(void)int_prio;
(void)timer_callback;
} }
bool timer_set_period(long cycles) bool timer_set_period(long cycles)

View file

@ -36,9 +36,8 @@ Uint32 SDL_timer_callback(Uint32 interval, void *param){
((int)((1000*cycles)/TIMER_FREQ)) ((int)((1000*cycles)/TIMER_FREQ))
bool timer_register(int reg_prio, void (*unregister_callback)(void), bool timer_register(int reg_prio, void (*unregister_callback)(void),
long cycles, int int_prio, void (*timer_callback)(void)) long cycles, void (*timer_callback)(void))
{ {
(void)int_prio;/* interrupt priority not used */
(void)unregister_callback; (void)unregister_callback;
if (reg_prio <= timer_prio || cycles == 0) if (reg_prio <= timer_prio || cycles == 0)
return false; return false;