Index: bootloader/SOURCES =================================================================== --- bootloader/SOURCES (revision 17611) +++ bootloader/SOURCES (working copy) @@ -1,5 +1,7 @@ + common.c + #if defined(IPOD_ARCH) ipod.c #elif defined(GIGABEAT_F) @@ -28,4 +30,6 @@ mrobe500.c #elif defined(CPU_TCC77X) || defined(CPU_TCC780X) telechips.c +#elif defined(SDL) +sdl.c #endif Index: tools/configure =================================================================== --- tools/configure (revision 17611) +++ tools/configure (working copy) @@ -650,7 +650,7 @@ ################################################################## # Figure out target platform # - +uname=`uname` if [ "1" != `parse_args --target` ]; then buildfor=`parse_args --target`; else @@ -677,8 +677,8 @@ 60) Elio TPJ-1022 70) M:Robe 500 80) DAX 1GB MP3/DAB 71) M:Robe 100 - ==Creative== ==Philips== - 90) Zen Vision:M 30GB 100) GoGear SA9200 + ==Creative== ==Philips== ==App== + 90) Zen Vision:M 30GB 100) GoGear SA9200 200) SDL 91) Zen Vision:M 60GB 92) Zen Vision @@ -1675,6 +1675,36 @@ t_manufacturer="philips" t_model="sa9200" ;; + + 200) + target_id=42 + modelname="sdl" + target="-DSDL" # The #define used in firmware/export/config.h for conditional compilation + memory=16 # how many megabytes of RAM + simcc # Which compiler to use, see the beginning of the file + tool="" #"$rootdir/tools/scramble -add=iax5" # Which command to use for creating a rockbox binary to be loaded by the boot loader + bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" # How to create a monochrome bitmap + bmp2rb_native="$rootdir/tools/bmp2rb -f 4" # How to create a native bitmap + bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" # How to create a monochrome bitmap for the remote lcd + bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" # How to create a native bitmap for the remote lcd + bootoutput="rockbox.bin" + output="rockbox" # The name of the Rockbox binary file + appextra="recorder:gui" # What directories in the apps/ tree to include in compilation + archosrom="" # The name of the binary file if the device supports running directly from flash (mostly Archos related) + flash="" # The name of the Rockbox binary file if the device supports having the binary in flash (mostly Archos related) + plugins="no" # Does it support plugins? + swcodec="yes" + codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a" # What codecs it supports + # toolset is the tools within the tools directory that we build for this particular target. + toolset="$genericbitmaptools" + # architecture, manufacturer and model for the target-tree build + t_cpu="generic" + t_manufacturer="sdl" + #t_model="" + boottool="cp" + USE_ELF="yes" + buildsdl="yes" + ;; *) echo "Please select a supported target platform!" @@ -2021,10 +2051,14 @@ GCCOPTS="$GCCOPTS" fi -if test "$simulator" = "yes"; then +if test "$simulator" = "yes"] ; then # add simul make stuff on the #SIMUL# line simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim," simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim," +elif test "$buildsdl" = "yes"; then + # add simul make stuff on the #SIMUL# line + simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim," + simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim," else # delete the lines that match simmagic1='/@SIMUL1@/D' Index: apps/codecs.c =================================================================== --- apps/codecs.c (revision 17611) +++ apps/codecs.c (working copy) @@ -53,7 +53,7 @@ #define LOGF_ENABLE #include "logf.h" -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #if CONFIG_CODEC == SWCODEC unsigned char codecbuf[CODEC_SIZE]; #endif @@ -140,7 +140,7 @@ profile_func_exit, #endif -#if defined(HAVE_RECORDING) && !defined(SIMULATOR) +#if defined(HAVE_RECORDING) && !defined(SIMULATOR) && !defined(SDL) false, /* stop_encoder */ 0, /* enc_codec_loaded */ enc_get_inputs, @@ -175,7 +175,7 @@ { struct codec_header *hdr; int status; -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) hdr = (struct codec_header *)codecbuf; if (size <= (signed)sizeof(struct codec_header) @@ -209,7 +209,7 @@ sim_codec_close(pd); return CODEC_ERROR; } -#endif /* SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ if (hdr->api_version > CODEC_API_VERSION || hdr->api_version < CODEC_MIN_API_VERSION) { sim_codec_close(pd); Index: apps/playlist.c =================================================================== --- apps/playlist.c (revision 17611) +++ apps/playlist.c (working copy) @@ -1352,7 +1352,7 @@ dirty_pointers = false; break ; -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) case SYS_USB_CONNECTED: usb_acknowledge(SYS_USB_CONNECTED_ACK); usb_wait_for_disconnect(&playlist_queue); Index: apps/screens.c =================================================================== --- apps/screens.c (revision 17611) +++ apps/screens.c (working copy) @@ -137,7 +137,7 @@ } gui_syncstatusbar_draw(&statusbars, true); -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) while (button_get(true) & BUTTON_REL); #else usb_acknowledge(SYS_USB_CONNECTED_ACK); @@ -149,7 +149,7 @@ gui_syncstatusbar_draw(&statusbars, false); } } -#endif /* SIMULATOR */ +#endif /* SIMULATOR || SDL */ #ifdef HAVE_LCD_CHARCELLS status_set_usb(false); #endif /* HAVE_LCD_CHARCELLS */ Index: apps/codecs.h =================================================================== --- apps/codecs.h (revision 17611) +++ apps/codecs.h (working copy) @@ -41,7 +41,7 @@ #include "thread.h" #endif #if (CONFIG_CODEC == SWCODEC) -#if !defined(SIMULATOR) && defined(HAVE_RECORDING) +#if !defined(SIMULATOR) && !defined(SDL) && defined(HAVE_RECORDING) #include "pcm_record.h" #endif #include "dsp.h" @@ -68,7 +68,7 @@ #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #define PREFIX(_x_) sim_ ## _x_ #else #define PREFIX(_x_) _x_ @@ -216,7 +216,7 @@ void (*profile_func_exit)(void *this_fn, void *call_site); #endif -#if defined(HAVE_RECORDING) && !defined(SIMULATOR) +#if defined(HAVE_RECORDING) && !defined(SIMULATOR) && !defined(SDL) volatile bool stop_encoder; volatile int enc_codec_loaded; /* <0=error, 0=pending, >0=ok */ void (*enc_get_inputs)(struct enc_inputs *inputs); @@ -254,10 +254,10 @@ }; #ifdef CODEC -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) /* plugin_* is correct, codecs use the plugin linker script */ -extern unsigned char plugin_start_addr[]; -extern unsigned char plugin_end_addr[]; +//extern unsigned char plugin_start_addr[]; +//extern unsigned char plugin_end_addr[]; /* decoders */ #define CODEC_HEADER \ const struct codec_header __header \ @@ -283,7 +283,7 @@ const struct codec_header __header = { \ CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, \ NULL, NULL, codec_start }; -#endif /* SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ #endif /* CODEC */ /* create full codec path from root filenames in audio_formats[] Index: apps/recorder/radio.c =================================================================== --- apps/recorder/radio.c (revision 17611) +++ apps/recorder/radio.c (working copy) @@ -485,7 +485,7 @@ if(radio_status == FMRADIO_OFF) audio_stop(); -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if CONFIG_CODEC != SWCODEC if(rec_create_directory() > 0) @@ -507,7 +507,7 @@ sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN); #endif /* CONFIG_CODEC != SWCODEC */ -#endif /* ndef SIMULATOR */ +#endif /* # !defined(SIMULATOR) && !defined(SDL) */ /* turn on radio */ #if CONFIG_CODEC == SWCODEC @@ -578,7 +578,7 @@ switch(button) { case ACTION_FM_STOP: -#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) +#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) && !defined(SDL) if(audio_status() == AUDIO_STATUS_RECORD) { audio_stop(); @@ -617,7 +617,7 @@ break; } #endif /* FM_RECORD_DBLPRE */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) if(audio_status() == AUDIO_STATUS_RECORD) { rec_command(RECORDING_CMD_START_NEWFILE); @@ -629,7 +629,7 @@ rec_command(RECORDING_CMD_START); update_screen = true; } -#endif /* SIMULATOR */ +#endif /* #!defined(SIMULATOR) && !defined(SDL) */ last_seconds = 0; break; #endif /* #ifdef FM_RECORD */ @@ -875,7 +875,7 @@ } } -#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) +#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) && !defined(SDL) seconds = audio_recorded_time() / HZ; if (update_screen || seconds > last_seconds) { @@ -976,7 +976,7 @@ #endif } /*while(!done)*/ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if CONFIG_CODEC != SWCODEC if(audio_status() & AUDIO_STATUS_ERROR) { @@ -998,12 +998,12 @@ #endif /* CONFIG_CODEC != SWCODEC */ sound_settings_apply(); -#endif /* SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ if(keep_playing) { /* Catch FMRADIO_PLAYING status for the sim. */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if CONFIG_CODEC != SWCODEC /* Enable the Left and right A/D Converter */ audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN), @@ -1012,7 +1012,7 @@ mas_codec_writereg(6, 0x4000); #endif end_search(); -#endif /* SIMULATOR */ +#endif /* # !defined(SIMULATOR) && !defined(SDL) */ } else { Index: apps/Makefile =================================================================== --- apps/Makefile (revision 17611) +++ apps/Makefile (working copy) @@ -103,7 +103,7 @@ libspeex-rockbox: $(SILENT)mkdir -p $(OBJDIR)/libspeex-rockbox $(call PRINTS,MAKE in libspeex for rockbox core)$(MAKE) -C $(APPSDIR)/codecs/libspeex ROCKBOX_VOICE_CODEC=1 OBJDIR=$(OBJDIR)/libspeex-rockbox OUTPUT=$(BUILDDIR)/libspeex-rockbox.a - + build-codecs: $(SILENT)$(MAKE) -C codecs/lib OBJDIR=$(OBJDIR)/codecs/lib $(SILENT)$(MAKE) -C codecs OBJDIR=$(OBJDIR)/codecs @@ -141,8 +141,21 @@ $(OBJDIR)/rombox.elf : $(OBJS) $(LINKROM) $(DEPFILE) $(LIBROCKBOX) $(VOICE) $(BITMAPLIBS) $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lrockbox -lgcc $(LINKVOICE) $(LINKBITMAPS) -L$(BUILDDIR)/firmware -T$(LINKROM) -Wl,-Map,$(OBJDIR)/rombox.map -ifndef SIMVER +#hack to test if its a sim or an SDL builds +temp=0 +ifdef SIMVER +temp=1 +endif +ifdef SDL +temp=1 +endif +ifeq "$(temp)" "0" + +#if (!defined(SIMVER) && !defined(SDL)) + +#ifndef SIMVER + $(OBJDIR)/rockbox.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX) $(VOICE) $(BITMAPLIBS) $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR)/firmware -L$(BUILDDIR) -lrockbox $(LINKVOICE) $(LINKBITMAPS) -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/rockbox.map @@ -175,12 +188,6 @@ else # this is a simulator build -ifeq ($(SIMVER), win32) -# OK, this is ugly but we need it on the link line to make it do right -EXTRAOBJ = $(BUILDDIR)/sim/uisw32-res.o -LDOPTS += -lwinmm -endif - # OS X's ld does not support -Map ifeq ($(UNAME), Darwin) SIMULATOR_MAP= Index: apps/plugins/plugin.lds =================================================================== --- apps/plugins/plugin.lds (revision 17611) +++ apps/plugins/plugin.lds (working copy) @@ -1,5 +1,5 @@ #include "config.h" - +#if !defined(SDL) /* These output formats should be in the config-files */ #ifdef CPU_COLDFIRE @@ -218,3 +218,4 @@ KEEP(*(.comment)) } } +#endif /* SDL */ \ No newline at end of file Index: apps/plugins/Makefile =================================================================== --- apps/plugins/Makefile (revision 17611) +++ apps/plugins/Makefile (working copy) @@ -87,30 +87,15 @@ $(BITMAPLIBS): $(BUILDDIR)/libplugin%.a: build-% -ifndef SIMVER -$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a $(BITMAPLIBS) - $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $< -L$(BUILDDIR) $(CODECLIBS) -lplugin $(LINKBITMAPS) -lgcc \ - -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/$*.map +#ifndef SIMVER +#$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a $(BITMAPLIBS) +# $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $< -L$(BUILDDIR) $(CODECLIBS) -lplugin $(LINKBITMAPS) -lgcc \ +# -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/$*.map +# +#$(OBJDIR)/%.rock : $(OBJDIR)/%.elf +# $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@ +#else -$(OBJDIR)/%.rock : $(OBJDIR)/%.elf - $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@ -else - -ifeq ($(SIMVER), x11) -################################################### -# This is the X11 simulator version - -$(OBJDIR)/%.rock : $(OBJDIR)/%.o $(BUILDDIR)/libplugin.a $(BITMAPLIBS) - $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $< -L$(BUILDDIR) $(CODECLIBS) -lplugin $(LINKBITMAPS) -o $@ -ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN) -# 'x' must be kept or you'll have "Win32 error 5" -# $ fgrep 5 /usr/include/w32api/winerror.h | head -1 -# #define ERROR_ACCESS_DENIED 5L -else - $(SILENT)chmod -x $@ -endif - -else # end of x11-simulator ifeq ($(SIMVER), sdl) ################################################### # This is the SDL simulator version @@ -125,27 +110,9 @@ $(SILENT)chmod -x $@ endif -else # end of sdl-simulator -################################################### -# This is the win32 simulator version -DLLTOOLFLAGS = --export-all -DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin - -$(OBJDIR)/%.rock : $(OBJDIR)/%.o $(BUILDDIR)/libplugin.a $(BITMAPLIBS) - $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< - $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(BUILDDIR)/libplugin.a $(BITMAPLIBS) \ - $(patsubst -l%,$(BUILDDIR)/lib%.a,$(CODECLIBS)) -o $@ -ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN) -# 'x' must be kept or you'll have "Win32 error 5" -# $ fgrep 5 /usr/include/w32api/winerror.h | head -1 -# #define ERROR_ACCESS_DENIED 5L -else - $(SILENT)chmod -x $@ endif -endif # end of win32-simulator -endif -endif # end of simulator section +#endif # end of simulator section include $(TOOLSDIR)/make.inc Index: apps/plugins/lib/pluginlib_actions.c =================================================================== --- apps/plugins/lib/pluginlib_actions.c (revision 17611) +++ apps/plugins/lib/pluginlib_actions.c (working copy) @@ -37,7 +37,8 @@ { PLA_RIGHT_REPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE}, #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) || \ (CONFIG_KEYPAD == IRIVER_H10_PAD) || \ - (CONFIG_KEYPAD == GIGABEAT_PAD) + (CONFIG_KEYPAD == GIGABEAT_PAD) ||\ + (CONFIG_KEYPAD == SDL_PAD) ||\ { PLA_UP, BUTTON_RC_FF, BUTTON_NONE}, { PLA_DOWN, BUTTON_RC_REW, BUTTON_NONE}, { PLA_LEFT, BUTTON_RC_VOL_DOWN, BUTTON_NONE}, @@ -79,6 +80,7 @@ || (CONFIG_KEYPAD == IRIVER_H300_PAD) \ || (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \ || (CONFIG_KEYPAD == GIGABEAT_PAD) \ + || (CONFIG_KEYPAD == SDL_PAD) \ || (CONFIG_KEYPAD == RECORDER_PAD) \ || (CONFIG_KEYPAD == ARCHOS_AV300_PAD) \ || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \ @@ -172,6 +174,7 @@ || (CONFIG_KEYPAD == IRIVER_H300_PAD) \ || (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \ || (CONFIG_KEYPAD == GIGABEAT_PAD) \ + || (CONFIG_KEYPAD == SDL_PAD) \ || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \ || (CONFIG_KEYPAD == GIGABEAT_S_PAD) \ || (CONFIG_KEYPAD == MROBE100_PAD) \ @@ -299,7 +302,7 @@ {PLA_FIRE, BUTTON_RC_MODE, BUTTON_NONE}, {PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE}, {PLA_FIRE_REPEAT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE}, -#elif CONFIG_KEYPAD == GIGABEAT_PAD +#elif CONFIG_KEYPAD == GIGABEAT_PAD || CONFIG_KEYPAD == SDL_PAD {PLA_QUIT, BUTTON_POWER, BUTTON_NONE}, {PLA_START, BUTTON_A, BUTTON_NONE}, {PLA_MENU, BUTTON_MENU, BUTTON_NONE}, @@ -407,6 +410,7 @@ || (CONFIG_KEYPAD == IRIVER_H300_PAD) \ || (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \ || (CONFIG_KEYPAD == GIGABEAT_PAD) \ + || (CONFIG_KEYPAD == SDL_PAD) \ || (CONFIG_KEYPAD == RECORDER_PAD) \ || (CONFIG_KEYPAD == ARCHOS_AV300_PAD) \ || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \ Index: apps/plugins/lib/overlay.c =================================================================== --- apps/plugins/lib/overlay.c (revision 17611) +++ apps/plugins/lib/overlay.c (working copy) @@ -19,7 +19,7 @@ * ****************************************************************************/ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #include "plugin.h" #include "overlay.h" Index: apps/plugins/lib/overlay.h =================================================================== --- apps/plugins/lib/overlay.h (revision 17611) +++ apps/plugins/lib/overlay.h (working copy) @@ -22,7 +22,7 @@ #ifndef __OVERLAY_H__ #define __OVERLAY_H__ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #include "plugin.h" /* load and run a plugin linked as an overlay. */ Index: apps/plugins/SOURCES =================================================================== --- apps/plugins/SOURCES (revision 17611) +++ apps/plugins/SOURCES (working copy) @@ -1,3 +1,4 @@ +#if !defined(SDL) /* plugins common to all models */ battery_bench.c chessclock.c @@ -149,3 +150,4 @@ superdom.c #endif #endif /* m:robe 500 */ +#endif /* !SDL */ \ No newline at end of file Index: apps/plugins/SUBDIRS =================================================================== --- apps/plugins/SUBDIRS (revision 17611) +++ apps/plugins/SUBDIRS (working copy) @@ -1,4 +1,4 @@ -#if !defined(IRIVER_IFP7XX_SERIES) +#if !defined(IRIVER_IFP7XX_SERIES) && !defined(SDL) /* For all targets */ shortcuts Index: apps/gui/statusbar.c =================================================================== --- apps/gui/statusbar.c (revision 17611) +++ apps/gui/statusbar.c (working copy) @@ -395,7 +395,7 @@ fill = endfill = (percent * (STATUSBAR_BATTERY_WIDTH-3) + 50) / 100; } -#if CONFIG_CHARGING == CHARGING_MONITOR && !defined(SIMULATOR) +#if CONFIG_CHARGING == CHARGING_MONITOR && !defined(SIMULATOR) && !defined(SDL) /* Certain charge controlled targets */ /* show graphical animation when charging instead of numbers */ if ((global_settings.battery_display) && @@ -681,7 +681,7 @@ unsigned long samprk; int xpos; -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) samprk = 44100; #else #ifdef HAVE_SPDIF_REC Index: apps/settings.h =================================================================== --- apps/settings.h (revision 17611) +++ apps/settings.h (working copy) @@ -162,7 +162,7 @@ This helps to save space for menus and options. */ #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */ -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) /* a space which is defined in stubs.c */ extern unsigned char vp_dummy[VIRT_SIZE]; #define VIRT_PTR vp_dummy @@ -721,7 +721,7 @@ int list_accel_wait; /* ms between increases */ #endif #ifdef HAVE_USBSTACK - int usb_stack_mode; /* device or host */ + int usb_stack_mode; /* device or host */ unsigned char usb_stack_device_driver[32]; /* usb device driver to load */ #endif #if CONFIG_CODEC == SWCODEC Index: apps/menus/settings_menu.c =================================================================== --- apps/menus/settings_menu.c (revision 17611) +++ apps/menus/settings_menu.c (working copy) @@ -336,7 +336,7 @@ switch (action) { case ACTION_EXIT_MENUITEM: /* on exit */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) dac_line_in(global_settings.line_in); #endif break; Index: apps/menus/main_menu.c =================================================================== --- apps/menus/main_menu.c (revision 17611) +++ apps/menus/main_menu.c (working copy) @@ -398,7 +398,7 @@ #endif ) { -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) struct info_data *info = (struct info_data *)lists->data; info->new_data = true; gui_syncsplash(0, ID2P(LANG_SCANNING_DISK)); Index: apps/tagcache.c =================================================================== --- apps/tagcache.c (revision 17611) +++ apps/tagcache.c (working copy) @@ -3036,7 +3036,7 @@ int masterfd; mutex_lock(&command_queue_mutex); - + if ( (masterfd = open_master_fd(&myhdr, true)) < 0) return false; @@ -4370,7 +4370,7 @@ case SYS_POWEROFF: break ; -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) case SYS_USB_CONNECTED: logf("USB: TagCache"); usb_acknowledge(SYS_USB_CONNECTED_ACK); @@ -4484,7 +4484,7 @@ create_thread(tagcache_thread, tagcache_stack, sizeof(tagcache_stack), 0, tagcache_thread_name IF_PRIO(, PRIORITY_BACKGROUND) - IF_COP(, CPU)); + IF_COP(, CPU)); #else tc_stat.initialized = true; allocate_tempbuf(); Index: apps/filetree.c =================================================================== --- apps/filetree.c (revision 17611) +++ apps/filetree.c (working copy) @@ -518,7 +518,7 @@ break; #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) /* firmware file */ case FILE_ATTR_MOD: gui_syncsplash(0, ID2P(LANG_WAIT)); Index: apps/playback.c =================================================================== --- apps/playback.c (revision 17611) +++ apps/playback.c (working copy) @@ -114,7 +114,7 @@ /* Define one constant that includes recording related functionality */ -#if defined(HAVE_RECORDING) && !defined(SIMULATOR) +#if defined(HAVE_RECORDING) && !defined(SIMULATOR) && !defined(SDL) #define AUDIO_HAVE_RECORDING #endif @@ -495,7 +495,7 @@ bool audio_load_encoder(int afmt) { -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) const char *enc_fn = get_codec_filename(afmt | CODEC_TYPE_ENCODER); if (!enc_fn) return false; @@ -520,7 +520,7 @@ void audio_remove_encoder(void) { -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) /* force encoder codec unload (if currently loaded) */ if (ci.enc_codec_loaded <= 0) return; @@ -2425,7 +2425,7 @@ audio_finalise_track_change(); break; -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) case SYS_USB_CONNECTED: LOGFQUEUE("audio < SYS_USB_CONNECTED"); if (playing) Index: apps/status.h =================================================================== --- apps/status.h (revision 17611) +++ apps/status.h (working copy) @@ -44,7 +44,7 @@ enum playmode status_get_ffmode(void); int current_playmode(void); -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #include #endif #ifdef HAVE_LCD_CHARCELLS Index: apps/plugin.c =================================================================== --- apps/plugin.c (revision 17611) +++ apps/plugin.c (working copy) @@ -47,7 +47,7 @@ #include "bidi.h" #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; void *sim_plugin_load(char *plugin, void **pd); void sim_plugin_close(void *pd); @@ -122,7 +122,7 @@ || defined (IRIVER_H10) lcd_yuv_set_options, #endif -#elif (LCD_DEPTH < 4) && !defined(SIMULATOR) +#elif (LCD_DEPTH < 4) && !defined(SIMULATOR) && !defined(SDL) lcd_blit_mono, lcd_blit_grey_phase, #endif /* LCD_DEPTH */ @@ -257,7 +257,7 @@ read_line, settings_parseline, ata_sleep, -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) ata_disk_is_active, #endif ata_spin, @@ -292,7 +292,7 @@ #endif reset_poweroff_timer, -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) system_memory_guard, &cpu_frequency, @@ -303,7 +303,7 @@ cpu_boost, #endif #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ -#endif /* !SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ #ifdef HAVE_SCHEDULER_BOOSTCTRL trigger_cpu_boost, cancel_cpu_boost, @@ -335,7 +335,7 @@ profile_func_exit, #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) /* special simulator hooks */ #if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8 sim_lcd_ex_init, @@ -381,7 +381,7 @@ sound_max, sound_unit, sound_val2phys, -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) mp3_play_data, mp3_play_pause, mp3_play_stop, @@ -442,7 +442,7 @@ audio_current_track, audio_flush_and_reload_tracks, audio_get_file_pos, -#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) +#if !defined(SIMULATOR) && !defined(SDL) && (CONFIG_CODEC != SWCODEC) mpeg_get_last_header, #endif #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \ @@ -450,7 +450,7 @@ sound_set_pitch, #endif -#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) +#if !defined(SIMULATOR) && !defined(SDL) && (CONFIG_CODEC != SWCODEC) /* MAS communication */ mas_readmem, mas_writemem, @@ -490,7 +490,7 @@ battery_level, battery_level_safe, battery_time, -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) battery_voltage, #endif #if CONFIG_CHARGING @@ -607,7 +607,7 @@ { int rc; struct plugin_header *hdr; -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) void *pd; #else /* !SIMULATOR */ int fd; @@ -639,7 +639,7 @@ gui_syncsplash(0, ID2P(LANG_WAIT)); strcpy(current_plugin, plugin); -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) hdr = sim_plugin_load((char *)plugin, &pd); if (pd == NULL) { gui_syncsplash(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin); Index: apps/SOURCES =================================================================== --- apps/SOURCES (revision 17611) +++ apps/SOURCES (working copy) @@ -192,4 +192,6 @@ keymaps/keymap-creativezv.c #elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD keymaps/keymap-sa9200.c +#elif CONFIG_KEYPAD == SLD_PAD +keymaps/keymap-sdl.c #endif Index: apps/plugin.h =================================================================== --- apps/plugin.h (revision 17611) +++ apps/plugin.h (working copy) @@ -115,7 +115,7 @@ #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #define PREFIX(_x_) sim_ ## _x_ #else #define PREFIX(_x_) _x_ @@ -206,7 +206,7 @@ || defined (IRIVER_H10) void (*lcd_yuv_set_options)(unsigned options); #endif -#elif (LCD_DEPTH < 4) && !defined(SIMULATOR) +#elif (LCD_DEPTH < 4) && !defined(SIMULATOR) && !defined(SDL) void (*lcd_blit_mono)(const unsigned char *data, int x, int by, int width, int bheight, int stride); void (*lcd_blit_grey_phase)(unsigned char *values, unsigned char *phases, @@ -357,7 +357,7 @@ int (*read_line)(int fd, char* buffer, int buffer_size); bool (*settings_parseline)(char* line, char** name, char** value); void (*ata_sleep)(void); -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) bool (*ata_disk_is_active)(void); #endif void (*ata_spin)(void); @@ -388,7 +388,7 @@ size_t stack_size, unsigned flags, const char *name IF_PRIO(, int priority) - IF_COP(, unsigned int core)); + IF_COP(, unsigned int core)); void (*thread_exit)(void); void (*thread_wait)(struct thread_entry *thread); #if CONFIG_CODEC == SWCODEC @@ -399,7 +399,7 @@ #endif void (*reset_poweroff_timer)(void); -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) int (*system_memory_guard)(int newmode); long *cpu_frequency; #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -409,7 +409,7 @@ void (*cpu_boost)(bool on_off); #endif #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ -#endif /* !SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ #ifdef HAVE_SCHEDULER_BOOSTCTRL void (*trigger_cpu_boost)(void); void (*cancel_cpu_boost)(void); @@ -448,7 +448,7 @@ void (*profile_func_exit)(void *this_fn, void *call_site); #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) /* special simulator hooks */ #if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8 void (*sim_lcd_ex_init)(int shades, unsigned long (*getpixel)(int, int)); @@ -495,7 +495,7 @@ int (*sound_max)(int setting); const char * (*sound_unit)(int setting); int (*sound_val2phys)(int setting, int value); -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) void (*mp3_play_data)(const unsigned char* start, int size, void (*get_more)(unsigned char** start, size_t* size)); void (*mp3_play_pause)(bool play); void (*mp3_play_stop)(void); @@ -503,7 +503,7 @@ #if CONFIG_CODEC != SWCODEC void (*bitswap)(unsigned char *data, int length); #endif -#endif /* !SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ #if CONFIG_CODEC == SWCODEC const unsigned long *audio_master_sampr_list; const unsigned long *hw_freq_sampr; @@ -560,7 +560,7 @@ struct mp3entry* (*audio_current_track)(void); void (*audio_flush_and_reload_tracks)(void); int (*audio_get_file_pos)(void); -#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) +#if !defined(SIMULATOR) && !defined(SDL) && (CONFIG_CODEC != SWCODEC) unsigned long (*mpeg_get_last_header)(void); #endif #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \ @@ -569,7 +569,7 @@ #endif /* MAS communication */ -#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) +#if !defined(SIMULATOR) && !defined(SDL) && (CONFIG_CODEC != SWCODEC) int (*mas_readmem)(int bank, int addr, unsigned long* dest, int len); int (*mas_writemem)(int bank, int addr, const unsigned long* src, int len); int (*mas_readreg)(int reg); @@ -623,7 +623,7 @@ int (*battery_level)(void); bool (*battery_level_safe)(void); int (*battery_time)(void); -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) unsigned int (*battery_voltage)(void); #endif #if CONFIG_CHARGING @@ -655,7 +655,7 @@ void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size, char *iedata, size_t iedata_size); #endif -#if defined(DEBUG) || defined(SIMULATOR) +#if defined(DEBUG) || defined(SIMULATOR) void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); #endif #ifdef ROCKBOX_HAS_LOGF @@ -765,14 +765,15 @@ }; #ifdef PLUGIN -#ifndef SIMULATOR -extern unsigned char plugin_start_addr[]; +#if !defined(SIMULATOR) && !defined(SDL) +/*extern unsigned char plugin_start_addr[]; extern unsigned char plugin_end_addr[]; #define PLUGIN_HEADER \ const struct plugin_header __header \ __attribute__ ((section (".header")))= { \ PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ plugin_start_addr, plugin_end_addr, plugin_start }; +*/ #else /* SIMULATOR */ #define PLUGIN_HEADER \ const struct plugin_header __header \ Index: apps/buffering.c =================================================================== --- apps/buffering.c (revision 17611) +++ apps/buffering.c (working copy) @@ -63,7 +63,7 @@ /* macros to enable logf for queues logging on SYS_TIMEOUT can be disabled */ -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) /* Define this for logf output of all queuing except SYS_TIMEOUT */ #define BUFFERING_LOGQUEUES /* Define this to logf SYS_TIMEOUT messages */ @@ -1384,7 +1384,7 @@ } break; -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) case SYS_USB_CONNECTED: LOGFQUEUE("buffering < SYS_USB_CONNECTED"); usb_acknowledge(SYS_USB_CONNECTED_ACK); Index: apps/debug_menu.c =================================================================== --- apps/debug_menu.c (revision 17611) +++ apps/debug_menu.c (working copy) @@ -50,7 +50,7 @@ #include "lcd-remote.h" #include "crc32.h" #include "logf.h" -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #include "disk.h" #include "adc.h" #include "power.h" @@ -219,7 +219,7 @@ #ifdef HAVE_LCD_BITMAP #if CONFIG_CODEC != SWCODEC -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) static bool dbg_audio_thread(void) { char buf[32]; @@ -266,7 +266,7 @@ } return false; } -#endif /* !SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ #else /* CONFIG_CODEC == SWCODEC */ extern size_t filebuflen; /* This is a size_t, but call it a long so it puts a - when it's bad. */ @@ -275,7 +275,7 @@ static void dbg_audio_task(void) { -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) if(FREQ > CPUFREQ_NORMAL) boost_ticks++; freq_sum += FREQ/1000000; /* in MHz */ @@ -367,7 +367,7 @@ snprintf(buf, sizeof(buf), "handle count: %d", (int)d.num_handles); lcd_puts(0, line++, buf); -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) snprintf(buf, sizeof(buf), "cpu freq: %3dMHz", (int)((FREQ + 500000) / 1000000)); lcd_puts(0, line++, buf); @@ -453,7 +453,7 @@ } #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #ifdef CPU_PP static int perfcheck(void) { @@ -773,9 +773,9 @@ return false; } #endif /* !HAVE_LCD_BITMAP */ -#endif /* !SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) static char* dbg_partitions_getname(int selected_item, void *data, char *buffer, size_t buffer_len) { @@ -959,7 +959,7 @@ lcd_puts(0, line++, buf); line++; -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) snprintf(buf, sizeof(buf), "Measured freq: %ldHz", spdif_measure_frequency()); lcd_puts(0, line++, buf); @@ -981,7 +981,7 @@ } #endif /* CPU_COLDFIRE */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #ifdef HAVE_LCD_BITMAP /* button definitions */ #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ @@ -1360,9 +1360,9 @@ return false; } #endif /* !HAVE_LCD_BITMAP */ -#endif /* !SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ -#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR) +#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR) && !defined(SDL) static bool dbg_pcf(void) { char buf[128]; @@ -1467,7 +1467,7 @@ } #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ -#if defined(HAVE_TSC2100) && !defined(SIMULATOR) +#if defined(HAVE_TSC2100) && !defined(SIMULATOR) && !defined(SDL) #include "tsc2100.h" char *itob(int n, int len) { @@ -1536,7 +1536,7 @@ return simplelist_show_list(&info); } #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #ifdef HAVE_LCD_BITMAP /* * view_battery() shows a automatically scaled graph of the battery voltage @@ -1722,7 +1722,7 @@ #endif /* HAVE_LCD_BITMAP */ #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if defined(HAVE_MMC) || defined(HAVE_ATA_SD) #if defined(HAVE_MMC) #define CARDTYPE "MMC" @@ -1974,7 +1974,7 @@ info.scroll_all = true; return simplelist_show_list(&info); } -#endif /* !SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ #ifdef HAVE_DIRCACHE static int dircache_callback(int btn, struct gui_synclist *lists) @@ -2159,7 +2159,7 @@ } #endif /* CPU */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if CONFIG_TUNER static int radio_callback(int btn, struct gui_synclist *lists) { @@ -2220,7 +2220,7 @@ return simplelist_show_list(&info); } #endif /* CONFIG_TUNER */ -#endif /* !SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ #ifdef HAVE_LCD_BITMAP extern bool do_screendump_instead_of_usb; @@ -2340,7 +2340,7 @@ } #endif -#if (defined(HAVE_SCROLLWHEEL) && (CONFIG_KEYPAD==IPOD_4G_PAD) && !defined(SIMULATOR)) +#if (defined(HAVE_SCROLLWHEEL) && (CONFIG_KEYPAD==IPOD_4G_PAD) && !defined(SIMULATOR) && !defined(SDL)) extern bool wheel_is_touched; extern int old_wheel_value; extern int new_wheel_value; @@ -2433,7 +2433,7 @@ } #endif -#if defined(CREATIVE_ZVx) && !defined(SIMULATOR) +#if defined(CREATIVE_ZVx) && !defined(SIMULATOR) && !defined(SDL) extern int pic_dbg_num_items(void); extern char* pic_dbg_item(int selected_item, void *data, char *buffer, size_t buffer_len); @@ -2473,16 +2473,16 @@ || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L { "View I/O ports", dbg_ports }, #endif - #if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR) + #if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR) && !defined(SDL) { "View PCF registers", dbg_pcf }, #endif -#if defined(HAVE_TSC2100) && !defined(SIMULATOR) +#if defined(HAVE_TSC2100) && !defined(SIMULATOR) && !defined(SDL) { "TSC2100 debug", tsc2100_debug }, #endif #ifdef HAVE_ADJUSTABLE_CPU_FREQ { "CPU frequency", dbg_cpufreq }, #endif -#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR) +#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR) && !defined(SDL) { "S/PDIF analyzer", dbg_spdif }, #endif #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) @@ -2490,18 +2490,18 @@ #endif { "View OS stacks", dbg_os }, #ifdef HAVE_LCD_BITMAP -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) { "View battery", view_battery }, #endif { "Screendump", dbg_screendump }, #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) { "View HW info", dbg_hw_info }, #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) { "View partitions", dbg_partitions }, #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) { "View disk info", dbg_disk_info }, #if !defined(HAVE_MMC) && !defined(HAVE_ATA_SD) { "Dump ATA identify info", dbg_identify_info}, @@ -2516,14 +2516,14 @@ #ifdef HAVE_LCD_BITMAP #if CONFIG_CODEC == SWCODEC { "View buffering thread", dbg_buffering_thread }, -#elif !defined(SIMULATOR) +#elif !defined(SIMULATOR) && !defined(SDL) { "View audio thread", dbg_audio_thread }, #endif #ifdef PM_DEBUG { "pm histogram", peak_meter_histogram}, #endif /* PM_DEBUG */ #endif /* HAVE_LCD_BITMAP */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if CONFIG_TUNER { "FM Radio", dbg_fm_radio }, #endif @@ -2534,7 +2534,7 @@ #if CONFIG_USBOTG == USBOTG_ISP1583 { "View ISP1583 info", dbg_isp1583 }, #endif -#if defined(CREATIVE_ZVx) && !defined(SIMULATOR) +#if defined(CREATIVE_ZVx) && !defined(SIMULATOR) && !defined(SDL) { "View PIC info", dbg_pic }, #endif #ifdef ROCKBOX_HAS_LOGF @@ -2550,7 +2550,7 @@ #ifdef CPU_BOOST_LOGGING {"cpu_boost log",cpu_boost_log}, #endif -#if (defined(HAVE_SCROLLWHEEL) && (CONFIG_KEYPAD==IPOD_4G_PAD) && !defined(SIMULATOR)) +#if (defined(HAVE_SCROLLWHEEL) && (CONFIG_KEYPAD==IPOD_4G_PAD) && !defined(SIMULATOR) && !defined(SDL)) {"Debug scrollwheel", dbg_scrollwheel}, #endif }; Index: apps/scrobbler.c =================================================================== --- apps/scrobbler.c (revision 17611) +++ apps/scrobbler.c (working copy) @@ -249,7 +249,7 @@ void scrobbler_shutdown(void) { -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) if (scrobbler_ata_callback) { unregister_ata_idle_func(scrobbler_flush_callback, false); Index: apps/codecs/codec_crt0.c =================================================================== --- apps/codecs/codec_crt0.c (revision 17611) +++ apps/codecs/codec_crt0.c (working copy) @@ -36,7 +36,7 @@ enum codec_status codec_start(struct codec_api *api) { -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #ifdef USE_IRAM api->memcpy(iramstart, iramcopy, iramend - iramstart); api->memset(iedata, 0, iend - iedata); Index: apps/codecs/lib/codeclib.h =================================================================== --- apps/codecs/lib/codeclib.h (revision 17611) +++ apps/codecs/lib/codeclib.h (working copy) @@ -24,6 +24,11 @@ #define MALLOC_BUFSIZE (512*1024) +//unsigned char plugin_end_addr[400]; +//unsigned char plugin_bss_start[400]; + + + extern struct codec_api *ci; extern long mem_ptr; extern long bufsize; Index: apps/codecs/SOURCES =================================================================== --- apps/codecs/SOURCES (revision 17611) +++ apps/codecs/SOURCES (working copy) @@ -21,7 +21,7 @@ adx.c nsf.c spc.c -#if defined(HAVE_RECORDING) && !defined(SIMULATOR) +#if defined(HAVE_RECORDING) && !defined(SIMULATOR) && !defined(SDL) /* encoders */ aiff_enc.c mp3_enc.c Index: apps/debug_menu.h =================================================================== --- apps/debug_menu.h (revision 17611) +++ apps/debug_menu.h (working copy) @@ -21,7 +21,7 @@ bool debug_menu(void); -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) extern bool dbg_ports(void); extern bool dbg_partitions(void); #endif Index: apps/main.c =================================================================== --- apps/main.c (revision 17611) +++ apps/main.c (working copy) @@ -74,7 +74,7 @@ #if (CONFIG_CODEC == SWCODEC) #include "playback.h" #endif -#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR) +#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR) && !defined(SDL) #include "pcm_record.h" #endif @@ -105,7 +105,7 @@ #include "cuesheet.h" -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #include "system-sdl.h" #endif @@ -115,7 +115,7 @@ static void init(void); -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) void app_main(void) #else static void app_main(void) @@ -266,7 +266,7 @@ } #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) static void init(void) { @@ -562,7 +562,7 @@ audio_init(); -#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR) +#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR) && !defined(SDL) pcm_rec_init(); #endif Index: apps/keymaps/keymap-sdl.c =================================================================== --- apps/keymaps/keymap-sdl.c (revision 0) +++ apps/keymaps/keymap-sdl.c (revision 0) @@ -0,0 +1,380 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: keymap-gigabeat.c 15866 2007-12-02 12:07:01Z roolku $ + * + * Copyright (C) 2006 Jonathan Gordon + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +/* Button Code Definitions for the toshiba gigabeat target */ +#include +#include +#include + +#include "config.h" +#include "action.h" +#include "button.h" +#include "settings.h" + +/* + * The format of the list is as follows + * { Action Code, Button code, Prereq button code } + * if there's no need to check the previous button's value, use BUTTON_NONE + * Insert LAST_ITEM_IN_LIST at the end of each mapping + */ + +/* CONTEXT_CUSTOM's used in this file... + +CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions) +CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens + i.e where up/down is inc/dec + CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec + +*/ + + +static const struct button_mapping button_context_standard[] = { + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, + + { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_SELECT }, + + { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, + { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, + + { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; /* button_context_standard */ + + +static const struct button_mapping button_context_wps[] = { + { ACTION_WPS_PLAY, BUTTON_A|BUTTON_REL, BUTTON_A }, + { ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + + { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + + { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, + { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, + + { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_A|BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_WPS_ABSETA_PREVDIR, BUTTON_A|BUTTON_LEFT, BUTTON_NONE }, + { ACTION_WPS_ABRESET, BUTTON_A|BUTTON_SELECT, BUTTON_NONE }, + + { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + + { ACTION_WPS_PITCHSCREEN, BUTTON_A|BUTTON_UP, BUTTON_A }, + { ACTION_WPS_PITCHSCREEN, BUTTON_A|BUTTON_DOWN, BUTTON_A }, + + { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, + { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, + { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + + { ACTION_WPS_ID3SCREEN, BUTTON_A|BUTTON_MENU, BUTTON_NONE }, + { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + + LAST_ITEM_IN_LIST +}; /* button_context_wps */ + +static const struct button_mapping button_context_list[] = { + { ACTION_LISTTREE_PGUP, BUTTON_A|BUTTON_UP, BUTTON_A }, + { ACTION_LISTTREE_PGUP, BUTTON_UP|BUTTON_REL, BUTTON_A|BUTTON_UP }, + { ACTION_LISTTREE_PGUP, BUTTON_A|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_LISTTREE_PGDOWN, BUTTON_A|BUTTON_DOWN, BUTTON_A }, + { ACTION_LISTTREE_PGDOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_A|BUTTON_DOWN }, + { ACTION_LISTTREE_PGDOWN, BUTTON_A|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, +#ifdef HAVE_VOLUME_IN_LIST + { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, +#endif + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_list */ + +static const struct button_mapping button_context_tree[] = { + { ACTION_TREE_WPS, BUTTON_A|BUTTON_REL, BUTTON_A }, + { ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE }, + { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) +}; /* button_context_tree */ + +static const struct button_mapping button_context_listtree_scroll_with_combo[] = { + { ACTION_NONE, BUTTON_A, BUTTON_NONE }, + { ACTION_TREE_PGLEFT, BUTTON_A|BUTTON_LEFT, BUTTON_A }, + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_A|BUTTON_LEFT }, + { ACTION_TREE_PGLEFT, BUTTON_A|BUTTON_LEFT, BUTTON_LEFT|BUTTON_REL }, + { ACTION_TREE_ROOT_INIT, BUTTON_A|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_A|BUTTON_LEFT }, + { ACTION_TREE_PGLEFT, BUTTON_A|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_PGRIGHT, BUTTON_A|BUTTON_RIGHT, BUTTON_A }, + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_A|BUTTON_RIGHT }, + { ACTION_TREE_PGRIGHT, BUTTON_A|BUTTON_RIGHT, BUTTON_RIGHT|BUTTON_REL }, + { ACTION_TREE_PGRIGHT, BUTTON_A|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), +}; + +static const struct button_mapping button_context_listtree_scroll_without_combo[] = { + { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, + { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), +}; + +static const struct button_mapping button_context_settings[] = { + { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_RESET, BUTTON_A, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings */ + +static const struct button_mapping button_context_settings_right_is_inc[] = { + { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_RESET, BUTTON_A, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settingsgraphical */ + +static const struct button_mapping button_context_yesno[] = { + { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings_yesno */ + +static const struct button_mapping button_context_colorchooser[] = { + { ACTION_STD_OK, BUTTON_A|BUTTON_REL, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), +}; /* button_context_colorchooser */ + +static const struct button_mapping button_context_eq[] = { + { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), +}; /* button_context_eq */ + +/** Bookmark Screen **/ +static const struct button_mapping button_context_bmark[] = { + { ACTION_BMS_DELETE, BUTTON_A, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), +}; /* button_context_bmark */ + +static const struct button_mapping button_context_time[] = { + { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, + { ACTION_STD_OK, BUTTON_A, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS), +}; /* button_context_time */ + +static const struct button_mapping button_context_quickscreen[] = { + { ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE }, + { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_quickscreen */ + +static const struct button_mapping button_context_pitchscreen[] = { + { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE }, + { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_TOGGLE_MODE, BUTTON_MENU, BUTTON_NONE }, + { ACTION_PS_RESET, BUTTON_A, BUTTON_NONE }, + { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_pitchcreen */ + +static const struct button_mapping button_context_keyboard[] = { + { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_A|BUTTON_LEFT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_A|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_A|BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_A|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE }, + { ACTION_KBD_PAGE_FLIP, BUTTON_A|BUTTON_MENU, BUTTON_NONE }, + { ACTION_KBD_DONE, BUTTON_A|BUTTON_REL, BUTTON_A }, + { ACTION_KBD_ABORT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_KBD_BACKSPACE, BUTTON_MENU, BUTTON_NONE }, + { ACTION_KBD_BACKSPACE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE }, + { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_MORSE_INPUT, BUTTON_A|BUTTON_POWER, BUTTON_NONE }, + { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; /* button_context_keyboard */ + +/***************************************************************************** + * Remote control mappings + *****************************************************************************/ + +static const struct button_mapping remote_button_context_standard[] = { + { ACTION_STD_PREV, BUTTON_RC_VOL_UP, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_RC_VOL_DOWN, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_RC_REW, BUTTON_NONE }, + { ACTION_STD_OK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF }, + { ACTION_STD_CONTEXT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_RC_FF }, + { ACTION_STD_MENU, BUTTON_RC_DSP, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; + +static const struct button_mapping remote_button_context_wps[] = { + { ACTION_WPS_PLAY, BUTTON_RC_PLAY, BUTTON_NONE }, + + { ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF }, + { ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW }, + + { ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_REPEAT }, + { ACTION_WPS_STOPSEEK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_REPEAT }, + + { ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY }, + { ACTION_WPS_MENU, BUTTON_RC_DSP, BUTTON_NONE }, + + { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; + +static const struct button_mapping remote_button_context_tree[] = { + { ACTION_TREE_WPS, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY }, + { ACTION_TREE_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY }, + { ACTION_STD_CANCEL, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; + +static const struct button_mapping* get_context_mapping_remote( int context ) +{ + context ^= CONTEXT_REMOTE; + + switch (context) + { + case CONTEXT_WPS: + return remote_button_context_wps; + case CONTEXT_MAINMENU: + case CONTEXT_TREE: + return remote_button_context_tree; + } + return remote_button_context_standard; +} + +const struct button_mapping* get_context_mapping(int context) +{ + if (context&CONTEXT_REMOTE) + return get_context_mapping_remote(context); + + switch (context) + { + case CONTEXT_STD: + return button_context_standard; + case CONTEXT_WPS: + return button_context_wps; + + case CONTEXT_LIST: + return button_context_list; + case CONTEXT_MAINMENU: + case CONTEXT_TREE: + if (global_settings.hold_lr_for_scroll_in_list) + return button_context_listtree_scroll_without_combo; + else + return button_context_listtree_scroll_with_combo; + case CONTEXT_CUSTOM|CONTEXT_TREE: + return button_context_tree; + + case CONTEXT_SETTINGS: + return button_context_settings; + case CONTEXT_CUSTOM|CONTEXT_SETTINGS: + return button_context_settings_right_is_inc; + + case CONTEXT_SETTINGS_COLOURCHOOSER: + return button_context_colorchooser; + case CONTEXT_SETTINGS_EQ: + return button_context_eq; + + case CONTEXT_SETTINGS_TIME: + return button_context_time; + + case CONTEXT_YESNOSCREEN: + return button_context_yesno; + case CONTEXT_BOOKMARKSCREEN: + return button_context_bmark; + case CONTEXT_QUICKSCREEN: + return button_context_quickscreen; + case CONTEXT_PITCHSCREEN: + return button_context_pitchscreen; + case CONTEXT_KEYBOARD: + return button_context_keyboard; + } + return button_context_standard; +} Property changes on: apps/keymaps/keymap-sdl.c ___________________________________________________________________ Name: svn:executable + * Index: apps/misc.c =================================================================== --- apps/misc.c (revision 17611) +++ apps/misc.c (working copy) @@ -645,7 +645,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) { -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) (void)callback; (void)parameter; bookmark_autobookmark(); Index: firmware/export/config-sdl.h =================================================================== --- firmware/export/config-sdl.h (revision 0) +++ firmware/export/config-sdl.h (revision 0) @@ -0,0 +1,207 @@ +/* + * This config file is for SDL targets + */ +#define TARGET_TREE /* this target is using the target tree system */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 200 +#define MODEL_NAME "SDL" + +/* Taken from other targets*/ +#define VOLUME_MIN -730 +#define VOLUME_MAX 0 + +//#define HW_SAMPR_CAPS (SAMPR_CAP_44) + +/* define this if you have recording possibility */ +//#define HAVE_RECORDING + +//#define REC_SAMPR_CAPS (SAMPR_CAP_22) +//#define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */ +//#define REC_SAMPR_DEFAULT SAMPR_22 + +/* Define bitmask of input sources - recordable bitmask can be defined + explicitly if different */ +//#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO) + +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP + +/* define this if you have a colour LCD */ +#define HAVE_LCD_COLOR + +/* define this if you want album art for this target */ +#define HAVE_ALBUMART + +/* define this if you have a light associated with the buttons */ +//#define HAVE_BUTTON_LIGHT + +/* define this if you have access to the quickscreen */ +//#define HAVE_QUICKSCREEN + +/* define this if you have access to the pitchscreen */ +//#define HAVE_PITCHSCREEN + +/* define this if you would like tagcache to build on this target */ +//#define HAVE_TAGCACHE + +/* LCD dimensions */ +#define LCD_WIDTH 320 +#define LCD_HEIGHT 240 +#define LCD_DEPTH 16 /* 65536 colours */ +#define LCD_PIXELFORMAT RGB565 /* rgb565 */ + +#ifndef BOOTLOADER +/* define this if you have LCD enable function */ +#define HAVE_LCD_ENABLE + +/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE + should be defined as well. */ +#define HAVE_LCD_SLEEP +#define HAVE_LCD_SLEEP_SETTING +#endif + +/* define this if you can flip your LCD */ +//#define HAVE_LCD_FLIP + +/* define this if you can invert the colours on your LCD */ +//#define HAVE_LCD_INVERT + +/* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */ + +#define CONFIG_KEYPAD SLD_PAD + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC +/* There is no hardware tone control */ +#define HAVE_SW_TONE_CONTROLS +/* The PP5024 has a built-in AustriaMicrosystems AS3514 */ +//#define HAVE_AS3514 + +/* define this if you have a real-time clock */ +#ifndef BOOTLOADER +//#define CONFIG_RTC RTC_AS3514 +#endif + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +/* Some Sansa E200s seem to be FAT16 formatted */ +//#define HAVE_FAT16SUPPORT + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x80000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x80000 + +#define AB_REPEAT_ENABLE 1 + +/* FM Tuner */ + + +/* Define this for LCD backlight available */ +#define HAVE_BACKLIGHT +#define HAVE_BACKLIGHT_BRIGHTNESS + +/* define this if the unit uses a scrollwheel for navigation */ +//#define HAVE_SCROLLWHEEL +/* define from which rotation speed [degree/sec] on the acceleration starts */ +//#define WHEEL_ACCEL_START 540 +/* define type of acceleration (1 = ^2, 2 = ^3, 3 = ^4) */ +//#define WHEEL_ACCELERATION 1 + +/* define this if you have a flash memory storage */ +#define HAVE_FLASH_STORAGE + +/* define this if the flash memory uses the SecureDigital Memory Card protocol */ +//#define HAVE_ATA_SD + +#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 0 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ + +/* Hardware controlled charging? FIXME */ +//#define CONFIG_CHARGING CHARGING_SIMPLE + +/* define this if the unit can be powered or charged via USB */ +//#define HAVE_USB_POWER + +/** Non-simulator section **/ +#ifndef SIMULATOR + +/* Define this if you have a PortalPlayer PP5024 */ +#define CONFIG_CPU X86 + +/* Define this if you want to use the PP5024 i2c interface */ +#define CONFIG_I2C I2C_PP5024 + +/* define this if the hardware can be powered off while charging */ +/* Sansa can't be powered off while charging */ +/* #define HAVE_POWEROFF_WHILE_CHARGING */ + +/* The start address index for ROM builds */ +#define ROM_START 0x00000000 + +/* Define this to the CPU frequency */ +#define CPU_FREQ 75000000 + +/* Type of LCD TODO: hopefully the same as the x5 but check this*/ +#define CONFIG_LCD LCD_X5 + +/* Offset ( in the firmware file's header ) to the file CRC and data. These are + only used when loading the old format rockbox.e200 file */ +#define FIRMWARE_OFFSET_FILE_CRC 0x0 +#define FIRMWARE_OFFSET_FILE_DATA 0x8 + +#ifndef BOOTLOADER +//#define HAVE_MULTIVOLUME +//#define HAVE_HOTSWAP +#endif + +/* #define USB_IPODSTYLE */ + +/* USB On-the-go */ +//#define CONFIG_USBOTG USBOTG_ARC + +/* enable these for the experimental usb stack */ +//#define HAVE_USBSTACK +//#define USB_VENDOR_ID 0x0781 +//#define USB_PRODUCT_ID 0x7421 + +/* Virtual LED (icon) */ +#define CONFIG_LED LED_VIRTUAL + +/* Define this if you have adjustable CPU frequency */ +//#define HAVE_ADJUSTABLE_CPU_FREQ + +/* +#define MI4_FORMAT +#define BOOTFILE_EXT "mi4" +#define BOOTFILE "rockbox." BOOTFILE_EXT +#define OLD_BOOTFILE "rockbox.e200" + +#define BOOTDIR "/.rockbox" + +#define ICODE_ATTR_TREMOR_NOT_MDCT + +#define INCLUDE_TIMEOUT_API +*/ +#endif /* SIMULATOR */ + +/** Port-specific settings **/ + +/* Main LCD backlight brightness range and defaults */ +#define MIN_BRIGHTNESS_SETTING 1 +#define MAX_BRIGHTNESS_SETTING 12 +#define DEFAULT_BRIGHTNESS_SETTING 6 + +/* Default recording levels */ +#define DEFAULT_REC_MIC_GAIN 23 +#define DEFAULT_REC_LEFT_GAIN 23 +#define DEFAULT_REC_RIGHT_GAIN 23 + + + Property changes on: firmware/export/config-sdl.h ___________________________________________________________________ Name: svn:executable + * Index: firmware/export/kernel.h =================================================================== --- firmware/export/kernel.h (revision 17611) +++ firmware/export/kernel.h (working copy) @@ -203,7 +203,7 @@ extern volatile long current_tick; #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #define sleep(x) sim_sleep(x) #endif Index: firmware/export/system.h =================================================================== --- firmware/export/system.h (revision 17611) +++ firmware/export/system.h (working copy) @@ -191,7 +191,7 @@ MAXMEMGUARD }; -#ifndef SIMULATOR +#ifndef SIMULATOR // #include "system-target.h" #else /* SIMULATOR */ Index: firmware/export/backlight.h =================================================================== --- firmware/export/backlight.h (revision 17611) +++ firmware/export/backlight.h (working copy) @@ -68,7 +68,7 @@ #endif #endif /* HAVE_REMOTE_LCD */ -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) void sim_backlight(int value); void sim_remote_backlight(int value); #endif Index: firmware/export/audio.h =================================================================== --- firmware/export/audio.h (revision 17611) +++ firmware/export/audio.h (working copy) @@ -35,7 +35,7 @@ #endif /* CONFIG_CODEC == SWCODEC */ -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #define audio_play(x) sim_audio_play(x) #endif Index: firmware/export/thread.h =================================================================== --- firmware/export/thread.h (revision 17611) +++ firmware/export/thread.h (working copy) @@ -79,7 +79,7 @@ #define DEFAULT_STACK_SIZE 0x400 /* Bytes */ -#ifndef SIMULATOR +#if(!defined(SIMULATOR) && !defined(SDL)) /* Need to keep structures inside the header file because debug_menu * needs them. */ #ifdef CPU_COLDFIRE @@ -115,7 +115,7 @@ void *s; /* Semaphore for blocking and wakeup */ void (*start)(void); /* Start function */ }; -#endif /* !SIMULATOR */ +#endif /* !SIMULATOR && !SDL */ /* NOTE: The use of the word "queue" may also refer to a linked list of threads being maintained that are normally dealt with in FIFO order @@ -469,7 +469,7 @@ create_thread(void (*function)(void), void* stack, size_t stack_size, unsigned flags, const char *name IF_PRIO(, int priority) - IF_COP(, unsigned int core)); + IF_COP(, unsigned int core)); /* Set and clear the CPU frequency boost flag for the calling thread */ #ifdef HAVE_SCHEDULER_BOOSTCTRL Index: firmware/export/buffer.h =================================================================== --- firmware/export/buffer.h (revision 17611) +++ firmware/export/buffer.h (working copy) @@ -20,7 +20,7 @@ #define BUFFER_H /* defined in linker script */ -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) extern unsigned char *audiobufend; #else extern unsigned char audiobufend[]; Index: firmware/export/powermgmt.h =================================================================== --- firmware/export/powermgmt.h (revision 17611) +++ firmware/export/powermgmt.h (working copy) @@ -56,7 +56,7 @@ extern charger_input_state_type charger_input_state; #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if CONFIG_CHARGING == CHARGING_CONTROL #define START_TOPOFF_CHG 85 /* Battery % to start at top-off */ @@ -157,7 +157,7 @@ /* Start up power management thread */ void powermgmt_init(void); -#endif /* SIMULATOR */ +#endif /* !SIMULATOR && !SDL */ /* Returns battery statust */ int battery_level(void); /* percent */ Index: firmware/export/config.h =================================================================== --- firmware/export/config.h (revision 17611) +++ firmware/export/config.h (working copy) @@ -262,6 +262,8 @@ #include "config-creativezv.h" #elif defined(PHILIPS_SA9200) #include "config-sa9200.h" +#elif defined(SDL) +#include "config-sdl.h" #else /* no known platform */ #endif @@ -352,7 +354,7 @@ #define HAVE_EXTENDED_MESSAGING_AND_NAME -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #define HAVE_PRIORITY_SCHEDULING #define HAVE_SCHEDULER_BOOSTCTRL #endif /* SIMULATOR */ @@ -440,7 +442,7 @@ #endif /* IRAM usage */ -#if !defined(SIMULATOR) && /* Not for simulators */ \ +#if !defined(SIMULATOR) && !defined(SDL) && /* Not for simulators */ \ (((CONFIG_CPU == SH7034) && !defined(PLUGIN)) || /* SH1 archos: core only */ \ defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \ defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \ Index: firmware/export/lcd.h =================================================================== --- firmware/export/lcd.h (revision 17611) +++ firmware/export/lcd.h (working copy) @@ -62,7 +62,7 @@ #define NUMLN_UNPACK(x) ((unsigned char)((x) & STYLE_MAXLN_MASK)) #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #ifndef MAX_PATH #define MAX_PATH 260 #endif @@ -95,12 +95,12 @@ extern void lcd_write_data(const fb_data* p_bytes, int count); extern void lcd_init(void); -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) /* Define a dummy device specific init for the sims */ #define lcd_init_device() #else extern void lcd_init_device(void); -#endif /* SIMULATOR */ +#endif /* SIMULATOR || SDL*/ extern void lcd_backlight(bool on); extern int lcd_default_contrast(void); Index: firmware/export/ata_idle_notify.h =================================================================== --- firmware/export/ata_idle_notify.h (revision 17611) +++ firmware/export/ata_idle_notify.h (working copy) @@ -40,7 +40,7 @@ DISK_EVENT_SPINUP = (EVENT_CLASS_DISK|1), }; -#define USING_ATA_CALLBACK !defined(SIMULATOR) \ +#define USING_ATA_CALLBACK (!defined(SIMULATOR) || !defined(SDL)) \ && !defined(HAVE_FLASH_DISK) typedef bool (*ata_idle_notify)(void); Index: firmware/export/power.h =================================================================== --- firmware/export/power.h (revision 17611) +++ firmware/export/power.h (working copy) @@ -35,7 +35,7 @@ bool charging_state(void); # endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) void power_init(void); Index: firmware/export/timer.h =================================================================== --- firmware/export/timer.h (revision 17611) +++ firmware/export/timer.h (working copy) @@ -34,7 +34,7 @@ #elif CONFIG_CPU == S3C2440 || CONFIG_CPU == DM320 || CONFIG_CPU == TCC7801 \ || defined(CPU_TCC77X) #include "timer-target.h" -#elif defined(SIMULATOR) +#elif defined(SIMULATOR) || defined(SDL) #define TIMER_FREQ 1000000 #else #define TIMER_FREQ CPU_FREQ Index: firmware/kernel.c =================================================================== --- firmware/kernel.c (revision 17611) +++ firmware/kernel.c (working copy) @@ -20,7 +20,7 @@ #include #include "config.h" #include "kernel.h" -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #include "system-sdl.h" #include "debug.h" #endif @@ -37,7 +37,7 @@ #endif #if KERNEL_OBJECT_CHECKS -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #define KERNEL_ASSERT(exp, msg...) \ ({ if (!({ exp; })) { DEBUGF(msg); exit(-1); } }) #else @@ -437,7 +437,7 @@ switch_thread(); #elif defined(CREATIVE_ZVx) && defined(BOOTLOADER) /* hacky.. */ - long sleep_ticks = current_tick + ticks + 1; + long sleep_ticks = current_tick + ticks + 1; while (sleep_ticks > current_tick) switch_thread(); #else Index: firmware/debug.c =================================================================== --- firmware/debug.c (revision 17611) +++ firmware/debug.c (working copy) @@ -33,7 +33,7 @@ #endif #endif -#ifndef SIMULATOR /* allow non archos platforms to display output */ +#if !defined(SIMULATOR) && !defined(SDL) /* allow non archos platforms to display output */ #include "kernel.h" #include "system.h" #include "debug.h" Index: firmware/sound.c =================================================================== --- firmware/sound.c (revision 17611) +++ firmware/sound.c (working copy) @@ -33,7 +33,7 @@ #if CONFIG_CODEC == SWCODEC #include "pcm.h" #endif -#endif +#endif /* SIMULATOR */ /* TODO * find a nice way to handle 1.5db steps -> see wm8751 ifdef in sound_set_bass/treble @@ -46,16 +46,16 @@ /* volume/balance/treble/bass interdependency main part */ #define VOLUME_RANGE (VOLUME_MAX - VOLUME_MIN) -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) extern bool audio_is_initialized; #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) extern unsigned long shadow_io_control_main; extern unsigned shadow_codec_reg0; #endif -#endif /* SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) /* dummy for sim */ const struct sound_settings_info audiohw_settings[] = { [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN / 10, VOLUME_MAX / 10, -25}, @@ -215,7 +215,7 @@ } #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if CONFIG_CODEC == MAS3507D /* convert tenth of dB volume (-780..+180) to dac3550 register value */ static int tenthdb2reg(int db) @@ -308,10 +308,10 @@ #endif } #endif /* (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 */ -#endif /* !SIMULATOR */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) unsigned long mdb_shape_shadow = 0; @@ -525,7 +525,7 @@ } #endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */ -#else /* SIMULATOR */ +#else /* !defined(SIMULATOR) && !defined(SDL) */ int sim_volume; void sound_set_volume(int value) { @@ -706,7 +706,7 @@ #endif /* !defined(HAVE_AS3514) || defined(SIMULATOR) */ #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) /* This function works by telling the decoder that we have another crystal frequency than we actually have. It will adjust its internal parameters and the result is that the audio is played at another pitch. Index: firmware/backlight.c =================================================================== --- firmware/backlight.c (revision 17611) +++ firmware/backlight.c (working copy) @@ -35,7 +35,7 @@ #ifdef HAVE_REMOTE_LCD #include "lcd-remote.h" #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #include "backlight-target.h" #endif @@ -44,7 +44,7 @@ #define BACKLIGHT_FULL_INIT #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) /* TODO: find a better way to do it but we need a kernel thread somewhere to handle this */ extern void screen_dump(void); @@ -219,7 +219,7 @@ } #endif /* HAVE_LCD_SLEEP */ -#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) +#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) && !defined(SDL) /* backlight fading */ #define BL_PWM_INTERVAL 5 /* Cycle interval in ms */ #define BL_PWM_BITS 8 @@ -490,7 +490,7 @@ break; #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) /* Here for now or else the aggressive init messes up scrolling */ #ifdef HAVE_REMOTE_LCD case SYS_REMOTE_PLUGGED: @@ -511,8 +511,8 @@ lcd_off(); break; #endif /* HAVE_REMOTE_LCD/ HAVE_REMOTE_LCD_AS_MAIN */ -#endif /* !SIMULATOR */ -#ifdef SIMULATOR +#endif /* !SIMULATOR && !SDL */ +#if defined(SIMULATOR) || defined(SDL) /* This one here too for lack of a better place */ case SYS_SCREENDUMP: screen_dump(); @@ -639,7 +639,7 @@ { queue_init(&backlight_queue, true); -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) if (_backlight_init()) { # ifdef HAVE_BACKLIGHT_PWM_FADING Index: firmware/panic.c =================================================================== --- firmware/panic.c (revision 17611) +++ firmware/panic.c (working copy) @@ -38,7 +38,7 @@ { va_list ap; -#ifndef SIMULATOR +#if (!defined(SIMULATOR) && !defined(SDL)) #if (CONFIG_LED == LED_REAL) bool state = false; int i = 0; @@ -50,7 +50,7 @@ #endif set_irq_level(DISABLE_INTERRUPTS); -#endif /* SIMULATOR */ +#endif /* !SIMULATOR || !SDL*/ va_start( ap, fmt ); vsnprintf( panic_buf, sizeof(panic_buf), fmt, ap ); @@ -88,7 +88,7 @@ while (1) { -#ifndef SIMULATOR +#if (!defined(SIMULATOR) && !defined(SDL)) #if (CONFIG_LED == LED_REAL) if (--i <= 0) { @@ -127,6 +127,6 @@ if(false) #endif /* CPU */ system_reboot(); -#endif /* !SIMULATOR */ +#endif /* !SIMULATOR !SDL*/ } } Index: firmware/Makefile =================================================================== --- firmware/Makefile (revision 17611) +++ firmware/Makefile (working copy) @@ -7,7 +7,7 @@ # $Id$ # -INCLUDES=$(TARGET_INC) -Iinclude -I$(FIRMDIR) -Iexport -Icommon -Idrivers -I$(BUILDDIR) +INCLUDES=$(TARGET_INC) -Iinclude -I$(FIRMDIR) -Iexport -Icommon -Idrivers -I$(BUILDDIR) CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(BUILDDATE) $(EXTRA_DEFINES) \ -DMEM=${MEMORYSIZE} Index: firmware/include/dbgcheck.h =================================================================== --- firmware/include/dbgcheck.h (revision 17611) +++ firmware/include/dbgcheck.h (working copy) @@ -4,7 +4,7 @@ #include #ifdef DEBUG - #ifndef SIMULATOR + #if !defined(SIMULATOR) && !defined(SDL) /* check whether a function is inside the valid memory location */ #define IS_FUNCPTR(fp) ({/ extern char _text[];/ Index: firmware/include/dircache.h =================================================================== --- firmware/include/dircache.h (revision 17611) +++ firmware/include/dircache.h (working copy) @@ -35,7 +35,7 @@ struct dircache_entry *first; struct dircache_entry *ce; struct dircache_entry *down_entry; -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) DIR_UNCACHED *dir, *newdir; struct dirent_uncached *entry; #else Index: firmware/include/dir_uncached.h =================================================================== --- firmware/include/dir_uncached.h (revision 17611) +++ firmware/include/dir_uncached.h (working copy) @@ -30,7 +30,7 @@ #define ATTR_ARCHIVE 0x20 #define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #define dirent_uncached sim_dirent #define DIR_UNCACHED SIM_DIR #define opendir_uncached sim_opendir @@ -55,7 +55,7 @@ #include "fat.h" typedef struct { -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) bool busy; long startcluster; struct fat_dir fatdir; Index: firmware/include/file.h =================================================================== --- firmware/include/file.h (revision 17611) +++ firmware/include/file.h (working copy) @@ -46,7 +46,7 @@ #define O_TRUNC 0x10 #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #define open(x,y) sim_open(x,y) #define creat(x) sim_creat(x) #define remove(x) sim_remove(x) Index: firmware/include/stdlib.h =================================================================== --- firmware/include/stdlib.h (revision 17611) +++ firmware/include/stdlib.h (working copy) @@ -23,7 +23,7 @@ #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 -_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR))); +_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR))); void *malloc(size_t); void *calloc (size_t nmemb, size_t size); @@ -38,7 +38,7 @@ #define abs(x) ((x)>0?(x):-(x)) #define labs(x) abs(x) -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) void exit(int status); #endif Index: firmware/include/stdio.h =================================================================== --- firmware/include/stdio.h (revision 17611) +++ firmware/include/stdio.h (working copy) @@ -1,5 +1,5 @@ #ifndef _STDIO_H_ -#define _STDIO_H_ +#define _STDIO_H_ #include <_ansi.h> @@ -10,22 +10,22 @@ #include #ifndef NULL -#define NULL 0 +#define NULL 0 #endif -#define EOF (-1) +#define EOF (-1) #ifndef SEEK_SET -#define SEEK_SET 0 /* set file offset to offset */ +#define SEEK_SET 0 /* set file offset to offset */ #endif #ifndef SEEK_CUR -#define SEEK_CUR 1 /* set file offset to current plus offset */ +#define SEEK_CUR 1 /* set file offset to current plus offset */ #endif #ifndef SEEK_END -#define SEEK_END 2 /* set file offset to EOF plus offset */ +#define SEEK_END 2 /* set file offset to EOF plus offset */ #endif -#define TMP_MAX 26 +#define TMP_MAX 26 #ifdef __GNUC__ #define __VALIST __gnuc_va_list @@ -36,7 +36,7 @@ int snprintf (char *buf, size_t size, const char *fmt, ...); int vsnprintf (char *buf, int size, const char *fmt, __VALIST ap); -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) typedef void FILE; int vfprintf(FILE *stream, const char *format, __VALIST ap); #ifdef WIN32 Index: firmware/include/errno.h =================================================================== --- firmware/include/errno.h (revision 17611) +++ firmware/include/errno.h (working copy) @@ -2,7 +2,7 @@ non-reentrant. Instead, its address is returned by the function __errno. */ -#if defined(SIMULATOR) && !defined(__MINGW32__) && !defined(__CYGWIN__) +#if (defined(SIMULATOR) || defined(SDL)) && !defined(__MINGW32__) && !defined(__CYGWIN__) #include "/usr/include/errno.h" /* use the host system implementation */ @@ -12,130 +12,130 @@ extern int errno; -#define EPERM 1 /* Not super-user */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* I/O error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Arg list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file number */ -#define ECHILD 10 /* No children */ -#define EAGAIN 11 /* No more processes */ -#define ENOMEM 12 /* Not enough core */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Mount device busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* Too many open files in system */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Not a typewriter */ -#define ETXTBSY 26 /* Text file busy */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ -#define EDOM 33 /* Math arg out of domain of func */ -#define ERANGE 34 /* Math result not representable */ -#define ENOMSG 35 /* No message of desired type */ -#define EIDRM 36 /* Identifier removed */ -#define ECHRNG 37 /* Channel number out of range */ -#define EL2NSYNC 38 /* Level 2 not synchronized */ -#define EL3HLT 39 /* Level 3 halted */ -#define EL3RST 40 /* Level 3 reset */ -#define ELNRNG 41 /* Link number out of range */ -#define EUNATCH 42 /* Protocol driver not attached */ -#define ENOCSI 43 /* No CSI structure available */ -#define EL2HLT 44 /* Level 2 halted */ -#define EDEADLK 45 /* Deadlock condition */ -#define ENOLCK 46 /* No record locks available */ -#define EBADE 50 /* Invalid exchange */ -#define EBADR 51 /* Invalid request descriptor */ -#define EXFULL 52 /* Exchange full */ -#define ENOANO 53 /* No anode */ -#define EBADRQC 54 /* Invalid request code */ -#define EBADSLT 55 /* Invalid slot */ -#define EDEADLOCK 56 /* File locking deadlock error */ -#define EBFONT 57 /* Bad font file fmt */ -#define ENOSTR 60 /* Device not a stream */ -#define ENODATA 61 /* No data (for no delay io) */ -#define ETIME 62 /* Timer expired */ -#define ENOSR 63 /* Out of streams resources */ -#define ENONET 64 /* Machine is not on the network */ -#define ENOPKG 65 /* Package not installed */ -#define EREMOTE 66 /* The object is remote */ -#define ENOLINK 67 /* The link has been severed */ -#define EADV 68 /* Advertise error */ -#define ESRMNT 69 /* Srmount error */ -#define ECOMM 70 /* Communication error on send */ -#define EPROTO 71 /* Protocol error */ -#define EMULTIHOP 74 /* Multihop attempted */ -#define ELBIN 75 /* Inode is remote (not really error) */ -#define EDOTDOT 76 /* Cross mount point (not really error) */ -#define EBADMSG 77 /* Trying to read unreadable message */ -#define ENOTUNIQ 80 /* Given log. name not unique */ -#define EBADFD 81 /* f.d. invalid for this operation */ -#define EREMCHG 82 /* Remote address changed */ -#define ELIBACC 83 /* Can't access a needed shared lib */ -#define ELIBBAD 84 /* Accessing a corrupted shared lib */ -#define ELIBSCN 85 /* .lib section in a.out corrupted */ -#define ELIBMAX 86 /* Attempting to link in too many libs */ -#define ELIBEXEC 87 /* Attempting to exec a shared library */ -#define ENOSYS 88 /* Function not implemented */ +#define EPERM 1 /* Not super-user */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No children */ +#define EAGAIN 11 /* No more processes */ +#define ENOMEM 12 /* Not enough core */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Mount device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math arg out of domain of func */ +#define ERANGE 34 /* Math result not representable */ +#define ENOMSG 35 /* No message of desired type */ +#define EIDRM 36 /* Identifier removed */ +#define ECHRNG 37 /* Channel number out of range */ +#define EL2NSYNC 38 /* Level 2 not synchronized */ +#define EL3HLT 39 /* Level 3 halted */ +#define EL3RST 40 /* Level 3 reset */ +#define ELNRNG 41 /* Link number out of range */ +#define EUNATCH 42 /* Protocol driver not attached */ +#define ENOCSI 43 /* No CSI structure available */ +#define EL2HLT 44 /* Level 2 halted */ +#define EDEADLK 45 /* Deadlock condition */ +#define ENOLCK 46 /* No record locks available */ +#define EBADE 50 /* Invalid exchange */ +#define EBADR 51 /* Invalid request descriptor */ +#define EXFULL 52 /* Exchange full */ +#define ENOANO 53 /* No anode */ +#define EBADRQC 54 /* Invalid request code */ +#define EBADSLT 55 /* Invalid slot */ +#define EDEADLOCK 56 /* File locking deadlock error */ +#define EBFONT 57 /* Bad font file fmt */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data (for no delay io) */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* The object is remote */ +#define ENOLINK 67 /* The link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 74 /* Multihop attempted */ +#define ELBIN 75 /* Inode is remote (not really error) */ +#define EDOTDOT 76 /* Cross mount point (not really error) */ +#define EBADMSG 77 /* Trying to read unreadable message */ +#define ENOTUNIQ 80 /* Given log. name not unique */ +#define EBADFD 81 /* f.d. invalid for this operation */ +#define EREMCHG 82 /* Remote address changed */ +#define ELIBACC 83 /* Can't access a needed shared lib */ +#define ELIBBAD 84 /* Accessing a corrupted shared lib */ +#define ELIBSCN 85 /* .lib section in a.out corrupted */ +#define ELIBMAX 86 /* Attempting to link in too many libs */ +#define ELIBEXEC 87 /* Attempting to exec a shared library */ +#define ENOSYS 88 /* Function not implemented */ #define ENMFILE 89 /* No more files */ -#define ENOTEMPTY 90 /* Directory not empty */ -#define ENAMETOOLONG 91 /* File or path name too long */ -#define ELOOP 92 /* Too many symbolic links */ -#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define ENOTEMPTY 90 /* Directory not empty */ +#define ENAMETOOLONG 91 /* File or path name too long */ +#define ELOOP 92 /* Too many symbolic links */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ #define EPFNOSUPPORT 96 /* Protocol family not supported */ #define ECONNRESET 104 /* Connection reset by peer */ -#define ENOBUFS 105 /* No buffer space available */ +#define ENOBUFS 105 /* No buffer space available */ #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ -#define EPROTOTYPE 107 /* Protocol wrong type for socket */ -#define ENOTSOCK 108 /* Socket operation on non-socket */ -#define ENOPROTOOPT 109 /* Protocol not available */ -#define ESHUTDOWN 110 /* Can't send after socket shutdown */ -#define ECONNREFUSED 111 /* Connection refused */ -#define EADDRINUSE 112 /* Address already in use */ -#define ECONNABORTED 113 /* Connection aborted */ -#define ENETUNREACH 114 /* Network is unreachable */ -#define ENETDOWN 115 /* Network interface is not configured */ -#define ETIMEDOUT 116 /* Connection timed out */ -#define EHOSTDOWN 117 /* Host is down */ -#define EHOSTUNREACH 118 /* Host is unreachable */ -#define EINPROGRESS 119 /* Connection already in progress */ -#define EALREADY 120 /* Socket already connected */ -#define EDESTADDRREQ 121 /* Destination address required */ -#define EMSGSIZE 122 /* Message too long */ -#define EPROTONOSUPPORT 123 /* Unknown protocol */ -#define ESOCKTNOSUPPORT 124 /* Socket type not supported */ -#define EADDRNOTAVAIL 125 /* Address not available */ +#define EPROTOTYPE 107 /* Protocol wrong type for socket */ +#define ENOTSOCK 108 /* Socket operation on non-socket */ +#define ENOPROTOOPT 109 /* Protocol not available */ +#define ESHUTDOWN 110 /* Can't send after socket shutdown */ +#define ECONNREFUSED 111 /* Connection refused */ +#define EADDRINUSE 112 /* Address already in use */ +#define ECONNABORTED 113 /* Connection aborted */ +#define ENETUNREACH 114 /* Network is unreachable */ +#define ENETDOWN 115 /* Network interface is not configured */ +#define ETIMEDOUT 116 /* Connection timed out */ +#define EHOSTDOWN 117 /* Host is down */ +#define EHOSTUNREACH 118 /* Host is unreachable */ +#define EINPROGRESS 119 /* Connection already in progress */ +#define EALREADY 120 /* Socket already connected */ +#define EDESTADDRREQ 121 /* Destination address required */ +#define EMSGSIZE 122 /* Message too long */ +#define EPROTONOSUPPORT 123 /* Unknown protocol */ +#define ESOCKTNOSUPPORT 124 /* Socket type not supported */ +#define EADDRNOTAVAIL 125 /* Address not available */ #define ENETRESET 126 -#define EISCONN 127 /* Socket is already connected */ -#define ENOTCONN 128 /* Socket is not connected */ +#define EISCONN 127 /* Socket is already connected */ +#define ENOTCONN 128 /* Socket is not connected */ #define ETOOMANYREFS 129 #define EPROCLIM 130 #define EUSERS 131 #define EDQUOT 132 #define ESTALE 133 -#define ENOTSUP 134 /* Not supported */ +#define ENOTSUP 134 /* Not supported */ #define ENOMEDIUM 135 /* No medium (in tape drive) */ #define ENOSHARE 136 /* No such host or network path */ #define ECASECLASH 137 /* Filename exists with different case */ /* From cygwin32. */ -#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ -#define __ELASTERROR 2000 /* Users can add values starting here */ +#define __ELASTERROR 2000 /* Users can add values starting here */ #endif /* _SYS_ERRNO_H */ #endif /* !SIMULATOR */ Index: firmware/SOURCES =================================================================== --- firmware/SOURCES (revision 17611) +++ firmware/SOURCES (working copy) @@ -14,10 +14,12 @@ #ifdef RB_PROFILE profile.c #endif /* RB_PROFILE */ +#ifndef SDL rolo.c thread.c timer.c #endif /* SIMULATOR */ +#endif /* SDL */ panic.c debug.c @@ -28,10 +30,10 @@ common/crc32-mi4.c #endif common/ctype.c -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) common/dir_uncached.c common/file.c -#endif /* SIMULATOR */ +#endif /* !SIMULATOR && !SDL */ #ifdef HAVE_DIRCACHE common/dircache.c #endif /* HAVE_DIRCACHE */ @@ -161,7 +163,7 @@ /* Tuner */ #if CONFIG_TUNER tuner.c -#ifndef SIMULATOR +#if !def(SIMULATOR) && !def(SDL) #if (CONFIG_TUNER & LV24020LP) drivers/tuner/lv24020lp.c #endif /* (CONFIG_TUNER & LV24020LP) */ @@ -191,7 +193,7 @@ pcm.c #ifdef HAVE_RECORDING enc_base.c -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) pcm_record.c #endif /* SIMULATOR */ #endif /* HAVE_RECORDING */ @@ -201,7 +203,7 @@ #ifndef BOOTLOADER mpeg.c -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) drivers/mas.c #endif /* SIMULATOR */ #endif /* BOOTLOADER */ @@ -236,7 +238,7 @@ #endif /* !defined(SIMULATOR) && !defined(BOOTLOADER) */ /* USB Stack */ -#if !defined(SIMULATOR) +#if !defined(SIMULATOR) && !defined(SDL) #ifdef HAVE_USBSTACK usbstack/usb_core.c usbstack/usb_storage.c @@ -254,7 +256,7 @@ drivers/m5636.c #endif #endif /* !defined(HAVE_USBSTACK) */ -#endif /* !defined(SIMULATOR) */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ /* Other Random Hardware */ #ifdef HAVE_TSC2100 @@ -370,7 +372,7 @@ common/memset.c common/memset16.c common/strlen.c -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) crt0.S drivers/i2c.c #endif /* SIMULATOR */ @@ -1006,3 +1008,12 @@ #endif /* BOOTLOADER */ #endif /* SIMULATOR */ #endif /* COWON_D2 */ + +#ifdef SDL +target/generic/sdl/lcd-sdl.c +target/generic/sdl/pcm-sdl.c +target/generic/sdl/button-sdl.c +target/generic/sdl/timer-sdl.c +target/generic/sdl/thread-sdl.c +target/generic/sdl/kernel-sdl.c +#endif \ No newline at end of file Index: firmware/target/generic/sdl/ata-target.h =================================================================== --- firmware/target/generic/sdl/ata-target.h (revision 0) +++ firmware/target/generic/sdl/ata-target.h (revision 0) @@ -0,0 +1,22 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: ata-target.h 14624 2007-09-06 03:01:41Z lowlight $ + * + * Copyright (C) 2006 by Daniel Ankers + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef ATA_TARGET_H +#define ATA_TARGET_H + +#endif Property changes on: firmware/target/generic/sdl/ata-target.h ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/pcm-sdl.c =================================================================== --- firmware/target/generic/sdl/pcm-sdl.c (revision 0) +++ firmware/target/generic/sdl/pcm-sdl.c (revision 0) @@ -0,0 +1,365 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: sound.c 15010 2007-10-07 06:13:05Z jethead71 $ + * + * Copyright (C) 2005 by Nick Lanham + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "autoconf.h" + +#include +#include +#include +#include "debug.h" +#include "kernel.h" +#include "sound.h" + +#include "pcm.h" +#include "pcm_sampr.h" +#include "SDL.h" + +static int cvt_status = -1; +static unsigned long pcm_frequency = SAMPR_44; + +static Uint8* pcm_data; +static size_t pcm_data_size; +static size_t pcm_sample_bytes; +static size_t pcm_channel_bytes; + +struct pcm_udata +{ + Uint8 *stream; + Uint32 num_in; + Uint32 num_out; + FILE *debug; +} udata; + +static SDL_AudioSpec obtained; +static SDL_AudioCVT cvt; + +extern bool debug_audio; + +#ifndef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +void pcm_play_lock(void) +{ + SDL_LockAudio(); +} + +void pcm_play_unlock(void) +{ + SDL_UnlockAudio(); +} + +static void pcm_apply_settings_nolock(void) +{ + cvt_status = SDL_BuildAudioCVT(&cvt, AUDIO_S16SYS, 2, pcm_frequency, + obtained.format, obtained.channels, obtained.freq); + + pcm_curr_sampr = pcm_frequency; + + if (cvt_status < 0) { + cvt.len_ratio = (double)obtained.freq / (double)pcm_curr_sampr; + } +} + +void pcm_apply_settings(void) +{ + pcm_play_lock(); + pcm_apply_settings_nolock(); + pcm_play_unlock(); +} + +void pcm_play_dma_start(const void *addr, size_t size) +{ + pcm_apply_settings_nolock(); + + pcm_data = (Uint8 *) addr; + pcm_data_size = size; + + SDL_PauseAudio(0); +} + +void pcm_play_dma_stop(void) +{ + SDL_PauseAudio(1); +} + +void pcm_play_dma_pause(bool pause) +{ + if (pause) + SDL_PauseAudio(1); + else + SDL_PauseAudio(0); +} + +size_t pcm_get_bytes_waiting(void) +{ + return pcm_data_size; +} + +void pcm_set_frequency(unsigned int frequency) +{ + switch (frequency) + { + HW_HAVE_8_( case SAMPR_8:) + HW_HAVE_11_(case SAMPR_11:) + HW_HAVE_12_(case SAMPR_12:) + HW_HAVE_16_(case SAMPR_16:) + HW_HAVE_22_(case SAMPR_22:) + HW_HAVE_24_(case SAMPR_24:) + HW_HAVE_32_(case SAMPR_32:) + HW_HAVE_44_(case SAMPR_44:) + HW_HAVE_48_(case SAMPR_48:) + HW_HAVE_64_(case SAMPR_64:) + HW_HAVE_88_(case SAMPR_88:) + HW_HAVE_96_(case SAMPR_96:) + break; + default: + frequency = SAMPR_44; + } + + pcm_frequency = frequency; +} + +extern int sim_volume; /* in firmware/sound.c */ +void write_to_soundcard(struct pcm_udata *udata) { + if (cvt.needed) { + Uint32 rd = udata->num_in; + Uint32 wr = (double)rd * cvt.len_ratio; + + if (wr > udata->num_out) { + wr = udata->num_out; + rd = (double)wr / cvt.len_ratio; + + if (rd > udata->num_in) + { + rd = udata->num_in; + wr = (double)rd * cvt.len_ratio; + } + } + + if (wr == 0 || rd == 0) + { + udata->num_out = udata->num_in = 0; + return; + } + + if (cvt_status > 0) { + cvt.len = rd * pcm_sample_bytes; + cvt.buf = (Uint8 *) malloc(cvt.len * cvt.len_mult); + + memcpy(cvt.buf, pcm_data, cvt.len); + + SDL_ConvertAudio(&cvt); + SDL_MixAudio(udata->stream, cvt.buf, cvt.len_cvt, sim_volume); + + udata->num_in = cvt.len / pcm_sample_bytes; + udata->num_out = cvt.len_cvt / pcm_sample_bytes; +#if 0 + if (udata->debug != NULL) { + fwrite(cvt.buf, sizeof(Uint8), cvt.len_cvt, udata->debug); + } +#endif + free(cvt.buf); + } + else { + /* Convert is bad, so do silence */ + Uint32 num = wr*obtained.channels; + udata->num_in = rd; + udata->num_out = wr; + + switch (pcm_channel_bytes) + { + case 1: + { + Uint8 *stream = udata->stream; + while (num-- > 0) + *stream++ = obtained.silence; + break; + } + case 2: + { + Uint16 *stream = (Uint16 *)udata->stream; + while (num-- > 0) + *stream++ = obtained.silence; + break; + } + } +#if 0 + if (udata->debug != NULL) { + fwrite(udata->stream, sizeof(Uint8), wr, udata->debug); + } +#endif + } + } else { + udata->num_in = udata->num_out = MIN(udata->num_in, udata->num_out); + SDL_MixAudio(udata->stream, pcm_data, + udata->num_out * pcm_sample_bytes, sim_volume); +#if 0 + if (udata->debug != NULL) { + fwrite(pcm_data, sizeof(Uint8), udata->num_out * pcm_sample_bytes, + udata->debug); + } +#endif + } +} + +void sdl_audio_callback(struct pcm_udata *udata, Uint8 *stream, int len) +{ + udata->stream = stream; + + /* Write what we have in the PCM buffer */ + if (pcm_data_size > 0) + goto start; + + /* Audio card wants more? Get some more then. */ + while (len > 0) { + if ((ssize_t)pcm_data_size <= 0) { + pcm_data_size = 0; + + if (pcm_callback_for_more) + pcm_callback_for_more(&pcm_data, &pcm_data_size); + } + + if (pcm_data_size > 0) { + start: + udata->num_in = pcm_data_size / pcm_sample_bytes; + udata->num_out = len / pcm_sample_bytes; + + write_to_soundcard(udata); + + udata->num_in *= pcm_sample_bytes; + udata->num_out *= pcm_sample_bytes; + + pcm_data += udata->num_in; + pcm_data_size -= udata->num_in; + udata->stream += udata->num_out; + len -= udata->num_out; + } else { + DEBUGF("sdl_audio_callback: No Data.\n"); + pcm_play_dma_stop(); + pcm_play_dma_stopped_callback(); + break; + } + } +} + +const void * pcm_play_dma_get_peak_buffer(int *count) +{ + uintptr_t addr = (uintptr_t)pcm_data; + *count = pcm_data_size / 4; + return (void *)((addr + 2) & ~3); +} + +#ifdef HAVE_RECORDING +void pcm_rec_lock(void) +{ +} + +void pcm_rec_unlock(void) +{ +} + +void pcm_rec_dma_init(void) +{ +} + +void pcm_rec_dma_close(void) +{ +} + +void pcm_rec_dma_start(void *start, size_t size) +{ + (void)start; + (void)size; +} + +void pcm_rec_dma_stop(void) +{ +} + +void pcm_record_more(void *start, size_t size) +{ + (void)start; + (void)size; +} + +unsigned long pcm_rec_status(void) +{ + return 0; +} + +const void * pcm_rec_dma_get_peak_buffer(int *count) +{ + *count = 0; + return NULL; +} + +#endif /* HAVE_RECORDING */ + +void pcm_play_dma_init(void) +{ + SDL_AudioSpec wanted_spec; + udata.debug = NULL; +#if 0 + if (debug_audio) { + udata.debug = fopen("audiodebug.raw", "wb"); + } +#endif + /* Set 16-bit stereo audio at 44Khz */ + wanted_spec.freq = 44100; + wanted_spec.format = AUDIO_S16SYS; + wanted_spec.channels = 2; + wanted_spec.samples = 2048; + wanted_spec.callback = + (void (SDLCALL *)(void *userdata, + Uint8 *stream, int len))sdl_audio_callback; + wanted_spec.userdata = &udata; + + /* Open the audio device and start playing sound! */ + if(SDL_OpenAudio(&wanted_spec, &obtained) < 0) { + DEBUGF( "Unable to open audio: %s\n", SDL_GetError()); + return; + } + + switch (obtained.format) + { + case AUDIO_U8: + case AUDIO_S8: + pcm_channel_bytes = 1; + break; + case AUDIO_U16LSB: + case AUDIO_S16LSB: + case AUDIO_U16MSB: + case AUDIO_S16MSB: + pcm_channel_bytes = 2; + break; + default: + DEBUGF("Unknown sample format obtained: %u\n", + (unsigned)obtained.format); + return; + } + + pcm_sample_bytes = obtained.channels * pcm_channel_bytes; + + pcm_apply_settings_nolock(); +} + +void pcm_postinit(void) +{ +} Property changes on: firmware/target/generic/sdl/pcm-sdl.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/adc-target.h =================================================================== --- firmware/target/generic/sdl/adc-target.h (revision 0) +++ firmware/target/generic/sdl/adc-target.h (revision 0) @@ -0,0 +1,44 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: adc-target.h 14624 2007-09-06 03:01:41Z lowlight $ + * + * Copyright (C) 2006 by Barry Wardell + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _ADC_TARGET_H_ +#define _ADC_TARGET_H_ + +#if 0 +/* ADC channels */ +#define NUM_ADC_CHANNELS 13 + +#define ADC_BVDD 0 /* Battery voltage of 4V LiIo accumulator */ +#define ADC_RTCSUP 1 /* RTC backup battery voltage */ +#define ADC_UVDD 2 /* USB host voltage */ +#define ADC_CHG_IN 3 /* Charger input voltage */ +#define ADC_CVDD 4 /* Charger pump output voltage */ +#define ADC_BATTEMP 5 /* Battery charging temperature */ +#define ADC_MICSUP1 6 /* Voltage on MicSup1 for remote control + or external voltage measurement */ +#define ADC_MICSUP2 7 /* Voltage on MicSup1 for remote control + or external voltage measurement */ +#define ADC_VBE1 8 /* Measuring junction temperature @ 2uA */ +#define ADC_VBE2 9 /* Measuring junction temperature @ 1uA */ +#define ADC_I_MICSUP1 10 /* Current of MicSup1 for remote control detection */ +#define ADC_I_MICSUP2 11 /* Current of MicSup2 for remote control detection */ +#define ADC_VBAT 12 /* Single cell battery voltage */ + +#define ADC_UNREG_POWER ADC_BVDD /* For compatibility */ +#endif +#endif Property changes on: firmware/target/generic/sdl/adc-target.h ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/kernel-sdl.c =================================================================== --- firmware/target/generic/sdl/kernel-sdl.c (revision 0) +++ firmware/target/generic/sdl/kernel-sdl.c (revision 0) @@ -0,0 +1,168 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 by Felix Arends + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include +#include +#include +#include "memory.h" +#include "system-sdl.h" +#include "uisdl.h" +#include "kernel.h" +#include "thread-sdl.h" +#include "thread.h" +#include "debug.h" + +static SDL_TimerID tick_timer_id; +long start_tick; + +/* Condition to signal that "interrupts" may proceed */ +static SDL_cond *sim_thread_cond; +/* Mutex to serialize changing levels and exclude other threads while + * inside a handler */ +static SDL_mutex *sim_irq_mtx; +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 + * 3) Threads must be excluded when irq routine is running + * 4) No more than one handler routine should execute at a time + */ +int set_irq_level(int level) +{ + SDL_LockMutex(sim_irq_mtx); + + int oldlevel = interrupt_level; + + if (status_reg == 0 && level == 0 && oldlevel != 0) + { + /* Not in a handler and "interrupts" are being reenabled */ + if (handlers_pending > 0) + SDL_CondSignal(sim_thread_cond); + } + + interrupt_level = level; /* save new level */ + + SDL_UnlockMutex(sim_irq_mtx); + return oldlevel; +} + +void sim_enter_irq_handler(void) +{ + SDL_LockMutex(sim_irq_mtx); + handlers_pending++; + + if(interrupt_level != 0) + { + /* "Interrupts" are disabled. Wait for reenable */ + SDL_CondWait(sim_thread_cond, sim_irq_mtx); + } + + status_reg = 1; +} + +void sim_exit_irq_handler(void) +{ + if (--handlers_pending > 0) + SDL_CondSignal(sim_thread_cond); + + status_reg = 0; + SDL_UnlockMutex(sim_irq_mtx); +} + +bool sim_kernel_init(void) +{ + sim_irq_mtx = SDL_CreateMutex(); + if (sim_irq_mtx == NULL) + { + DEBUGF(stderr, "Cannot create sim_handler_mtx\n"); + return false; + } + + sim_thread_cond = SDL_CreateCond(); + if (sim_thread_cond == NULL) + { + DEBUGF(stderr, "Cannot create sim_thread_cond\n"); + return false; + } + + return true; +} + +void sim_kernel_shutdown(void) +{ + SDL_RemoveTimer(tick_timer_id); + SDL_DestroyMutex(sim_irq_mtx); + SDL_DestroyCond(sim_thread_cond); +} + +Uint32 tick_timer(Uint32 interval, void *param) +{ + long new_tick; + + (void) interval; + (void) param; + + new_tick = (SDL_GetTicks() - start_tick) / (1000/HZ); + + if(new_tick != current_tick) + { + long t; + for(t = new_tick - current_tick; t > 0; t--) + { + 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](); + } + } + + sim_exit_irq_handler(); + } + + current_tick = new_tick; + } + + return 1; +} + +void tick_start(unsigned int interval_in_ms) +{ + if (tick_timer_id != NULL) + { + SDL_RemoveTimer(tick_timer_id); + tick_timer_id = NULL; + } + else + { + start_tick = SDL_GetTicks(); + } + + tick_timer_id = SDL_AddTimer(interval_in_ms, tick_timer, NULL); +} Property changes on: firmware/target/generic/sdl/kernel-sdl.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/timer-sdl.c =================================================================== --- firmware/target/generic/sdl/timer-sdl.c (revision 0) +++ firmware/target/generic/sdl/timer-sdl.c (revision 0) @@ -0,0 +1,60 @@ +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id: timer.h 13806 2007-07-06 21:36:32Z jethead71 $ +* +* Copyright (C) 2005 Kévin Ferrare +* +* All files in this archive are subject to the GNU General Public License. +* See the file COPYING in the source tree root for full license agreement. +* +* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +* KIND, either express or implied. +* +****************************************************************************/ + +#include "timer.h" +#include + +static int timer_prio = -1; +void (*global_timer_callback)(void); +SDL_TimerID timerId; + +Uint32 SDL_timer_callback(Uint32 interval, void *param){ + (void)param; + global_timer_callback(); + return(interval); +} + +#define cycles_to_miliseconds(cycles) \ + ((int)((1000*cycles)/TIMER_FREQ)) + +bool timer_register(int reg_prio, void (*unregister_callback)(void), + long cycles, int int_prio, void (*timer_callback)(void)) +{ + (void)int_prio;/* interrupt priority not used */ + (void)unregister_callback; + if (reg_prio <= timer_prio || cycles == 0) + return false; + timer_prio=reg_prio; + global_timer_callback=timer_callback; + timerId=SDL_AddTimer(cycles_to_miliseconds(cycles), SDL_timer_callback, 0); + return true; +} + +bool timer_set_period(long cycles) +{ + SDL_RemoveTimer (timerId); + timerId=SDL_AddTimer(cycles_to_miliseconds(cycles), SDL_timer_callback, 0); + return true; +} + +void timer_unregister(void) +{ + SDL_RemoveTimer (timerId); + timer_prio = -1; +} Property changes on: firmware/target/generic/sdl/timer-sdl.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/backlight-target.h =================================================================== --- firmware/target/generic/sdl/backlight-target.h (revision 0) +++ firmware/target/generic/sdl/backlight-target.h (revision 0) @@ -0,0 +1,30 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: backlight-target.h 15599 2007-11-12 18:49:53Z amiconn $ + * + * Copyright (C) 2006 by Barry Wardell + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef BACKLIGHT_TARGET_H +#define BACKLIGHT_TARGET_H + +#define _backlight_init() true +void _backlight_on(void); +void _backlight_off(void); +void _backlight_set_brightness(int brightness); +int __backlight_is_on(void); + +void _buttonlight_on(void); +void _buttonlight_off(void); +#endif Property changes on: firmware/target/generic/sdl/backlight-target.h ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/usb-target.h =================================================================== --- firmware/target/generic/sdl/usb-target.h (revision 0) +++ firmware/target/generic/sdl/usb-target.h (revision 0) @@ -0,0 +1,24 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: usb-target.h 12198 2007-02-04 21:46:01Z dave $ + * + * Copyright (C) 2006 by Barry Wardelll + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef USB_TARGET_H +#define USB_TARGET_H + +//void usb_init_device(void); + +#endif Property changes on: firmware/target/generic/sdl/usb-target.h ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/lcd-sdl.c =================================================================== --- firmware/target/generic/sdl/lcd-sdl.c (revision 0) +++ firmware/target/generic/sdl/lcd-sdl.c (revision 0) @@ -0,0 +1,450 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * + * Copyright (C) 2006 Dan Everton + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +/*SDL LCD driver created by concating both lcd-sdl and lcd-bitmap from the + uisimulator/sdl folder + */ + +#include "uisdl.h" +#include "lcd-sdl.h" + +SDL_Surface* lcd_surface; +int lcd_backlight_val; + +#if LCD_DEPTH <= 8 +#ifdef HAVE_BACKLIGHT +SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0}; +SDL_Color lcd_backlight_color_max = {UI_LCD_FGCOLORLIGHT, 0}; +#endif +SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0}; +SDL_Color lcd_color_max = {UI_LCD_FGCOLOR, 0}; +#endif + +#if LCD_DEPTH < 8 +int lcd_ex_shades = 0; +unsigned long (*lcd_ex_getpixel)(int, int) = NULL; +#endif + +static unsigned long get_lcd_pixel(int x, int y) +{ +#if LCD_DEPTH == 1 + return ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); +#elif LCD_DEPTH == 2 +#if LCD_PIXELFORMAT == HORIZONTAL_PACKING + return ((lcd_framebuffer[y][x/4] >> (2 * (~x & 3))) & 3); +#elif LCD_PIXELFORMAT == VERTICAL_PACKING + return ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3); +#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED + unsigned bits = (lcd_framebuffer[y/8][x] >> (y & 7)) & 0x0101; + return (bits | (bits >> 7)) & 3; +#endif +#elif LCD_DEPTH == 16 +#if LCD_PIXELFORMAT == RGB565SWAPPED + unsigned bits = lcd_framebuffer[y][x]; + return (bits >> 8) | (bits << 8); +#else + return lcd_framebuffer[y][x]; +#endif +#endif +} + +void lcd_update(void) +{ + /* update a full screen rect */ + lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); +} + +void lcd_update_rect(int x_start, int y_start, int width, int height) +{ + sdl_update_rect(lcd_surface, x_start, y_start, width, height, LCD_WIDTH, + LCD_HEIGHT, get_lcd_pixel); + sdl_gui_update(lcd_surface, x_start, y_start, width, height, LCD_WIDTH, + LCD_HEIGHT, background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0); +} + +#ifdef HAVE_BACKLIGHT +void sim_backlight(int value) +{ + lcd_backlight_val = value; + +#if LCD_DEPTH <= 8 + if (value > 0) { + sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, + &lcd_backlight_color_max, 0, (1< 0) { + sdl_set_gradient(lcd_surface, &lcd_backlight_color_max, + &lcd_backlight_color_zero, (1< 0) { + sdl_set_gradient(lcd_surface, &lcd_color_max, + &lcd_backlight_color_zero, (1<> 9 + * |G| = |74 -24 -51| |Cb - 128| >> 8 + * |B| |74 128 0| |Cr - 128| >> 9 + */ +#define YFAC (74) +#define RVFAC (101) +#define GUFAC (-24) +#define GVFAC (-51) +#define BUFAC (128) + +static inline int clamp(int val, int min, int max) +{ + if (val < min) + val = min; + else if (val > max) + val = max; + return val; +} + +void lcd_yuv_set_options(unsigned options) +{ + (void)options; +} + +/* Draw a partial YUV colour bitmap - similiar behavior to lcd_blit_yuv + in the core */ +void lcd_blit_yuv(unsigned char * const src[3], + int src_x, int src_y, int stride, + int x, int y, int width, int height) +{ + const unsigned char *ysrc, *usrc, *vsrc; + int linecounter; + fb_data *dst, *row_end; + long z; + + /* width and height must be >= 2 and an even number */ + width &= ~1; + linecounter = height >> 1; + +#if LCD_WIDTH >= LCD_HEIGHT + dst = &lcd_framebuffer[y][x]; + row_end = dst + width; +#else + dst = &lcd_framebuffer[x][LCD_WIDTH - y - 1]; + row_end = dst + LCD_WIDTH * width; +#endif + + z = stride * src_y; + ysrc = src[0] + z + src_x; + usrc = src[1] + (z >> 2) + (src_x >> 1); + vsrc = src[2] + (usrc - src[1]); + + /* stride => amount to jump from end of last row to start of next */ + stride -= width; + + /* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */ + + do + { + do + { + int y, cb, cr, rv, guv, bu, r, g, b; + + y = YFAC*(*ysrc++ - 16); + cb = *usrc++ - 128; + cr = *vsrc++ - 128; + + rv = RVFAC*cr; + guv = GUFAC*cb + GVFAC*cr; + bu = BUFAC*cb; + + r = y + rv; + g = y + guv; + b = y + bu; + + if ((unsigned)(r | g | b) > 64*256-1) + { + r = clamp(r, 0, 64*256-1); + g = clamp(g, 0, 64*256-1); + b = clamp(b, 0, 64*256-1); + } + + *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + +#if LCD_WIDTH >= LCD_HEIGHT + dst++; +#else + dst += LCD_WIDTH; +#endif + + y = YFAC*(*ysrc++ - 16); + r = y + rv; + g = y + guv; + b = y + bu; + + if ((unsigned)(r | g | b) > 64*256-1) + { + r = clamp(r, 0, 64*256-1); + g = clamp(g, 0, 64*256-1); + b = clamp(b, 0, 64*256-1); + } + + *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + +#if LCD_WIDTH >= LCD_HEIGHT + dst++; +#else + dst += LCD_WIDTH; +#endif + } + while (dst < row_end); + + ysrc += stride; + usrc -= width >> 1; + vsrc -= width >> 1; + +#if LCD_WIDTH >= LCD_HEIGHT + row_end += LCD_WIDTH; + dst += LCD_WIDTH - width; +#else + row_end -= 1; + dst -= LCD_WIDTH*width + 1; +#endif + + do + { + int y, cb, cr, rv, guv, bu, r, g, b; + + y = YFAC*(*ysrc++ - 16); + cb = *usrc++ - 128; + cr = *vsrc++ - 128; + + rv = RVFAC*cr; + guv = GUFAC*cb + GVFAC*cr; + bu = BUFAC*cb; + + r = y + rv; + g = y + guv; + b = y + bu; + + if ((unsigned)(r | g | b) > 64*256-1) + { + r = clamp(r, 0, 64*256-1); + g = clamp(g, 0, 64*256-1); + b = clamp(b, 0, 64*256-1); + } + + *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + +#if LCD_WIDTH >= LCD_HEIGHT + dst++; +#else + dst += LCD_WIDTH; +#endif + + y = YFAC*(*ysrc++ - 16); + r = y + rv; + g = y + guv; + b = y + bu; + + if ((unsigned)(r | g | b) > 64*256-1) + { + r = clamp(r, 0, 64*256-1); + g = clamp(g, 0, 64*256-1); + b = clamp(b, 0, 64*256-1); + } + + *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + +#if LCD_WIDTH >= LCD_HEIGHT + dst++; +#else + dst += LCD_WIDTH; +#endif + } + while (dst < row_end); + + ysrc += stride; + usrc += stride >> 1; + vsrc += stride >> 1; + +#if LCD_WIDTH >= LCD_HEIGHT + row_end += LCD_WIDTH; + dst += LCD_WIDTH - width; +#else + row_end -= 1; + dst -= LCD_WIDTH*width + 1; +#endif + } + while (--linecounter > 0); + +#if LCD_WIDTH >= LCD_HEIGHT + lcd_update_rect(x, y, width, height); +#else + lcd_update_rect(LCD_WIDTH - y - height, x, height, width); +#endif +} +#endif /* HAVE_LCD_COLOR */ + + + + +int display_zoom = 1; + +void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width, + int height, int max_x, int max_y, + unsigned long (*getpixel)(int, int)) +{ + int x, y; + int xmax, ymax; + SDL_Rect dest; + + ymax = y_start + height; + xmax = x_start + width; + + if(xmax > max_x) + xmax = max_x; + if(ymax >= max_y) + ymax = max_y; + + SDL_LockSurface(surface); + + dest.w = display_zoom; + dest.h = display_zoom; + + for (x = x_start; x < xmax; x++) { + dest.x = x * display_zoom; + + for (y = y_start; y < ymax; y++) { + dest.y = y * display_zoom; + + SDL_FillRect(surface, &dest, (Uint32)getpixel(x, y)); + } + } + + SDL_UnlockSurface(surface); +} + +void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width, + int height, int max_x, int max_y, int ui_x, int ui_y) +{ + int xmax, ymax; + + ymax = y_start + height; + xmax = x_start + width; + + if(xmax > max_x) + xmax = max_x; + if(ymax >= max_y) + ymax = max_y; + + SDL_Rect src = {x_start * display_zoom, y_start * display_zoom, + xmax * display_zoom, ymax * display_zoom}; + SDL_Rect dest= {(ui_x + x_start) * display_zoom, (ui_y + y_start) * display_zoom, + xmax * display_zoom, ymax * display_zoom}; + + SDL_BlitSurface(surface, &src, gui_surface, &dest); + SDL_Flip(gui_surface); +} + +/* set a range of bitmap indices to a gradient from startcolour to endcolour */ +void sdl_set_gradient(SDL_Surface *surface, SDL_Color *start, SDL_Color *end, + int first, int steps) +{ + int i; + SDL_Color palette[steps]; + + for (i = 0; i < steps; i++) { + palette[i].r = start->r + (end->r - start->r) * i / (steps - 1); + palette[i].g = start->g + (end->g - start->g) * i / (steps - 1); + palette[i].b = start->b + (end->b - start->b) * i / (steps - 1); + } + + SDL_SetPalette(surface, SDL_LOGPAL|SDL_PHYSPAL, palette, first, steps); +} + Property changes on: firmware/target/generic/sdl/lcd-sdl.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/boot.lds =================================================================== Property changes on: firmware/target/generic/sdl/boot.lds ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/button-target.h =================================================================== --- firmware/target/generic/sdl/button-target.h (revision 0) +++ firmware/target/generic/sdl/button-target.h (revision 0) @@ -0,0 +1,98 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: button-target.h 13442 2007-05-20 11:42:04Z markun $ + * + * Copyright (C) 2006 by Linus Nielsen Feltzing + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _BUTTON_TARGET_H_ +#define _BUTTON_TARGET_H_ + +#include +#include "config.h" + +#define HAS_BUTTON_HOLD + +bool button_hold(void); +void button_init_device(void); +int button_read_device(void); + +/* Toshiba Gigabeat specific button codes */ + +#define BUTTON_POWER 0x00000001 +#define BUTTON_MENU 0x00000002 + +#define BUTTON_LEFT 0x00000004 +#define BUTTON_RIGHT 0x00000008 +#define BUTTON_UP 0x00000010 +#define BUTTON_DOWN 0x00000020 + +#define BUTTON_VOL_UP 0x00000040 +#define BUTTON_VOL_DOWN 0x00000080 + +#define BUTTON_SELECT 0x00000100 +#define BUTTON_A 0x00000200 + +/* Remote control buttons */ + +#define BUTTON_RC_VOL_UP 0x00000400 +#define BUTTON_RC_VOL_DOWN 0x00000800 +#define BUTTON_RC_FF 0x00001000 +#define BUTTON_RC_REW 0x00002000 + +#define BUTTON_RC_PLAY 0x00004000 +#define BUTTON_RC_DSP 0x00008000 + +/* Toshiba Gigabeat specific remote button ADC values */ +/* The remote control uses ADC 1 to emulate button pushes + Reading (approx) Button HP plugged in? Remote plugged in? + 0 N/A Yes No + 125 Play/Pause Cant tell Yes + 241 Speaker+ Cant tell Yes + 369 Rewind Cant tell Yes + 492 Fast Fwd Cant tell Yes + 616 Vol + Cant tell Yes + 742 Vol - Cant tell Yes + 864 None Cant tell Yes + 1023 N/A No No +*/ + +/* + Notes: + + Buttons on the remote are translated into equivalent button presses just + as if you were pressing them on the Gigabeat itself. + + We cannot tell if the hold is asserted on the remote. The Hold function on + the remote is to block the output of the buttons changing. + + Only one button can be sensed at a time. If another is pressed, the button + with the lowest reading is dominant. So, if Rewind and Vol + are pressed + at the same time, Rewind value is the one that is read. +*/ + + + + +#define BUTTON_MAIN (BUTTON_POWER|BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\ + |BUTTON_UP|BUTTON_DOWN|BUTTON_VOL_UP|BUTTON_VOL_DOWN\ + |BUTTON_SELECT|BUTTON_A) + +#define BUTTON_REMOTE (BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN|BUTTON_RC_FF\ + |BUTTON_RC_REW|BUTTON_RC_PLAY|BUTTON_RC_DSP) + +#define POWEROFF_BUTTON BUTTON_POWER +#define POWEROFF_COUNT 10 + +#endif /* _BUTTON_TARGET_H_ */ Property changes on: firmware/target/generic/sdl/button-target.h ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/thread-sdl.c =================================================================== --- firmware/target/generic/sdl/thread-sdl.c (revision 0) +++ firmware/target/generic/sdl/thread-sdl.c (revision 0) @@ -0,0 +1,608 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: thread-sdl.c 16811 2008-03-26 01:50:41Z jethead71 $ + * + * Copyright (C) 2006 Dan Everton + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include "system-sdl.h" +#include "thread-sdl.h" +#include "system.h" +#include "kernel.h" +#include "thread.h" +#include "panic.h" +#include "debug.h" + +/* Define this as 1 to show informational messages that are not errors. */ +#define THREAD_SDL_DEBUGF_ENABLED 0 + +#if THREAD_SDL_DEBUGF_ENABLED +#define THREAD_SDL_DEBUGF(...) DEBUGF(__VA_ARGS__) +static char __name[32]; +#define THREAD_SDL_GET_NAME(thread) \ + ({ thread_get_name(__name, ARRAYLEN(__name), thread); __name; }) +#else +#define THREAD_SDL_DEBUGF(...) +#define THREAD_SDL_GET_NAME(thread) +#endif + +#define THREAD_PANICF(str...) \ + ({ panicf(str); exit(-1); }) + +/* Thread/core entries as in rockbox core */ +struct core_entry cores[NUM_CORES]; +struct thread_entry threads[MAXTHREADS]; +/* Jump buffers for graceful exit - kernel threads don't stay neatly + * in their start routines responding to messages so this is the only + * way to get them back in there so they may exit */ +static jmp_buf thread_jmpbufs[MAXTHREADS]; +static SDL_mutex *m; +static bool threads_exit = false; + +extern long start_tick; + +void thread_sdl_shutdown(void) +{ + int i; + /* Take control */ + SDL_LockMutex(m); + + /* Tell all threads jump back to their start routines, unlock and exit + gracefully - we'll check each one in turn for it's status. Threads + _could_ terminate via remove_thread or multiple threads could exit + on each unlock but that is safe. */ + threads_exit = true; + + for (i = 0; i < MAXTHREADS; i++) + { + struct thread_entry *thread = &threads[i]; + if (thread->context.t != NULL) + { + /* Signal thread on delay or block */ + SDL_Thread *t = thread->context.t; + SDL_SemPost(thread->context.s); + SDL_UnlockMutex(m); + /* Wait for it to finish */ + SDL_WaitThread(t, NULL); + /* Relock for next thread signal */ + SDL_LockMutex(m); + } + } + + SDL_UnlockMutex(m); + SDL_DestroyMutex(m); +} + +/* Do main thread creation in this file scope to avoid the need to double- + return to a prior call-level which would be unaware of the fact setjmp + was used */ +extern void app_main(void *param); +static int thread_sdl_app_main(void *param) +{ + SDL_LockMutex(m); + cores[CURRENT_CORE].running = &threads[0]; + + /* Set the jump address for return */ + if (setjmp(thread_jmpbufs[0]) == 0) + { + app_main(param); + /* should not ever be reached but... */ + THREAD_PANICF("app_main returned!\n"); + } + + /* Unlock and exit */ + SDL_UnlockMutex(m); + return 0; +} + +/* Initialize SDL threading */ +bool thread_sdl_init(void *param) +{ + struct thread_entry *thread; + memset(cores, 0, sizeof(cores)); + memset(threads, 0, sizeof(threads)); + + m = SDL_CreateMutex(); + + if (SDL_LockMutex(m) == -1) + { + DEBUGF("Couldn't lock mutex\n"); + return false; + } + + /* Slot 0 is reserved for the main thread - initialize it here and + then create the SDL thread - it is possible to have a quick, early + shutdown try to access the structure. */ + thread = &threads[0]; + thread->stack = (uintptr_t *)" "; + thread->stack_size = 8; + thread->name = "main"; + thread->state = STATE_RUNNING; + thread->context.s = SDL_CreateSemaphore(0); + cores[CURRENT_CORE].running = thread; + + if (thread->context.s == NULL) + { + DEBUGF("Failed to create main semaphore\n"); + return false; + } + + thread->context.t = SDL_CreateThread(thread_sdl_app_main, param); + + if (thread->context.t == NULL) + { + SDL_DestroySemaphore(thread->context.s); + DEBUGF( "Failed to create main thread\n"); + return false; + } + + THREAD_SDL_DEBUGF("Main thread: %p\n", thread); + + SDL_UnlockMutex(m); + return true; +} + +/* A way to yield and leave the threading system for extended periods */ +void thread_sdl_thread_lock(void *me) +{ + SDL_LockMutex(m); + cores[CURRENT_CORE].running = (struct thread_entry *)me; + + if (threads_exit) + thread_exit(); +} + +void * thread_sdl_thread_unlock(void) +{ + struct thread_entry *current = cores[CURRENT_CORE].running; + SDL_UnlockMutex(m); + return current; +} + +static struct thread_entry * find_empty_thread_slot(void) +{ + struct thread_entry *thread = NULL; + int n; + + for (n = 0; n < MAXTHREADS; n++) + { + int state = threads[n].state; + + if (state == STATE_KILLED) + { + thread = &threads[n]; + break; + } + } + + return thread; +} + +static void add_to_list_l(struct thread_entry **list, + struct thread_entry *thread) +{ + if (*list == NULL) + { + /* Insert into unoccupied list */ + thread->l.next = thread; + thread->l.prev = thread; + *list = thread; + } + else + { + /* Insert last */ + thread->l.next = *list; + thread->l.prev = (*list)->l.prev; + thread->l.prev->l.next = thread; + (*list)->l.prev = thread; + } +} + +static void remove_from_list_l(struct thread_entry **list, + struct thread_entry *thread) +{ + if (thread == thread->l.next) + { + /* The only item */ + *list = NULL; + return; + } + + if (thread == *list) + { + /* List becomes next item */ + *list = thread->l.next; + } + + /* Fix links to jump over the removed entry. */ + thread->l.prev->l.next = thread->l.next; + thread->l.next->l.prev = thread->l.prev; +} + +struct thread_entry *thread_get_current(void) +{ + return cores[CURRENT_CORE].running; +} + +void switch_thread(void) +{ + struct thread_entry *current = cores[CURRENT_CORE].running; + + enable_irq(); + + switch (current->state) + { + case STATE_RUNNING: + { + SDL_UnlockMutex(m); + /* Any other thread waiting already will get it first */ + SDL_LockMutex(m); + break; + } /* STATE_RUNNING: */ + + case STATE_BLOCKED: + { + int oldlevel; + + SDL_UnlockMutex(m); + SDL_SemWait(current->context.s); + SDL_LockMutex(m); + + oldlevel = disable_irq_save(); + current->state = STATE_RUNNING; + restore_irq(oldlevel); + break; + } /* STATE_BLOCKED: */ + + case STATE_BLOCKED_W_TMO: + { + int result, oldlevel; + + SDL_UnlockMutex(m); + result = SDL_SemWaitTimeout(current->context.s, current->tmo_tick); + SDL_LockMutex(m); + + oldlevel = disable_irq_save(); + + if (current->state == STATE_BLOCKED_W_TMO) + { + /* Timed out */ + remove_from_list_l(current->bqp, current); + +#ifdef HAVE_WAKEUP_EXT_CB + if (current->wakeup_ext_cb != NULL) + current->wakeup_ext_cb(current); +#endif + current->state = STATE_RUNNING; + } + + if (result == SDL_MUTEX_TIMEDOUT) + { + /* Other signals from an explicit wake could have been made before + * arriving here if we timed out waiting for the semaphore. Make + * sure the count is reset. */ + while (SDL_SemValue(current->context.s) > 0) + SDL_SemTryWait(current->context.s); + } + + restore_irq(oldlevel); + break; + } /* STATE_BLOCKED_W_TMO: */ + + case STATE_SLEEPING: + { + SDL_UnlockMutex(m); + SDL_SemWaitTimeout(current->context.s, current->tmo_tick); + SDL_LockMutex(m); + current->state = STATE_RUNNING; + break; + } /* STATE_SLEEPING: */ + } + + cores[CURRENT_CORE].running = current; + + if (threads_exit) + thread_exit(); +} + +void sleep_thread(int ticks) +{ + struct thread_entry *current = cores[CURRENT_CORE].running; + int rem; + + current->state = STATE_SLEEPING; + + rem = (SDL_GetTicks() - start_tick) % (1000/HZ); + if (rem < 0) + rem = 0; + + current->tmo_tick = (1000/HZ) * ticks + ((1000/HZ)-1) - rem; +} + +void block_thread(struct thread_entry *current) +{ + current->state = STATE_BLOCKED; + add_to_list_l(current->bqp, current); +} + +void block_thread_w_tmo(struct thread_entry *current, int ticks) +{ + current->state = STATE_BLOCKED_W_TMO; + current->tmo_tick = (1000/HZ)*ticks; + add_to_list_l(current->bqp, current); +} + +unsigned int wakeup_thread(struct thread_entry **list) +{ + struct thread_entry *thread = *list; + + if (thread != NULL) + { + switch (thread->state) + { + case STATE_BLOCKED: + case STATE_BLOCKED_W_TMO: + remove_from_list_l(list, thread); + thread->state = STATE_RUNNING; + SDL_SemPost(thread->context.s); + return THREAD_OK; + } + } + + return THREAD_NONE; +} + +unsigned int thread_queue_wake(struct thread_entry **list) +{ + unsigned int result = THREAD_NONE; + + for (;;) + { + unsigned int rc = wakeup_thread(list); + + if (rc == THREAD_NONE) + break; + + result |= rc; + } + + return result; +} + +void thread_thaw(struct thread_entry *thread) +{ + if (thread->state == STATE_FROZEN) + { + thread->state = STATE_RUNNING; + SDL_SemPost(thread->context.s); + } +} + +int runthread(void *data) +{ + struct thread_entry *current; + jmp_buf *current_jmpbuf; + + /* Cannot access thread variables before locking the mutex as the + data structures may not be filled-in yet. */ + SDL_LockMutex(m); + cores[CURRENT_CORE].running = (struct thread_entry *)data; + current = cores[CURRENT_CORE].running; + current_jmpbuf = &thread_jmpbufs[current - threads]; + + /* Setup jump for exit */ + if (setjmp(*current_jmpbuf) == 0) + { + /* Run the thread routine */ + if (current->state == STATE_FROZEN) + { + SDL_UnlockMutex(m); + SDL_SemWait(current->context.s); + SDL_LockMutex(m); + cores[CURRENT_CORE].running = current; + } + + if (!threads_exit) + { + current->context.start(); + THREAD_SDL_DEBUGF("Thread Done: %d (%s)\n", + current - threads, THREAD_SDL_GET_NAME(current)); + /* Thread routine returned - suicide */ + } + + thread_exit(); + } + else + { + /* Unlock and exit */ + SDL_UnlockMutex(m); + } + + return 0; +} + +struct thread_entry* + create_thread(void (*function)(void), void* stack, size_t stack_size, + unsigned flags, const char *name) +{ + struct thread_entry *thread; + SDL_Thread* t; + SDL_sem *s; + + THREAD_SDL_DEBUGF("Creating thread: (%s)\n", name ? name : ""); + + thread = find_empty_thread_slot(); + if (thread == NULL) + { + DEBUGF("Failed to find thread slot\n"); + return NULL; + } + + s = SDL_CreateSemaphore(0); + if (s == NULL) + { + DEBUGF("Failed to create semaphore\n"); + return NULL; + } + + t = SDL_CreateThread(runthread, thread); + if (t == NULL) + { + DEBUGF("Failed to create SDL thread\n"); + SDL_DestroySemaphore(s); + return NULL; + } + + thread->stack = stack; + thread->stack_size = stack_size; + thread->name = name; + thread->state = (flags & CREATE_THREAD_FROZEN) ? + STATE_FROZEN : STATE_RUNNING; + thread->context.start = function; + thread->context.t = t; + thread->context.s = s; + + THREAD_SDL_DEBUGF("New Thread: %d (%s)\n", + thread - threads, THREAD_SDL_GET_NAME(thread)); + + return thread; +} + +void init_threads(void) +{ + /* Main thread is already initialized */ + if (cores[CURRENT_CORE].running != &threads[0]) + { + THREAD_PANICF("Wrong main thread in init_threads: %p\n", + cores[CURRENT_CORE].running); + } + + THREAD_SDL_DEBUGF("First Thread: %d (%s)\n", + 0, THREAD_SDL_GET_NAME(&threads[0])); +} + +void remove_thread(struct thread_entry *thread) +{ + struct thread_entry *current = cores[CURRENT_CORE].running; + SDL_Thread *t; + SDL_sem *s; + + int oldlevel = disable_irq_save(); + + if (thread == NULL) + { + thread = current; + } + + t = thread->context.t; + s = thread->context.s; + thread->context.t = NULL; + + if (thread != current) + { + switch (thread->state) + { + case STATE_BLOCKED: + case STATE_BLOCKED_W_TMO: + /* Remove thread from object it's waiting on */ + remove_from_list_l(thread->bqp, thread); + +#ifdef HAVE_WAKEUP_EXT_CB + if (thread->wakeup_ext_cb != NULL) + thread->wakeup_ext_cb(thread); +#endif + break; + } + + SDL_SemPost(s); + } + + THREAD_SDL_DEBUGF("Removing thread: %d (%s)\n", + thread - threads, THREAD_SDL_GET_NAME(thread)); + + thread->state = STATE_KILLED; + thread_queue_wake(&thread->queue); + + SDL_DestroySemaphore(s); + + if (thread == current) + { + /* Do a graceful exit - perform the longjmp back into the thread + function to return */ + restore_irq(oldlevel); + longjmp(thread_jmpbufs[current - threads], 1); + } + + SDL_KillThread(t); + restore_irq(oldlevel); +} + +void thread_exit(void) +{ + remove_thread(NULL); +} + +void thread_wait(struct thread_entry *thread) +{ + struct thread_entry *current = cores[CURRENT_CORE].running; + + if (thread == NULL) + thread = current; + + if (thread->state != STATE_KILLED) + { + current->bqp = &thread->queue; + block_thread(current); + switch_thread(); + } +} + +int thread_stack_usage(const struct thread_entry *thread) +{ + return 50; + (void)thread; +} + +unsigned thread_get_status(const struct thread_entry *thread) +{ + return thread->state; +} + +/* Return name if one or ID if none */ +void thread_get_name(char *buffer, int size, + struct thread_entry *thread) +{ + if (size <= 0) + return; + + *buffer = '\0'; + + if (thread) + { + /* Display thread name if one or ID if none */ + bool named = thread->name && *thread->name; + const char *fmt = named ? "%s" : "%08lX"; + intptr_t name = named ? + (intptr_t)thread->name : (intptr_t)thread; + snprintf(buffer, size, fmt, name); + } +} Property changes on: firmware/target/generic/sdl/thread-sdl.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/sdl/button-sdl.c =================================================================== --- firmware/target/generic/sdl/button-sdl.c (revision 0) +++ firmware/target/generic/sdl/button-sdl.c (revision 0) @@ -0,0 +1,1140 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: button.c 17525 2008-05-15 18:01:14Z mcuelenaere $ + * + * Copyright (C) 2002 by Felix Arends + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "uisdl.h" +#include "lcd-charcells.h" +#include "lcd-remote.h" +#include "config.h" +#include "button.h" +#include "kernel.h" +#include "backlight.h" + + +#include "debug.h" + +static intptr_t button_data; /* data value from last message dequeued */ + +#ifdef HAVE_TOUCHPAD +static int mouse_coords = 0; +static enum touchpad_mode touchpad_mode = TOUCHPAD_POINT; +void touchpad_set_mode(enum touchpad_mode mode) +{ + touchpad_mode = mode; +} +enum touchpad_mode touchpad_get_mode(void) +{ + return touchpad_mode; +} +#endif +/* how long until repeat kicks in */ +#define REPEAT_START 6 + +/* the speed repeat starts at */ +#define REPEAT_INTERVAL_START 4 + +/* speed repeat finishes at */ +#define REPEAT_INTERVAL_FINISH 2 + +#if defined(IRIVER_H100_SERIES) || defined (IRIVER_H300_SERIES) +int _remote_type=REMOTETYPE_H100_LCD; + +int remote_type(void) +{ + return _remote_type; +} +#endif + +struct event_queue button_queue; + +static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ + +#ifdef HAVE_BACKLIGHT +static bool filter_first_keypress; + +void set_backlight_filter_keypress(bool value) +{ + filter_first_keypress = value; +} +#ifdef HAVE_REMOTE_LCD +static bool remote_filter_first_keypress; + +void set_remote_backlight_filter_keypress(bool value) +{ + remote_filter_first_keypress = value; +} +#endif +#endif + +#ifdef HAS_BUTTON_HOLD +bool hold_button_state = false; +bool button_hold(void) { + return hold_button_state; +} +#endif + +#ifdef HAS_REMOTE_BUTTON_HOLD +bool remote_hold_button_state = false; +bool remote_button_hold(void) { + return remote_hold_button_state; +} +#endif + +static int lastbtn; +void button_event(int key, bool pressed) +{ + int new_btn = 0; + int diff = 0; + int data = 0; + static int count = 0; + static int repeat_speed = REPEAT_INTERVAL_START; + static int repeat_count = 0; + static bool repeat = false; + static bool post = false; +#ifdef HAVE_BACKLIGHT + static bool skip_release = false; +#ifdef HAVE_REMOTE_LCD + static bool skip_remote_release = false; +#endif +#endif + static bool usb_connected = false; + if (usb_connected && key != SDLK_u) + return; + switch (key) + { + +#ifdef HAVE_TOUCHPAD + case BUTTON_TOUCHPAD: + data = mouse_coords; + switch (touchpad_mode) + { + case TOUCHPAD_POINT: + new_btn = BUTTON_TOUCHPAD; + break; + case TOUCHPAD_BUTTON: + { + static int touchpad_buttons[3][3] = { + {BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT}, + {BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT}, + {BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT}, + }; + int px_x = ((data&0xffff0000)>>16), px_y = ((data&0x0000ffff)); + new_btn = touchpad_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)]; + break; + } + } + break; + case SDLK_KP7: + new_btn = BUTTON_TOPLEFT; + break; + case SDLK_KP8: + new_btn = BUTTON_TOPMIDDLE; + break; + case SDLK_KP9: + new_btn = BUTTON_TOPRIGHT; + break; + case SDLK_KP4: + new_btn = BUTTON_MIDLEFT; + break; + case SDLK_KP5: + new_btn = BUTTON_CENTER; + break; + case SDLK_KP6: + new_btn = BUTTON_MIDRIGHT; + break; + case SDLK_KP1: + new_btn = BUTTON_BOTTOMLEFT; + break; + case SDLK_KP2: + new_btn = BUTTON_BOTTOMMIDDLE; + break; + case SDLK_KP3: + new_btn = BUTTON_BOTTOMRIGHT; + break; + +#endif + case SDLK_u: + if (!pressed) + { + usb_connected = !usb_connected; + if (usb_connected) + queue_post(&button_queue, SYS_USB_CONNECTED, 0); + else + queue_post(&button_queue, SYS_USB_DISCONNECTED, 0); + } + return; + +#ifdef HAS_BUTTON_HOLD + case SDLK_h: + if(pressed) + { + hold_button_state = !hold_button_state; + DEBUGF("Hold button is %s\n", hold_button_state?"ON":"OFF"); + } + return; +#endif + +#ifdef HAS_REMOTE_BUTTON_HOLD + case SDLK_j: + if(pressed) + { + remote_hold_button_state = !remote_hold_button_state; + DEBUGF("Remote hold button is %s\n", + remote_hold_button_state?"ON":"OFF"); + } + return; +#endif + +#if CONFIG_KEYPAD == GIGABEAT_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_POWER; + break; + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + case SDLK_a: + new_btn = BUTTON_A; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP_PERIOD: + case SDLK_INSERT: + new_btn = BUTTON_MENU; + break; + +#elif CONFIG_KEYPAD == GIGABEAT_S_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_F8: + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; + case SDLK_KP_PLUS: + case SDLK_KP_ENTER: + case SDLK_RETURN: + new_btn = BUTTON_PLAY; + break; + case SDLK_KP7: + new_btn = BUTTON_BACK; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP9: + case SDLK_KP_PERIOD: + case SDLK_INSERT: + new_btn = BUTTON_MENU; + break; + +#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_PLAY; + break; + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + case SDLK_a: + new_btn = BUTTON_POWER; + break; + case SDLK_KP_DIVIDE: + case SDLK_F1: + new_btn = BUTTON_REC; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + +#elif CONFIG_KEYPAD == IAUDIO_M3_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_VOL_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_VOL_DOWN; + break; + case SDLK_KP_PERIOD: + case SDLK_INSERT: + new_btn = BUTTON_MODE; + break; + case SDLK_KP_DIVIDE: + case SDLK_F1: + new_btn = BUTTON_REC; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_PLAY; + break; + +#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \ + || (CONFIG_KEYPAD == IPOD_4G_PAD) + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_SCROLL_BACK; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_SCROLL_FWD; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_PLAY; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP_PERIOD: + case SDLK_INSERT: + new_btn = BUTTON_MENU; + break; + +#elif CONFIG_KEYPAD == IRIVER_H10_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_SCROLL_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_SCROLL_DOWN; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_POWER; + break; + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; + case SDLK_KP_DIVIDE: + case SDLK_F1: + new_btn = BUTTON_REW; + break; + case SDLK_KP_MULTIPLY: + case SDLK_F2: + new_btn = BUTTON_FF; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_PLAY; + break; + +#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) + case SDLK_t: + if(pressed) + switch(_remote_type) + { + case REMOTETYPE_UNPLUGGED: + _remote_type=REMOTETYPE_H100_LCD; + DEBUGF("Changed remote type to H100\n"); + break; + case REMOTETYPE_H100_LCD: + _remote_type=REMOTETYPE_H300_LCD; + DEBUGF("Changed remote type to H300\n"); + break; + case REMOTETYPE_H300_LCD: + _remote_type=REMOTETYPE_H300_NONLCD; + DEBUGF("Changed remote type to H300 NON-LCD\n"); + break; + case REMOTETYPE_H300_NONLCD: + _remote_type=REMOTETYPE_UNPLUGGED; + DEBUGF("Changed remote type to none\n"); + break; + } + break; + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_ON; + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + case SDLK_a: + new_btn = BUTTON_OFF; + break; + case SDLK_KP_DIVIDE: + case SDLK_F1: + new_btn = BUTTON_REC; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP_PERIOD: + case SDLK_INSERT: + new_btn = BUTTON_MODE; + break; + +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_PLAY; + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + case SDLK_a: + new_btn = BUTTON_EQ; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP_PERIOD: + case SDLK_INSERT: + new_btn = BUTTON_MODE; + break; + +#elif CONFIG_KEYPAD == ONDIO_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + case SDLK_a: + new_btn = BUTTON_OFF; + break; + case SDLK_KP_PERIOD: + case SDLK_INSERT: + new_btn = BUTTON_MENU; + break; + +#elif CONFIG_KEYPAD == PLAYER_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_PLAY; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_STOP; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_ON; + break; + case SDLK_KP_PERIOD: + case SDLK_INSERT: + new_btn = BUTTON_MENU; + break; + +#elif CONFIG_KEYPAD == RECORDER_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_ON; + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + case SDLK_a: + new_btn = BUTTON_OFF; + break; + case SDLK_KP_DIVIDE: + case SDLK_F1: + new_btn = BUTTON_F1; + break; + case SDLK_KP_MULTIPLY: + case SDLK_F2: + new_btn = BUTTON_F2; + break; + case SDLK_KP_MINUS: + case SDLK_F3: + new_btn = BUTTON_F3; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_PLAY; + break; + +#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_ON; + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + case SDLK_a: + new_btn = BUTTON_OFF; + break; + case SDLK_KP_DIVIDE: + case SDLK_F1: + new_btn = BUTTON_F1; + break; + case SDLK_KP_MULTIPLY: + case SDLK_F2: + new_btn = BUTTON_F2; + break; + case SDLK_KP_MINUS: + case SDLK_F3: + new_btn = BUTTON_F3; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + +#elif CONFIG_KEYPAD == SANSA_E200_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_SCROLL_BACK; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_SCROLL_FWD; + break; + case SDLK_KP9: + new_btn = BUTTON_UP; + break; + case SDLK_KP3: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP1: + new_btn = BUTTON_POWER; + break; + case SDLK_KP7: + new_btn = BUTTON_REC; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + +#elif CONFIG_KEYPAD == SANSA_C200_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP3: + new_btn = BUTTON_POWER; + break; + case SDLK_KP1: + new_btn = BUTTON_REC; + break; + case SDLK_KP5: + case SDLK_KP_ENTER: + case SDLK_RETURN: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP7: + new_btn = BUTTON_VOL_DOWN; + break; + case SDLK_KP9: + new_btn = BUTTON_VOL_UP; + break; + +#elif CONFIG_KEYPAD == MROBE500_PAD + case SDLK_F9: + new_btn = BUTTON_RC_HEART; + break; + case SDLK_F10: + new_btn = BUTTON_RC_MODE; + break; + case SDLK_F11: + new_btn = BUTTON_RC_VOL_DOWN; + break; + case SDLK_F12: + new_btn = BUTTON_RC_VOL_UP; + break; + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_UP: + new_btn = BUTTON_RC_PLAY; + break; + case SDLK_DOWN: + new_btn = BUTTON_RC_DOWN; + break; + case SDLK_F8: + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; +#elif CONFIG_KEYPAD == MROBE100_PAD + case SDLK_KP1: + new_btn = BUTTON_DISPLAY; + break; + case SDLK_KP7: + new_btn = BUTTON_MENU; + break; + case SDLK_KP9: + new_btn = BUTTON_PLAY; + break; + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP_MULTIPLY: + case SDLK_F8: + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; + +#elif CONFIG_KEYPAD == COWOND2_PAD + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; + case SDLK_KP_PLUS: + new_btn = BUTTON_PLUS; + break; + case SDLK_KP_MINUS: + new_btn = BUTTON_MINUS; + break; + case SDLK_KP_ENTER: + new_btn = BUTTON_MENU; + break; +#elif CONFIG_KEYPAD == CREATIVEZVM_PAD + case SDLK_KP1: + new_btn = BUTTON_BACK; + break; + case SDLK_KP3: + new_btn = BUTTON_MENU; + break; + case SDLK_KP7: + new_btn = BUTTON_CUSTOM; + break; + case SDLK_KP9: + new_btn = BUTTON_PLAY; + break; + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP_MULTIPLY: + case SDLK_F8: + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; +#elif CONFIG_KEYPAD == CREATIVEZV_PAD + case SDLK_KP1: + new_btn = BUTTON_PREV; + break; + case SDLK_KP3: + new_btn = BUTTON_NEXT; + break; + case SDLK_KP7: + new_btn = BUTTON_BACK; + break; + case SDLK_p: + new_btn = BUTTON_PLAY; + break; + case SDLK_KP9: + new_btn = BUTTON_MENU; + break; + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP_MULTIPLY: + case SDLK_F8: + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; + case SDLK_z: + new_btn = BUTTON_VOL_DOWN; + break; + case SDLK_s: + new_btn = BUTTON_VOL_UP; + break; +#elif CONFIG_KEYPAD == SLD_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_POWER; + break; + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP_PERIOD: + case SDLK_INSERT: + new_btn = BUTTON_MENU; + break; +#else +#error No keymap defined! +#endif /* CONFIG_KEYPAD */ + case SDLK_KP0: + case SDLK_F5: + if(pressed) + { + queue_broadcast(SYS_SCREENDUMP, 0); + return; + } + break; + } + + if (pressed) + btn |= new_btn; + else + btn &= ~new_btn; + + /* Lots of stuff copied from real button.c. Not good, I think... */ + + /* Find out if a key has been released */ + diff = btn ^ lastbtn; + if(diff && (btn & diff) == 0) + { +#ifdef HAVE_BACKLIGHT +#ifdef HAVE_REMOTE_LCD + if(diff & BUTTON_REMOTE) + if(!skip_remote_release) + queue_post(&button_queue, BUTTON_REL | diff, data); + else + skip_remote_release = false; + else +#endif + if(!skip_release) + queue_post(&button_queue, BUTTON_REL | diff, data); + else + skip_release = false; +#else + queue_post(&button_queue, BUTTON_REL | diff, data); +#endif + } + + else + { + if ( btn ) + { + /* normal keypress */ + if ( btn != lastbtn ) + { + post = true; + repeat = false; + repeat_speed = REPEAT_INTERVAL_START; + + } + else /* repeat? */ + { + if ( repeat ) + { + if (!post) + count--; + if (count == 0) + { + post = true; + /* yes we have repeat */ + repeat_speed--; + if (repeat_speed < REPEAT_INTERVAL_FINISH) + repeat_speed = REPEAT_INTERVAL_FINISH; + count = repeat_speed; + + repeat_count++; + } + } + else + { + if (count++ > REPEAT_START) + { + post = true; + repeat = true; + repeat_count = 0; + /* initial repeat */ + count = REPEAT_INTERVAL_START; + } + } + } + if ( post ) + { + if(repeat) + { + if (queue_empty(&button_queue)) + { + queue_post(&button_queue, BUTTON_REPEAT | btn, data); +#ifdef HAVE_BACKLIGHT +#ifdef HAVE_REMOTE_LCD + if(btn & BUTTON_REMOTE) + { + if(skip_remote_release) + skip_remote_release = false; + } + else +#endif + if(skip_release) + skip_release = false; +#endif + post = false; + } + } + else + { +#ifdef HAVE_BACKLIGHT +#ifdef HAVE_REMOTE_LCD + if (btn & BUTTON_REMOTE) { + if (!remote_filter_first_keypress + || is_remote_backlight_on(false)) + queue_post(&button_queue, btn, data); + else + skip_remote_release = true; + } + else +#endif + if (!filter_first_keypress + || is_backlight_on(false)) + queue_post(&button_queue, btn, data); + else + skip_release = true; +#else /* no backlight, nothing to skip */ + queue_post(&button_queue, btn, data); +#endif + post = false; + } + +#ifdef HAVE_REMOTE_LCD + if(btn & BUTTON_REMOTE) + remote_backlight_on(); + else +#endif + backlight_on(); + + } + } + else + { + repeat = false; + count = 0; + } + } + lastbtn = btn & ~(BUTTON_REL | BUTTON_REPEAT); +} + +/* Again copied from real button.c... */ + +int button_queue_count( void ) +{ + return queue_count(&button_queue); +} + +long button_get(bool block) +{ + struct queue_event ev; + + if ( block || !queue_empty(&button_queue) ) { + queue_wait(&button_queue, &ev); + button_data = ev.data; + return ev.id; + } + return BUTTON_NONE; +} + +long button_get_w_tmo(int ticks) +{ + struct queue_event ev; + queue_wait_w_tmo(&button_queue, &ev, ticks); + if (ev.id == SYS_TIMEOUT) + ev.id = BUTTON_NONE; + else + button_data = ev.data; + + return ev.id; +} + +intptr_t button_get_data(void) +{ +#ifdef HAVE_TOUCHPAD + return button_data; +#else + /* Needed by the accelerating wheel driver for Sansa e200 */ + return 1 << 24; +#endif +} + +#ifdef HAVE_TOUCHPAD +extern bool debug_wps; +void mouse_tick_task(void) +{ + static int last_check = 0; + int x,y; + if (TIME_BEFORE(current_tick, last_check+(HZ/10))) + return; + last_check = current_tick; + if (SDL_GetMouseState(&x, &y) & SDL_BUTTON(SDL_BUTTON_LEFT)) + { + mouse_coords = (x<<16)|y; + button_event(BUTTON_TOUCHPAD, true); + if (debug_wps) + printf("Mouse at: (%d, %d)\n", x, y); + } +} +#endif +void button_init(void) +{ +#ifdef HAVE_TOUCHPAD + tick_add_task(mouse_tick_task); +#endif +} + +int button_status(void) +{ + return btn; +} + +void button_clear_queue(void) +{ + queue_clear(&button_queue); +} + Property changes on: firmware/target/generic/sdl/button-sdl.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/system-generic.h =================================================================== --- firmware/target/generic/system-generic.h (revision 0) +++ firmware/target/generic/system-generic.h (revision 0) @@ -0,0 +1,160 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: system-arm.h 17148 2008-04-16 20:44:10Z jethead71 $ + * + * Copyright (C) 2002 by Alan Korr + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef SYSTEM_GENERIC_H +#define SYSTEM_GENERIC_H + +#define nop \ + asm volatile ("nop") + +static inline uint16_t swap16(uint16_t value) + /* + result[15..8] = value[ 7..0]; + result[ 7..0] = value[15..8]; + */ +{ + return (value >> 8) | (value << 8); +} + +static inline uint32_t swap32(uint32_t value) + /* + result[31..24] = value[ 7.. 0]; + result[23..16] = value[15.. 8]; + result[15.. 8] = value[23..16]; + result[ 7.. 0] = value[31..24]; + */ +{ + uint32_t hi = swap16(value >> 16); + uint32_t lo = swap16(value & 0xffff); + return (lo << 16) | hi; +} + +static inline uint32_t swap_odd_even32(uint32_t value) +{ + /* + result[31..24],[15.. 8] = value[23..16],[ 7.. 0] + result[23..16],[ 7.. 0] = value[31..24],[15.. 8] + */ + uint32_t t = value & 0xff00ff00; + return (t >> 8) | ((t ^ value) << 8); +} + +#if 0 +/* Core-level interrupt masking */ + +/* This one returns the old status */ +#define IRQ_ENABLED 0x00 +#define IRQ_DISABLED 0x80 +#define IRQ_STATUS 0x80 +#define FIQ_ENABLED 0x00 +#define FIQ_DISABLED 0x40 +#define FIQ_STATUS 0x40 +#define IRQ_FIQ_ENABLED 0x00 +#define IRQ_FIQ_DISABLED 0xc0 +#define IRQ_FIQ_STATUS 0xc0 +#define HIGHEST_IRQ_LEVEL IRQ_DISABLED + +#define set_irq_level(status) \ + set_interrupt_status((status), IRQ_STATUS) +#define set_fiq_status(status) \ + set_interrupt_status((status), FIQ_STATUS) + +static inline int set_interrupt_status(int status, int mask) +{ + unsigned long cpsr; + int oldstatus; + /* Read the old levels and set the new ones */ + asm volatile ( + "mrs %1, cpsr \n" + "bic %0, %1, %[mask] \n" + "orr %0, %0, %2 \n" + "msr cpsr_c, %0 \n" + : "=&r,r"(cpsr), "=&r,r"(oldstatus) + : "r,i"(status & mask), [mask]"i,i"(mask)); + + return oldstatus; +} + +static inline void enable_interrupt(int mask) +{ + /* Clear I and/or F disable bit */ + int tmp; + asm volatile ( + "mrs %0, cpsr \n" + "bic %0, %0, %1 \n" + "msr cpsr_c, %0 \n" + : "=&r"(tmp) : "i"(mask)); +} + +static inline void disable_interrupt(int mask) +{ + /* Set I and/or F disable bit */ + int tmp; + asm volatile ( + "mrs %0, cpsr \n" + "orr %0, %0, %1 \n" + "msr cpsr_c, %0 \n" + : "=&r"(tmp) : "i"(mask)); +} + +#define disable_irq() \ + disable_interrupt(IRQ_STATUS) + +#define enable_irq() \ + enable_interrupt(IRQ_STATUS) + +#define disable_fiq() \ + disable_interrupt(FIQ_STATUS) + +#define enable_fiq() \ + enable_interrupt(FIQ_STATUS) + +static inline int disable_interrupt_save(int mask) +{ + /* Set I and/or F disable bit and return old cpsr value */ + int cpsr, tmp; + asm volatile ( + "mrs %1, cpsr \n" + "orr %0, %1, %2 \n" + "msr cpsr_c, %0 \n" + : "=&r"(tmp), "=&r"(cpsr) + : "i"(mask)); + return cpsr; +} + +#define disable_irq_save() \ + disable_interrupt_save(IRQ_STATUS) + +#define disable_fiq_save() \ + disable_interrupt_save(FIQ_STATUS) + +static inline void restore_interrupt(int cpsr) +{ + /* Set cpsr_c from value returned by disable_interrupt_save + * or set_interrupt_status */ + asm volatile ("msr cpsr_c, %0" : : "r"(cpsr)); +} + +#define restore_irq(cpsr) \ + restore_interrupt(cpsr) + +#define restore_fiq(cpsr) \ + restore_interrupt(cpsr) + +#endif /* SYSTEM_GENERIC_H */ +#endif Property changes on: firmware/target/generic/system-generic.h ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/crt0.c =================================================================== --- firmware/target/generic/crt0.c (revision 0) +++ firmware/target/generic/crt0.c (revision 0) @@ -0,0 +1,18 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: crt0-pp.S 17290 2008-04-29 06:47:34Z amiconn $ + * + * Copyright (C) 2002 by Linus Nielsen Feltzing + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ Property changes on: firmware/target/generic/crt0.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/generic/system-target.h =================================================================== --- firmware/target/generic/system-target.h (revision 0) +++ firmware/target/generic/system-target.h (revision 0) @@ -0,0 +1,180 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: system-target.h 17192 2008-04-20 17:53:05Z amiconn $ + * + * Copyright (C) 2002 by Alan Korr + * Copyright (C) 2007 by Michael Sevakis + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef SYSTEM_TARGET_H +#define SYSTEM_TARGET_H + +#include "system-generic.h" + +#ifdef CPU_PP +/* TODO: This header is actually portalplayer specific, and should be + * moved into an appropriate subdir (or even split in 2). */ + +#if CONFIG_CPU == PP5002 +#define CPUFREQ_SLEEP 32768 +#define CPUFREQ_DEFAULT 24000000 +#define CPUFREQ_NORMAL 30000000 +#define CPUFREQ_MAX 80000000 + +#else /* PP5022, PP5024 */ +#define CPUFREQ_SLEEP 32768 +#define CPUFREQ_DEFAULT 24000000 +#define CPUFREQ_NORMAL 30000000 +#define CPUFREQ_MAX 80000000 +#endif + +#define inl(a) (*(volatile unsigned long *) (a)) +#define outl(a,b) (*(volatile unsigned long *) (b) = (a)) +#define inb(a) (*(volatile unsigned char *) (a)) +#define outb(a,b) (*(volatile unsigned char *) (b) = (a)) +#define inw(a) (*(volatile unsigned short *) (a)) +#define outw(a,b) (*(volatile unsigned short *) (b) = (a)) + +#if defined(HAVE_ADJUSTABLE_CPU_FREQ) && NUM_CORES > 1 +extern struct spinlock boostctrl_spin; +#endif + +static inline void udelay(unsigned usecs) +{ + unsigned stop = USEC_TIMER + usecs; + while (TIME_BEFORE(USEC_TIMER, stop)); +} + +static inline unsigned int current_core(void) +{ + /* + * PROCESSOR_ID seems to be 32-bits: + * CPU = 0x55555555 = |01010101|01010101|01010101|01010101| + * COP = 0xaaaaaaaa = |10101010|10101010|10101010|10101010| + * ^ + */ + unsigned int core; + asm volatile ( + "ldrb %0, [%1] \n" /* Just load the LSB */ + "mov %0, %0, lsr #7 \n" /* Bit 7 => index */ + : "=r"(core) /* CPU=0, COP=1 */ + : "r"(&PROCESSOR_ID) + ); + return core; +} + +/* Return the actual ID instead of core index */ +static inline unsigned int processor_id(void) +{ + unsigned int id; + + asm volatile ( + "ldrb %0, [%1] \n" + : "=r"(id) + : "r"(&PROCESSOR_ID) + ); + + return id; +} + +#if CONFIG_CPU == PP5002 +static inline void sleep_core(int core) +{ + asm volatile ( + /* Sleep: PP5002 crashes if the instruction that puts it to sleep is + * located at 0xNNNNNNN0. 4/8/C works. This sequence makes sure + * that the correct alternative is executed. Don't change the order + * of the next 4 instructions! */ + "tst pc, #0x0c \n" + "mov r0, #0xca \n" + "strne r0, [%[ctl]] \n" + "streq r0, [%[ctl]] \n" + "nop \n" /* nop's needed because of pipeline */ + "nop \n" + "nop \n" + : + : [ctl]"r"(&PROC_CTL(core)) + : "r0" + ); +} +static inline void wake_core(int core) +{ + asm volatile ( + "mov r0, #0xce \n" + "str r0, [%[ctl]] \n" + : + : [ctl]"r"(&PROC_CTL(core)) + : "r0" + ); +} +#else /* PP502x */ +static inline void sleep_core(int core) +{ + asm volatile ( + "mov r0, #0x80000000 \n" + "str r0, [%[ctl]] \n" + "nop \n" + : + : [ctl]"r"(&PROC_CTL(core)) + : "r0" + ); +} +static inline void wake_core(int core) +{ + asm volatile ( + "mov r0, #0 \n" + "str r0, [%[ctl]] \n" + : + : [ctl]"r"(&PROC_CTL(core)) + : "r0" + ); +} +#endif + +#ifdef BOOTLOADER +/* All addresses within rockbox are in IRAM in the bootloader so + are therefore uncached */ +#define UNCACHED_ADDR(a) (a) + +#else /* !BOOTLOADER */ + +#if CONFIG_CPU == PP5002 +#define UNCACHED_BASE_ADDR 0x28000000 +#else /* PP502x */ +#define UNCACHED_BASE_ADDR 0x10000000 +#endif + +#define UNCACHED_ADDR(a) \ + ((typeof (a))((uintptr_t)(a) | UNCACHED_BASE_ADDR)) +#endif /* BOOTLOADER */ + +/* Certain data needs to be out of the way of cache line interference + * such as data for COP use or for use with UNCACHED_ADDR */ +#define PROC_NEEDS_CACHEALIGN +#define CACHEALIGN_BITS (4) /* 2^4 = 16 bytes */ + +/** cache functions **/ +#ifndef BOOTLOADER +#define CACHE_FUNCTIONS_AS_CALL + +#define HAVE_INVALIDATE_ICACHE +void invalidate_icache(void); + +#define HAVE_FLUSH_ICACHE +void flush_icache(void); +#endif + +#endif /* CPU_PP */ + +#endif /* SYSTEM_TARGET_H */ Property changes on: firmware/target/generic/system-target.h ___________________________________________________________________ Name: svn:executable + * Index: firmware/common/timefuncs.c =================================================================== --- firmware/common/timefuncs.c (revision 17611) +++ firmware/common/timefuncs.c (working copy) @@ -25,7 +25,7 @@ #include "timefuncs.h" #include "debug.h" -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) static struct tm tm; #endif @@ -45,7 +45,7 @@ struct tm *get_time(void) { -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if CONFIG_RTC static long timeout = 0; Index: firmware/common/dircache.c =================================================================== --- firmware/common/dircache.c (revision 17611) +++ firmware/common/dircache.c (working copy) @@ -175,13 +175,13 @@ */ static int dircache_scan(IF_MV2(int volume,) struct travel_data *td) { -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) while ( ( td->entry = readdir_uncached(td->dir) ) ) #else while ( (fat_getnext(td->dir, &td->entry) >= 0) && (td->entry.name[0])) #endif { -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) if (!strcmp(".", td->entry->d_name) || !strcmp("..", td->entry->d_name)) { @@ -214,7 +214,7 @@ dircache_size += td->ce->name_len; entry_count++; -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) if (td->entry->attribute & ATTR_DIRECTORY) #else if (td->entry.attr & FAT_ATTR_DIRECTORY) @@ -228,7 +228,7 @@ td->pathpos = strlen(dircache_cur_path); strncpy(&dircache_cur_path[td->pathpos], "/", sizeof(dircache_cur_path) - td->pathpos - 1); -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) strncpy(&dircache_cur_path[td->pathpos+1], td->entry->d_name, sizeof(dircache_cur_path) - td->pathpos - 2); @@ -279,7 +279,7 @@ /** * Recursively scan the hard disk and build the cache. */ -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) static int dircache_travel(IF_MV2(int volume,) DIR_UNCACHED *dir, struct dircache_entry *ce) #else static int dircache_travel(IF_MV2(int volume,) struct fat_dir *dir, struct dircache_entry *ce) @@ -290,7 +290,7 @@ memset(ce, 0, sizeof(struct dircache_entry)); -#if defined(HAVE_MULTIVOLUME) && !defined(SIMULATOR) +#if defined(HAVE_MULTIVOLUME) && !defined(SIMULATOR) && !defined(SDL) if (volume > 0) { ce->d_name = ((char *)dircache_root+dircache_size); @@ -317,7 +317,7 @@ ce = dir_recursion[depth].ce; ce->d_name = "."; ce->name_len = 2; -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) closedir_uncached(dir_recursion[depth].dir); ce->attribute = ATTR_DIRECTORY; #else @@ -339,7 +339,7 @@ logf("memory allocation error"); return -3; } -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) ce->attribute = ATTR_DIRECTORY; #else ce->attribute = FAT_ATTR_DIRECTORY; @@ -360,7 +360,7 @@ return -2; } -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) dir_recursion[depth].dir = dir_recursion[depth-1].newdir; #else dir_recursion[depth].dir = &dir_recursion[depth-1].newdir; @@ -546,7 +546,7 @@ */ static int dircache_do_rebuild(void) { -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) DIR_UNCACHED *pdir; #else struct fat_dir dir, *pdir; @@ -571,7 +571,7 @@ if (fat_ismounted(i)) { #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) pdir = opendir_uncached("/"); if (pdir == NULL) { @@ -669,7 +669,7 @@ dircache_initialized = false; break ; -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) case SYS_USB_CONNECTED: usb_acknowledge(SYS_USB_CONNECTED_ACK); usb_wait_for_disconnect(&dircache_queue); Index: firmware/buffer.c =================================================================== --- firmware/buffer.c (revision 17611) +++ firmware/buffer.c (working copy) @@ -19,7 +19,7 @@ #include #include "buffer.h" -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) unsigned char audiobuffer[(MEM*1024-256)*1024]; unsigned char *audiobufend = audiobuffer + sizeof(audiobuffer); #else Index: firmware/pcm.c =================================================================== --- firmware/pcm.c (revision 17611) +++ firmware/pcm.c (working copy) @@ -300,7 +300,7 @@ void pcm_mute(bool mute) { -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) audiohw_mute(mute); #endif Index: firmware/powermgmt.c =================================================================== --- firmware/powermgmt.c (revision 17611) +++ firmware/powermgmt.c (working copy) @@ -49,11 +49,11 @@ #endif #include "logf.h" #include "lcd-remote.h" -#ifdef SIMULATOR +#if defined( SIMULATOR) || defined(SDL) #include #endif -#if (defined(IAUDIO_X5) || defined(IAUDIO_M5)) && !defined (SIMULATOR) +#if (defined(IAUDIO_X5) || defined(IAUDIO_M5)) && !defined (SIMULATOR) && !defined(SDL) #include "pcf50606.h" #include "lcd-remote-target.h" #endif @@ -87,7 +87,7 @@ charger_input_state_type charger_input_state IDATA_ATTR; #endif -#ifdef SIMULATOR /***********************************************************/ +#if defined(SIMULATOR) || defined(SDL) /***********************************************************/ #define BATT_MINMVOLT 2500 /* minimum millivolts of battery */ #define BATT_MAXMVOLT 4500 /* maximum millivolts of battery */ @@ -1115,7 +1115,7 @@ power off after an 20 second timeout - 28 seconds if recording */ if (shutdown_timeout == 0) { -#if (defined(IAUDIO_X5) || defined(IAUDIO_M5)) && !defined (SIMULATOR) +#if (defined(IAUDIO_X5) || defined(IAUDIO_M5)) && !defined (SIMULATOR) && !defined(SDL) pcf50606_reset_timeout(); /* Reset timer on first attempt only */ #endif #ifdef HAVE_RECORDING @@ -1132,7 +1132,7 @@ { logf("sys_cancel_shutdown()"); -#if (defined(IAUDIO_X5) || defined(IAUDIO_M5)) && !defined (SIMULATOR) +#if (defined(IAUDIO_X5) || defined(IAUDIO_M5)) && !defined (SIMULATOR) && !defined(SDL) /* TODO: Move some things to target/ tree */ if (shutdown_timeout) pcf50606_reset_timeout(); @@ -1144,7 +1144,7 @@ /* Various hardware housekeeping tasks relating to shutting down the jukebox */ void shutdown_hw(void) { -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) charging_algorithm_close(); audio_stop(); if (battery_level_safe()) { /* do not save on critical battery */ Index: firmware/scroll_engine.c =================================================================== --- firmware/scroll_engine.c (revision 17611) +++ firmware/scroll_engine.c (working copy) @@ -234,7 +234,7 @@ usb_wait_for_disconnect(&scroll_queue); sync_display_ticks(); return true; -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) case SYS_REMOTE_PLUGGED: if (!remote_initialized) sync_display_ticks(); @@ -272,7 +272,7 @@ delay = current_tick; if ( -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) !remote_initialized || #endif (tick_remote = lcd_remote_scroll_info.last_scroll + Index: firmware/usb.c =================================================================== --- firmware/usb.c (revision 17611) +++ firmware/usb.c (working copy) @@ -63,7 +63,7 @@ #endif #endif -#if !defined(SIMULATOR) && !defined(USB_NONE) +#if !defined(SIMULATOR) && !defined(USB_NONE) && !defined(SDL) #define NUM_POLL_READINGS (HZ/5) static int countdown; Index: firmware/drivers/button.c =================================================================== --- firmware/drivers/button.c (revision 17611) +++ firmware/drivers/button.c (working copy) @@ -37,7 +37,7 @@ #include "lcd-remote.h" #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if 0 /* Older than MAX_EVENT_AGE button events are going to be ignored. * Used to prevent for example volume going up uncontrollable when events Index: firmware/drivers/fat.c =================================================================== --- firmware/drivers/fat.c (revision 17611) +++ firmware/drivers/fat.c (working copy) @@ -236,6 +236,7 @@ + fat_bpb->firstdatasector; } +#ifndef SDL void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free) { #ifndef HAVE_MULTIVOLUME @@ -247,6 +248,7 @@ if (free) *free = fat_bpb->fsinfo.freecount * fat_bpb->bpb_secperclus / 2; } +#endif void fat_init(void) { Index: uisimulator/sdl/button.c =================================================================== --- uisimulator/sdl/button.c (revision 17611) +++ uisimulator/sdl/button.c (working copy) @@ -880,6 +880,40 @@ case SDLK_s: new_btn = BUTTON_VOL_UP; break; +#elif CONFIG_KEYPAD == SLD_PAD + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_KP_PLUS: + case SDLK_F8: + new_btn = BUTTON_POWER; + break; + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + case SDLK_KP5: + case SDLK_SPACE: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP_PERIOD: + case SDLK_INSERT: + new_btn = BUTTON_MENU; + break; #else #error No keymap defined! #endif /* CONFIG_KEYPAD */ Index: uisimulator/sdl/lcd-bitmap.c =================================================================== --- uisimulator/sdl/lcd-bitmap.c (revision 17611) +++ uisimulator/sdl/lcd-bitmap.c (working copy) @@ -108,7 +108,7 @@ } #endif -/* initialise simulator lcd driver */ +/* initialize simulator lcd driver */ void sim_lcd_init(void) { #if LCD_DEPTH == 16 @@ -124,7 +124,7 @@ sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max, 0, (1<> 9, g >> 8, b >> 9); #if LCD_WIDTH >= LCD_HEIGHT - dst++; + dst++; #else dst += LCD_WIDTH; #endif @@ -274,7 +274,7 @@ *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); #if LCD_WIDTH >= LCD_HEIGHT - dst++; + dst++; #else dst += LCD_WIDTH; #endif @@ -319,7 +319,7 @@ *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); #if LCD_WIDTH >= LCD_HEIGHT - dst++; + dst++; #else dst += LCD_WIDTH; #endif @@ -339,7 +339,7 @@ *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); #if LCD_WIDTH >= LCD_HEIGHT - dst++; + dst++; #else dst += LCD_WIDTH; #endif Index: uisimulator/sdl/uisdl.h =================================================================== --- uisimulator/sdl/uisdl.h (revision 17611) +++ uisimulator/sdl/uisdl.h (working copy) @@ -404,6 +404,16 @@ #define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */ #define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */ +#elif defined(SDL) +#define UI_TITLE "SDL Rockbox" +#define UI_WIDTH 401 /* width of GUI window */ +#define UI_HEIGHT 655 /* height of GUI window */ +/* high-colour */ +#define UI_LCD_POSX 48 /* x position of lcd */ +#define UI_LCD_POSY 60 /* y position of lcd */ +#define UI_LCD_WIDTH 240 +#define UI_LCD_HEIGHT 320 + #endif extern SDL_Surface *gui_surface; extern bool background; /* True if the background image is enabled */ Index: uisimulator/sdl/UI-sdl.bmp =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: uisimulator/sdl/UI-sdl.bmp ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Index: uisimulator/sdl/SOURCES =================================================================== --- uisimulator/sdl/SOURCES (revision 17611) +++ uisimulator/sdl/SOURCES (working copy) @@ -1,15 +1,15 @@ -button.c -kernel-sdl.c +//button.c +//kernel-sdl.c #ifdef HAVE_LCD_BITMAP -lcd-bitmap.c +//lcd-bitmap.c #elif defined(HAVE_LCD_CHARCELLS) lcd-charcells.c #endif #ifdef HAVE_REMOTE_LCD lcd-remote-bitmap.c #endif -lcd-sdl.c -sound.c -timer.c -thread-sdl.c -uisdl.c +//lcd-sdl.c +//sound.c +//timer.c +//thread-sdl.c +//uisdl.c Index: uisimulator/common/SOURCES =================================================================== --- uisimulator/common/SOURCES (revision 17611) +++ uisimulator/common/SOURCES (working copy) @@ -7,3 +7,4 @@ #endif sim_icons.c stubs.c +../sdl/uisdl.c