Index: tools/configure =================================================================== --- tools/configure (revision 18139) +++ tools/configure (working copy) @@ -667,7 +667,7 @@ ################################################################## # Figure out target platform # - +uname=`uname` if [ "1" != `parse_args --target` ]; then buildfor=`parse_args --target`; else @@ -700,6 +700,10 @@ ==Onda== 120) VX747 + + ==Rockbox As an App== + 200) SDL Application + EOF buildfor=`input`; @@ -1689,6 +1693,35 @@ t_manufacturer="tatung" t_model="tpj1022" ;; + + 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) + 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" + ;; 100|sa9200) target_id=41 @@ -2118,10 +2151,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 18139) +++ apps/codecs.c (working copy) @@ -55,7 +55,7 @@ #define LOGF_ENABLE #include "logf.h" -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #if CONFIG_CODEC == SWCODEC unsigned char codecbuf[CODEC_SIZE]; #endif @@ -91,7 +91,7 @@ NULL, /* discard_codec */ NULL, /* set_offset */ NULL, /* configure */ - + /* kernel/ system */ PREFIX(sleep), yield, @@ -177,9 +177,9 @@ { 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) || (hdr->magic != CODEC_MAGIC #ifdef HAVE_RECORDING @@ -195,7 +195,7 @@ } #else /* SIMULATOR */ void *pd; - + hdr = sim_codec_load_ram(codecbuf, size, &pd); if (pd == NULL) @@ -211,7 +211,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); @@ -245,7 +245,7 @@ int rc; codec_get_full_path(path, plugin); - + fd = open(path, O_RDONLY); if (fd < 0) { snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", path); @@ -253,7 +253,7 @@ gui_syncsplash(HZ*2, msgbuf); return fd; } - + rc = read(fd, &codecbuf[0], CODEC_SIZE); close(fd); if (rc <= 0) { Index: apps/playlist.c =================================================================== --- apps/playlist.c (revision 18139) +++ apps/playlist.c (working copy) @@ -1354,7 +1354,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 18139) +++ apps/screens.c (working copy) @@ -139,7 +139,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); @@ -151,7 +151,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 18139) +++ apps/codecs.h (working copy) @@ -70,7 +70,7 @@ #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #define PREFIX(_x_) sim_ ## _x_ #else #define PREFIX(_x_) _x_ @@ -106,11 +106,11 @@ off_t filesize; /* Total file length */ off_t curpos; /* Current buffer position */ - + /* For gapless mp3 */ struct mp3entry *id3; /* TAG metadata pointer */ bool *taginfo_ready; /* Is metadata read */ - + /* Codec should periodically check if stop_codec is set to true. In case it is, codec must return immediately */ bool stop_codec; @@ -123,7 +123,7 @@ /* The dsp instance to be used for audio output */ struct dsp_config *dsp; - + /* Returns buffer to malloc array. Only codeclib should need this. */ void* (*get_codec_memory)(size_t *size); /* Insert PCM data into audio buffer for playback. Playback will start @@ -131,7 +131,7 @@ bool (*pcmbuf_insert)(const void *ch1, const void *ch2, int count); /* Set song position in WPS (value in ms). */ void (*set_elapsed)(unsigned int value); - + /* Read next amount bytes from file buffer to . Will return number of bytes read or 0 if end of file. */ size_t (*read_filebuf)(void *ptr, size_t size); @@ -154,7 +154,7 @@ bool (*request_next_track)(void); /* Free the buffer area of the current codec after its loaded */ void (*discard_codec)(void); - + void (*set_offset)(size_t value); /* Configure different codec buffer parameters. */ void (*configure)(int setting, intptr_t value); @@ -218,7 +218,7 @@ void (*profile_func_enter)(void *this_fn, void *call_site); void (*profile_func_exit)(void *this_fn, void *call_site); #endif - + #if defined(HAVE_RECORDING) && !defined(SIMULATOR) volatile bool stop_encoder; volatile int enc_codec_loaded; /* <0=error, 0=pending, >0=ok */ @@ -242,7 +242,7 @@ #endif /* new stuff at the end, sort into place next time - the API gets incompatible */ + the API gets incompatible */ }; @@ -257,10 +257,10 @@ }; #ifdef CODEC -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(HAVE_SHARED_LIBS) /* 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 \ @@ -286,7 +286,7 @@ const struct codec_header __header = { \ CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, \ NULL, NULL, codec_start }; -#endif /* SIMULATOR */ +#endif /* !defined(SIMULATOR) */ #endif /* CODEC */ /* create full codec path from root filenames in audio_formats[] Index: apps/recorder/radio.c =================================================================== --- apps/recorder/radio.c (revision 18139) +++ apps/recorder/radio.c (working copy) @@ -98,8 +98,8 @@ #define FM_RECORD_DBLPRE #define FM_RECORD #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || (CONFIG_KEYPAD == SANSA_C200_PAD) -#define FM_MENU -#define FM_PRESET +#define FM_MENU +#define FM_PRESET #define FM_STOP #define FM_MODE #define FM_EXIT @@ -115,7 +115,7 @@ static int search_dir = 0; static int radio_status = FMRADIO_OFF; -static bool in_screen = false; +static bool in_screen = false; #define MAX_PRESETS 64 static bool presets_loaded = false, presets_changed = false; @@ -159,10 +159,10 @@ return radio_status; } -bool in_radio_screen(void) -{ - return in_screen; -} +bool in_radio_screen(void) +{ + return in_screen; +} /* TODO: Move some more of the control functionality to an HAL and clean up the mess */ @@ -186,7 +186,7 @@ if(radio_status == FMRADIO_OFF) tuner_power(true); - curr_freq = global_status.last_frequency + curr_freq = global_status.last_frequency * fmr->freq_step + fmr->freq_min; tuner_set(RADIO_SLEEP, 0); /* wake up the tuner */ @@ -233,7 +233,7 @@ if(radio_status == FMRADIO_OFF) { - radio_status |= FMRADIO_START_PAUSED; + radio_status |= FMRADIO_START_PAUSED; radio_start(); } @@ -326,7 +326,7 @@ { const struct fm_region_data * const fmr = &fm_region_data[global_settings.fm_region]; - global_status.last_frequency = (curr_freq - fmr->freq_min) + global_status.last_frequency = (curr_freq - fmr->freq_min) / fmr->freq_step; status_save(); } @@ -335,7 +335,7 @@ { if (num_presets < 1) return; - + if (curr_preset == -1) curr_preset = find_closest_preset(curr_freq, direction); else @@ -479,22 +479,22 @@ screens[i].clear_viewport(); screens[i].update_viewport(); } - + fh = font_get(FONT_UI)->height; - + /* Adjust for font size, trying to center the information vertically */ if(fh < 10) top_of_screen = 1; - + if(num_presets <= 0) { memset(presets, 0, sizeof(presets)); radio_load_presets(global_settings.fmr_file); } - - if(radio_status == FMRADIO_OFF) + + if(radio_status == FMRADIO_OFF) audio_stop(); -#ifndef SIMULATOR +#if !defined(SIMULATOR) #if CONFIG_CODEC != SWCODEC if(rec_create_directory() > 0) @@ -516,7 +516,7 @@ sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN); #endif /* CONFIG_CODEC != SWCODEC */ -#endif /* ndef SIMULATOR */ +#endif /* # !defined(SIMULATOR) */ /* turn on radio */ #if CONFIG_CODEC == SWCODEC @@ -530,7 +530,7 @@ if(num_presets < 1 && yesno_pop(ID2P(LANG_FM_FIRST_AUTOSCAN))) scan_presets(vp); - + curr_preset = find_preset(curr_freq); if(curr_preset != -1) radio_mode = RADIO_PRESET_MODE; @@ -624,9 +624,9 @@ { rec_lastclick = current_tick; break; - } + } #endif /* FM_RECORD_DBLPRE */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) if(audio_status() == AUDIO_STATUS_RECORD) { rec_command(RECORDING_CMD_START_NEWFILE); @@ -638,7 +638,7 @@ rec_command(RECORDING_CMD_START); update_screen = true; } -#endif /* SIMULATOR */ +#endif /* #!defined(SIMULATOR) */ last_seconds = 0; break; #endif /* #ifdef FM_RECORD */ @@ -659,12 +659,12 @@ save_preset_list(); else radio_save_presets(); - } + } } - + /* Clear the preset list on exit. */ clear_preset_list(); - + break; case ACTION_STD_PREV: @@ -738,7 +738,7 @@ #endif update_screen = true; break; - + #ifdef FM_PRESET case ACTION_FM_PRESET: if(num_presets < 1) @@ -772,7 +772,7 @@ update_screen = true; break; #endif /* FM_PRESET */ - + #ifdef FM_FREEZE case ACTION_FM_FREEZE: if(!screen_freeze) @@ -835,7 +835,7 @@ talk = true; break; #endif - + default: default_event_handler(button); break; @@ -851,7 +851,7 @@ #endif if(!screen_freeze) - { + { /* Only display the peak meter when not recording */ #if CONFIG_CODEC != SWCODEC if(!audio_status()) @@ -903,18 +903,18 @@ { screens[i].set_viewport(&vp[i]); } - + snprintf(buf, 128, curr_preset >= 0 ? "%d. %s" : " ", curr_preset + 1, presets[curr_preset].name); FOR_NB_SCREENS(i) screens[i].puts_scroll(0, top_of_screen, buf); - + freq = curr_freq / 10000; snprintf(buf, 128, str(LANG_FM_STATION), freq / 100, freq % 100); FOR_NB_SCREENS(i) screens[i].puts_scroll(0, top_of_screen + 1, buf); - + snprintf(buf, 128, stereo?str(LANG_CHANNEL_STEREO): str(LANG_CHANNEL_MONO)); FOR_NB_SCREENS(i) @@ -954,7 +954,7 @@ screens[i].update_viewport(); screens[i].set_viewport(NULL); } - + #ifdef HAVE_BUTTONBAR gui_buttonbar_draw(&buttonbar); #endif @@ -995,7 +995,7 @@ #endif } /*while(!done)*/ -#ifndef SIMULATOR +#if !defined(SIMULATOR) #if CONFIG_CODEC != SWCODEC if(audio_status() & AUDIO_STATUS_ERROR) { @@ -1016,17 +1016,17 @@ break; } } - + audio_init_playback(); #endif /* CONFIG_CODEC != SWCODEC */ sound_settings_apply(); -#endif /* SIMULATOR */ +#endif /* !defined(SIMULATOR) */ if(keep_playing) { /* Catch FMRADIO_PLAYING status for the sim. */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) #if CONFIG_CODEC != SWCODEC /* Enable the Left and right A/D Converter */ audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN), @@ -1035,7 +1035,7 @@ mas_codec_writereg(6, 0x4000); #endif end_search(); -#endif /* SIMULATOR */ +#endif /* # !defined(SIMULATOR) */ } else { @@ -1065,7 +1065,7 @@ { int fd; int i; - + fd = creat(filepreset); if(fd >= 0) { @@ -1074,7 +1074,7 @@ fdprintf(fd, "%d:%s\n", presets[i].frequency, presets[i].name); } close(fd); - + if(!strncasecmp(FMPRESET_PATH, filepreset, strlen(FMPRESET_PATH))) set_file(filepreset, global_settings.fmr_file, MAX_FILENAME); presets_changed = false; @@ -1082,7 +1082,7 @@ else { gui_syncsplash(HZ, ID2P(LANG_FM_PRESET_SAVE_FAILED)); - } + } } void radio_load_presets(char *filename) @@ -1105,13 +1105,13 @@ return; } /* Temporary preset, loaded until player shuts down. */ - else if(filename[0] == '/') + else if(filename[0] == '/') strncpy(filepreset, filename, sizeof(filepreset)); /* Preset from default directory. */ else snprintf(filepreset, sizeof(filepreset), "%s/%s.fmr", FMPRESET_PATH, filename); - + fd = open(filepreset, O_RDONLY); if(fd >= 0) { @@ -1153,7 +1153,7 @@ if(num_presets < MAX_PRESETS) { memset(buf, 0, MAX_FMPRESET_LEN); - + if (!kbd_input(buf, MAX_FMPRESET_LEN)) { struct fmstation * const fms = &presets[num_presets]; @@ -1218,7 +1218,7 @@ radio_mode = RADIO_SCAN_MODE; presets_loaded = false; } - + return 1; } @@ -1228,9 +1228,9 @@ } static int save_preset_list(void) -{ +{ if(num_presets > 0) - { + { bool bad_file_name = true; if(!dir_exists(FMPRESET_PATH)) /* Check if there is preset folder */ @@ -1255,7 +1255,7 @@ if((!p1) || (len > MAX_FILENAME) || (len == 0)) { /* no slash, too long or too short */ - gui_syncsplash(HZ, ID2P(LANG_INVALID_FILENAME)); + gui_syncsplash(HZ, ID2P(LANG_INVALID_FILENAME)); } else { @@ -1276,7 +1276,7 @@ } else gui_syncsplash(HZ, ID2P(LANG_FM_NO_PRESETS)); - + return true; } @@ -1284,22 +1284,22 @@ { /* Clear all the preset entries */ memset(presets, 0, sizeof (presets)); - + num_presets = 0; presets_loaded = false; /* The preset list will be cleared switch to Scan Mode. */ radio_mode = RADIO_SCAN_MODE; - + presets_changed = false; /* Don't ask to save when clearing the list. */ - + return true; } -MENUITEM_FUNCTION(radio_edit_preset_item, MENU_FUNC_CHECK_RETVAL, - ID2P(LANG_FM_EDIT_PRESET), +MENUITEM_FUNCTION(radio_edit_preset_item, MENU_FUNC_CHECK_RETVAL, + ID2P(LANG_FM_EDIT_PRESET), radio_edit_preset, NULL, NULL, Icon_NOICON); MENUITEM_FUNCTION(radio_delete_preset_item, MENU_FUNC_CHECK_RETVAL, - ID2P(LANG_FM_DELETE_PRESET), + ID2P(LANG_FM_DELETE_PRESET), radio_delete_preset, NULL, NULL, Icon_NOICON); static int radio_preset_callback(int action, const struct menu_item_ex *this_item) @@ -1310,7 +1310,7 @@ (void)this_item; } MAKE_MENU(handle_radio_preset_menu, ID2P(LANG_PRESET), - radio_preset_callback, Icon_NOICON, &radio_edit_preset_item, + radio_preset_callback, Icon_NOICON, &radio_edit_preset_item, &radio_delete_preset_item); /* present a list of preset stations */ static char * presets_get_name(int selected_item, void *data, @@ -1434,7 +1434,7 @@ return 0; } MENUITEM_FUNCTION_DYNTEXT(radio_mode_item, 0, - toggle_radio_mode, NULL, + toggle_radio_mode, NULL, get_mode_text, NULL, NULL, NULL, Icon_NOICON); #endif @@ -1443,12 +1443,12 @@ bool do_scan = true; int i; struct viewport *vp = (struct viewport *)viewports; - + FOR_NB_SCREENS(i) screens[i].set_viewport(vp?&vp[i]:NULL); if(num_presets > 0) /* Do that to avoid 2 questions. */ do_scan = yesno_pop(ID2P(LANG_FM_CLEAR_PRESETS)); - + if(do_scan) { const struct fm_region_data * const fmr = @@ -1489,7 +1489,7 @@ tuner_set(RADIO_MUTE, 0); presets_changed = true; - + FOR_NB_SCREENS(i) { screens[i].clear_viewport(); @@ -1559,35 +1559,35 @@ #endif /* HAVE_RECORDING */ #ifdef FM_RECORDING_SCREEN -MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING), +MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING), fm_recording_screen, NULL, NULL, Icon_Recording); #endif #ifdef FM_RECORDING_SETTINGS -MENUITEM_FUNCTION(recsettings_item, 0, ID2P(LANG_RECORDING_SETTINGS), +MENUITEM_FUNCTION(recsettings_item, 0, ID2P(LANG_RECORDING_SETTINGS), fm_recording_settings, NULL, NULL, Icon_Recording); #endif #ifndef FM_PRESET -MENUITEM_FUNCTION(radio_presets_item, 0, ID2P(LANG_PRESET), +MENUITEM_FUNCTION(radio_presets_item, 0, ID2P(LANG_PRESET), handle_radio_presets, NULL, NULL, Icon_NOICON); #endif #ifndef FM_PRESET_ADD -MENUITEM_FUNCTION(radio_addpreset_item, 0, ID2P(LANG_FM_ADD_PRESET), +MENUITEM_FUNCTION(radio_addpreset_item, 0, ID2P(LANG_FM_ADD_PRESET), radio_add_preset, NULL, NULL, Icon_NOICON); #endif -MENUITEM_FUNCTION(presetload_item, 0, ID2P(LANG_FM_PRESET_LOAD), +MENUITEM_FUNCTION(presetload_item, 0, ID2P(LANG_FM_PRESET_LOAD), load_preset_list, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(presetsave_item, 0, ID2P(LANG_FM_PRESET_SAVE), +MENUITEM_FUNCTION(presetsave_item, 0, ID2P(LANG_FM_PRESET_SAVE), save_preset_list, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(presetclear_item, 0, ID2P(LANG_FM_PRESET_CLEAR), +MENUITEM_FUNCTION(presetclear_item, 0, ID2P(LANG_FM_PRESET_CLEAR), clear_preset_list, NULL, NULL, Icon_NOICON); MENUITEM_FUNCTION(scan_presets_item, MENU_FUNC_USEPARAM, ID2P(LANG_FM_SCAN_PRESETS), scan_presets, NULL, NULL, Icon_NOICON); -MAKE_MENU(radio_settings_menu, ID2P(LANG_FM_MENU), NULL, - Icon_Radio_screen, +MAKE_MENU(radio_settings_menu, ID2P(LANG_FM_MENU), NULL, + Icon_Radio_screen, #ifndef FM_PRESET &radio_presets_item, #endif Index: apps/Makefile =================================================================== --- apps/Makefile (revision 18139) +++ 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/Makefile =================================================================== --- apps/plugins/Makefile (revision 18139) +++ 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 18139) +++ apps/plugins/lib/pluginlib_actions.c (working copy) @@ -39,7 +39,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}, @@ -81,6 +82,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) \ @@ -174,6 +176,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) \ @@ -301,7 +304,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}, @@ -409,6 +412,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 18139) +++ apps/plugins/lib/overlay.c (working copy) @@ -21,28 +21,28 @@ * ****************************************************************************/ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(HAVE_SHARED_LIBS) #include "plugin.h" #include "overlay.h" -/* load and run a plugin linked as an overlay. +/* load and run a plugin linked as an overlay. arguments: rb = pointer to plugin api, also passed on to the overlay parameter = plugin parameter, passed on to the overlay filename = overlay file name, absolute path as usual name = overlay display name - + result: return value from the overlay - + As long as a large plugin to be overlayed doesn't use the audiobuffer itself, no adjustments in the plugin source code are necessary to make it work as an overlay, it only needs an adapted linker script. - - If the overlayed plugin *does* use the audiobuffer itself, it needs + + If the overlayed plugin *does* use the audiobuffer itself, it needs to make sure not to overwrite itself. - + The linker script for the overlay should use a base address towards the end of the audiobuffer, just low enough to make the overlay fit. */ @@ -75,7 +75,7 @@ rb->splash(2*HZ, "%s overlay: Incompatible model.", name); return PLUGIN_ERROR; } - if (header.api_version != PLUGIN_API_VERSION) + if (header.api_version != PLUGIN_API_VERSION) { rb->splash(2*HZ, "%s overlay: Incompatible version.", name); return PLUGIN_ERROR; Index: apps/plugins/lib/overlay.h =================================================================== --- apps/plugins/lib/overlay.h (revision 18139) +++ apps/plugins/lib/overlay.h (working copy) @@ -24,7 +24,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/SUBDIRS =================================================================== --- apps/plugins/SUBDIRS (revision 18139) +++ apps/plugins/SUBDIRS (working copy) @@ -1,4 +1,4 @@ -#if !defined(IRIVER_IFP7XX_SERIES) +#if !defined(IRIVER_IFP7XX_SERIES) /* For all targets */ shortcuts Index: apps/gui/statusbar.c =================================================================== --- apps/gui/statusbar.c (revision 18139) +++ apps/gui/statusbar.c (working copy) @@ -162,7 +162,7 @@ memset((void*)&(bar->lastinfo), 0, sizeof(struct status_info)); #if CONFIG_RTC bar->last_tm_min = 0; -#endif +#endif } void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) @@ -202,7 +202,7 @@ { #endif /* CONFIG_CHARGING < CHARGING_MONITOR */ /* animate in (max.) 4 steps, starting near the current charge level */ - if (TIME_AFTER(current_tick, bar->battery_icon_switch_tick)) + if (TIME_AFTER(current_tick, bar->battery_icon_switch_tick)) { if (++bar->info.batt_charge_step > 3) bar->info.batt_charge_step = bar->info.battlevel / 34; @@ -260,7 +260,7 @@ display->set_drawmode(DRMODE_SOLID); if (bar->info.battery_state) - gui_statusbar_icon_battery(display, bar->info.battlevel, + gui_statusbar_icon_battery(display, bar->info.battlevel, bar->info.batt_charge_step); #ifdef HAVE_USB_POWER if (bar->info.usb_inserted) @@ -287,7 +287,7 @@ #endif bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume); gui_statusbar_icon_play_state(display, current_playmode() + Icon_Play); - + #ifdef HAVE_RECORDING /* If in recording screen, replace repeat mode, volume and shuffle icons with recording info */ @@ -337,7 +337,7 @@ #ifdef HAVE_LCD_CHARCELLS display->icon(ICON_BATTERY, bar->info.battery_state); - + if (bar->info.batt_charge_step > -1) val = bar->info.batt_charge_step; else @@ -373,7 +373,7 @@ /* * Print battery icon to status bar */ -static void gui_statusbar_icon_battery(struct screen * display, int percent, +static void gui_statusbar_icon_battery(struct screen * display, int percent, int batt_charge_step) { int fill, endfill; @@ -397,7 +397,7 @@ fill = endfill = (percent * (STATUSBAR_BATTERY_WIDTH-3) + 50) / 100; } -#if CONFIG_CHARGING == CHARGING_MONITOR && !defined(SIMULATOR) +#if CONFIG_CHARGING == CHARGING_MONITOR && !defined(SIMULATOR) /* Certain charge controlled targets */ /* show graphical animation when charging instead of numbers */ if ((global_settings.battery_display) && @@ -459,7 +459,7 @@ unsigned int width, height; bool needs_redraw = false; int type = global_settings.volume_type; - struct screen * display=bar->display; + struct screen * display=bar->display; const int minvol = sound_min(SOUND_VOLUME); const int maxvol = sound_max(SOUND_VOLUME); @@ -635,7 +635,7 @@ */ static void gui_statusbar_write_format_info(struct screen * display) { - /* Can't fit info for sw codec targets in statusbar using FONT_SYSFIXED + /* Can't fit info for sw codec targets in statusbar using FONT_SYSFIXED so must use icons */ int rec_format = global_settings.rec_format; unsigned bitrk = 0; /* compiler warns about unitialized use !! */ @@ -662,8 +662,8 @@ xpos += BM_GLYPH_WIDTH; } } - + /* Show bitmap - clipping right edge if needed */ display->mono_bitmap_part(bm, 0, 0, STATUSBAR_ENCODER_WIDTH, xpos, STATUSBAR_Y_POS, width, STATUSBAR_HEIGHT); @@ -683,7 +683,7 @@ unsigned long samprk; int xpos; -#ifdef SIMULATOR +#if defined(SIMULATOR) samprk = 44100; #else #ifdef HAVE_SPDIF_REC @@ -703,7 +703,7 @@ STATUSBAR_RECFREQ_X_POS, STATUSBAR_Y_POS); /* write the 'k' */ - display->mono_bitmap(bitmap_glyphs_4x8[Glyph_4x8_k], xpos, + display->mono_bitmap(bitmap_glyphs_4x8[Glyph_4x8_k], xpos, STATUSBAR_Y_POS, BM_GLYPH_WIDTH, STATUSBAR_HEIGHT); } @@ -733,10 +733,10 @@ /* Display Samplerate info in statusbar */ #if CONFIG_CODEC == SWCODEC - /* SWCODEC targets use bitmaps for glyphs */ + /* SWCODEC targets use bitmaps for glyphs */ gui_statusbar_write_samplerate_info(display); #else /* !SWCODEC */ - /* hwcodec targets have sysfont characters */ + /* hwcodec targets have sysfont characters */ #ifdef HAVE_SPDIF_REC if (global_settings.rec_source == AUDIO_SRC_SPDIF) { Index: apps/settings.h =================================================================== --- apps/settings.h (revision 18139) +++ apps/settings.h (working copy) @@ -171,7 +171,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 @@ -732,7 +732,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 18139) +++ apps/menus/settings_menu.c (working copy) @@ -338,7 +338,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 18139) +++ apps/menus/main_menu.c (working copy) @@ -405,7 +405,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/filetree.c =================================================================== --- apps/filetree.c (revision 18139) +++ apps/filetree.c (working copy) @@ -520,7 +520,7 @@ break; #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) /* firmware file */ case FILE_ATTR_MOD: gui_syncsplash(0, ID2P(LANG_WAIT)); Index: apps/tagcache.c =================================================================== --- apps/tagcache.c (revision 18139) +++ apps/tagcache.c (working copy) @@ -3038,7 +3038,7 @@ int masterfd; mutex_lock(&command_queue_mutex); - + if ( (masterfd = open_master_fd(&myhdr, true)) < 0) return false; @@ -4373,7 +4373,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); @@ -4487,7 +4487,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/playback.c =================================================================== --- apps/playback.c (revision 18139) +++ apps/playback.c (working copy) @@ -504,7 +504,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; @@ -529,7 +529,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; @@ -1260,11 +1260,11 @@ while (1) { status = 0; - + if (!pcmbuf_is_crossfade_active()) { cancel_cpu_boost(); } - + queue_wait(&codec_queue, &ev); codec_requested_stop = false; @@ -2459,7 +2459,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 18139) +++ apps/status.h (working copy) @@ -46,7 +46,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 18139) +++ apps/plugin.c (working copy) @@ -49,7 +49,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); @@ -123,7 +123,7 @@ || defined(IRIVER_H10) || defined(COWON_D2) 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 */ @@ -296,7 +296,7 @@ #endif reset_poweroff_timer, -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) system_memory_guard, &cpu_frequency, @@ -307,7 +307,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, @@ -339,7 +339,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, @@ -385,7 +385,7 @@ sound_max, sound_unit, sound_val2phys, -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) mp3_play_data, mp3_play_pause, mp3_play_stop, @@ -446,7 +446,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) || \ @@ -454,7 +454,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, @@ -494,7 +494,7 @@ battery_level, battery_level_safe, battery_time, -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) battery_voltage, #endif #if CONFIG_CHARGING @@ -613,7 +613,7 @@ { int rc; struct plugin_header *hdr; -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) void *pd; #else /* !SIMULATOR */ int fd; @@ -641,7 +641,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 18139) +++ apps/SOURCES (working copy) @@ -198,4 +198,6 @@ keymaps/keymap-sa9200.c #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD keymaps/keymap-hdd1630.c +#elif CONFIG_KEYPAD == SLD_PAD +keymaps/keymap-sdl.c #endif Index: apps/plugin.h =================================================================== --- apps/plugin.h (revision 18139) +++ apps/plugin.h (working copy) @@ -119,7 +119,7 @@ #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #define PREFIX(_x_) sim_ ## _x_ #else #define PREFIX(_x_) _x_ @@ -209,7 +209,7 @@ || defined(IRIVER_H10) || defined(COWON_D2) 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, @@ -222,7 +222,7 @@ #ifdef HAVE_LCD_INVERT void (*lcd_set_invert_display)(bool yesno); #endif /* HAVE_LCD_INVERT */ - + #ifdef HAVE_LCD_ENABLE void (*lcd_set_enable_hook)(void (*enable_hook)(void)); struct event_queue *button_queue; @@ -335,7 +335,7 @@ intptr_t (*button_get_data)(void); #endif void (*button_clear_queue)(void); - int (*button_queue_count)(void); + int (*button_queue_count)(void); #ifdef HAS_BUTTON_HOLD bool (*button_hold)(void); #endif @@ -406,7 +406,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 @@ -416,7 +416,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); @@ -455,7 +455,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)); @@ -502,7 +502,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); @@ -510,7 +510,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; @@ -597,7 +597,7 @@ /* scroll bar */ struct gui_syncstatusbar *statusbars; void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw); - + /* options */ const struct settings_list* (*find_setting)(const void* variable, int *id); bool (*option_screen)(const struct settings_list *setting, @@ -611,8 +611,8 @@ const char* no_str, int no_voice, void (*function)(bool)); bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit, - const int* variable, void (*function)(int), int step, - int min, int max, + const int* variable, void (*function)(int), int step, + int min, int max, void (*formatter)(char*, size_t, int, const char*) ); bool (*set_bool)(const char* string, const bool* variable ); @@ -630,7 +630,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 @@ -776,14 +776,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 18139) +++ apps/buffering.c (working copy) @@ -65,7 +65,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 */ @@ -1385,7 +1385,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 18139) +++ apps/debug_menu.c (working copy) @@ -53,7 +53,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" @@ -222,7 +222,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]; @@ -268,7 +268,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. */ @@ -277,7 +277,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 */ @@ -368,7 +368,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); @@ -454,7 +454,7 @@ } #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #ifdef CPU_PP static int perfcheck(void) { @@ -770,9 +770,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) { @@ -955,7 +955,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); @@ -977,7 +977,7 @@ } #endif /* CPU_COLDFIRE */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #ifdef HAVE_LCD_BITMAP /* button definitions */ #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ @@ -1357,9 +1357,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]; @@ -1462,7 +1462,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) { @@ -1531,7 +1531,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 @@ -1727,7 +1727,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" @@ -1979,7 +1979,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) @@ -2164,7 +2164,7 @@ } #endif /* CPU */ -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #if CONFIG_TUNER static int radio_callback(int btn, struct gui_synclist *lists) { @@ -2225,7 +2225,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; @@ -2344,7 +2344,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; @@ -2436,7 +2436,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); @@ -2476,16 +2476,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) @@ -2493,18 +2493,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}, @@ -2519,14 +2519,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 @@ -2537,7 +2537,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 @@ -2553,7 +2553,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/codecs/codec_crt0.c =================================================================== --- apps/codecs/codec_crt0.c (revision 18139) +++ apps/codecs/codec_crt0.c (working copy) @@ -38,7 +38,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/debug_menu.h =================================================================== --- apps/debug_menu.h (revision 18139) +++ apps/debug_menu.h (working copy) @@ -23,7 +23,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 18139) +++ apps/main.c (working copy) @@ -107,7 +107,7 @@ #include "cuesheet.h" -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #include "system-sdl.h" #endif @@ -117,7 +117,7 @@ static void init(void); -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) void app_main(void) #else static void app_main(void) @@ -142,15 +142,15 @@ #ifdef HAVE_DIRCACHE int result = 0; bool clear = false; - + if (preinit) dircache_init(); - + if (!global_settings.dircache) return 0; - + # ifdef HAVE_EEPROM_SETTINGS - if (firmware_settings.initialized && firmware_settings.disk_clean + if (firmware_settings.initialized && firmware_settings.disk_clean && preinit) { result = dircache_load(); @@ -165,7 +165,7 @@ gui_syncsplash(0, str(LANG_SCANNING_DISK)); clear = true; } - + dircache_build(global_status.dircache_size); } } @@ -174,7 +174,7 @@ { if (preinit) return -1; - + if (!dircache_is_enabled() && !dircache_is_initializing()) { @@ -185,7 +185,7 @@ } result = dircache_build(global_status.dircache_size); } - + if (result < 0) { /* Initialization of dircache failed. Manual action is @@ -194,9 +194,9 @@ gui_syncsplash(0, "Dircache failed, disabled. Result: %d", result); global_settings.dircache = false; } - + } - + if (clear) { backlight_on(); @@ -204,7 +204,7 @@ global_status.dircache_size = dircache_get_cache_size(); status_save(); } - + return result; #else (void)preinit; @@ -218,7 +218,7 @@ bool clear = false; tagcache_init(); - + while (!tagcache_is_initialized()) { #ifdef HAVE_LCD_CHARCELLS @@ -245,11 +245,11 @@ #endif #ifdef HAVE_LCD_BITMAP gui_syncsplash(0, "%s [%d/%d]", - str(LANG_TAGCACHE_INIT), ret, + str(LANG_TAGCACHE_INIT), ret, tagcache_get_max_commit_step()); #else lcd_double_height(false); - snprintf(buf, sizeof(buf), " DB [%d/%d]", ret, + snprintf(buf, sizeof(buf), " DB [%d/%d]", ret, tagcache_get_max_commit_step()); lcd_puts(0, 1, buf); lcd_update(); @@ -268,7 +268,7 @@ } #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) static void init(void) { @@ -353,13 +353,13 @@ #endif cpu_boost(true); #endif - + buffer_init(); settings_reset(); i2c_init(); - + power_init(); enable_irq(); @@ -404,7 +404,7 @@ button_init(); powermgmt_init(); - + #if CONFIG_TUNER radio_init(); #endif @@ -448,11 +448,11 @@ #ifdef HAVE_EEPROM_SETTINGS eeprom_settings_init(); #endif - + usb_start_monitoring(); #ifndef HAVE_USBSTACK while (usb_detect() == USB_INSERTED) - { + { #ifdef HAVE_EEPROM_SETTINGS firmware_settings.disk_clean = false; #endif @@ -517,7 +517,7 @@ remove(TAGCACHE_STATEFILE); #endif } - + gui_sync_wps_init(); settings_apply(true); init_dircache(false); @@ -573,7 +573,7 @@ #ifdef AUTOROCK { - static const char filename[] = PLUGIN_APPS_DIR "/autostart.rock"; + static const char filename[] = PLUGIN_APPS_DIR "/autostart.rock"; if(file_exists(filename)) /* no complaint if it doesn't exist */ { Index: apps/misc.c =================================================================== --- apps/misc.c (revision 18139) +++ apps/misc.c (working copy) @@ -647,7 +647,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/kernel.h =================================================================== --- firmware/export/kernel.h (revision 18139) +++ firmware/export/kernel.h (working copy) @@ -206,7 +206,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 18139) +++ firmware/export/system.h (working copy) @@ -193,7 +193,7 @@ MAXMEMGUARD }; -#ifndef SIMULATOR +#ifndef SIMULATOR // #include "system-target.h" #else /* SIMULATOR */ Index: firmware/export/backlight.h =================================================================== --- firmware/export/backlight.h (revision 18139) +++ firmware/export/backlight.h (working copy) @@ -70,7 +70,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 18139) +++ firmware/export/audio.h (working copy) @@ -37,7 +37,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 18139) +++ firmware/export/thread.h (working copy) @@ -81,7 +81,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 @@ -125,7 +125,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 @@ -479,7 +479,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 18139) +++ firmware/export/buffer.h (working copy) @@ -22,7 +22,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 18139) +++ firmware/export/powermgmt.h (working copy) @@ -58,7 +58,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 */ @@ -159,7 +159,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 18139) +++ firmware/export/config.h (working copy) @@ -291,6 +291,8 @@ #include "config-meizu-m6sl.h" #elif defined(ONDA_VX747) #include "config-ondavx747.h" +#elif defined(SDL) +#include "config-sdl.h" #else /* no known platform */ #endif @@ -381,7 +383,7 @@ #define HAVE_EXTENDED_MESSAGING_AND_NAME -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #define HAVE_PRIORITY_SCHEDULING #define HAVE_SCHEDULER_BOOSTCTRL #endif /* SIMULATOR */ @@ -473,7 +475,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 18139) +++ 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 18139) +++ firmware/export/ata_idle_notify.h (working copy) @@ -43,7 +43,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 18139) +++ firmware/export/power.h (working copy) @@ -37,7 +37,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 18139) +++ firmware/export/timer.h (working copy) @@ -36,7 +36,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 18139) +++ firmware/kernel.c (working copy) @@ -22,7 +22,7 @@ #include #include "config.h" #include "kernel.h" -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) #include "system-sdl.h" #include "debug.h" #endif @@ -39,7 +39,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 @@ -439,7 +439,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 18139) +++ firmware/debug.c (working copy) @@ -35,7 +35,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/backlight.c =================================================================== --- firmware/backlight.c (revision 18139) +++ firmware/backlight.c (working copy) @@ -37,7 +37,7 @@ #ifdef HAVE_REMOTE_LCD #include "lcd-remote.h" #endif -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) #include "backlight-target.h" #endif @@ -46,7 +46,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); @@ -221,7 +221,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 @@ -492,7 +492,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: @@ -513,8 +513,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(); @@ -641,7 +641,7 @@ { queue_init(&backlight_queue, true); -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) if (_backlight_init()) { # ifdef HAVE_BACKLIGHT_PWM_FADING Index: firmware/sound.c =================================================================== --- firmware/sound.c (revision 18139) +++ firmware/sound.c (working copy) @@ -35,7 +35,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 @@ -50,16 +50,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}, @@ -219,7 +219,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) @@ -312,10 +312,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; @@ -529,7 +529,7 @@ } #endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */ -#else /* SIMULATOR */ +#else /* !defined(SIMULATOR) && !defined(SDL) */ int sim_volume; void sound_set_volume(int value) { @@ -710,7 +710,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/panic.c =================================================================== --- firmware/panic.c (revision 18139) +++ firmware/panic.c (working copy) @@ -40,7 +40,7 @@ { va_list ap; -#ifndef SIMULATOR +#if (!defined(SIMULATOR) && !defined(SDL)) #if (CONFIG_LED == LED_REAL) bool state = false; int i = 0; @@ -52,7 +52,7 @@ #endif set_irq_level(DISABLE_INTERRUPTS); -#endif /* SIMULATOR */ +#endif /* !SIMULATOR || !SDL*/ va_start( ap, fmt ); vsnprintf( panic_buf, sizeof(panic_buf), fmt, ap ); @@ -90,7 +90,7 @@ while (1) { -#ifndef SIMULATOR +#if (!defined(SIMULATOR) && !defined(SDL)) #if (CONFIG_LED == LED_REAL) if (--i <= 0) { @@ -131,6 +131,6 @@ if(false) #endif /* CPU */ system_reboot(); -#endif /* !SIMULATOR */ +#endif /* !SIMULATOR !SDL*/ } } Index: firmware/include/dbgcheck.h =================================================================== --- firmware/include/dbgcheck.h (revision 18139) +++ 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 18139) +++ firmware/include/dircache.h (working copy) @@ -37,7 +37,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 18139) +++ firmware/include/dir_uncached.h (working copy) @@ -32,7 +32,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 @@ -57,7 +57,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 18139) +++ firmware/include/file.h (working copy) @@ -48,7 +48,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 18139) +++ 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 18139) +++ 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 18139) +++ 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 */ Index: firmware/SOURCES =================================================================== --- firmware/SOURCES (revision 18139) +++ 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 */ @@ -163,7 +165,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) */ @@ -193,7 +195,7 @@ pcm.c #ifdef HAVE_RECORDING enc_base.c -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) pcm_record.c #endif /* SIMULATOR */ #endif /* HAVE_RECORDING */ @@ -203,7 +205,7 @@ #ifndef BOOTLOADER mpeg.c -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) drivers/mas.c #endif /* SIMULATOR */ #endif /* BOOTLOADER */ @@ -238,7 +240,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 @@ -256,7 +258,7 @@ drivers/m5636.c #endif #endif /* !defined(HAVE_USBSTACK) */ -#endif /* !defined(SIMULATOR) */ +#endif /* !defined(SIMULATOR) && !defined(SDL) */ /* Other Random Hardware */ #ifdef HAVE_TSC2100 @@ -391,7 +393,7 @@ common/memset.c common/memset16.c common/strlen.c -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) crt0.S drivers/i2c.c #endif /* SIMULATOR */ 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 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,23 @@ +/*************************************************************************** + * __________ __ ___. + * 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_ + + +#endif Property changes on: firmware/target/generic/sdl/adc-target.h ___________________________________________________________________ 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 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 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,100 @@ +/*************************************************************************** + * __________ __ ___. + * 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_ + +/*taken from the gigabeat*/ + +#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/system-generic.h =================================================================== --- firmware/target/generic/system-generic.h (revision 0) +++ firmware/target/generic/system-generic.h (revision 0) @@ -0,0 +1,59 @@ +/*************************************************************************** + * __________ __ ___. + * 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); +} + + + +#endif /* SYSTEM_GENERIC_H */ Property changes on: firmware/target/generic/system-generic.h ___________________________________________________________________ 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,26 @@ +/*************************************************************************** + * __________ __ ___. + * 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" + + +#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 18139) +++ firmware/common/timefuncs.c (working copy) @@ -27,7 +27,7 @@ #include "timefuncs.h" #include "debug.h" -#ifndef SIMULATOR +#if !defined(SIMULATOR) && !defined(SDL) static struct tm tm; #endif @@ -47,7 +47,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 18139) +++ firmware/common/dircache.c (working copy) @@ -177,13 +177,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)) { @@ -216,7 +216,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) @@ -230,7 +230,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); @@ -281,7 +281,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) @@ -292,7 +292,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); @@ -319,7 +319,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 @@ -341,7 +341,7 @@ logf("memory allocation error"); return -3; } -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) ce->attribute = ATTR_DIRECTORY; #else ce->attribute = FAT_ATTR_DIRECTORY; @@ -362,7 +362,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; @@ -548,7 +548,7 @@ */ static int dircache_do_rebuild(void) { -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) DIR_UNCACHED *pdir; #else struct fat_dir dir, *pdir; @@ -573,7 +573,7 @@ if (fat_ismounted(i)) { #endif -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(SDL) pdir = opendir_uncached("/"); if (pdir == NULL) { @@ -671,7 +671,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 18139) +++ firmware/buffer.c (working copy) @@ -21,7 +21,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 18139) +++ firmware/pcm.c (working copy) @@ -302,7 +302,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 18139) +++ firmware/powermgmt.c (working copy) @@ -51,11 +51,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 @@ -89,7 +89,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 */ @@ -1119,7 +1119,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 @@ -1136,7 +1136,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(); @@ -1148,7 +1148,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 18139) +++ firmware/scroll_engine.c (working copy) @@ -240,7 +240,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(); @@ -278,7 +278,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 18139) +++ firmware/usb.c (working copy) @@ -65,7 +65,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 18139) +++ firmware/drivers/button.c (working copy) @@ -39,7 +39,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 18139) +++ firmware/drivers/fat.c (working copy) @@ -238,6 +238,7 @@ + fat_bpb->firstdatasector; } +#ifndef SDL void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free) { #ifndef HAVE_MULTIVOLUME @@ -249,6 +250,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 18139) +++ uisimulator/sdl/button.c (working copy) @@ -924,6 +924,40 @@ case SDLK_SPACE: new_btn = BUTTON_SELECT; 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/uisdl.h =================================================================== --- uisimulator/sdl/uisdl.h (revision 18139) +++ uisimulator/sdl/uisdl.h (working copy) @@ -419,6 +419,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/common/SOURCES =================================================================== --- uisimulator/common/SOURCES (revision 18139) +++ uisimulator/common/SOURCES (working copy) @@ -7,3 +7,4 @@ #endif sim_icons.c stubs.c +../sdl/uisdl.c