summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-04-04 19:38:46 +0000
committerJens Arnold <amiconn@rockbox.org>2008-04-04 19:38:46 +0000
commitac9b92716a11cf7699f6ce9668b1ca5cd4171cf9 (patch)
treeb327ea00d2320464d5022b63690032ec31b55f47 /firmware
parent3183b9e534eba4ca07ffaa68895e63177b5d8761 (diff)
downloadrockbox-ac9b92716a11cf7699f6ce9668b1ca5cd4171cf9.tar.gz
rockbox-ac9b92716a11cf7699f6ce9668b1ca5cd4171cf9.tar.bz2
rockbox-ac9b92716a11cf7699f6ce9668b1ca5cd4171cf9.zip
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
Diffstat (limited to 'firmware')
-rw-r--r--firmware/backlight.c5
-rw-r--r--firmware/export/timer.h3
-rw-r--r--firmware/timer.c19
3 files changed, 19 insertions, 8 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 4126b82a2c..a09521de9a 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -289,7 +289,8 @@ 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, 0, backlight_isr
+ IF_COP(, CPU)))
{
#ifdef _BACKLIGHT_FADE_BOOST
/* Prevent cpu frequency changes while dimming. */
@@ -813,7 +814,7 @@ void remote_backlight_on(void) {}
void remote_backlight_off(void) {}
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;
return true;
diff --git a/firmware/export/timer.h b/firmware/export/timer.h
index 21995ef459..08bf7b13e4 100644
--- a/firmware/export/timer.h
+++ b/firmware/export/timer.h
@@ -39,7 +39,8 @@
#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, int int_prio, void (*timer_callback)(void)
+ IF_COP(,int core));
bool timer_set_period(long cycles);
#ifdef CPU_COLDFIRE
void timers_adjust_prescale(int multiplier, bool enable_irq);
diff --git a/firmware/timer.c b/firmware/timer.c
index d15ba64443..23df271220 100644
--- a/firmware/timer.c
+++ b/firmware/timer.c
@@ -25,12 +25,12 @@
#include "logf.h"
static int timer_prio = -1;
-void (*pfn_timer)(void) = NULL; /* timer callback */
-void (*pfn_unregister)(void) = NULL; /* unregister callback */
+void NOCACHEBSS_ATTR (*pfn_timer)(void) = NULL; /* timer callback */
+void NOCACHEBSS_ATTR (*pfn_unregister)(void) = NULL; /* unregister callback */
#ifdef CPU_COLDFIRE
static int base_prescale;
#elif defined CPU_PP || CONFIG_CPU == PNX0101
-static long cycles_new = 0;
+static long NOCACHEBSS_ATTR cycles_new = 0;
#endif
/* interrupt handler */
@@ -201,6 +201,8 @@ static bool timer_set(long cycles, bool start)
pfn_unregister();
pfn_unregister = NULL;
}
+ CPU_INT_CLR = TIMER2_MASK;
+ COP_INT_CLR = TIMER2_MASK;
}
if (start || (cycles_new == -1)) /* within isr, cycles_new is "locked" */
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 */
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)
return false;
@@ -264,7 +267,12 @@ bool timer_register(int reg_prio, void (*unregister_callback)(void),
return true;
#elif defined(CPU_PP)
/* 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;
#elif CONFIG_CPU == PNX0101
irq_set_int_handler(IRQ_TIMER1, TIMER1_ISR);
@@ -301,6 +309,7 @@ void timer_unregister(void)
#elif defined(CPU_PP)
TIMER2_CFG = 0; /* stop timer 2 */
CPU_INT_CLR = TIMER2_MASK;
+ COP_INT_CLR = TIMER2_MASK;
#elif CONFIG_CPU == PNX0101
TIMER1.ctrl &= ~0x80; /* disable timer 1 */
irq_disable_int(IRQ_TIMER1);