diff --git a/apps/plugin.h b/apps/plugin.h index 2a5b6829c0..160eb2b1e7 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -128,12 +128,12 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* 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 backwards compatibility (and please take the opportunity to sort in any 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 */ enum plugin_status { @@ -461,8 +461,8 @@ struct plugin_api { void (*cpucache_invalidate)(void); #endif bool (*timer_register)(int reg_prio, void (*unregister_callback)(void), - long cycles, int int_prio, - void (*timer_callback)(void) IF_COP(, int core)); + long cycles, void (*timer_callback)(void) + IF_COP(, int core)); void (*timer_unregister)(void); bool (*timer_set_period)(long count); diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c index 494fa17842..73bc49ff00 100644 --- a/apps/plugins/alpine_cdc.c +++ b/apps/plugins/alpine_cdc.c @@ -231,11 +231,13 @@ void timer_set_mode(int mode) 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) { - 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 { diff --git a/apps/plugins/doom/i_system.c b/apps/plugins/doom/i_system.c index 09a61808fd..601ffc3b27 100644 --- a/apps/plugins/doom/i_system.c +++ b/apps/plugins/doom/i_system.c @@ -109,7 +109,7 @@ int I_GetTime (void) void I_Init (void) { #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 I_InitSound(); } diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c index ea70ae942b..6fa422be05 100644 --- a/apps/plugins/lib/grey_core.c +++ b/apps/plugins/lib/grey_core.c @@ -648,11 +648,10 @@ void grey_show(bool enable) #endif #if NUM_CORES > 1 rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, - 1, _timer_isr, + _timer_isr, (_grey_info.flags & GREY_ON_COP) ? COP : CPU); #else - rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, 1, - _timer_isr); + rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, _timer_isr); #endif #endif /* !SIMULATOR */ rb->screen_dump_set_hook(grey_screendump_hook); diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index 8906c923a0..10b9e41738 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c @@ -910,7 +910,7 @@ enum plugin_status plugin_start(const void* parameter) #endif /* CONFIG_CODEC != SWCODEC */ 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(); diff --git a/apps/plugins/test_scanrate.c b/apps/plugins/test_scanrate.c index 7a0a13bc94..7746916386 100644 --- a/apps/plugins/test_scanrate.c +++ b/apps/plugins/test_scanrate.c @@ -162,7 +162,7 @@ int plugin_main(void) rb->cpu_boost(true); #endif /* 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)); while (!done) diff --git a/apps/plugins/video.c b/apps/plugins/video.c index bcbbb99d80..bd8a95eb71 100644 --- a/apps/plugins/video.c +++ b/apps/plugins/video.c @@ -562,10 +562,10 @@ int SeekTo(int fd, int nPos) gPlay.bVideoUnderrun = false; /* start display interrupt */ #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)); #else - rb->timer_register(1, NULL, gFileHdr.video_frametime, 1, + rb->timer_register(1, NULL, gFileHdr.video_frametime, timer4_isr IF_COP(, CPU)); #endif } @@ -748,10 +748,10 @@ int PlayTick(int fd) { /* start the video */ #if FREQ == 12000000 /* Ondio speed kludge */ rb->timer_register(1, NULL, - gPlay.nFrameTimeAdjusted, 1, timer4_isr); + gPlay.nFrameTimeAdjusted, timer4_isr); #else rb->timer_register(1, NULL, - gFileHdr.video_frametime, 1, timer4_isr); + gFileHdr.video_frametime, timer4_isr); #endif } } diff --git a/docs/PLUGIN_API.new b/docs/PLUGIN_API.new index 7e597eed58..d54d7a1ce0 100644 --- a/docs/PLUGIN_API.new +++ b/docs/PLUGIN_API.new @@ -2438,11 +2438,10 @@ void thread_wait(struct thread_entry *thread) \param thread \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 unregister_callback \param cycles - \param int_prio \param core \param timer_callback \return diff --git a/firmware/backlight.c b/firmware/backlight.c index 12acca00a7..8eded957f7 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -332,7 +332,7 @@ static void backlight_dim(int value) if (bl_timer_active) 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))) { #ifdef _BACKLIGHT_FADE_BOOST diff --git a/firmware/export/timer.h b/firmware/export/timer.h index 678d9ad8c6..7b56330e18 100644 --- a/firmware/export/timer.h +++ b/firmware/export/timer.h @@ -41,7 +41,7 @@ #define TIMER_FREQ CPU_FREQ #endif 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)); bool timer_set_period(long cycles); #ifdef CPU_COLDFIRE diff --git a/firmware/profile.c b/firmware/profile.c index cb68f18d8e..6700eca404 100644 --- a/firmware/profile.c +++ b/firmware/profile.c @@ -140,7 +140,7 @@ void profile_thread_started(int current_thread) { if (profiling < PROF_ERROR) { /* After we de-mask, if profiling is active, reactivate the timer */ 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; memset(indices,0,INDEX_SIZE * sizeof(unsigned short)); 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; } diff --git a/firmware/target/arm/as3525/timer-target.h b/firmware/target/arm/as3525/timer-target.h index d42afaa2c4..b1bdfed78f 100644 --- a/firmware/target/arm/as3525/timer-target.h +++ b/firmware/target/arm/as3525/timer-target.h @@ -30,7 +30,7 @@ void __timer_stop(void); #define __TIMER_SET(cycles, set) \ __timer_set(cycles, set) -#define __TIMER_START(int_prio) \ +#define __TIMER_START() \ __timer_start() #define __TIMER_STOP(...) \ diff --git a/firmware/target/arm/at91sam/lyre_proto1/timer-target.h b/firmware/target/arm/at91sam/lyre_proto1/timer-target.h index 1db63c5211..b8298d3d77 100644 --- a/firmware/target/arm/at91sam/lyre_proto1/timer-target.h +++ b/firmware/target/arm/at91sam/lyre_proto1/timer-target.h @@ -32,7 +32,7 @@ void __timer_stop(void); #define __TIMER_SET(cycles, set) \ __timer_set(cycles, set) -#define __TIMER_START(int_prio) \ +#define __TIMER_START() \ __timer_start() #define __TIMER_STOP(...) \ diff --git a/firmware/target/arm/imx31/gigabeat-s/timer-target.h b/firmware/target/arm/imx31/gigabeat-s/timer-target.h index 4ea459719c..f019a45519 100644 --- a/firmware/target/arm/imx31/gigabeat-s/timer-target.h +++ b/firmware/target/arm/imx31/gigabeat-s/timer-target.h @@ -31,7 +31,7 @@ void _timer_stop(void); #define __TIMER_SET(cycles, set) \ _timer_set(cycles, set) -#define __TIMER_START(int_prio) \ +#define __TIMER_START() \ _timer_start() #define __TIMER_STOP(...) \ diff --git a/firmware/target/arm/pnx0101/timer-target.h b/firmware/target/arm/pnx0101/timer-target.h index 68d0e6b58a..853da07838 100644 --- a/firmware/target/arm/pnx0101/timer-target.h +++ b/firmware/target/arm/pnx0101/timer-target.h @@ -30,7 +30,7 @@ void __timer_stop(void); #define __TIMER_SET(cycles, set) \ __timer_set(cycles, set) -#define __TIMER_START(int_prio) \ +#define __TIMER_START() \ __timer_start() #define __TIMER_STOP(...) \ diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/timer-target.h b/firmware/target/arm/s3c2440/gigabeat-fx/timer-target.h index 577d0f947c..700833486d 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/timer-target.h +++ b/firmware/target/arm/s3c2440/gigabeat-fx/timer-target.h @@ -32,7 +32,7 @@ void __timer_stop(void); #define __TIMER_SET(cycles, set) \ __timer_set(cycles, set) -#define __TIMER_START(int_prio) \ +#define __TIMER_START() \ __timer_start() #define __TIMER_STOP(...) \ diff --git a/firmware/target/arm/tcc780x/timer-target.h b/firmware/target/arm/tcc780x/timer-target.h index c477ca6c70..d6a8c4b0aa 100644 --- a/firmware/target/arm/tcc780x/timer-target.h +++ b/firmware/target/arm/tcc780x/timer-target.h @@ -31,7 +31,7 @@ void __timer_stop(void); #define __TIMER_SET(cycles, set) \ __timer_set(cycles, set) -#define __TIMER_START(int_prio) \ +#define __TIMER_START() \ __timer_start() #define __TIMER_STOP(...) \ diff --git a/firmware/target/arm/timer-target.h b/firmware/target/arm/timer-target.h index 6801cfe783..7b7fdabdce 100644 --- a/firmware/target/arm/timer-target.h +++ b/firmware/target/arm/timer-target.h @@ -39,10 +39,10 @@ void __timer_stop(void); __timer_set(cycles, set) #if NUM_CORES > 1 -#define __TIMER_START(int_prio, core) \ +#define __TIMER_START(core) \ __timer_start(core) #else -#define __TIMER_START(int_prio) \ +#define __TIMER_START() \ __timer_start() #endif diff --git a/firmware/target/arm/tms320dm320/timer-target.h b/firmware/target/arm/tms320dm320/timer-target.h index 072f7e06a9..9f3ffdf712 100644 --- a/firmware/target/arm/tms320dm320/timer-target.h +++ b/firmware/target/arm/tms320dm320/timer-target.h @@ -31,7 +31,7 @@ void __timer_stop(void); #define __TIMER_SET(cycles, set) \ __timer_set(cycles, set) -#define __TIMER_START(int_prio) \ +#define __TIMER_START() \ __timer_start() #define __TIMER_STOP(...) \ diff --git a/firmware/target/coldfire/timer-target.h b/firmware/target/coldfire/timer-target.h index c7f695a0c8..29488887e8 100644 --- a/firmware/target/coldfire/timer-target.h +++ b/firmware/target/coldfire/timer-target.h @@ -31,7 +31,7 @@ void __timer_stop(void); #define __TIMER_SET(cycles, set) \ __timer_set(cycles, set) -#define __TIMER_START(int_prio) \ +#define __TIMER_START() \ __timer_start() #define __TIMER_STOP(...) \ diff --git a/firmware/target/mips/ingenic_jz47xx/timer-target.h b/firmware/target/mips/ingenic_jz47xx/timer-target.h index d42bd41bdc..2e072440ab 100644 --- a/firmware/target/mips/ingenic_jz47xx/timer-target.h +++ b/firmware/target/mips/ingenic_jz47xx/timer-target.h @@ -33,7 +33,7 @@ void __timer_stop(void); #define __TIMER_SET(cycles, set) \ __timer_set(cycles, set) -#define __TIMER_START(int_prio) \ +#define __TIMER_START() \ __timer_start() #define __TIMER_STOP(...) \ diff --git a/firmware/target/sh/archos/timer-archos.c b/firmware/target/sh/archos/timer-archos.c index e7526a8409..c61318f721 100644 --- a/firmware/target/sh/archos/timer-archos.c +++ b/firmware/target/sh/archos/timer-archos.c @@ -71,9 +71,9 @@ bool __timer_set(long cycles, bool start) 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 */ return true; } diff --git a/firmware/target/sh/archos/timer-target.h b/firmware/target/sh/archos/timer-target.h index 08fcae1156..89dfe57eb3 100644 --- a/firmware/target/sh/archos/timer-target.h +++ b/firmware/target/sh/archos/timer-target.h @@ -24,7 +24,7 @@ #include "config.h" bool __timer_set(long cycles, bool start); -bool __timer_start(int int_prio); +bool __timer_start(void); void __timer_stop(void); #define TIMER_FREQ CPU_FREQ @@ -32,8 +32,8 @@ void __timer_stop(void); #define __TIMER_SET(cycles, set) \ __timer_set(cycles, set) -#define __TIMER_START(int_prio) \ - __timer_start(int_prio) +#define __TIMER_START() \ + __timer_start() #define __TIMER_STOP(...) \ __timer_stop() 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; void SHAREDBSS_ATTR (*pfn_timer)(void) = NULL; /* timer 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) { return __TIMER_SET(cycles, start); @@ -49,17 +37,12 @@ static bool timer_set(long cycles, bool start) /* Register a user timer, called every TIMER_FREQ cycles */ 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 (reg_prio <= timer_prio || cycles == 0) return false; -#if CONFIG_CPU == SH7034 - if (int_prio < 1 || int_prio > 15) - return false; -#endif - if (!timer_set(cycles, true)) return false; @@ -68,18 +51,10 @@ bool timer_register(int reg_prio, void (*unregister_callback)(void), timer_prio = reg_prio; #if NUM_CORES > 1 - return __TIMER_START(int_prio, core); + return __TIMER_START(core); #else - return __TIMER_START(int_prio); + return __TIMER_START(); #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) diff --git a/uisimulator/sdl/timer.c b/uisimulator/sdl/timer.c index f4368bb745..369aeab929 100644 --- a/uisimulator/sdl/timer.c +++ b/uisimulator/sdl/timer.c @@ -36,9 +36,8 @@ Uint32 SDL_timer_callback(Uint32 interval, void *param){ ((int)((1000*cycles)/TIMER_FREQ)) 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; if (reg_prio <= timer_prio || cycles == 0) return false;