From 623cd1cb0dcb78b2dfc92e50de34b1d72737c3d8 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Mon, 27 Oct 2008 17:18:01 +0000 Subject: Fix red-- it should. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18894 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/kernel.h | 28 ++++++++++++++++------------ uisimulator/sdl/kernel-sdl.c | 20 ++++---------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 9438f6d308..beba58eb21 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h @@ -191,8 +191,24 @@ struct wakeup /* We don't enable interrupts in the iPod bootloader, so we need to fake the current_tick variable */ #define current_tick (signed)(USEC_TIMER/10000) + +static inline void call_tick_tasks(void) +{ +} #else extern volatile long current_tick; + +/* inline helper for implementing target interrupt handler */ +static inline void call_tick_tasks(void) +{ + extern void (*tick_funcs[MAX_NUM_TICK_TASKS+1])(void); + int i; + + current_tick++; + + for (i = 0; tick_funcs[i] != NULL; i++) + tick_funcs[i](); +} #endif #ifdef SIMULATOR @@ -207,18 +223,6 @@ int tick_add_task(void (*f)(void)); int tick_remove_task(void (*f)(void)); extern void tick_start(unsigned int interval_in_ms); -/* inline helper for implementing target interrupt handler */ -static inline void call_tick_tasks(void) -{ - extern void (*tick_funcs[MAX_NUM_TICK_TASKS+1])(void); - int i; - - current_tick++; - - for (i = 0; tick_funcs[i] != NULL; i++) - tick_funcs[i](); -} - struct timeout; /* timeout callback type diff --git a/uisimulator/sdl/kernel-sdl.c b/uisimulator/sdl/kernel-sdl.c index 3a1d82bf24..2ff18b33ee 100644 --- a/uisimulator/sdl/kernel-sdl.c +++ b/uisimulator/sdl/kernel-sdl.c @@ -42,8 +42,6 @@ static int interrupt_level = HIGHEST_IRQ_LEVEL; static int handlers_pending = 0; static int status_reg = 0; -extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); - /* Nescessary logic: * 1) All threads must pass unblocked * 2) Current handler must always pass unblocked @@ -129,26 +127,16 @@ Uint32 tick_timer(Uint32 interval, void *param) if(new_tick != current_tick) { - long t; - for(t = new_tick - current_tick; t > 0; t--) + while(current_tick < new_tick) { - int i; - sim_enter_irq_handler(); - /* Run through the list of tick tasks */ - for(i = 0;i < MAX_NUM_TICK_TASKS;i++) - { - if(tick_funcs[i]) - { - tick_funcs[i](); - } - } + /* Run through the list of tick tasks - increments tick + * on each iteration. */ + call_tick_tasks(); sim_exit_irq_handler(); } - - current_tick = new_tick; } return 1; -- cgit v1.2.3