summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-06-21 16:53:00 +0000
committerThomas Martitz <kugel@rockbox.org>2010-06-21 16:53:00 +0000
commit35e8b1429a2cdcf6580f6d25890fed9865165d0b (patch)
tree084be19a29bffa879eee8e3cad92d8f3b342a337
parent02e04585bdf1fbd00cf84d2000f59ec198440cb3 (diff)
downloadrockbox-35e8b1429a2cdcf6580f6d25890fed9865165d0b.tar.gz
rockbox-35e8b1429a2cdcf6580f6d25890fed9865165d0b.tar.bz2
rockbox-35e8b1429a2cdcf6580f6d25890fed9865165d0b.zip
Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with #if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently).
The simulator defines PLATFORM_HOSTED, as RaaA will do (RaaA will not define SIMULATOR). The new define is to (de-)select code to compile on hosted platforms generally. Should be no functional change to targets or the simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27019 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/audio_path.c6
-rw-r--r--apps/bitmaps/mono/SOURCES2
-rw-r--r--apps/bitmaps/remote_mono/SOURCES2
-rw-r--r--apps/buffering.c2
-rw-r--r--apps/codecs.c22
-rw-r--r--apps/codecs.h2
-rw-r--r--apps/codecs/codec_crt0.c2
-rw-r--r--apps/codecs/lib/SOURCES2
-rw-r--r--apps/codecs/lib/tlsf/src/tlsf.c4
-rw-r--r--apps/codecs/libm4a/demux.c4
-rw-r--r--apps/codecs/libspc/spc_codec.h2
-rw-r--r--apps/codecs/libtremor/ctype.c3
-rw-r--r--apps/debug_menu.c38
-rw-r--r--apps/filetree.c2
-rw-r--r--apps/main.c4
-rw-r--r--apps/menus/main_menu.c2
-rw-r--r--apps/misc.c2
-rw-r--r--apps/pcmbuf.c2
-rw-r--r--apps/playback.c6
-rw-r--r--apps/playlist.c2
-rw-r--r--apps/plugin.c30
-rw-r--r--apps/plugin.h24
-rw-r--r--apps/plugins/BUILD_OVERLAY2
-rw-r--r--apps/plugins/SOURCES4
-rw-r--r--apps/plugins/beatbox/beatbox.c2
-rw-r--r--apps/plugins/bitmaps/mono/SOURCES2
-rw-r--r--apps/plugins/bitmaps/remote_mono/SOURCES2
-rw-r--r--apps/plugins/bitmaps/remote_native/SOURCES2
-rw-r--r--apps/plugins/chip8.c14
-rw-r--r--apps/plugins/doom/rockdoom.c6
-rw-r--r--apps/plugins/doom/rockmacros.h2
-rw-r--r--apps/plugins/goban.c2
-rw-r--r--apps/plugins/imageviewer/imageviewer.h2
-rw-r--r--apps/plugins/lib/SOURCES6
-rw-r--r--apps/plugins/lib/pluginlib_exit.h2
-rw-r--r--apps/plugins/lua/rockaux.c2
-rw-r--r--apps/plugins/lua/rockconf.h2
-rw-r--r--apps/plugins/lua/rocklibc.h2
-rw-r--r--apps/plugins/midi/midiutil.h2
-rw-r--r--apps/plugins/pacbox/pacbox_lcd.c2
-rw-r--r--apps/plugins/rockboy/rockboy.c2
-rw-r--r--apps/plugins/test_codec.c2
-rw-r--r--apps/plugins/test_disk.c4
-rw-r--r--apps/plugins/test_fps.c6
-rw-r--r--apps/plugins/test_mem.c2
-rw-r--r--apps/radio/radio.c4
-rw-r--r--apps/recorder/peakmeter.c6
-rw-r--r--apps/scrobbler.c3
-rw-r--r--apps/settings.c2
-rw-r--r--apps/status.h2
-rw-r--r--apps/tagcache.c2
-rw-r--r--firmware/SOURCES38
-rw-r--r--firmware/backlight.c5
-rw-r--r--firmware/buffer.c2
-rw-r--r--firmware/common/dircache.c8
-rw-r--r--firmware/drivers/button.c6
-rw-r--r--firmware/export/ata_idle_notify.h2
-rw-r--r--firmware/export/audio.h2
-rw-r--r--firmware/export/buffer.h6
-rw-r--r--firmware/export/config.h28
-rw-r--r--firmware/export/config/sim.h1
-rw-r--r--firmware/export/font.h2
-rw-r--r--firmware/export/hwcompat.h4
-rw-r--r--firmware/export/kernel.h2
-rw-r--r--firmware/export/power.h2
-rw-r--r--firmware/export/powermgmt.h4
-rw-r--r--firmware/export/storage.h4
-rw-r--r--firmware/export/system.h9
-rw-r--r--firmware/export/thread.h8
-rw-r--r--firmware/export/timer.h2
-rw-r--r--firmware/export/tuner.h4
-rw-r--r--firmware/include/dbgcheck.h4
-rw-r--r--firmware/include/dir_uncached.h6
-rw-r--r--firmware/include/dircache.h2
-rw-r--r--firmware/include/file.h5
-rw-r--r--firmware/logf.c2
-rw-r--r--firmware/panic.c2
-rw-r--r--firmware/powermgmt.c6
-rw-r--r--firmware/scroll_engine.c4
-rw-r--r--firmware/sound.c12
-rw-r--r--firmware/system.c2
81 files changed, 233 insertions, 209 deletions
diff --git a/apps/audio_path.c b/apps/audio_path.c
index 0469d4412a..dab43ebf42 100644
--- a/apps/audio_path.c
+++ b/apps/audio_path.c
@@ -42,7 +42,7 @@
#endif
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef AUDIO_CPU_BOOST
static void audio_cpu_boost(bool state)
@@ -115,7 +115,7 @@ int audio_get_spdif_sample_rate(void)
} /* audio_get_spdif_sample_rate */
#endif /* HAVE_SPDIF_IN */
-#else /* SIMULATOR */
+#else /* PLATFORM_HOSTED */
/** Sim stubs **/
@@ -153,4 +153,4 @@ int audio_get_spdif_sample_rate(void)
} /* audio_get_spdif_sample_rate */
#endif /* HAVE_SPDIF_IN */
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_NATIVE */
diff --git a/apps/bitmaps/mono/SOURCES b/apps/bitmaps/mono/SOURCES
index 4d9008e8a3..2dccf2ad4f 100644
--- a/apps/bitmaps/mono/SOURCES
+++ b/apps/bitmaps/mono/SOURCES
@@ -1,3 +1,3 @@
-#if defined(SIMULATOR) && defined(__APPLE__)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx_dummy.bmp
#endif
diff --git a/apps/bitmaps/remote_mono/SOURCES b/apps/bitmaps/remote_mono/SOURCES
index 83b71c10b2..75f641fd95 100644
--- a/apps/bitmaps/remote_mono/SOURCES
+++ b/apps/bitmaps/remote_mono/SOURCES
@@ -1,3 +1,3 @@
-#if defined(SIMULATOR) && defined(__APPLE__)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx_remote_dummy.bmp
#endif
diff --git a/apps/buffering.c b/apps/buffering.c
index 8a6418fd22..c2cecddf03 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -1488,7 +1488,7 @@ void buffering_thread(void)
base_handle_id = (int)ev.data;
break;
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_USB_CONNECTED:
LOGFQUEUE("buffering < SYS_USB_CONNECTED");
usb_acknowledge(SYS_USB_CONNECTED_ACK);
diff --git a/apps/codecs.c b/apps/codecs.c
index 46d9223560..22e692c111 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -54,20 +54,20 @@
#define LOGF_ENABLE
#include "logf.h"
-#ifdef SIMULATOR
-#define PREFIX(_x_) sim_ ## _x_
-#else
-#define PREFIX
-#endif
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
-#ifdef SIMULATOR
+#define PREFIX(_x_) sim_ ## _x_
#if CONFIG_CODEC == SWCODEC
unsigned char codecbuf[CODEC_SIZE];
#endif
void *sim_codec_load_ram(char* codecptr, int size, void **pd);
void sim_codec_close(void *pd);
-#else
+
+#else /* !PLATFORM_HOSTED */
+
+#define PREFIX
#define sim_codec_close(x)
+
#endif
size_t codec_size;
@@ -77,7 +77,7 @@ extern void* plugin_get_audio_buffer(size_t *buffer_size);
#undef open
static int open(const char* pathname, int flags, ...)
{
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
int fd;
if (flags & O_CREAT)
{
@@ -201,7 +201,7 @@ static int codec_load_ram(int size, struct codec_api *api)
{
struct codec_header *hdr;
int status;
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
hdr = (struct codec_header *)codecbuf;
if (size <= (signed)sizeof(struct codec_header)
@@ -220,7 +220,7 @@ static int codec_load_ram(int size, struct codec_api *api)
codec_size = hdr->end_addr - codecbuf;
-#else /* SIMULATOR */
+#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
void *pd;
hdr = sim_codec_load_ram(codecbuf, size, &pd);
@@ -241,7 +241,7 @@ static int codec_load_ram(int size, struct codec_api *api)
codec_size = codecbuf - codecbuf;
-#endif /* SIMULATOR */
+#endif /* CONFIG_PLATFORM */
if (hdr->api_version > CODEC_API_VERSION
|| hdr->api_version < CODEC_MIN_API_VERSION) {
sim_codec_close(pd);
diff --git a/apps/codecs.h b/apps/codecs.h
index 27c9caba13..c3dbc4aaa3 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -254,7 +254,7 @@ extern unsigned char codecbuf[];
extern size_t codec_size;
#ifdef CODEC
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* plugin_* is correct, codecs use the plugin linker script */
extern unsigned char plugin_start_addr[];
extern unsigned char plugin_end_addr[];
diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c
index ed313634e3..dd0f99ffd8 100644
--- a/apps/codecs/codec_crt0.c
+++ b/apps/codecs/codec_crt0.c
@@ -36,7 +36,7 @@ extern enum codec_status codec_main(void);
enum codec_status codec_start(void)
{
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef USE_IRAM
ci->memcpy(iramstart, iramcopy, iramend - iramstart);
ci->memset(iedata, 0, iend - iedata);
diff --git a/apps/codecs/lib/SOURCES b/apps/codecs/lib/SOURCES
index da77f97d30..49e744721d 100644
--- a/apps/codecs/lib/SOURCES
+++ b/apps/codecs/lib/SOURCES
@@ -24,6 +24,6 @@ setjmp_cf.S
setjmp_mips.S
#endif
-#elif defined(SIMULATOR) && defined(__APPLE__)
+#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx.dummy.c
#endif
diff --git a/apps/codecs/lib/tlsf/src/tlsf.c b/apps/codecs/lib/tlsf/src/tlsf.c
index 570e472607..87f8d262ee 100644
--- a/apps/codecs/lib/tlsf/src/tlsf.c
+++ b/apps/codecs/lib/tlsf/src/tlsf.c
@@ -104,6 +104,7 @@
#include <sys/mman.h>
#endif
+#include "config.h"
#include "tlsf.h"
#if !defined(__GNUC__)
@@ -164,7 +165,8 @@
#define PAGE_SIZE (getpagesize())
#endif
-#if defined(ROCKBOX) && defined(SIMULATOR) || !defined(ROCKBOX)
+#if defined(ROCKBOX) && (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(DEBUG) \
+ || !defined(ROCKBOX)
int printf(const char* fmt, ...);
#define PRINT_MSG(fmt, args...) printf(fmt, ## args)
#define ERROR_MSG(fmt, args...) printf(fmt, ## args)
diff --git a/apps/codecs/libm4a/demux.c b/apps/codecs/libm4a/demux.c
index 8c7189e158..bde2238409 100644
--- a/apps/codecs/libm4a/demux.c
+++ b/apps/codecs/libm4a/demux.c
@@ -37,10 +37,8 @@
#include "m4a.h"
-#if defined(DEBUG) || defined(SIMULATOR)
-#ifdef DEBUGF
#undef DEBUGF
-#endif
+#if defined(DEBUG)
#define DEBUGF qtmovie->stream->ci->debugf
#else
#define DEBUGF(...)
diff --git a/apps/codecs/libspc/spc_codec.h b/apps/codecs/libspc/spc_codec.h
index 95d09fa091..b3a445c596 100644
--- a/apps/codecs/libspc/spc_codec.h
+++ b/apps/codecs/libspc/spc_codec.h
@@ -51,7 +51,7 @@
/* TGB is the only target fast enough for gaussian and realtime BRR decode */
/* echo is almost fast enough but not quite */
#if defined(TOSHIBA_GIGABEAT_F) || defined(TOSHIBA_GIGABEAT_S) ||\
- defined(SIMULATOR) || MEMORYSIZE <= 2
+ (CONFIG_PLATFORM & PLATFORM_HOSTED) || MEMORYSIZE <= 2
/* Don't cache BRR waves */
#define SPC_BRRCACHE 0
diff --git a/apps/codecs/libtremor/ctype.c b/apps/codecs/libtremor/ctype.c
index 359be61e5a..9f22047675 100644
--- a/apps/codecs/libtremor/ctype.c
+++ b/apps/codecs/libtremor/ctype.c
@@ -1,3 +1,4 @@
-#ifndef SIMULATOR
+#include "config.h"
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "libc/ctype.c"
#endif
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 8da022453d..bd969df0c0 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -53,7 +53,7 @@
#include "lcd-remote.h"
#include "crc32.h"
#include "logf.h"
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "disk.h"
#include "adc.h"
#include "power.h"
@@ -276,7 +276,7 @@ static unsigned int ticks, boost_ticks, freq_sum;
static void dbg_audio_task(void)
{
-#ifndef SIMULATOR
+#ifdef CPUFREQ_NORMAL
if(FREQ > CPUFREQ_NORMAL)
boost_ticks++;
freq_sum += FREQ/1000000; /* in MHz */
@@ -371,7 +371,7 @@ static bool dbg_buffering_thread(void)
screens[i].putsf(0, line++, "handle count: %d", (int)d.num_handles);
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
screens[i].putsf(0, line++, "cpu freq: %3dMHz",
(int)((FREQ + 500000) / 1000000));
#endif
@@ -758,7 +758,7 @@ static bool dbg_hw_info(void)
#endif /* !HAVE_LCD_BITMAP */
#endif /* !SIMULATOR */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
static const char* dbg_partitions_getname(int selected_item, void *data,
char *buffer, size_t buffer_len)
{
@@ -786,7 +786,7 @@ bool dbg_partitions(void)
info.get_name = dbg_partitions_getname;
return simplelist_show_list(&info);
}
-#endif
+#endif /* PLATFORM_NATIVE */
#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
static bool dbg_spdif(void)
@@ -928,7 +928,7 @@ static bool dbg_spdif(void)
lcd_putsf(0, line++, "Clock accuracy: %d", x);
line++;
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
lcd_putsf(0, line++, "Measured freq: %ldHz",
spdif_measure_frequency());
#endif
@@ -950,7 +950,7 @@ static bool dbg_spdif(void)
}
#endif /* CPU_COLDFIRE */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef HAVE_LCD_BITMAP
/* button definitions */
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
@@ -1334,9 +1334,9 @@ bool dbg_ports(void)
return false;
}
#endif /* !HAVE_LCD_BITMAP */
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_NATIVE */
-#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
+#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
static bool dbg_pcf(void)
{
int line;
@@ -1423,7 +1423,7 @@ static bool dbg_cpufreq(void)
}
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
-#if defined(HAVE_TSC2100) && !defined(SIMULATOR)
+#if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "tsc2100.h"
static char *itob(int n, int len)
{
@@ -1493,7 +1493,7 @@ static bool tsc2100_debug(void)
return simplelist_show_list(&info);
}
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef HAVE_LCD_BITMAP
/*
* view_battery() shows a automatically scaled graph of the battery voltage
@@ -1785,7 +1785,7 @@ static bool view_battery(void)
#endif /* HAVE_LCD_BITMAP */
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
#if (CONFIG_STORAGE & STORAGE_MMC)
@@ -2106,7 +2106,7 @@ static bool dbg_disk_info(void)
info.scroll_all = true;
return simplelist_show_list(&info);
}
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#ifdef HAVE_DIRCACHE
static int dircache_callback(int btn, struct gui_synclist *lists)
@@ -2672,10 +2672,10 @@ static const struct the_menu_item menuitems[] = {
|| CONFIG_CPU == DM320 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2
{ "View I/O ports", dbg_ports },
#endif
-#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
+#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "View PCF registers", dbg_pcf },
#endif
-#if defined(HAVE_TSC2100) && !defined(SIMULATOR)
+#if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "TSC2100 debug", tsc2100_debug },
#endif
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -2689,18 +2689,18 @@ static const struct the_menu_item menuitems[] = {
#endif
{ "View OS stacks", dbg_os },
#ifdef HAVE_LCD_BITMAP
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "View battery", view_battery },
#endif
{ "Screendump", dbg_screendump },
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "View HW info", dbg_hw_info },
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "View partitions", dbg_partitions },
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "View disk info", dbg_disk_info },
#if (CONFIG_STORAGE & STORAGE_ATA)
{ "Dump ATA identify info", dbg_identify_info},
diff --git a/apps/filetree.c b/apps/filetree.c
index 1faf4c987e..460ab9e453 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -597,7 +597,7 @@ int ft_enter(struct tree_context* c)
break;
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* firmware file */
case FILE_ATTR_MOD:
splash(0, ID2P(LANG_WAIT));
diff --git a/apps/main.c b/apps/main.c
index 2555deb12f..19249241bb 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -115,6 +115,8 @@
#ifdef SIMULATOR
#include "sim_tasks.h"
+#endif
+#ifdef HAVE_SDL
#include "system-sdl.h"
#endif
@@ -313,7 +315,7 @@ static void init_tagcache(void)
}
#endif
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
static void init(void)
{
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index 3dd6348e57..32164ff3e0 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -347,7 +347,7 @@ static int info_action_callback(int action, struct gui_synclist *lists)
#endif
)
{
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
struct info_data *info = (struct info_data *)lists->data;
int i;
info->new_data = true;
diff --git a/apps/misc.c b/apps/misc.c
index 41988363ad..bae8dfbd07 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -251,7 +251,7 @@ static void system_restore(void)
static bool clean_shutdown(void (*callback)(void *), void *parameter)
{
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
(void)callback;
(void)parameter;
bookmark_autobookmark(false);
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index e9102b2a73..ebc31fbb2e 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -30,7 +30,7 @@
/* Define LOGF_ENABLE to enable logf output in this file */
/*#define LOGF_ENABLE*/
#include "logf.h"
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "cpu.h"
#endif
#include <string.h>
diff --git a/apps/playback.c b/apps/playback.c
index 6be869f83a..4a28a9d008 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -468,7 +468,7 @@ unsigned char *audio_get_recording_buffer(size_t *buffer_size)
bool audio_load_encoder(int afmt)
{
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
const char *enc_fn = get_codec_filename(afmt | CODEC_TYPE_ENCODER);
if (!enc_fn)
return false;
@@ -493,7 +493,7 @@ bool audio_load_encoder(int afmt)
void audio_remove_encoder(void)
{
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* force encoder codec unload (if currently loaded) */
if (ci.enc_codec_loaded <= 0)
return;
@@ -2008,7 +2008,7 @@ static void audio_thread(void)
LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED");
audio_finalise_track_change();
break;
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_USB_CONNECTED:
LOGFQUEUE("audio < SYS_USB_CONNECTED");
if (playing)
diff --git a/apps/playlist.c b/apps/playlist.c
index 485601cd7e..4a6db883f7 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1318,7 +1318,7 @@ static void playlist_thread(void)
dirty_pointers = false;
break ;
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_USB_CONNECTED:
usb_acknowledge(SYS_USB_CONNECTED_ACK);
usb_wait_for_disconnect(&playlist_queue);
diff --git a/apps/plugin.c b/apps/plugin.c
index d626ef6488..56d2be9f40 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -57,7 +57,7 @@
#include "usbstack/usb_hid.h"
#endif
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define PREFIX(_x_) sim_ ## _x_
#else
#define PREFIX
@@ -72,7 +72,7 @@
static unsigned int open_files;
#endif
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
void *sim_plugin_load(char *plugin, void **pd);
void sim_plugin_close(void *pd);
@@ -157,7 +157,7 @@ static const struct plugin_api rockbox_api = {
lcd_yuv_set_options,
#endif
#endif /* MEMORYSIZE > 2 */
-#elif (LCD_DEPTH < 4) && !defined(SIMULATOR)
+#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
lcd_blit_mono,
lcd_blit_grey_phase,
#endif /* LCD_DEPTH */
@@ -366,7 +366,7 @@ static const struct plugin_api rockbox_api = {
#endif
reset_poweroff_timer,
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
system_memory_guard,
&cpu_frequency,
@@ -377,7 +377,7 @@ static const struct plugin_api rockbox_api = {
cpu_boost,
#endif
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#ifdef HAVE_SCHEDULER_BOOSTCTRL
trigger_cpu_boost,
cancel_cpu_boost,
@@ -415,7 +415,7 @@ static const struct plugin_api rockbox_api = {
remove_event,
send_event,
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
/* special simulator hooks */
#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
sim_lcd_ex_init,
@@ -437,7 +437,7 @@ static const struct plugin_api rockbox_api = {
memset,
memcpy,
memmove,
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
_ctype_,
#endif
atoi,
@@ -467,7 +467,7 @@ static const struct plugin_api rockbox_api = {
#ifdef AUDIOHW_HAVE_EQ
sound_enum_hw_eq_band_setting,
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
mp3_play_data,
mp3_play_pause,
mp3_play_stop,
@@ -589,7 +589,7 @@ static const struct plugin_api rockbox_api = {
battery_level,
battery_level_safe,
battery_time,
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
battery_voltage,
#endif
#if CONFIG_CHARGING
@@ -603,7 +603,7 @@ static const struct plugin_api rockbox_api = {
#endif
/* misc */
-#if !defined(SIMULATOR)
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
&errno,
#endif
srand,
@@ -727,15 +727,15 @@ int plugin_load(const char* plugin, const void* parameter)
{
int rc, i;
struct plugin_header *hdr;
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
void *pd;
-#else /* !SIMULATOR */
+#else /* PLATFOR_NATIVE */
int fd;
ssize_t readsize;
#if NUM_CORES > 1
unsigned my_core;
#endif
-#endif /* !SIMULATOR */
+#endif /* CONFIG_PLATFORM */
#if LCD_DEPTH > 1
fb_data* old_backdrop;
@@ -755,7 +755,7 @@ int plugin_load(const char* plugin, const void* parameter)
splash(0, ID2P(LANG_WAIT));
strcpy(current_plugin, plugin);
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
hdr = sim_plugin_load((char *)plugin, &pd);
if (pd == NULL) {
splashf(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin);
@@ -990,7 +990,7 @@ static int open_wrapper(const char* pathname, int flags, ...)
/* we don't have an 'open' function. it's a define. and we need
* the real file_open, hence PREFIX() doesn't work here */
int fd;
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
if (flags & O_CREAT)
{
va_list ap;
diff --git a/apps/plugin.h b/apps/plugin.h
index a6b864ba44..b0f4e051c5 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -233,7 +233,7 @@ struct plugin_api {
void (*lcd_yuv_set_options)(unsigned options);
#endif
#endif /* MEMORYSIZE > 2 */
-#elif (LCD_DEPTH < 4) && !defined(SIMULATOR)
+#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
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,
@@ -474,7 +474,7 @@ struct plugin_api {
#endif
void (*reset_poweroff_timer)(void);
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int (*system_memory_guard)(int newmode);
long *cpu_frequency;
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -484,7 +484,7 @@ struct plugin_api {
void (*cpu_boost)(bool on_off);
#endif
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#ifdef HAVE_SCHEDULER_BOOSTCTRL
void (*trigger_cpu_boost)(void);
void (*cancel_cpu_boost)(void);
@@ -530,7 +530,7 @@ struct plugin_api {
void (*remove_event)(unsigned short id, void (*handler)(void *data));
void (*send_event)(unsigned short id, void *data);
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
/* special simulator hooks */
#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
void (*sim_lcd_ex_init)(unsigned long (*getpixel)(int, int));
@@ -553,7 +553,7 @@ struct plugin_api {
void* (*memset)(void *dst, int c, size_t length);
void* (*memcpy)(void *out, const void *in, size_t n);
void* (*memmove)(void *out, const void *in, size_t n);
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
const unsigned char *_rbctype_;
#endif
int (*atoi)(const char *str);
@@ -584,7 +584,7 @@ struct plugin_api {
int (*sound_enum_hw_eq_band_setting)(unsigned int band,
unsigned int band_setting);
#endif /* AUDIOHW_HAVE_EQ */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
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);
@@ -593,7 +593,7 @@ struct plugin_api {
#if CONFIG_CODEC != SWCODEC
void (*bitswap)(unsigned char *data, int length);
#endif
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#if CONFIG_CODEC == SWCODEC
const unsigned long *audio_master_sampr_list;
const unsigned long *hw_freq_sampr;
@@ -731,7 +731,7 @@ struct plugin_api {
int (*battery_level)(void);
bool (*battery_level_safe)(void);
int (*battery_time)(void);
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
unsigned int (*battery_voltage)(void);
#endif
#if CONFIG_CHARGING
@@ -745,7 +745,7 @@ struct plugin_api {
#endif
/* misc */
-#if !defined(SIMULATOR)
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int* __errno;
#endif
void (*srand)(unsigned int seed);
@@ -902,7 +902,7 @@ struct plugin_header {
};
#ifdef PLUGIN
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
extern unsigned char plugin_start_addr[];
extern unsigned char plugin_end_addr[];
#define PLUGIN_HEADER \
@@ -911,14 +911,14 @@ extern unsigned char plugin_end_addr[];
__attribute__ ((section (".header")))= { \
PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
plugin_start_addr, plugin_end_addr, plugin_start, &rb };
-#else /* SIMULATOR */
+#else /* PLATFORM_HOSTED */
#define PLUGIN_HEADER \
const struct plugin_api *rb DATA_ATTR; \
const struct plugin_header __header \
__attribute__((visibility("default"))) = { \
PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
NULL, NULL, plugin_start, &rb };
-#endif /* SIMULATOR */
+#endif /* CONFIG_PLATFORM */
#ifdef PLUGIN_USE_IRAM
/* Declare IRAM variables */
diff --git a/apps/plugins/BUILD_OVERLAY b/apps/plugins/BUILD_OVERLAY
index 0afcbfbbf9..dd129333c2 100644
--- a/apps/plugins/BUILD_OVERLAY
+++ b/apps/plugins/BUILD_OVERLAY
@@ -4,6 +4,6 @@
* they will grep for "YES" to see if overlay plugins must be built
*/
-#if PLUGIN_BUFFER_SIZE <= 0x20000 && !defined(SIMULATOR)
+#if PLUGIN_BUFFER_SIZE <= 0x20000 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
YES
#endif
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 9e4b66ec14..a63bb922b6 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -65,7 +65,7 @@ iriverify.c
-#ifndef SIMULATOR /* those plugins only run on hardware */
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE) /* those plugins only run on hardware */
/* Overlays loaders */
#if PLUGIN_BUFFER_SIZE <= 0x20000 && defined(HAVE_LCD_BITMAP)
@@ -132,7 +132,7 @@ wavplay.c
wavrecord.c
#endif
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
diff --git a/apps/plugins/beatbox/beatbox.c b/apps/plugins/beatbox/beatbox.c
index 1a940e1047..a51f738cd2 100644
--- a/apps/plugins/beatbox/beatbox.c
+++ b/apps/plugins/beatbox/beatbox.c
@@ -125,7 +125,7 @@ PLUGIN_IRAM_DECLARE
#undef SYNC
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define SYNC
#endif
diff --git a/apps/plugins/bitmaps/mono/SOURCES b/apps/plugins/bitmaps/mono/SOURCES
index 0152e92e0d..813ede362c 100644
--- a/apps/plugins/bitmaps/mono/SOURCES
+++ b/apps/plugins/bitmaps/mono/SOURCES
@@ -61,6 +61,6 @@ superdom_boarditems.160x128x1.bmp
#endif
#endif /* HAVE_LCD_BITMAP */
-#if defined(SIMULATOR) && defined(__APPLE__)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx.dummy.bmp
#endif
diff --git a/apps/plugins/bitmaps/remote_mono/SOURCES b/apps/plugins/bitmaps/remote_mono/SOURCES
index c59aab6107..b6be5138c9 100644
--- a/apps/plugins/bitmaps/remote_mono/SOURCES
+++ b/apps/plugins/bitmaps/remote_mono/SOURCES
@@ -1,3 +1,3 @@
-#if defined(SIMULATOR) && defined(__APPLE__)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx.dummy.bmp
#endif
diff --git a/apps/plugins/bitmaps/remote_native/SOURCES b/apps/plugins/bitmaps/remote_native/SOURCES
index 2bc3d59c07..b3cc2157ff 100644
--- a/apps/plugins/bitmaps/remote_native/SOURCES
+++ b/apps/plugins/bitmaps/remote_native/SOURCES
@@ -1,4 +1,4 @@
-#if defined(SIMULATOR) && defined(__APPLE__)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx.dummy.bmp
#endif
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c
index be66d6351f..a1372cd608 100644
--- a/apps/plugins/chip8.c
+++ b/apps/plugins/chip8.c
@@ -1185,7 +1185,7 @@ static byte chip8_keymap[16];
static unsigned long starttimer; /* Timer value at the beginning */
static unsigned long cycles; /* Number of update cycles (50Hz) */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
static bool is_playing;
/* one frame of bitswapped mp3 data */
@@ -1208,14 +1208,14 @@ static void callback(unsigned char** start, size_t* size)
*start = beep; /* give it the same frame again */
*size = sizeof(beep);
}
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_NATIVE */
/****************************************************************************/
/* Turn sound on */
/****************************************************************************/
static void chip8_sound_on (void)
{
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
if (!is_playing)
rb->mp3_play_pause(true); /* kickoff audio */
#endif
@@ -1226,7 +1226,7 @@ static void chip8_sound_on (void)
/****************************************************************************/
static void chip8_sound_off (void)
{
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
if (!is_playing)
rb->mp3_play_pause(false); /* pause audio */
#endif
@@ -1266,7 +1266,7 @@ static void chip8_update_display(void)
*row++ = w;
}
}
-#if defined(SIMULATOR) || (LCD_DEPTH > 1)
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || (LCD_DEPTH > 1)
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_mono_bitmap(lcd_framebuf[0], CHIP8_X, CHIP8_Y, CHIP8_LCDWIDTH,
CHIP8_HEIGHT);
@@ -1428,7 +1428,7 @@ static bool chip8_run(const char* file)
#endif
rb->lcd_update();
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* init sound */
is_playing = rb->mp3_is_playing(); /* would we disturb playback? */
if (!is_playing) /* no? then we can make sound */
@@ -1442,7 +1442,7 @@ static bool chip8_run(const char* file)
cycles = 0;
chip8();
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
if (!is_playing)
{ /* stop it if we used audio */
rb->mp3_play_stop(); /* Stop audio playback */
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index 26afdd93db..042212812a 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -62,7 +62,7 @@ int fileexists(const char * fname)
return -1;
}
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int my_open(const char *file, int flags, ...)
{
if(fpoint==8)
@@ -111,7 +111,7 @@ int my_close(int id)
bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
// Here is a hacked up printf command to get the output from the game.
int printf(const char *fmt, ...)
{
@@ -751,7 +751,7 @@ enum plugin_status plugin_start(const void* parameter)
printf("There were still: %d files open\n", fpoint);
while(fpoint>0)
{
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
close(filearray[fpoint]);
#else
rb->close(filearray[fpoint]);
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h
index 89c943622a..3276aa1539 100644
--- a/apps/plugins/doom/rockmacros.h
+++ b/apps/plugins/doom/rockmacros.h
@@ -42,7 +42,7 @@ char *my_strtok( char * s, const char * delim );
#undef read_line
#define read_line(a,b,c) rb->read_line((a),(b),(c))
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define open(a, ...) rb->open((a), __VA_ARGS__)
#define close(a) rb->close((a))
#else
diff --git a/apps/plugins/goban.c b/apps/plugins/goban.c
index 8c8aa7a449..7bb6744dde 100644
--- a/apps/plugins/goban.c
+++ b/apps/plugins/goban.c
@@ -20,7 +20,7 @@
****************************************************************************/
#include "plugin.h"
-#if PLUGIN_BUFFER_SIZE < 0x10000 && !defined(SIMULATOR)
+#if PLUGIN_BUFFER_SIZE < 0x10000 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "lib/overlay.h"
diff --git a/apps/plugins/imageviewer/imageviewer.h b/apps/plugins/imageviewer/imageviewer.h
index 5f22b03e97..79ac5ed9f1 100644
--- a/apps/plugins/imageviewer/imageviewer.h
+++ b/apps/plugins/imageviewer/imageviewer.h
@@ -386,7 +386,7 @@
#define PLUGIN_ABORT 11
#define PLUGIN_OUTOFMEM 12
-#if !defined(SIMULATOR) && defined(HAVE_DISK_STORAGE)
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && defined(HAVE_DISK_STORAGE)
#define DISK_SPINDOWN
#endif
#if PLUGIN_BUFFER_SIZE >= MIN_MEM
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES
index 2c4209b6d2..fa12f94730 100644
--- a/apps/plugins/lib/SOURCES
+++ b/apps/plugins/lib/SOURCES
@@ -28,7 +28,7 @@ grey_sh.S
#endif /* HAVE_LCD_BITMAP && LCD_DEPTH < 4 */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
overlay.c
#endif
@@ -76,7 +76,7 @@ pluginlib_albumart.c
pluginlib_touchscreen.c
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef CPU_ARM
../../codecs/lib/setjmp_arm.S
@@ -90,4 +90,4 @@ pluginlib_touchscreen.c
../../codecs/lib/setjmp_mips.S
#endif
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_NATIVE */
diff --git a/apps/plugins/lib/pluginlib_exit.h b/apps/plugins/lib/pluginlib_exit.h
index 6cded9d56f..00cbc8dc7f 100644
--- a/apps/plugins/lib/pluginlib_exit.h
+++ b/apps/plugins/lib/pluginlib_exit.h
@@ -23,7 +23,7 @@
#define __PLUGINLIB_EXIT_H__
#include "config.h"
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "../../codecs/lib/setjmp.h"
#else
#include <setjmp.h>
diff --git a/apps/plugins/lua/rockaux.c b/apps/plugins/lua/rockaux.c
index 1f832d4cc7..f10a1cb021 100644
--- a/apps/plugins/lua/rockaux.c
+++ b/apps/plugins/lua/rockaux.c
@@ -24,7 +24,7 @@
#define _ROCKCONF_H_ /* Protect against unwanted include */
#include "lua.h"
-#if !defined(SIMULATOR)
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int errno = 0;
#endif
diff --git a/apps/plugins/lua/rockconf.h b/apps/plugins/lua/rockconf.h
index 7fbc89f166..dd7f98f1d7 100644
--- a/apps/plugins/lua/rockconf.h
+++ b/apps/plugins/lua/rockconf.h
@@ -31,7 +31,7 @@
#undef LUA_PATH_DEFAULT
#define LUA_PATH_DEFAULT "$/?.lua;" "$/?/init.lua;" VIEWERS_DIR"/lua/?.lua;" VIEWERS_DIR"/lua/?/init.lua;"
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "../../codecs/lib/setjmp.h"
#else
#include <setjmp.h>
diff --git a/apps/plugins/lua/rocklibc.h b/apps/plugins/lua/rocklibc.h
index 9b68f429d2..44f916fded 100644
--- a/apps/plugins/lua/rocklibc.h
+++ b/apps/plugins/lua/rocklibc.h
@@ -26,7 +26,7 @@
#include <ctype.h>
#include "plugin.h"
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#include <errno.h>
#define PREFIX(_x_) sim_ ## _x_
#else
diff --git a/apps/plugins/midi/midiutil.h b/apps/plugins/midi/midiutil.h
index b1ed6569b7..d7a252035d 100644
--- a/apps/plugins/midi/midiutil.h
+++ b/apps/plugins/midi/midiutil.h
@@ -39,6 +39,8 @@
improved to increase MAX_VOICES for targets that can do 22kHz */
#ifdef CPU_PP
#define MAX_VOICES 16
+#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
+#define MAX_VOICES 48
#else
#define MAX_VOICES 24 /* Note: 24 midi channels is the minimum general midi spec implementation */
#endif /* CPU_PP */
diff --git a/apps/plugins/pacbox/pacbox_lcd.c b/apps/plugins/pacbox/pacbox_lcd.c
index 64b12f08eb..c4df2fa6cd 100644
--- a/apps/plugins/pacbox/pacbox_lcd.c
+++ b/apps/plugins/pacbox/pacbox_lcd.c
@@ -28,7 +28,7 @@
#include "arcade.h"
#include "hardware.h"
-#if defined(SIMULATOR) || !defined(IRIVER_H300_SERIES)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) || !defined(IRIVER_H300_SERIES)
void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf)
{
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index b95cd6d0ff..797971c734 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -403,7 +403,7 @@ enum plugin_status plugin_start(const void* parameter)
= rb->plugin_get_audio_buffer(&audio_buffer_free);
plugbuf=false;
}
-#if MEM <= 8 && !defined(SIMULATOR)
+#if MEM <= 8 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* loaded as an overlay plugin, protect from overwriting ourselves */
if ((unsigned)(plugin_start_addr - (unsigned char *)audio_bufferbase)
< audio_buffer_free)
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index 9598881790..77ad9c9530 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -697,7 +697,7 @@ static enum plugin_status test_track(const char* filename)
rb->snprintf(str,sizeof(str),"%d.%02d%% realtime",(int)speed/100,(int)speed%100);
log_text(str,true);
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* show effective clockrate in MHz needed for realtime decoding */
if (speed > 0)
{
diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c
index 443e9eb18b..08e1a39704 100644
--- a/apps/plugins/test_disk.c
+++ b/apps/plugins/test_disk.c
@@ -114,7 +114,7 @@ static bool test_fs(void)
log_init();
log_text("test_disk WRITE&VERIFY", true);
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
rb->snprintf(text_buf, sizeof(text_buf), "CPU clock: %ld Hz",
*rb->cpu_frequency);
log_text(text_buf, true);
@@ -304,7 +304,7 @@ static bool test_speed(void)
rb->memset(audiobuf, 'T', audiobuflen);
log_init();
log_text("test_disk SPEED TEST", true);
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
rb->snprintf(text_buf, sizeof(text_buf), "CPU clock: %ld Hz",
*rb->cpu_frequency);
log_text(text_buf, true);
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c
index 52a56d5954..62e7f489b0 100644
--- a/apps/plugins/test_fps.c
+++ b/apps/plugins/test_fps.c
@@ -340,7 +340,7 @@ static void time_greyscale(void)
/* plugin entry point */
enum plugin_status plugin_start(const void* parameter)
{
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
char str[32];
int cpu_freq;
#endif
@@ -350,7 +350,7 @@ enum plugin_status plugin_start(const void* parameter)
(void)parameter;
log_init();
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */
#endif
backlight_force_on(); /* backlight control in lib/helper.c */
@@ -370,7 +370,7 @@ enum plugin_status plugin_start(const void* parameter)
time_remote_update();
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
if (*rb->cpu_frequency != cpu_freq)
rb->snprintf(str, sizeof(str), "CPU clock changed!");
else
diff --git a/apps/plugins/test_mem.c b/apps/plugins/test_mem.c
index 2a8582bc45..f648c0073a 100644
--- a/apps/plugins/test_mem.c
+++ b/apps/plugins/test_mem.c
@@ -194,7 +194,7 @@ enum plugin_status plugin_start(const void* parameter)
rb->screens[0]->clear_display();
rb->screens[0]->putsf(0, line++, "%s", boost?"boosted":"unboosted");
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
rb->screens[0]->putsf(0, line++, "clock: %d Hz", *rb->cpu_frequency);
#endif
rb->screens[0]->putsf(0, line++, "loop#: %d", ++count);
diff --git a/apps/radio/radio.c b/apps/radio/radio.c
index 3dfa9a10f0..3728afc39c 100644
--- a/apps/radio/radio.c
+++ b/apps/radio/radio.c
@@ -420,10 +420,10 @@ int radio_screen(void)
bool have_recorded = false;
int timeout = current_tick + HZ/10;
unsigned int last_seconds = 0;
-#ifndef SIMULATOR
+#if !defined(SIMULATOR)
unsigned int seconds = 0;
struct audio_recording_options rec_options;
-#endif
+#endif /* SIMULATOR */
#endif /* CONFIG_CODEC != SWCODEC */
#ifndef HAVE_NOISY_IDLE_MODE
int button_timeout = current_tick + (2*HZ);
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 164b14b15c..9e93638717 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -18,7 +18,7 @@
* KIND, either express or implied.
*
****************************************************************************/
-#ifdef SIMULATOR
+#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
#include <stdlib.h> /* sim uses rand for peakmeter simulation */
#endif
#include "config.h"
@@ -538,7 +538,7 @@ void pm_reset_clipcount(void)
void peak_meter_playback(bool playback)
{
int i;
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
(void)playback;
#elif CONFIG_CODEC == SWCODEC
pm_playback = playback;
@@ -595,7 +595,7 @@ void peak_meter_peek(void)
left = pm_cur_left;
right = pm_cur_right;
#else
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
pm_cur_left = left = mas_codec_readreg(pm_src_left);
pm_cur_right = right = mas_codec_readreg(pm_src_right);
#else
diff --git a/apps/scrobbler.c b/apps/scrobbler.c
index 401f5b93b6..8d9f694ec2 100644
--- a/apps/scrobbler.c
+++ b/apps/scrobbler.c
@@ -24,6 +24,7 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging
*/
#include <stdio.h>
+#include <config.h>
#include "file.h"
#include "logf.h"
#include "metadata.h"
@@ -70,7 +71,7 @@ static unsigned long timestamp;
#endif
/* Crude work-around for Archos Sims - return a set amount */
-#if (CONFIG_CODEC != SWCODEC) && defined(SIMULATOR)
+#if (CONFIG_CODEC != SWCODEC) && (CONFIG_PLATFORM & PLATFORM_HOSTED)
unsigned long audio_prev_elapsed(void)
{
return 120000;
diff --git a/apps/settings.c b/apps/settings.c
index 12987c4746..2f6ce4cb92 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -837,7 +837,7 @@ void settings_apply(bool read_disk)
#ifdef HAVE_DISK_STORAGE
storage_spindown(global_settings.disk_spindown);
#endif
-#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
+#if (CONFIG_CODEC == MAS3507D) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
dac_line_in(global_settings.line_in);
#endif
set_poweroff_timeout(global_settings.poweroff);
diff --git a/apps/status.h b/apps/status.h
index 36b723ecb8..c8ec7bb354 100644
--- a/apps/status.h
+++ b/apps/status.h
@@ -45,7 +45,7 @@ void status_set_ffmode(enum playmode mode);
enum playmode status_get_ffmode(void);
int current_playmode(void);
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#include <time.h>
#endif
#ifdef HAVE_LCD_CHARCELLS
diff --git a/apps/tagcache.c b/apps/tagcache.c
index f4d3753768..822a84870c 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -4442,7 +4442,7 @@ static void tagcache_thread(void)
case SYS_POWEROFF:
break ;
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_USB_CONNECTED:
logf("USB: TagCache");
usb_acknowledge(SYS_USB_CONNECTED_ACK);
diff --git a/firmware/SOURCES b/firmware/SOURCES
index c95946dd0d..bef2b772ad 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -10,7 +10,7 @@ usb.c
logf.c
#endif /* ROCKBOX_HAS_LOGF */
kernel.c
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef RB_PROFILE
profile.c
#endif /* RB_PROFILE */
@@ -19,7 +19,7 @@ rolo.c
#endif /* !defined(BOOTLOADER) || defined(CPU_SH) */
thread.c
timer.c
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#ifdef HAVE_SDL
target/hosted/sdl/button-sdl.c
target/hosted/sdl/kernel-sdl.c
@@ -40,13 +40,13 @@ panic.c
debug.c
/* Standard library */
-#if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__)
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(__MINGW32__) || defined(__CYGWIN__)
libc/errno.c
libc/strtok.c
/* alsa on linux requires a more advanced sprintf, i.e. not ours */
libc/sprintf.c
-#endif /* !SIMULATOR || __MINGW32__ || __CYGWIN__ */
-#if !defined(SIMULATOR)
+#endif /* PLATFORM_NATIVE || __MINGW32__ || __CYGWIN__ */
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
libc/atoi.c
libc/ctype.c
libc/memcmp.c
@@ -70,11 +70,11 @@ common/crc32.c
#ifdef MI4_FORMAT
common/crc32-mi4.c
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
common/dir_uncached.c
common/file.c
common/disk.c
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#ifdef HAVE_DIRCACHE
common/dircache.c
#endif /* HAVE_DIRCACHE */
@@ -143,21 +143,21 @@ backlight-sw-fading.c
/* Misc. */
drivers/led.c
drivers/button.c
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef HAVE_DAC3550A
drivers/dac.c
#endif
#ifdef HAVE_SERIAL
drivers/serial.c
#endif
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#ifdef HAVE_TOUCHSCREEN
drivers/touchscreen.c
#endif
/* Storage */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#if (CONFIG_STORAGE & STORAGE_MMC)
drivers/ata_mmc.c
#endif
@@ -184,7 +184,7 @@ drivers/fat.c
#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
sdmmc.c
#endif
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
/* EEPROM */
#ifdef HAVE_EEPROM
@@ -195,7 +195,7 @@ eeprom_settings.c
#endif /* HAVE_EEPROM */
/* RTC */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#if (CONFIG_RTC == RTC_M41ST84W)
drivers/rtc/rtc_m41st84w.c
#elif (CONFIG_RTC == RTC_PCF50606)
@@ -225,13 +225,13 @@ drivers/rtc/rtc_s35390a.c
#elif (CONFIG_RTC == RTC_D2)
drivers/rtc/rtc_d2.c
#endif /* (CONFIG_RTC == RTC_) */
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#ifndef BOOTLOADER
/* Tuner */
#if CONFIG_TUNER
tuner.c
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#if (CONFIG_TUNER & LV24020LP)
drivers/tuner/lv24020lp.c
#endif /* (CONFIG_TUNER & LV24020LP) */
@@ -254,7 +254,7 @@ drivers/tuner/ipod_remote_tuner.c
#if (CONFIG_TUNER & RDA5802)
drivers/tuner/rda5802.c
#endif /* (CONFIG_TUNER & RDA5802) */
-#endif /*SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#endif /* CONFIG_TUNER */
#endif /* BOOTLOADER */
@@ -285,7 +285,7 @@ drivers/mas.c
#endif /* SWCODEC */
/* Audio codec */
-#if !defined(SIMULATOR) && !defined(BOOTLOADER)
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER)
#if defined(HAVE_UDA1380)
drivers/audio/uda1380.c
#elif defined(HAVE_WM8751) \
@@ -319,7 +319,7 @@ drivers/audio/sdl.c
#if CONFIG_CODEC == SWCODEC
target/hosted/sdl/pcm-sdl.c
#endif
-#endif /* !defined(SIMULATOR) && !defined(BOOTLOADER) */
+#endif /* (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER) */
/* USB Stack */
#if !defined(SIMULATOR)
@@ -531,10 +531,10 @@ libc/memmove.c
libc/memset.c
common/memset16.c
libc/strlen.c
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
crt0.S
drivers/i2c.c
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#endif /* defined(CPU_*) */
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 27bc8a453f..6a5070df49 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -40,6 +40,9 @@
#ifdef HAVE_REMOTE_LCD
#include "lcd-remote.h"
#endif
+
+#if defined(HAVE_BACKLIGHT) && defined(BACKLIGHT_FULL_INIT)
+
#ifndef SIMULATOR
#include "backlight-target.h"
#else
@@ -51,8 +54,6 @@
#include "backlight-sw-fading.h"
#endif
-#if defined(HAVE_BACKLIGHT) && defined(BACKLIGHT_FULL_INIT)
-
#define BACKLIGHT_FADE_IN_THREAD \
(CONFIG_BACKLIGHT_FADING & (BACKLIGHT_FADING_SW_SETTING \
|BACKLIGHT_FADING_SW_HW_REG \
diff --git a/firmware/buffer.c b/firmware/buffer.c
index 07d06cd4a0..015fc04b86 100644
--- a/firmware/buffer.c
+++ b/firmware/buffer.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include "buffer.h"
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
unsigned char audiobuffer[(MEM*1024-256)*1024];
unsigned char *audiobufend = audiobuffer + sizeof(audiobuffer);
#else
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index f8365e1137..0a58175d53 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -171,7 +171,7 @@ static bool check_event_queue(void)
return false;
}
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* scan and build static data (avoid redundancy on stack) */
static struct
{
@@ -301,7 +301,7 @@ static int dircache_scan_and_build(IF_MV2(int volume,) struct dircache_entry *ce
return sab_process_dir(0, ce);
}
-#else /* !SIMULATOR */
+#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) /* PLATFORM_HOSTED */
static char sab_path[MAX_PATH];
static int sab_process_dir(struct dircache_entry *ce)
@@ -400,7 +400,7 @@ static int dircache_scan_and_build(IF_MV2(int volume,) struct dircache_entry *ce
strlcpy(sab_path, "/", sizeof sab_path);
return sab_process_dir(ce);
}
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
/**
* Internal function to get a pointer to dircache_entry for a given filename.
@@ -689,7 +689,7 @@ static void dircache_thread(void)
dircache_initialized = false;
break ;
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_USB_CONNECTED:
usb_acknowledge(SYS_USB_CONNECTED_ACK);
usb_wait_for_disconnect(&dircache_queue);
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 16c0d2c16a..171acaaded 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -33,7 +33,7 @@
#include "serial.h"
#include "power.h"
#include "powermgmt.h"
-#ifdef SIMULATOR
+#ifdef HAVE_SDL
#include "button-sdl.h"
#else
#include "button-target.h"
@@ -215,7 +215,7 @@ static void button_tick(void)
/* Safety net for players without hardware
poweroff */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
if(repeat_count > POWEROFF_COUNT * 10)
power_off();
#endif
@@ -440,7 +440,7 @@ static int button_flip(int button)
{
int newbutton = button;
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
newbutton &=
~(BUTTON_LEFT | BUTTON_RIGHT
#if defined(BUTTON_UP) && defined(BUTTON_DOWN)
diff --git a/firmware/export/ata_idle_notify.h b/firmware/export/ata_idle_notify.h
index 348165f1d1..439b883e41 100644
--- a/firmware/export/ata_idle_notify.h
+++ b/firmware/export/ata_idle_notify.h
@@ -43,7 +43,7 @@ enum {
DISK_EVENT_SPINUP = (EVENT_CLASS_DISK|1),
};
-#define USING_STORAGE_CALLBACK !defined(SIMULATOR) \
+#define USING_STORAGE_CALLBACK (CONFIG_PLATFORM & PLATFORM_NATIVE) \
&& ! ((CONFIG_STORAGE & STORAGE_NAND) \
&& (CONFIG_NAND == NAND_IFP7XX)) \
&& !defined(BOOTLOADER)
diff --git a/firmware/export/audio.h b/firmware/export/audio.h
index 1e09081ba5..b81597a892 100644
--- a/firmware/export/audio.h
+++ b/firmware/export/audio.h
@@ -36,7 +36,7 @@
#endif /* CONFIG_CODEC == SWCODEC */
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define audio_play(x) sim_audio_play(x)
#endif
diff --git a/firmware/export/buffer.h b/firmware/export/buffer.h
index 4c80471b27..ae8886bffc 100644
--- a/firmware/export/buffer.h
+++ b/firmware/export/buffer.h
@@ -23,10 +23,10 @@
#include "config.h"
/* defined in linker script */
-#ifdef SIMULATOR
-extern unsigned char *audiobufend;
-#else
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
extern unsigned char audiobufend[];
+#else
+extern unsigned char *audiobufend;
#endif
extern unsigned char *audiobuf;
diff --git a/firmware/export/config.h b/firmware/export/config.h
index de84dc3742..c06e5d110a 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -74,6 +74,13 @@
#define AT91SAM9260 9260
#define AS3525v2 35252
+/* platforms
+ * bit fields to allow PLATFORM_HOSTED to be OR'ed e.g. with a
+ * possible future PLATFORM_ANDROID (some OSes might need totally different
+ * handling to run on them than a stand-alone application) */
+#define PLATFORM_NATIVE (1<<0)
+#define PLATFORM_HOSTED (1<<1)
+
/* CONFIG_KEYPAD */
#define PLAYER_PAD 1
#define RECORDER_PAD 2
@@ -497,6 +504,10 @@ Lyre prototype 1 */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING
#endif
+#ifndef CONFIG_PLATFORM
+#define CONFIG_PLATFORM PLATFORM_NATIVE
+#endif
+
#ifndef CONFIG_TUNER
#define CONFIG_TUNER 0
#endif
@@ -675,10 +686,10 @@ Lyre prototype 1 */
#define HAVE_EXTENDED_MESSAGING_AND_NAME
#define HAVE_WAKEUP_EXT_CB
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define HAVE_PRIORITY_SCHEDULING
#define HAVE_SCHEDULER_BOOSTCTRL
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#define HAVE_SEMAPHORE_OBJECTS
@@ -744,7 +755,7 @@ Lyre prototype 1 */
#endif
/* IRAM usage */
-#if !defined(SIMULATOR) && /* Not for simulators */ \
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && /* Not for hosted environments */ \
(((CONFIG_CPU == SH7034) && !defined(PLUGIN)) || /* SH1 archos: core only */ \
defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \
defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \
@@ -780,9 +791,10 @@ Lyre prototype 1 */
#define IBSS_ATTR
#define STATICIRAM static
#endif
+
#if (defined(CPU_PP) || (CONFIG_CPU == AS3525) || (CONFIG_CPU == AS3525v2) || \
(CONFIG_CPU == IMX31L)) \
- && !defined(SIMULATOR) && !defined(BOOTLOADER)
+ && (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER)
/* Functions that have INIT_ATTR attached are NOT guaranteed to survive after
* root_menu() has been called. Their code may be overwritten by other data or
* code in order to save RAM, and references to them might point into
@@ -799,7 +811,7 @@ Lyre prototype 1 */
#define INIT_ATTR
#endif
-#if defined(SIMULATOR) && defined(__APPLE__)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
#define DATA_ATTR __attribute__ ((section("__DATA, .data")))
#else
#define DATA_ATTR __attribute__ ((section(".data")))
@@ -923,7 +935,7 @@ Lyre prototype 1 */
#else /* BOOTLOADER */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
//#define USB_ENABLE_SERIAL
#define USB_ENABLE_STORAGE
@@ -941,11 +953,11 @@ Lyre prototype 1 */
/* This attribute can be used to enable to detection of plugin file handles leaks.
* When enabled, the plugin core will monitor open/close/creat and when the plugin exits
* will display an error message if the plugin leaked some file handles */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define HAVE_PLUGIN_CHECK_OPEN_CLOSE
#endif
-#if defined(HAVE_DIRCACHE) && !defined(SIMULATOR)
+#if defined(HAVE_DIRCACHE) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define HAVE_IO_PRIORITY
#endif
diff --git a/firmware/export/config/sim.h b/firmware/export/config/sim.h
index d65b0fbbf8..5dcb4f6f2d 100644
--- a/firmware/export/config/sim.h
+++ b/firmware/export/config/sim.h
@@ -101,4 +101,5 @@
#define HAVE_SDL
#define HAVE_SDL_AUDIO
+#define CONFIG_PLATFORM PLATFORM_HOSTED
#define _ISOC99_SOURCE 1
diff --git a/firmware/export/font.h b/firmware/export/font.h
index f6915d9c09..7284564380 100644
--- a/firmware/export/font.h
+++ b/firmware/export/font.h
@@ -28,7 +28,7 @@
*/
#include "config.h"
-#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
+#if defined(HAVE_LCD_BITMAP) || (CONFIG_PLATFORM & PLATFORM_HOSTED)
#ifndef __PCTOOL__
#include "font_cache.h"
#include "sysfont.h"
diff --git a/firmware/export/hwcompat.h b/firmware/export/hwcompat.h
index 27fcb25e36..c37add49f9 100644
--- a/firmware/export/hwcompat.h
+++ b/firmware/export/hwcompat.h
@@ -24,7 +24,7 @@
#include <stdbool.h>
#include "config.h"
-#if (CONFIG_CPU == SH7034) && !defined(SIMULATOR)
+#if (CONFIG_CPU == SH7034) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define ROM_VERSION (*(short *)0x020000fe)
@@ -49,7 +49,7 @@ static inline int tuner_detect_type(void)
}
#endif
-#endif /* (CONFIG_CPU == SH7034) && !SIMULATOR */
+#endif /* (CONFIG_CPU == SH7034) && (CONFIG_PLATFORM & PLATFORM_NATIVE) */
#ifdef ARCHOS_PLAYER
bool is_new_player(void);
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h
index bcf51c1723..9ef5af8c0c 100644
--- a/firmware/export/kernel.h
+++ b/firmware/export/kernel.h
@@ -201,7 +201,7 @@ static inline void call_tick_tasks(void)
}
#endif
-#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && !defined(PLUGIN) && !defined(CODEC)
#define sleep(x) sim_sleep(x)
#endif
diff --git a/firmware/export/power.h b/firmware/export/power.h
index 107158767f..137f40cb01 100644
--- a/firmware/export/power.h
+++ b/firmware/export/power.h
@@ -81,7 +81,7 @@ void ide_power_enable(bool on);
bool charging_state(void);
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
void power_init(void) INIT_ATTR;
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index d86118cd9b..03b9d34d54 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -74,7 +74,7 @@ extern unsigned int power_thread_inputs;
#include "powermgmt-target.h"
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* Generic current values that are intentionally meaningless - config header
* should define proper numbers.*/
@@ -129,7 +129,7 @@ extern const unsigned short percent_to_volt_charge[11];
/* Start up power management thread */
void powermgmt_init(void) INIT_ATTR;
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
/* Returns battery statust */
int battery_level(void); /* percent */
diff --git a/firmware/export/storage.h b/firmware/export/storage.h
index e62cf0d902..e59a5e5bf6 100644
--- a/firmware/export/storage.h
+++ b/firmware/export/storage.h
@@ -51,7 +51,7 @@ struct storage_info
char *revision;
};
-#if !defined(SIMULATOR) && !defined(CONFIG_STORAGE_MULTI)
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(CONFIG_STORAGE_MULTI)
/* storage_spindown, storage_sleep and storage_spin are passed as
* pointers, which doesn't work with argument-macros.
*/
@@ -185,7 +185,7 @@ struct storage_info
#else
//#error No storage driver!
#endif
-#else /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/
+#else /* NOT CONFIG_STORAGE_MULTI and PLATFORM_NATIVE*/
/* Simulator and multi-driver use normal functions */
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 5ac92e015d..7a04422b06 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -125,7 +125,7 @@ int get_cpu_boost_counter(void);
/* newer? SDL includes endian.h, So we ignore it */
-#if defined(SIMULATOR) || defined(__PCTOOL__)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) || defined(__PCTOOL__)
#undef letoh16
#undef letoh32
#undef htole16
@@ -234,8 +234,11 @@ enum {
#if !defined(SIMULATOR) && !defined(__PCTOOL__)
#include "system-target.h"
-#elif defined(HAVE_SDL) /* SIMULATOR */
+#elif defined(HAVE_SDL) /* SDL build */
#include "system-sdl.h"
+#endif
+
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
static inline uint16_t swap16(uint16_t value)
/*
result[15..8] = value[ 7..0];
@@ -268,7 +271,7 @@ static inline uint32_t swap_odd_even32(uint32_t value)
return (t >> 8) | ((t ^ value) << 8);
}
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_HOSTED */
#ifndef BIT_N
#define BIT_N(n) (1U << (n))
diff --git a/firmware/export/thread.h b/firmware/export/thread.h
index d907e5dc95..c4b7d1fa22 100644
--- a/firmware/export/thread.h
+++ b/firmware/export/thread.h
@@ -81,7 +81,7 @@
#define DEFAULT_STACK_SIZE 0x400 /* Bytes */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* Need to keep structures inside the header file because debug_menu
* needs them. */
#ifdef CPU_COLDFIRE
@@ -135,15 +135,15 @@ struct regs
uint32_t start; /* 44 - Thread start address, or NULL when started */
};
#endif /* CONFIG_CPU */
-#else
+#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
struct regs
{
- void *t; /* Simulator OS thread */
+ void *t; /* OS thread */
void *told; /* Last thread in slot (explained in thead-sdl.c) */
void *s; /* Semaphore for blocking and wakeup */
void (*start)(void); /* Start function */
};
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_NATIVE */
/* 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
diff --git a/firmware/export/timer.h b/firmware/export/timer.h
index b070acae31..b12ec55881 100644
--- a/firmware/export/timer.h
+++ b/firmware/export/timer.h
@@ -26,7 +26,7 @@
#include "config.h"
#include "cpu.h"
-#if defined(SIMULATOR)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define TIMER_FREQ 1000000
#endif
diff --git a/firmware/export/tuner.h b/firmware/export/tuner.h
index fa894a4b6c..461c9a3fcb 100644
--- a/firmware/export/tuner.h
+++ b/firmware/export/tuner.h
@@ -90,7 +90,7 @@ extern const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS];
#if CONFIG_TUNER
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
int tuner_set(int setting, int value);
int tuner_get(int setting);
#ifdef HAVE_RDS_CAP
@@ -142,7 +142,7 @@ extern int (*tuner_get)(int setting);
#include "ipod_remote_tuner.h"
#endif
-#endif /* SIMULATOR */
+#endif /* PLATFORM_HOSTED */
/* Additional messages that get enumerated after tuner driver headers */
diff --git a/firmware/include/dbgcheck.h b/firmware/include/dbgcheck.h
index e1f7aefbdb..0b38627d11 100644
--- a/firmware/include/dbgcheck.h
+++ b/firmware/include/dbgcheck.h
@@ -4,7 +4,7 @@
#include <stdbool.h>
#ifdef DEBUG
- #ifndef SIMULATOR
+ #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* check whether a function is inside the valid memory location */
#define IS_FUNCPTR(fp) ({/
extern char _text[];/
@@ -21,4 +21,4 @@
#endif
-#endif // #ifndef __DBGCHECK_H__ \ No newline at end of file
+#endif // #ifndef __DBGCHECK_H__
diff --git a/firmware/include/dir_uncached.h b/firmware/include/dir_uncached.h
index 4e5acf34d1..f225cf8e39 100644
--- a/firmware/include/dir_uncached.h
+++ b/firmware/include/dir_uncached.h
@@ -32,7 +32,7 @@
#define ATTR_ARCHIVE 0x20
#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define dirent_uncached sim_dirent
#define DIR_UNCACHED SIM_DIR
#define opendir_uncached sim_opendir
@@ -57,7 +57,7 @@ struct dirent_uncached {
#include "fat.h"
typedef struct {
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
bool busy;
long startcluster;
struct fat_dir fatdir;
@@ -66,7 +66,7 @@ typedef struct {
int volumecounter; /* running counter for faked volume entries */
#endif
#else
- /* simulator: */
+ /* simulator/application: */
void *dir; /* actually a DIR* dir */
char *name;
#endif
diff --git a/firmware/include/dircache.h b/firmware/include/dircache.h
index 9fd55fab6f..4472d5fbe0 100644
--- a/firmware/include/dircache.h
+++ b/firmware/include/dircache.h
@@ -36,7 +36,7 @@ struct travel_data {
struct dircache_entry *first;
struct dircache_entry *ce;
struct dircache_entry *down_entry;
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
DIR_UNCACHED *dir, *newdir;
struct dirent_uncached *entry;
#else
diff --git a/firmware/include/file.h b/firmware/include/file.h
index f66cc6c60e..9502f5999a 100644
--- a/firmware/include/file.h
+++ b/firmware/include/file.h
@@ -26,6 +26,7 @@
#define MAX_PATH 260
#include <sys/types.h>
+#include "config.h"
#include "_ansi.h"
#define MAX_OPEN_FILES 11
@@ -49,7 +50,7 @@
#define O_TRUNC 0x10
#endif
-#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && !defined(PLUGIN) && !defined(CODEC)
#define open(x, ...) sim_open(x, __VA_ARGS__)
#define creat(x,m) sim_creat(x,m)
#define remove(x) sim_remove(x)
@@ -78,7 +79,7 @@ extern int fsync(int fd);
extern ssize_t read(int fd, void *buf, size_t count);
extern off_t lseek(int fildes, off_t offset, int whence);
extern int file_creat(const char *pathname);
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* posix compatibility function */
static inline int creat(const char *pathname, mode_t mode)
{
diff --git a/firmware/logf.c b/firmware/logf.c
index 6bdda3f424..0136600e92 100644
--- a/firmware/logf.c
+++ b/firmware/logf.c
@@ -208,7 +208,7 @@ void _logf(const char *fmt, ...)
va_start(ap, fmt);
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
char buf[1024];
vsnprintf(buf, sizeof buf, fmt, ap);
DEBUGF("%s\n", buf);
diff --git a/firmware/panic.c b/firmware/panic.c
index 36eec67f12..bd2c719607 100644
--- a/firmware/panic.c
+++ b/firmware/panic.c
@@ -41,7 +41,7 @@ void panicf( const char *fmt, ...)
{
va_list ap;
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* Disable interrupts */
#ifdef CPU_ARM
disable_interrupt(IRQ_FIQ_STATUS);
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index f1dd83ef52..c5f981d1f6 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -44,7 +44,7 @@
#endif
#include "logf.h"
#include "lcd-remote.h"
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#include <time.h>
#endif
@@ -73,7 +73,7 @@ enum charge_state_type charge_state = DISCHARGING;
#endif
#endif /* CONFIG_CHARGING */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
static int shutdown_timeout = 0;
/*
* Average battery voltage and charger voltage, filtered via a digital
@@ -830,7 +830,7 @@ void cancel_shutdown(void)
shutdown_timeout = 0;
}
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
/* Send system battery level update events on reaching certain significant
levels. This must be called after battery_percent has been updated. */
diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c
index b7e0601150..4fee7ed1d6 100644
--- a/firmware/scroll_engine.c
+++ b/firmware/scroll_engine.c
@@ -242,7 +242,7 @@ static bool scroll_process_message(int delay)
usb_wait_for_disconnect(&scroll_queue);
sync_display_ticks();
return true;
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_REMOTE_PLUGGED:
if (!remote_initialized)
sync_display_ticks();
@@ -280,7 +280,7 @@ static void scroll_thread(void)
delay = current_tick;
if (
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
!remote_initialized ||
#endif
(tick_remote = lcd_remote_scroll_info.last_scroll +
diff --git a/firmware/sound.c b/firmware/sound.c
index dccca12264..76f1dd0df6 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -27,7 +27,7 @@
#include "system.h"
#include "i2c.h"
#include "mas.h"
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#if CONFIG_CPU == PNX0101
#include "pnx0101.h"
#endif
@@ -257,7 +257,7 @@ static void set_prescaled_volume(void)
dsp_callback(DSP_CALLBACK_SET_SW_VOLUME, 0);
#endif
-#ifndef SIMULATOR
+#ifndef HAVE_SDL_AUDIO
#if CONFIG_CODEC == MAS3507D
dac_volume(tenthdb2reg(l), tenthdb2reg(r), false);
#elif defined(HAVE_UDA1380) || defined(HAVE_WM8975) || defined(HAVE_WM8758) \
@@ -276,9 +276,9 @@ static void set_prescaled_volume(void)
#elif defined(HAVE_JZ4740_CODEC) || defined(HAVE_SDL_AUDIO)
audiohw_set_volume(current_volume);
#endif
-#else /* SIMULATOR */
+#else /* HAVE_SDL_AUDIO */
audiohw_set_volume(current_volume);
-#endif /* !SIMULATOR */
+#endif /* !HAVE_SDL_AUDIO */
}
#endif /* (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 */
@@ -714,7 +714,7 @@ void sound_set(int setting, int value)
&& !defined(HAVE_WM8758) && !defined(HAVE_TSC2100) \
&& !defined (HAVE_WM8711) && !defined (HAVE_WM8721) \
&& !defined (HAVE_WM8731) && !defined (HAVE_WM8978) \
- && !defined(HAVE_AK4537)) || defined(SIMULATOR)
+ && !defined(HAVE_AK4537)) || (CONFIG_PLATFORM & PLATFORM_HOSTED)
int sound_val2phys(int setting, int value)
{
#if CONFIG_CODEC == MAS3587F
@@ -820,7 +820,7 @@ int sound_val2phys(int setting, int value)
return value;
#endif
}
-#endif /* !defined(HAVE_AS3514) || defined(SIMULATOR) */
+#endif /* CONFIG_CODECs || PLATFORM_HOSTED */
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
/* This function works by telling the decoder that we have another
diff --git a/firmware/system.c b/firmware/system.c
index 87fc40850f..7e269ee119 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -26,7 +26,7 @@
#include "string.h"
#include "file.h"
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
long cpu_frequency SHAREDBSS_ATTR = CPU_FREQ;
#endif