summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-10-27 07:07:54 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-10-27 07:07:54 +0000
commit9c4423f01085305530b1eeb493436894da541e36 (patch)
tree14d5be788aa6834a67278a6bdca1f1e947792533 /firmware
parent75a9a9b9a7f7115c8e59a6c390ad462394bd711b (diff)
downloadrockbox-9c4423f01085305530b1eeb493436894da541e36.tar.gz
rockbox-9c4423f01085305530b1eeb493436894da541e36.zip
Coldfire: System tick at 10ms
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5367 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/kernel.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/firmware/kernel.c b/firmware/kernel.c
index a9c7711003..221f8a3b38 100644
--- a/firmware/kernel.c
+++ b/firmware/kernel.c
@@ -20,7 +20,7 @@
#include <string.h>
#include "kernel.h"
#include "thread.h"
-#include "sh7034.h"
+#include "cpu.h"
#include "system.h"
#include "panic.h"
@@ -154,6 +154,7 @@ int queue_broadcast(int id, void *data)
/****************************************************************************
* Timer tick
****************************************************************************/
+#if CONFIG_CPU == SH7034
static void tick_start(unsigned int interval_in_ms)
{
unsigned int count;
@@ -205,6 +206,52 @@ void IMIA0(void)
TSR0 &= ~0x01;
}
+#elif CONFIG_CPU == MCF5249
+static void tick_start(unsigned int interval_in_ms)
+{
+ unsigned int count;
+
+ count = FREQ/2 * interval_in_ms / 1000 / 16;
+
+ if(count > 0xffff)
+ {
+ panicf("Error! The tick interval is too long (%d ms)\n",
+ interval_in_ms);
+ return;
+ }
+
+ /* We are using timer 0 */
+
+ TRR0 = count; /* The reference count */
+ TCN0 = 0; /* reset the timer */
+ TMR0 = 0x001d; /* no prescaler, restart, CLK/16, enabled */
+
+ TER0 = 0xff; /* Clear all events */
+
+ ICR0 = (ICR0 & 0xff00ffff) | 0x008c0000; /* Interrupt on level 3.0 */
+ IMR &= ~0x200;
+}
+
+void TIMER0(void) __attribute__ ((interrupt_handler));
+void TIMER0(void)
+{
+ int i;
+
+ /* Run through the list of tick tasks */
+ for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
+ {
+ if(tick_funcs[i])
+ {
+ tick_funcs[i]();
+ }
+ }
+
+ current_tick++;
+ wake_up_thread();
+
+ TER0 = 0xff; /* Clear all events */
+}
+#endif
int tick_add_task(void (*f)(void))
{