summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-10-27 17:18:01 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-10-27 17:18:01 +0000
commit623cd1cb0dcb78b2dfc92e50de34b1d72737c3d8 (patch)
treede354652f4593a83ab5c949970e4d7943eb92c4a
parenta9e69d935cb5c2e5ffca1bbc977252ce7661d343 (diff)
downloadrockbox-623cd1cb0dcb78b2dfc92e50de34b1d72737c3d8.tar.gz
rockbox-623cd1cb0dcb78b2dfc92e50de34b1d72737c3d8.zip
Fix red-- it should.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18894 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/export/kernel.h28
-rw-r--r--uisimulator/sdl/kernel-sdl.c20
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
191/* We don't enable interrupts in the iPod bootloader, so we need to fake 191/* We don't enable interrupts in the iPod bootloader, so we need to fake
192 the current_tick variable */ 192 the current_tick variable */
193#define current_tick (signed)(USEC_TIMER/10000) 193#define current_tick (signed)(USEC_TIMER/10000)
194
195static inline void call_tick_tasks(void)
196{
197}
194#else 198#else
195extern volatile long current_tick; 199extern volatile long current_tick;
200
201/* inline helper for implementing target interrupt handler */
202static inline void call_tick_tasks(void)
203{
204 extern void (*tick_funcs[MAX_NUM_TICK_TASKS+1])(void);
205 int i;
206
207 current_tick++;
208
209 for (i = 0; tick_funcs[i] != NULL; i++)
210 tick_funcs[i]();
211}
196#endif 212#endif
197 213
198#ifdef SIMULATOR 214#ifdef SIMULATOR
@@ -207,18 +223,6 @@ int tick_add_task(void (*f)(void));
207int tick_remove_task(void (*f)(void)); 223int tick_remove_task(void (*f)(void));
208extern void tick_start(unsigned int interval_in_ms); 224extern void tick_start(unsigned int interval_in_ms);
209 225
210/* inline helper for implementing target interrupt handler */
211static inline void call_tick_tasks(void)
212{
213 extern void (*tick_funcs[MAX_NUM_TICK_TASKS+1])(void);
214 int i;
215
216 current_tick++;
217
218 for (i = 0; tick_funcs[i] != NULL; i++)
219 tick_funcs[i]();
220}
221
222struct timeout; 226struct timeout;
223 227
224/* timeout callback type 228/* 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;
42static int handlers_pending = 0; 42static int handlers_pending = 0;
43static int status_reg = 0; 43static int status_reg = 0;
44 44
45extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
46
47/* Nescessary logic: 45/* Nescessary logic:
48 * 1) All threads must pass unblocked 46 * 1) All threads must pass unblocked
49 * 2) Current handler must always pass unblocked 47 * 2) Current handler must always pass unblocked
@@ -129,26 +127,16 @@ Uint32 tick_timer(Uint32 interval, void *param)
129 127
130 if(new_tick != current_tick) 128 if(new_tick != current_tick)
131 { 129 {
132 long t; 130 while(current_tick < new_tick)
133 for(t = new_tick - current_tick; t > 0; t--)
134 { 131 {
135 int i;
136
137 sim_enter_irq_handler(); 132 sim_enter_irq_handler();
138 133
139 /* Run through the list of tick tasks */ 134 /* Run through the list of tick tasks - increments tick
140 for(i = 0;i < MAX_NUM_TICK_TASKS;i++) 135 * on each iteration. */
141 { 136 call_tick_tasks();
142 if(tick_funcs[i])
143 {
144 tick_funcs[i]();
145 }
146 }
147 137
148 sim_exit_irq_handler(); 138 sim_exit_irq_handler();
149 } 139 }
150
151 current_tick = new_tick;
152 } 140 }
153 141
154 return 1; 142 return 1;