1
0
Fork 0
forked from len0rd/rockbox

Allow to select the core for running the user timer on portalplayer targets. * Incompatible plugin API change -> sorted API.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16965 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2008-04-04 19:38:46 +00:00
parent 3183b9e534
commit ac9b92716a
11 changed files with 36 additions and 22 deletions

View file

@ -144,6 +144,7 @@ static const struct plugin_api rockbox_api = {
#if CONFIG_CHARGING #if CONFIG_CHARGING
backlight_set_timeout_plugged, backlight_set_timeout_plugged,
#endif #endif
is_backlight_on,
gui_syncsplash, gui_syncsplash,
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
@ -477,7 +478,7 @@ static const struct plugin_api rockbox_api = {
# endif # endif
#endif #endif
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
usb_powered, usb_powered,
#endif #endif
/* misc */ /* misc */
@ -576,7 +577,6 @@ static const struct plugin_api rockbox_api = {
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ the API gets incompatible */
is_backlight_on,
}; };
int plugin_load(const char* plugin, void* parameter) int plugin_load(const char* plugin, void* parameter)

View file

@ -120,12 +120,12 @@
#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 106 #define PLUGIN_API_VERSION 107
/* 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 105 #define PLUGIN_MIN_API_VERSION 107
/* plugin return codes */ /* plugin return codes */
enum plugin_status { enum plugin_status {
@ -235,6 +235,7 @@ struct plugin_api {
#if CONFIG_CHARGING #if CONFIG_CHARGING
void (*backlight_set_timeout_plugged)(int index); void (*backlight_set_timeout_plugged)(int index);
#endif #endif
bool (*is_backlight_on)(bool ignore_always_off);
void (*splash)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); void (*splash)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
@ -394,7 +395,7 @@ struct plugin_api {
#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, int int_prio,
void (*timer_callback)(void)); void (*timer_callback)(void) IF_COP(, int core));
void (*timer_unregister)(void); void (*timer_unregister)(void);
bool (*timer_set_period)(long count); bool (*timer_set_period)(long count);
@ -722,7 +723,6 @@ struct plugin_api {
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ the API gets incompatible */
bool (*is_backlight_on)(bool ignore_always_off);
}; };
/* plugin header */ /* plugin header */

View file

@ -231,11 +231,11 @@ 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); rb->timer_register(1, NULL, gTimer.timeout, 11, timer4_isr IF_COP(, CPU));
} }
else if (mode == TM_TRANSMIT) else if (mode == TM_TRANSMIT)
{ {
rb->timer_register(1, NULL, gTimer.transmit, 14, timer4_isr); rb->timer_register(1, NULL, gTimer.transmit, 14, timer4_isr IF_COP(, CPU));
} }
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); rb->timer_register(1, NULL, TIMER_FREQ/TICRATE, 1, doomtime IF_COP(, CPU));
#endif #endif
I_InitSound(); I_InitSound();
} }

View file

@ -603,7 +603,7 @@ void grey_show(bool enable)
_grey_info.rb->cpu_boost(true); _grey_info.rb->cpu_boost(true);
#endif #endif
_grey_info.rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, 1, _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, 1,
_timer_isr); _timer_isr IF_COP(, CPU));
#endif /* !SIMULATOR */ #endif /* !SIMULATOR */
_grey_info.rb->screen_dump_set_hook(grey_screendump_hook); _grey_info.rb->screen_dump_set_hook(grey_screendump_hook);
} }

View file

@ -322,7 +322,7 @@ enum plugin_status plugin_start(struct plugin_api* api, 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); rb->timer_register(1, NULL, TIMER_FREQ/1024, 1, timer_callback IF_COP(, CPU));
draw_display(); draw_display();

View file

@ -150,7 +150,8 @@ 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, timer_isr); rb->timer_register(1, NULL, TIMER_FREQ * 5 / scan_rate, 1,
timer_isr IF_COP(, CPU));
while (!done) while (!done)
{ {

View file

@ -540,9 +540,11 @@ 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, timer4_isr); rb->timer_register(1, NULL, gPlay.nFrameTimeAdjusted, 1,
timer4_isr IF_COP(, CPU));
#else #else
rb->timer_register(1, NULL, gFileHdr.video_frametime, 1, timer4_isr); rb->timer_register(1, NULL, gFileHdr.video_frametime, 1,
timer4_isr IF_COP(, CPU));
#endif #endif
} }

View file

@ -289,7 +289,8 @@ 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, 0, backlight_isr
IF_COP(, CPU)))
{ {
#ifdef _BACKLIGHT_FADE_BOOST #ifdef _BACKLIGHT_FADE_BOOST
/* Prevent cpu frequency changes while dimming. */ /* Prevent cpu frequency changes while dimming. */
@ -813,7 +814,7 @@ void remote_backlight_on(void) {}
void remote_backlight_off(void) {} void remote_backlight_off(void) {}
void remote_backlight_set_timeout(int value) {(void)value;} void remote_backlight_set_timeout(int value) {(void)value;}
bool is_remote_backlight_on(bool ignore_always_off) bool is_remote_backlight_on(bool ignore_always_off)
{ {
(void)ignore_always_off; (void)ignore_always_off;
return true; return true;

View file

@ -39,7 +39,8 @@
#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, int int_prio, void (*timer_callback)(void)
IF_COP(,int core));
bool timer_set_period(long cycles); bool timer_set_period(long cycles);
#ifdef CPU_COLDFIRE #ifdef CPU_COLDFIRE
void timers_adjust_prescale(int multiplier, bool enable_irq); void timers_adjust_prescale(int multiplier, bool enable_irq);

View file

@ -25,12 +25,12 @@
#include "logf.h" #include "logf.h"
static int timer_prio = -1; static int timer_prio = -1;
void (*pfn_timer)(void) = NULL; /* timer callback */ void NOCACHEBSS_ATTR (*pfn_timer)(void) = NULL; /* timer callback */
void (*pfn_unregister)(void) = NULL; /* unregister callback */ void NOCACHEBSS_ATTR (*pfn_unregister)(void) = NULL; /* unregister callback */
#ifdef CPU_COLDFIRE #ifdef CPU_COLDFIRE
static int base_prescale; static int base_prescale;
#elif defined CPU_PP || CONFIG_CPU == PNX0101 #elif defined CPU_PP || CONFIG_CPU == PNX0101
static long cycles_new = 0; static long NOCACHEBSS_ATTR cycles_new = 0;
#endif #endif
/* interrupt handler */ /* interrupt handler */
@ -201,6 +201,8 @@ static bool timer_set(long cycles, bool start)
pfn_unregister(); pfn_unregister();
pfn_unregister = NULL; pfn_unregister = NULL;
} }
CPU_INT_CLR = TIMER2_MASK;
COP_INT_CLR = TIMER2_MASK;
} }
if (start || (cycles_new == -1)) /* within isr, cycles_new is "locked" */ if (start || (cycles_new == -1)) /* within isr, cycles_new is "locked" */
TIMER2_CFG = 0xc0000000 | (cycles - 1); /* enable timer */ TIMER2_CFG = 0xc0000000 | (cycles - 1); /* enable timer */
@ -236,7 +238,8 @@ void timers_adjust_prescale(int multiplier, bool enable_irq)
/* 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, int int_prio, void (*timer_callback)(void)
IF_COP(, int core))
{ {
if (reg_prio <= timer_prio || cycles == 0) if (reg_prio <= timer_prio || cycles == 0)
return false; return false;
@ -264,7 +267,12 @@ bool timer_register(int reg_prio, void (*unregister_callback)(void),
return true; return true;
#elif defined(CPU_PP) #elif defined(CPU_PP)
/* unmask interrupt source */ /* unmask interrupt source */
CPU_INT_EN = TIMER2_MASK; #if NUM_CORES > 1
if (core == COP)
COP_INT_EN = TIMER2_MASK;
else
#endif
CPU_INT_EN = TIMER2_MASK;
return true; return true;
#elif CONFIG_CPU == PNX0101 #elif CONFIG_CPU == PNX0101
irq_set_int_handler(IRQ_TIMER1, TIMER1_ISR); irq_set_int_handler(IRQ_TIMER1, TIMER1_ISR);
@ -301,6 +309,7 @@ void timer_unregister(void)
#elif defined(CPU_PP) #elif defined(CPU_PP)
TIMER2_CFG = 0; /* stop timer 2 */ TIMER2_CFG = 0; /* stop timer 2 */
CPU_INT_CLR = TIMER2_MASK; CPU_INT_CLR = TIMER2_MASK;
COP_INT_CLR = TIMER2_MASK;
#elif CONFIG_CPU == PNX0101 #elif CONFIG_CPU == PNX0101
TIMER1.ctrl &= ~0x80; /* disable timer 1 */ TIMER1.ctrl &= ~0x80; /* disable timer 1 */
irq_disable_int(IRQ_TIMER1); irq_disable_int(IRQ_TIMER1);