summaryrefslogtreecommitdiff
path: root/uisimulator/sdl/uisdl.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-03-25 02:34:12 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-03-25 02:34:12 +0000
commit27cf67733936abd75fcb1f8da765977cd75906ee (patch)
treef894211a8a0c77b402dd3250b2bee2d17dcfe13f /uisimulator/sdl/uisdl.c
parentbc2f8fd8f38a3e010cd67bbac358f6e9991153c6 (diff)
downloadrockbox-27cf67733936abd75fcb1f8da765977cd75906ee.tar.gz
rockbox-27cf67733936abd75fcb1f8da765977cd75906ee.zip
Add a complete priority inheritance implementation to the scheduler (all mutex ownership and queue_send calls are inheritable). Priorities are differential so that dispatch depends on the runnable range of priorities. Codec priority can therefore be raised in small steps (pcmbuf updated to enable). Simplify the kernel functions to ease implementation and use the same kernel.c for both sim and target (I'm tired of maintaining two ;_). 1) Not sure if a minor audio break at first buffering issue will exist on large-sector disks (the main mutex speed issue was genuinely resolved earlier). At this point it's best dealt with at the buffering level. It seems a larger filechunk could be used again. 2) Perhaps 64-bit sims will have some minor issues (finicky) but a backroll of the code of concern there is a 5-minute job. All kernel objects become incompatible so a full rebuild and update is needed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16791 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/uisdl.c')
-rw-r--r--uisimulator/sdl/uisdl.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/uisimulator/sdl/uisdl.c b/uisimulator/sdl/uisdl.c
index e0a449ed48..09210926b5 100644
--- a/uisimulator/sdl/uisdl.c
+++ b/uisimulator/sdl/uisdl.c
@@ -40,19 +40,13 @@
40#include "SDL_thread.h" 40#include "SDL_thread.h"
41 41
42/* extern functions */ 42/* extern functions */
43extern void app_main (void *); /* mod entry point */ 43extern void new_key(int key);
44extern void new_key(int key);
45extern void sim_tick_tasks(void);
46extern bool sim_io_init(void);
47extern void sim_io_shutdown(void);
48 44
49void button_event(int key, bool pressed); 45void button_event(int key, bool pressed);
50 46
51SDL_Surface *gui_surface; 47SDL_Surface *gui_surface;
52bool background = false; /* Don't use backgrounds by default */ 48bool background = false; /* Don't use backgrounds by default */
53 49
54SDL_TimerID tick_timer_id;
55
56bool lcd_display_redraw = true; /* Used for player simulator */ 50bool lcd_display_redraw = true; /* Used for player simulator */
57char having_new_lcd = true; /* Used for player simulator */ 51char having_new_lcd = true; /* Used for player simulator */
58bool sim_alarm_wakeup = false; 52bool sim_alarm_wakeup = false;
@@ -63,31 +57,6 @@ bool debug_audio = false;
63bool debug_wps = false; 57bool debug_wps = false;
64int wps_verbose_level = 3; 58int wps_verbose_level = 3;
65 59
66long start_tick;
67
68Uint32 tick_timer(Uint32 interval, void *param)
69{
70 long new_tick;
71
72 (void) interval;
73 (void) param;
74
75 new_tick = (SDL_GetTicks() - start_tick) / (1000/HZ);
76
77 if (new_tick != current_tick) {
78 long i;
79 for (i = new_tick - current_tick; i > 0; i--)
80 {
81 sim_enter_irq_handler();
82 sim_tick_tasks();
83 sim_exit_irq_handler();
84 }
85 current_tick = new_tick;
86 }
87
88 return 1;
89}
90
91void gui_message_loop(void) 60void gui_message_loop(void)
92{ 61{
93 SDL_Event event; 62 SDL_Event event;
@@ -181,8 +150,6 @@ bool gui_startup(void)
181 SDL_UpdateRect(gui_surface, 0, 0, 0, 0); 150 SDL_UpdateRect(gui_surface, 0, 0, 0, 0);
182 } 151 }
183 152
184 start_tick = SDL_GetTicks();
185
186 return true; 153 return true;
187} 154}
188 155
@@ -191,7 +158,6 @@ bool gui_shutdown(void)
191 /* Order here is relevent to prevent deadlocks and use of destroyed 158 /* Order here is relevent to prevent deadlocks and use of destroyed
192 sync primitives by kernel threads */ 159 sync primitives by kernel threads */
193 thread_sdl_shutdown(); 160 thread_sdl_shutdown();
194 SDL_RemoveTimer(tick_timer_id);
195 sim_kernel_shutdown(); 161 sim_kernel_shutdown();
196 return true; 162 return true;
197} 163}
@@ -287,8 +253,6 @@ int main(int argc, char *argv[])
287 return -1; 253 return -1;
288 } 254 }
289 255
290 tick_timer_id = SDL_AddTimer(10, tick_timer, NULL);
291
292 gui_message_loop(); 256 gui_message_loop();
293 257
294 return gui_shutdown(); 258 return gui_shutdown();