From 64bde94ecf65b752a15250fb5ff05438502c4fde Mon Sep 17 00:00:00 2001 From: Felix Arends Date: Tue, 25 Jun 2002 21:01:08 +0000 Subject: Finally, again a working version of the win32 simulator. I re-wrote the makefile, it is much more compact now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1191 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/win32/kernel.c | 46 +++++++++++++++++++ uisimulator/win32/main.c | 25 ----------- uisimulator/win32/makefile | 97 +++++++++------------------------------- uisimulator/win32/mpeg.c | 13 ++++++ uisimulator/win32/uisw32.suo | Bin 12800 -> 13312 bytes uisimulator/win32/uisw32.vcproj | 33 ++++++++++++-- 6 files changed, 109 insertions(+), 105 deletions(-) delete mode 100644 uisimulator/win32/main.c diff --git a/uisimulator/win32/kernel.c b/uisimulator/win32/kernel.c index 102bb6c82a..3410bc9cc9 100644 --- a/uisimulator/win32/kernel.c +++ b/uisimulator/win32/kernel.c @@ -21,6 +21,7 @@ #include "uisw32.h" #include "kernel.h" #include "thread-win32.h" +#include "thread.h" void sleep(int ticks) { @@ -31,4 +32,49 @@ void sleep(int ticks) void yield (void) { PostThreadMessage (GetWindowThreadProcessId (hGUIWnd,NULL), TM_YIELD, 0, 0); +} + +void queue_init(struct event_queue *q) +{ + q->read = 0; + q->write = 0; +} + +void queue_wait(struct event_queue *q, struct event *ev) +{ + while(q->read == q->write) + { + switch_thread(); + } + + *ev = q->events[(q->read++) & QUEUE_LENGTH_MASK]; +} + +void queue_post(struct event_queue *q, int id, void *data) +{ + int wr; + int oldlevel; + + oldlevel = set_irq_level(15); + wr = (q->write++) & QUEUE_LENGTH_MASK; + + q->events[wr].id = id; + q->events[wr].data = data; + set_irq_level(oldlevel); +} + +bool queue_empty(struct event_queue* q) +{ + return ( q->read == q->write ); +} + +void switch_thread (void) +{ + yield (); +} + +int set_irq_level (int level) +{ + static int _lv = 0; + return (_lv = level); } \ No newline at end of file diff --git a/uisimulator/win32/main.c b/uisimulator/win32/main.c deleted file mode 100644 index bf14efbaca..0000000000 --- a/uisimulator/win32/main.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "uisw32.h" -#include "lcd-win32.h" - -#define FS 6 - -int main (void) -{ - int x; - lcd_init (); - - while (1) - { - for (x = 0; x < 10; x++) - { - lcd_clear_display (); - lcd_puts (x, 12, "Hello World!", FS); - lcd_puts (x, 32, "From the", FS); - lcd_puts (x, 40, " Open Source ", FS); - lcd_puts (x, 48, "Jukebox Project", FS); - lcd_update (); - } - } - - return 0; -} \ No newline at end of file diff --git a/uisimulator/win32/makefile b/uisimulator/win32/makefile index 11f16b3006..cbd2298f6e 100644 --- a/uisimulator/win32/makefile +++ b/uisimulator/win32/makefile @@ -27,93 +27,36 @@ APPDIR = ../../apps/ RECDIR = $(APPDIR)recorder/ RM = del -#DISPLAY = -DHAVE_LCD_CHARCELLS -DISPLAY = -DHAVE_LCD_BITMAP +DISPLAY = -DHAVE_LCD_CHARCELLS +#DISPLAY = -DHAVE_LCD_BITMAP -#KEYPAD = -DHAVE_PLAYER_KEYPAD -KEYPAD = -DHAVE_RECORDER_KEYPAD +KEYPAD = -DHAVE_PLAYER_KEYPAD +#KEYPAD = -DHAVE_RECORDER_KEYPAD CC = cl -DEFINES = -DWIN32 -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ -$(KEYPAD) $(DISPLAY) -LDFLAGS = /ouisw32.exe /link -subsystem:windows +LINK = link +DEFINES = -DWIN32 -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR $(KEYPAD) $(DISPLAY) +LDFLAGS = /OUT:uisw32.exe /SUBSYSTEM:windows INCLUDES = -I$(FIRMWAREDIR) -I$(DRIVERS) -I$(COMMON) -I$(SIMDIR) -I$(APPDIR) -I$(RECDIR) -LIBS = gdi32.lib user32.lib +LIBS = /DEFAULTLIB:gdi32.lib /DEFAULTLIB:user32.lib +CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) /MD /Fd"Release/vc70.pdb" /c -CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) /MD /Fd"Release/vc70.pdb" - -SRCS = lcd-win32.c uisw32.c lcd.c button.c tree.c main.c \ - chartables.c kernel.c uisw32.res dir-win32.c main_menu.c \ - play.c debug-win32.c menu.c credits.c sound_menu.c mpeg.c \ - id3.c settings.c sprintf.c thread-win32.c playlist.c string-win32.c +SRCS = *.c \ + $(DRIVERS)/lcd.c \ + $(APPDIR)*.c \ + $(FIRMWAREDIR)/chartables.c $(FIRMWAREDIR)/id3.c $(FIRMWAREDIR)/settings.c $(FIRMWAREDIR)/backlight.c \ + $(COMMON)/sprintf.c $(COMMON)/strtok.c !IF ("$(DISPLAY)" == "-DHAVE_LCD_BITMAP") -SRCS = $(SRCS) tetris.c boxes.c bounce.c sokoban.c icons.c bmp.c +SRCS = $(SRCS) $(RECDIR)*.c !ENDIF -OBJS = $(SRCS:.c=.obj) - -uisw32.exe: $(OBJS) - $(CC) $(CFLAGS) $(LIBS) $(LDFLAGS) $(OBJS) - -lcd.obj: $(DRIVERS)/lcd.c - $(CC) $(CFLAGS) -c $(DRIVERS)/lcd.c -olcd.obj - -chartables.obj: $(FIRMWAREDIR)/chartables.c - $(CC) $(CFLAGS) -c $(FIRMWAREDIR)/chartables.c -ochartables.obj - -tetris.obj: ../../apps/recorder/tetris.c - $(CC) $(CFLAGS) -c ../../apps/recorder/tetris.c -otetris.obj - -tree.obj: ../../apps/tree.c - $(CC) $(CFLAGS) -c ../../apps/tree.c -otree.obj - -main.obj: ../../apps/main.c - $(CC) $(CFLAGS) -c ../../apps/main.c -omain.obj - -main_menu.obj: ../../apps/main_menu.c - $(CC) $(CFLAGS) -c ../../apps/main_menu.c -omain_menu.obj - -play.obj: ../../apps/play.c - $(CC) $(CFLAGS) -c ../../apps/play.c -oplay.obj - -bmp.obj: ../../apps/recorder/bmp.c - $(CC) $(CFLAGS) -c ../../apps/recorder/bmp.c -obmp.obj - -bounce.obj: ../../apps/recorder/bounce.c - $(CC) $(CFLAGS) -c ../../apps/recorder/bounce.c -obounce.obj - -sokoban.obj: ../../apps/recorder/sokoban.c - $(CC) $(CFLAGS) -c ../../apps/recorder/sokoban.c -osokoban.obj +OBJS = *.obj uisw32.res -boxes.obj: ../../apps/recorder/boxes.c - $(CC) $(CFLAGS) -c ../../apps/recorder/boxes.c -oboxes.obj - -menu.obj: ../../apps/menu.c - $(CC) $(CFLAGS) -c ../../apps/menu.c -omenu.obj - -credits.obj: ../../apps/credits.c - $(CC) $(CFLAGS) -c ../../apps/credits.c -ocredits.obj - -icons.obj: ../../apps/recorder/icons.c - $(CC) $(CFLAGS) -c ../../apps/recorder/icons.c -oicons.obj - -sound_menu.obj: ../../apps/sound_menu.c - $(CC) $(CFLAGS) -c ../../apps/sound_menu.c -osound_menu.obj - -id3.obj: $(FIRMWAREDIR)/id3.c - $(CC) $(CFLAGS) -c $(FIRMWAREDIR)/id3.c -oid3.obj - -settings.obj: $(FIRMWAREDIR)/settings.c - $(CC) $(CFLAGS) -c $(FIRMWAREDIR)/settings.c -osettings.obj - -sprintf.obj: $(FIRMWAREDIR)/common/sprintf.c - $(CC) $(CFLAGS) -c $(FIRMWAREDIR)/common/sprintf.c -osprintf.obj - -playlist.obj: ../../apps/playlist.c - $(CC) $(CFLAGS) -c ../../apps/playlist.c -oplaylist.obj +uisw32.exe: $(SRCS:.c=.obj) + $(CC) $(CFLAGS) $(SRCS) + $(LINK) $(LIBS) $(LDFLAGS) $(OBJS) clean: - $(RM) *.obj - + $(RM) *.obj \ No newline at end of file diff --git a/uisimulator/win32/mpeg.c b/uisimulator/win32/mpeg.c index 1ff9bce3ff..a93b6a7f08 100644 --- a/uisimulator/win32/mpeg.c +++ b/uisimulator/win32/mpeg.c @@ -38,6 +38,19 @@ void mpeg_stop(void) { } +void mpeg_resume(void) +{ +} + +void mpeg_pause(void) +{ +} + +struct mp3entry* mpeg_current_track(void) +{ + return 0; +} + #ifndef MPEGPLAY void mpeg_play(char *tune) { diff --git a/uisimulator/win32/uisw32.suo b/uisimulator/win32/uisw32.suo index 1193c8e916..4c21df5b04 100644 Binary files a/uisimulator/win32/uisw32.suo and b/uisimulator/win32/uisw32.suo differ diff --git a/uisimulator/win32/uisw32.vcproj b/uisimulator/win32/uisw32.vcproj index c3429a4871..b4ae9dd107 100644 --- a/uisimulator/win32/uisw32.vcproj +++ b/uisimulator/win32/uisw32.vcproj @@ -19,8 +19,8 @@ + + + + + + @@ -124,6 +133,9 @@ + + @@ -185,17 +197,29 @@ RelativePath="..\..\apps\playlist.c"> + RelativePath="..\..\apps\screensavers_menu.c"> + + + + + + + + @@ -208,6 +232,9 @@ + +