summaryrefslogtreecommitdiff
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.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 @@
42#endif 42#endif
43#endif 43#endif
44 44
45#ifndef SIMULATOR 45#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
46 46
47#ifdef AUDIO_CPU_BOOST 47#ifdef AUDIO_CPU_BOOST
48static void audio_cpu_boost(bool state) 48static void audio_cpu_boost(bool state)
@@ -115,7 +115,7 @@ int audio_get_spdif_sample_rate(void)
115} /* audio_get_spdif_sample_rate */ 115} /* audio_get_spdif_sample_rate */
116#endif /* HAVE_SPDIF_IN */ 116#endif /* HAVE_SPDIF_IN */
117 117
118#else /* SIMULATOR */ 118#else /* PLATFORM_HOSTED */
119 119
120/** Sim stubs **/ 120/** Sim stubs **/
121 121
@@ -153,4 +153,4 @@ int audio_get_spdif_sample_rate(void)
153} /* audio_get_spdif_sample_rate */ 153} /* audio_get_spdif_sample_rate */
154#endif /* HAVE_SPDIF_IN */ 154#endif /* HAVE_SPDIF_IN */
155 155
156#endif /* !SIMULATOR */ 156#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 @@
1#if defined(SIMULATOR) && defined(__APPLE__) 1#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
2osx_dummy.bmp 2osx_dummy.bmp
3#endif 3#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 @@
1#if defined(SIMULATOR) && defined(__APPLE__) 1#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
2osx_remote_dummy.bmp 2osx_remote_dummy.bmp
3#endif 3#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)
1488 base_handle_id = (int)ev.data; 1488 base_handle_id = (int)ev.data;
1489 break; 1489 break;
1490 1490
1491#ifndef SIMULATOR 1491#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1492 case SYS_USB_CONNECTED: 1492 case SYS_USB_CONNECTED:
1493 LOGFQUEUE("buffering < SYS_USB_CONNECTED"); 1493 LOGFQUEUE("buffering < SYS_USB_CONNECTED");
1494 usb_acknowledge(SYS_USB_CONNECTED_ACK); 1494 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 @@
54#define LOGF_ENABLE 54#define LOGF_ENABLE
55#include "logf.h" 55#include "logf.h"
56 56
57#ifdef SIMULATOR 57#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
58#define PREFIX(_x_) sim_ ## _x_
59#else
60#define PREFIX
61#endif
62 58
63#ifdef SIMULATOR 59#define PREFIX(_x_) sim_ ## _x_
64#if CONFIG_CODEC == SWCODEC 60#if CONFIG_CODEC == SWCODEC
65unsigned char codecbuf[CODEC_SIZE]; 61unsigned char codecbuf[CODEC_SIZE];
66#endif 62#endif
67void *sim_codec_load_ram(char* codecptr, int size, void **pd); 63void *sim_codec_load_ram(char* codecptr, int size, void **pd);
68void sim_codec_close(void *pd); 64void sim_codec_close(void *pd);
69#else 65
66#else /* !PLATFORM_HOSTED */
67
68#define PREFIX
70#define sim_codec_close(x) 69#define sim_codec_close(x)
70
71#endif 71#endif
72 72
73size_t codec_size; 73size_t codec_size;
@@ -77,7 +77,7 @@ extern void* plugin_get_audio_buffer(size_t *buffer_size);
77#undef open 77#undef open
78static int open(const char* pathname, int flags, ...) 78static int open(const char* pathname, int flags, ...)
79{ 79{
80#ifdef SIMULATOR 80#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
81 int fd; 81 int fd;
82 if (flags & O_CREAT) 82 if (flags & O_CREAT)
83 { 83 {
@@ -201,7 +201,7 @@ static int codec_load_ram(int size, struct codec_api *api)
201{ 201{
202 struct codec_header *hdr; 202 struct codec_header *hdr;
203 int status; 203 int status;
204#ifndef SIMULATOR 204#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
205 hdr = (struct codec_header *)codecbuf; 205 hdr = (struct codec_header *)codecbuf;
206 206
207 if (size <= (signed)sizeof(struct codec_header) 207 if (size <= (signed)sizeof(struct codec_header)
@@ -220,7 +220,7 @@ static int codec_load_ram(int size, struct codec_api *api)
220 220
221 codec_size = hdr->end_addr - codecbuf; 221 codec_size = hdr->end_addr - codecbuf;
222 222
223#else /* SIMULATOR */ 223#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
224 void *pd; 224 void *pd;
225 225
226 hdr = sim_codec_load_ram(codecbuf, size, &pd); 226 hdr = sim_codec_load_ram(codecbuf, size, &pd);
@@ -241,7 +241,7 @@ static int codec_load_ram(int size, struct codec_api *api)
241 241
242 codec_size = codecbuf - codecbuf; 242 codec_size = codecbuf - codecbuf;
243 243
244#endif /* SIMULATOR */ 244#endif /* CONFIG_PLATFORM */
245 if (hdr->api_version > CODEC_API_VERSION 245 if (hdr->api_version > CODEC_API_VERSION
246 || hdr->api_version < CODEC_MIN_API_VERSION) { 246 || hdr->api_version < CODEC_MIN_API_VERSION) {
247 sim_codec_close(pd); 247 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[];
254extern size_t codec_size; 254extern size_t codec_size;
255 255
256#ifdef CODEC 256#ifdef CODEC
257#ifndef SIMULATOR 257#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
258/* plugin_* is correct, codecs use the plugin linker script */ 258/* plugin_* is correct, codecs use the plugin linker script */
259extern unsigned char plugin_start_addr[]; 259extern unsigned char plugin_start_addr[];
260extern unsigned char plugin_end_addr[]; 260extern 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);
36 36
37enum codec_status codec_start(void) 37enum codec_status codec_start(void)
38{ 38{
39#ifndef SIMULATOR 39#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
40#ifdef USE_IRAM 40#ifdef USE_IRAM
41 ci->memcpy(iramstart, iramcopy, iramend - iramstart); 41 ci->memcpy(iramstart, iramcopy, iramend - iramstart);
42 ci->memset(iedata, 0, iend - iedata); 42 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
24setjmp_mips.S 24setjmp_mips.S
25#endif 25#endif
26 26
27#elif defined(SIMULATOR) && defined(__APPLE__) 27#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
28osx.dummy.c 28osx.dummy.c
29#endif 29#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 @@
104#include <sys/mman.h> 104#include <sys/mman.h>
105#endif 105#endif
106 106
107#include "config.h"
107#include "tlsf.h" 108#include "tlsf.h"
108 109
109#if !defined(__GNUC__) 110#if !defined(__GNUC__)
@@ -164,7 +165,8 @@
164#define PAGE_SIZE (getpagesize()) 165#define PAGE_SIZE (getpagesize())
165#endif 166#endif
166 167
167#if defined(ROCKBOX) && defined(SIMULATOR) || !defined(ROCKBOX) 168#if defined(ROCKBOX) && (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(DEBUG) \
169 || !defined(ROCKBOX)
168int printf(const char* fmt, ...); 170int printf(const char* fmt, ...);
169#define PRINT_MSG(fmt, args...) printf(fmt, ## args) 171#define PRINT_MSG(fmt, args...) printf(fmt, ## args)
170#define ERROR_MSG(fmt, args...) printf(fmt, ## args) 172#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 @@
37 37
38#include "m4a.h" 38#include "m4a.h"
39 39
40#if defined(DEBUG) || defined(SIMULATOR)
41#ifdef DEBUGF
42#undef DEBUGF 40#undef DEBUGF
43#endif 41#if defined(DEBUG)
44#define DEBUGF qtmovie->stream->ci->debugf 42#define DEBUGF qtmovie->stream->ci->debugf
45#else 43#else
46#define DEBUGF(...) 44#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 @@
51/* TGB is the only target fast enough for gaussian and realtime BRR decode */ 51/* TGB is the only target fast enough for gaussian and realtime BRR decode */
52/* echo is almost fast enough but not quite */ 52/* echo is almost fast enough but not quite */
53#if defined(TOSHIBA_GIGABEAT_F) || defined(TOSHIBA_GIGABEAT_S) ||\ 53#if defined(TOSHIBA_GIGABEAT_F) || defined(TOSHIBA_GIGABEAT_S) ||\
54 defined(SIMULATOR) || MEMORYSIZE <= 2 54 (CONFIG_PLATFORM & PLATFORM_HOSTED) || MEMORYSIZE <= 2
55 /* Don't cache BRR waves */ 55 /* Don't cache BRR waves */
56 #define SPC_BRRCACHE 0 56 #define SPC_BRRCACHE 0
57 57
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 @@
1#ifndef SIMULATOR 1#include "config.h"
2#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2#include "libc/ctype.c" 3#include "libc/ctype.c"
3#endif 4#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 @@
53#include "lcd-remote.h" 53#include "lcd-remote.h"
54#include "crc32.h" 54#include "crc32.h"
55#include "logf.h" 55#include "logf.h"
56#ifndef SIMULATOR 56#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
57#include "disk.h" 57#include "disk.h"
58#include "adc.h" 58#include "adc.h"
59#include "power.h" 59#include "power.h"
@@ -276,7 +276,7 @@ static unsigned int ticks, boost_ticks, freq_sum;
276 276
277static void dbg_audio_task(void) 277static void dbg_audio_task(void)
278{ 278{
279#ifndef SIMULATOR 279#ifdef CPUFREQ_NORMAL
280 if(FREQ > CPUFREQ_NORMAL) 280 if(FREQ > CPUFREQ_NORMAL)
281 boost_ticks++; 281 boost_ticks++;
282 freq_sum += FREQ/1000000; /* in MHz */ 282 freq_sum += FREQ/1000000; /* in MHz */
@@ -371,7 +371,7 @@ static bool dbg_buffering_thread(void)
371 371
372 screens[i].putsf(0, line++, "handle count: %d", (int)d.num_handles); 372 screens[i].putsf(0, line++, "handle count: %d", (int)d.num_handles);
373 373
374#ifndef SIMULATOR 374#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
375 screens[i].putsf(0, line++, "cpu freq: %3dMHz", 375 screens[i].putsf(0, line++, "cpu freq: %3dMHz",
376 (int)((FREQ + 500000) / 1000000)); 376 (int)((FREQ + 500000) / 1000000));
377#endif 377#endif
@@ -758,7 +758,7 @@ static bool dbg_hw_info(void)
758#endif /* !HAVE_LCD_BITMAP */ 758#endif /* !HAVE_LCD_BITMAP */
759#endif /* !SIMULATOR */ 759#endif /* !SIMULATOR */
760 760
761#ifndef SIMULATOR 761#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
762static const char* dbg_partitions_getname(int selected_item, void *data, 762static const char* dbg_partitions_getname(int selected_item, void *data,
763 char *buffer, size_t buffer_len) 763 char *buffer, size_t buffer_len)
764{ 764{
@@ -786,7 +786,7 @@ bool dbg_partitions(void)
786 info.get_name = dbg_partitions_getname; 786 info.get_name = dbg_partitions_getname;
787 return simplelist_show_list(&info); 787 return simplelist_show_list(&info);
788} 788}
789#endif 789#endif /* PLATFORM_NATIVE */
790 790
791#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT) 791#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
792static bool dbg_spdif(void) 792static bool dbg_spdif(void)
@@ -928,7 +928,7 @@ static bool dbg_spdif(void)
928 lcd_putsf(0, line++, "Clock accuracy: %d", x); 928 lcd_putsf(0, line++, "Clock accuracy: %d", x);
929 line++; 929 line++;
930 930
931#ifndef SIMULATOR 931#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
932 lcd_putsf(0, line++, "Measured freq: %ldHz", 932 lcd_putsf(0, line++, "Measured freq: %ldHz",
933 spdif_measure_frequency()); 933 spdif_measure_frequency());
934#endif 934#endif
@@ -950,7 +950,7 @@ static bool dbg_spdif(void)
950} 950}
951#endif /* CPU_COLDFIRE */ 951#endif /* CPU_COLDFIRE */
952 952
953#ifndef SIMULATOR 953#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
954#ifdef HAVE_LCD_BITMAP 954#ifdef HAVE_LCD_BITMAP
955 /* button definitions */ 955 /* button definitions */
956#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ 956#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
@@ -1334,9 +1334,9 @@ bool dbg_ports(void)
1334 return false; 1334 return false;
1335} 1335}
1336#endif /* !HAVE_LCD_BITMAP */ 1336#endif /* !HAVE_LCD_BITMAP */
1337#endif /* !SIMULATOR */ 1337#endif /* PLATFORM_NATIVE */
1338 1338
1339#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR) 1339#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
1340static bool dbg_pcf(void) 1340static bool dbg_pcf(void)
1341{ 1341{
1342 int line; 1342 int line;
@@ -1423,7 +1423,7 @@ static bool dbg_cpufreq(void)
1423} 1423}
1424#endif /* HAVE_ADJUSTABLE_CPU_FREQ */ 1424#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
1425 1425
1426#if defined(HAVE_TSC2100) && !defined(SIMULATOR) 1426#if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
1427#include "tsc2100.h" 1427#include "tsc2100.h"
1428static char *itob(int n, int len) 1428static char *itob(int n, int len)
1429{ 1429{
@@ -1493,7 +1493,7 @@ static bool tsc2100_debug(void)
1493 return simplelist_show_list(&info); 1493 return simplelist_show_list(&info);
1494} 1494}
1495#endif 1495#endif
1496#ifndef SIMULATOR 1496#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1497#ifdef HAVE_LCD_BITMAP 1497#ifdef HAVE_LCD_BITMAP
1498/* 1498/*
1499 * view_battery() shows a automatically scaled graph of the battery voltage 1499 * view_battery() shows a automatically scaled graph of the battery voltage
@@ -1785,7 +1785,7 @@ static bool view_battery(void)
1785#endif /* HAVE_LCD_BITMAP */ 1785#endif /* HAVE_LCD_BITMAP */
1786#endif 1786#endif
1787 1787
1788#ifndef SIMULATOR 1788#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1789#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD) 1789#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
1790 1790
1791#if (CONFIG_STORAGE & STORAGE_MMC) 1791#if (CONFIG_STORAGE & STORAGE_MMC)
@@ -2106,7 +2106,7 @@ static bool dbg_disk_info(void)
2106 info.scroll_all = true; 2106 info.scroll_all = true;
2107 return simplelist_show_list(&info); 2107 return simplelist_show_list(&info);
2108} 2108}
2109#endif /* !SIMULATOR */ 2109#endif /* PLATFORM_NATIVE */
2110 2110
2111#ifdef HAVE_DIRCACHE 2111#ifdef HAVE_DIRCACHE
2112static int dircache_callback(int btn, struct gui_synclist *lists) 2112static int dircache_callback(int btn, struct gui_synclist *lists)
@@ -2672,10 +2672,10 @@ static const struct the_menu_item menuitems[] = {
2672 || CONFIG_CPU == DM320 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2 2672 || CONFIG_CPU == DM320 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2
2673 { "View I/O ports", dbg_ports }, 2673 { "View I/O ports", dbg_ports },
2674#endif 2674#endif
2675#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR) 2675#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
2676 { "View PCF registers", dbg_pcf }, 2676 { "View PCF registers", dbg_pcf },
2677#endif 2677#endif
2678#if defined(HAVE_TSC2100) && !defined(SIMULATOR) 2678#if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
2679 { "TSC2100 debug", tsc2100_debug }, 2679 { "TSC2100 debug", tsc2100_debug },
2680#endif 2680#endif
2681#ifdef HAVE_ADJUSTABLE_CPU_FREQ 2681#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -2689,18 +2689,18 @@ static const struct the_menu_item menuitems[] = {
2689#endif 2689#endif
2690 { "View OS stacks", dbg_os }, 2690 { "View OS stacks", dbg_os },
2691#ifdef HAVE_LCD_BITMAP 2691#ifdef HAVE_LCD_BITMAP
2692#ifndef SIMULATOR 2692#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2693 { "View battery", view_battery }, 2693 { "View battery", view_battery },
2694#endif 2694#endif
2695 { "Screendump", dbg_screendump }, 2695 { "Screendump", dbg_screendump },
2696#endif 2696#endif
2697#ifndef SIMULATOR 2697#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2698 { "View HW info", dbg_hw_info }, 2698 { "View HW info", dbg_hw_info },
2699#endif 2699#endif
2700#ifndef SIMULATOR 2700#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2701 { "View partitions", dbg_partitions }, 2701 { "View partitions", dbg_partitions },
2702#endif 2702#endif
2703#ifndef SIMULATOR 2703#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2704 { "View disk info", dbg_disk_info }, 2704 { "View disk info", dbg_disk_info },
2705#if (CONFIG_STORAGE & STORAGE_ATA) 2705#if (CONFIG_STORAGE & STORAGE_ATA)
2706 { "Dump ATA identify info", dbg_identify_info}, 2706 { "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)
597 break; 597 break;
598#endif 598#endif
599 599
600#ifndef SIMULATOR 600#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
601 /* firmware file */ 601 /* firmware file */
602 case FILE_ATTR_MOD: 602 case FILE_ATTR_MOD:
603 splash(0, ID2P(LANG_WAIT)); 603 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 @@
115 115
116#ifdef SIMULATOR 116#ifdef SIMULATOR
117#include "sim_tasks.h" 117#include "sim_tasks.h"
118#endif
119#ifdef HAVE_SDL
118#include "system-sdl.h" 120#include "system-sdl.h"
119#endif 121#endif
120 122
@@ -313,7 +315,7 @@ static void init_tagcache(void)
313} 315}
314#endif 316#endif
315 317
316#ifdef SIMULATOR 318#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
317 319
318static void init(void) 320static void init(void)
319{ 321{
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)
347#endif 347#endif
348 ) 348 )
349 { 349 {
350#ifndef SIMULATOR 350#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
351 struct info_data *info = (struct info_data *)lists->data; 351 struct info_data *info = (struct info_data *)lists->data;
352 int i; 352 int i;
353 info->new_data = true; 353 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)
251 251
252static bool clean_shutdown(void (*callback)(void *), void *parameter) 252static bool clean_shutdown(void (*callback)(void *), void *parameter)
253{ 253{
254#ifdef SIMULATOR 254#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
255 (void)callback; 255 (void)callback;
256 (void)parameter; 256 (void)parameter;
257 bookmark_autobookmark(false); 257 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 @@
30/* Define LOGF_ENABLE to enable logf output in this file */ 30/* Define LOGF_ENABLE to enable logf output in this file */
31/*#define LOGF_ENABLE*/ 31/*#define LOGF_ENABLE*/
32#include "logf.h" 32#include "logf.h"
33#ifndef SIMULATOR 33#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
34#include "cpu.h" 34#include "cpu.h"
35#endif 35#endif
36#include <string.h> 36#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)
468 468
469bool audio_load_encoder(int afmt) 469bool audio_load_encoder(int afmt)
470{ 470{
471#ifndef SIMULATOR 471#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
472 const char *enc_fn = get_codec_filename(afmt | CODEC_TYPE_ENCODER); 472 const char *enc_fn = get_codec_filename(afmt | CODEC_TYPE_ENCODER);
473 if (!enc_fn) 473 if (!enc_fn)
474 return false; 474 return false;
@@ -493,7 +493,7 @@ bool audio_load_encoder(int afmt)
493 493
494void audio_remove_encoder(void) 494void audio_remove_encoder(void)
495{ 495{
496#ifndef SIMULATOR 496#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
497 /* force encoder codec unload (if currently loaded) */ 497 /* force encoder codec unload (if currently loaded) */
498 if (ci.enc_codec_loaded <= 0) 498 if (ci.enc_codec_loaded <= 0)
499 return; 499 return;
@@ -2008,7 +2008,7 @@ static void audio_thread(void)
2008 LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED"); 2008 LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED");
2009 audio_finalise_track_change(); 2009 audio_finalise_track_change();
2010 break; 2010 break;
2011#ifndef SIMULATOR 2011#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2012 case SYS_USB_CONNECTED: 2012 case SYS_USB_CONNECTED:
2013 LOGFQUEUE("audio < SYS_USB_CONNECTED"); 2013 LOGFQUEUE("audio < SYS_USB_CONNECTED");
2014 if (playing) 2014 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)
1318 dirty_pointers = false; 1318 dirty_pointers = false;
1319 break ; 1319 break ;
1320 1320
1321#ifndef SIMULATOR 1321#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1322 case SYS_USB_CONNECTED: 1322 case SYS_USB_CONNECTED:
1323 usb_acknowledge(SYS_USB_CONNECTED_ACK); 1323 usb_acknowledge(SYS_USB_CONNECTED_ACK);
1324 usb_wait_for_disconnect(&playlist_queue); 1324 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 @@
57#include "usbstack/usb_hid.h" 57#include "usbstack/usb_hid.h"
58#endif 58#endif
59 59
60#ifdef SIMULATOR 60#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
61#define PREFIX(_x_) sim_ ## _x_ 61#define PREFIX(_x_) sim_ ## _x_
62#else 62#else
63#define PREFIX 63#define PREFIX
@@ -72,7 +72,7 @@
72static unsigned int open_files; 72static unsigned int open_files;
73#endif 73#endif
74 74
75#ifdef SIMULATOR 75#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
76static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; 76static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
77void *sim_plugin_load(char *plugin, void **pd); 77void *sim_plugin_load(char *plugin, void **pd);
78void sim_plugin_close(void *pd); 78void sim_plugin_close(void *pd);
@@ -157,7 +157,7 @@ static const struct plugin_api rockbox_api = {
157 lcd_yuv_set_options, 157 lcd_yuv_set_options,
158#endif 158#endif
159#endif /* MEMORYSIZE > 2 */ 159#endif /* MEMORYSIZE > 2 */
160#elif (LCD_DEPTH < 4) && !defined(SIMULATOR) 160#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
161 lcd_blit_mono, 161 lcd_blit_mono,
162 lcd_blit_grey_phase, 162 lcd_blit_grey_phase,
163#endif /* LCD_DEPTH */ 163#endif /* LCD_DEPTH */
@@ -366,7 +366,7 @@ static const struct plugin_api rockbox_api = {
366#endif 366#endif
367 367
368 reset_poweroff_timer, 368 reset_poweroff_timer,
369#ifndef SIMULATOR 369#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
370 system_memory_guard, 370 system_memory_guard,
371 &cpu_frequency, 371 &cpu_frequency,
372 372
@@ -377,7 +377,7 @@ static const struct plugin_api rockbox_api = {
377 cpu_boost, 377 cpu_boost,
378#endif 378#endif
379#endif /* HAVE_ADJUSTABLE_CPU_FREQ */ 379#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
380#endif /* !SIMULATOR */ 380#endif /* PLATFORM_NATIVE */
381#ifdef HAVE_SCHEDULER_BOOSTCTRL 381#ifdef HAVE_SCHEDULER_BOOSTCTRL
382 trigger_cpu_boost, 382 trigger_cpu_boost,
383 cancel_cpu_boost, 383 cancel_cpu_boost,
@@ -415,7 +415,7 @@ static const struct plugin_api rockbox_api = {
415 remove_event, 415 remove_event,
416 send_event, 416 send_event,
417 417
418#ifdef SIMULATOR 418#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
419 /* special simulator hooks */ 419 /* special simulator hooks */
420#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8 420#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
421 sim_lcd_ex_init, 421 sim_lcd_ex_init,
@@ -437,7 +437,7 @@ static const struct plugin_api rockbox_api = {
437 memset, 437 memset,
438 memcpy, 438 memcpy,
439 memmove, 439 memmove,
440#ifndef SIMULATOR 440#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
441 _ctype_, 441 _ctype_,
442#endif 442#endif
443 atoi, 443 atoi,
@@ -467,7 +467,7 @@ static const struct plugin_api rockbox_api = {
467#ifdef AUDIOHW_HAVE_EQ 467#ifdef AUDIOHW_HAVE_EQ
468 sound_enum_hw_eq_band_setting, 468 sound_enum_hw_eq_band_setting,
469#endif 469#endif
470#ifndef SIMULATOR 470#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
471 mp3_play_data, 471 mp3_play_data,
472 mp3_play_pause, 472 mp3_play_pause,
473 mp3_play_stop, 473 mp3_play_stop,
@@ -589,7 +589,7 @@ static const struct plugin_api rockbox_api = {
589 battery_level, 589 battery_level,
590 battery_level_safe, 590 battery_level_safe,
591 battery_time, 591 battery_time,
592#ifndef SIMULATOR 592#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
593 battery_voltage, 593 battery_voltage,
594#endif 594#endif
595#if CONFIG_CHARGING 595#if CONFIG_CHARGING
@@ -603,7 +603,7 @@ static const struct plugin_api rockbox_api = {
603#endif 603#endif
604 604
605 /* misc */ 605 /* misc */
606#if !defined(SIMULATOR) 606#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
607 &errno, 607 &errno,
608#endif 608#endif
609 srand, 609 srand,
@@ -727,15 +727,15 @@ int plugin_load(const char* plugin, const void* parameter)
727{ 727{
728 int rc, i; 728 int rc, i;
729 struct plugin_header *hdr; 729 struct plugin_header *hdr;
730#ifdef SIMULATOR 730#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
731 void *pd; 731 void *pd;
732#else /* !SIMULATOR */ 732#else /* PLATFOR_NATIVE */
733 int fd; 733 int fd;
734 ssize_t readsize; 734 ssize_t readsize;
735#if NUM_CORES > 1 735#if NUM_CORES > 1
736 unsigned my_core; 736 unsigned my_core;
737#endif 737#endif
738#endif /* !SIMULATOR */ 738#endif /* CONFIG_PLATFORM */
739 739
740#if LCD_DEPTH > 1 740#if LCD_DEPTH > 1
741 fb_data* old_backdrop; 741 fb_data* old_backdrop;
@@ -755,7 +755,7 @@ int plugin_load(const char* plugin, const void* parameter)
755 splash(0, ID2P(LANG_WAIT)); 755 splash(0, ID2P(LANG_WAIT));
756 strcpy(current_plugin, plugin); 756 strcpy(current_plugin, plugin);
757 757
758#ifdef SIMULATOR 758#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
759 hdr = sim_plugin_load((char *)plugin, &pd); 759 hdr = sim_plugin_load((char *)plugin, &pd);
760 if (pd == NULL) { 760 if (pd == NULL) {
761 splashf(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin); 761 splashf(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin);
@@ -990,7 +990,7 @@ static int open_wrapper(const char* pathname, int flags, ...)
990/* we don't have an 'open' function. it's a define. and we need 990/* we don't have an 'open' function. it's a define. and we need
991 * the real file_open, hence PREFIX() doesn't work here */ 991 * the real file_open, hence PREFIX() doesn't work here */
992 int fd; 992 int fd;
993#ifdef SIMULATOR 993#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
994 if (flags & O_CREAT) 994 if (flags & O_CREAT)
995 { 995 {
996 va_list ap; 996 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 {
233 void (*lcd_yuv_set_options)(unsigned options); 233 void (*lcd_yuv_set_options)(unsigned options);
234#endif 234#endif
235#endif /* MEMORYSIZE > 2 */ 235#endif /* MEMORYSIZE > 2 */
236#elif (LCD_DEPTH < 4) && !defined(SIMULATOR) 236#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
237 void (*lcd_blit_mono)(const unsigned char *data, int x, int by, int width, 237 void (*lcd_blit_mono)(const unsigned char *data, int x, int by, int width,
238 int bheight, int stride); 238 int bheight, int stride);
239 void (*lcd_blit_grey_phase)(unsigned char *values, unsigned char *phases, 239 void (*lcd_blit_grey_phase)(unsigned char *values, unsigned char *phases,
@@ -474,7 +474,7 @@ struct plugin_api {
474#endif 474#endif
475 475
476 void (*reset_poweroff_timer)(void); 476 void (*reset_poweroff_timer)(void);
477#ifndef SIMULATOR 477#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
478 int (*system_memory_guard)(int newmode); 478 int (*system_memory_guard)(int newmode);
479 long *cpu_frequency; 479 long *cpu_frequency;
480#ifdef HAVE_ADJUSTABLE_CPU_FREQ 480#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -484,7 +484,7 @@ struct plugin_api {
484 void (*cpu_boost)(bool on_off); 484 void (*cpu_boost)(bool on_off);
485#endif 485#endif
486#endif /* HAVE_ADJUSTABLE_CPU_FREQ */ 486#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
487#endif /* !SIMULATOR */ 487#endif /* PLATFORM_NATIVE */
488#ifdef HAVE_SCHEDULER_BOOSTCTRL 488#ifdef HAVE_SCHEDULER_BOOSTCTRL
489 void (*trigger_cpu_boost)(void); 489 void (*trigger_cpu_boost)(void);
490 void (*cancel_cpu_boost)(void); 490 void (*cancel_cpu_boost)(void);
@@ -530,7 +530,7 @@ struct plugin_api {
530 void (*remove_event)(unsigned short id, void (*handler)(void *data)); 530 void (*remove_event)(unsigned short id, void (*handler)(void *data));
531 void (*send_event)(unsigned short id, void *data); 531 void (*send_event)(unsigned short id, void *data);
532 532
533#ifdef SIMULATOR 533#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
534 /* special simulator hooks */ 534 /* special simulator hooks */
535#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8 535#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
536 void (*sim_lcd_ex_init)(unsigned long (*getpixel)(int, int)); 536 void (*sim_lcd_ex_init)(unsigned long (*getpixel)(int, int));
@@ -553,7 +553,7 @@ struct plugin_api {
553 void* (*memset)(void *dst, int c, size_t length); 553 void* (*memset)(void *dst, int c, size_t length);
554 void* (*memcpy)(void *out, const void *in, size_t n); 554 void* (*memcpy)(void *out, const void *in, size_t n);
555 void* (*memmove)(void *out, const void *in, size_t n); 555 void* (*memmove)(void *out, const void *in, size_t n);
556#ifndef SIMULATOR 556#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
557 const unsigned char *_rbctype_; 557 const unsigned char *_rbctype_;
558#endif 558#endif
559 int (*atoi)(const char *str); 559 int (*atoi)(const char *str);
@@ -584,7 +584,7 @@ struct plugin_api {
584 int (*sound_enum_hw_eq_band_setting)(unsigned int band, 584 int (*sound_enum_hw_eq_band_setting)(unsigned int band,
585 unsigned int band_setting); 585 unsigned int band_setting);
586#endif /* AUDIOHW_HAVE_EQ */ 586#endif /* AUDIOHW_HAVE_EQ */
587#ifndef SIMULATOR 587#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
588 void (*mp3_play_data)(const unsigned char* start, int size, 588 void (*mp3_play_data)(const unsigned char* start, int size,
589 void (*get_more)(unsigned char** start, size_t* size)); 589 void (*get_more)(unsigned char** start, size_t* size));
590 void (*mp3_play_pause)(bool play); 590 void (*mp3_play_pause)(bool play);
@@ -593,7 +593,7 @@ struct plugin_api {
593#if CONFIG_CODEC != SWCODEC 593#if CONFIG_CODEC != SWCODEC
594 void (*bitswap)(unsigned char *data, int length); 594 void (*bitswap)(unsigned char *data, int length);
595#endif 595#endif
596#endif /* !SIMULATOR */ 596#endif /* PLATFORM_NATIVE */
597#if CONFIG_CODEC == SWCODEC 597#if CONFIG_CODEC == SWCODEC
598 const unsigned long *audio_master_sampr_list; 598 const unsigned long *audio_master_sampr_list;
599 const unsigned long *hw_freq_sampr; 599 const unsigned long *hw_freq_sampr;
@@ -731,7 +731,7 @@ struct plugin_api {
731 int (*battery_level)(void); 731 int (*battery_level)(void);
732 bool (*battery_level_safe)(void); 732 bool (*battery_level_safe)(void);
733 int (*battery_time)(void); 733 int (*battery_time)(void);
734#ifndef SIMULATOR 734#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
735 unsigned int (*battery_voltage)(void); 735 unsigned int (*battery_voltage)(void);
736#endif 736#endif
737#if CONFIG_CHARGING 737#if CONFIG_CHARGING
@@ -745,7 +745,7 @@ struct plugin_api {
745#endif 745#endif
746 746
747 /* misc */ 747 /* misc */
748#if !defined(SIMULATOR) 748#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
749 int* __errno; 749 int* __errno;
750#endif 750#endif
751 void (*srand)(unsigned int seed); 751 void (*srand)(unsigned int seed);
@@ -902,7 +902,7 @@ struct plugin_header {
902}; 902};
903 903
904#ifdef PLUGIN 904#ifdef PLUGIN
905#ifndef SIMULATOR 905#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
906extern unsigned char plugin_start_addr[]; 906extern unsigned char plugin_start_addr[];
907extern unsigned char plugin_end_addr[]; 907extern unsigned char plugin_end_addr[];
908#define PLUGIN_HEADER \ 908#define PLUGIN_HEADER \
@@ -911,14 +911,14 @@ extern unsigned char plugin_end_addr[];
911 __attribute__ ((section (".header")))= { \ 911 __attribute__ ((section (".header")))= { \
912 PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ 912 PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
913 plugin_start_addr, plugin_end_addr, plugin_start, &rb }; 913 plugin_start_addr, plugin_end_addr, plugin_start, &rb };
914#else /* SIMULATOR */ 914#else /* PLATFORM_HOSTED */
915#define PLUGIN_HEADER \ 915#define PLUGIN_HEADER \
916 const struct plugin_api *rb DATA_ATTR; \ 916 const struct plugin_api *rb DATA_ATTR; \
917 const struct plugin_header __header \ 917 const struct plugin_header __header \
918 __attribute__((visibility("default"))) = { \ 918 __attribute__((visibility("default"))) = { \
919 PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ 919 PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
920 NULL, NULL, plugin_start, &rb }; 920 NULL, NULL, plugin_start, &rb };
921#endif /* SIMULATOR */ 921#endif /* CONFIG_PLATFORM */
922 922
923#ifdef PLUGIN_USE_IRAM 923#ifdef PLUGIN_USE_IRAM
924/* Declare IRAM variables */ 924/* 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 @@
4 * they will grep for "YES" to see if overlay plugins must be built 4 * they will grep for "YES" to see if overlay plugins must be built
5 */ 5 */
6 6
7#if PLUGIN_BUFFER_SIZE <= 0x20000 && !defined(SIMULATOR) 7#if PLUGIN_BUFFER_SIZE <= 0x20000 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
8YES 8YES
9#endif 9#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
65 65
66 66
67 67
68#ifndef SIMULATOR /* those plugins only run on hardware */ 68#if (CONFIG_PLATFORM & PLATFORM_NATIVE) /* those plugins only run on hardware */
69 69
70/* Overlays loaders */ 70/* Overlays loaders */
71#if PLUGIN_BUFFER_SIZE <= 0x20000 && defined(HAVE_LCD_BITMAP) 71#if PLUGIN_BUFFER_SIZE <= 0x20000 && defined(HAVE_LCD_BITMAP)
@@ -132,7 +132,7 @@ wavplay.c
132wavrecord.c 132wavrecord.c
133#endif 133#endif
134 134
135#endif /* SIMULATOR */ 135#endif /* PLATFORM_NATIVE */
136 136
137 137
138 138
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
125 125
126#undef SYNC 126#undef SYNC
127 127
128#ifdef SIMULATOR 128#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
129 #define SYNC 129 #define SYNC
130#endif 130#endif
131 131
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
61#endif 61#endif
62 62
63#endif /* HAVE_LCD_BITMAP */ 63#endif /* HAVE_LCD_BITMAP */
64#if defined(SIMULATOR) && defined(__APPLE__) 64#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
65osx.dummy.bmp 65osx.dummy.bmp
66#endif 66#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 @@
1#if defined(SIMULATOR) && defined(__APPLE__) 1#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
2osx.dummy.bmp 2osx.dummy.bmp
3#endif 3#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 @@
1#if defined(SIMULATOR) && defined(__APPLE__) 1#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
2osx.dummy.bmp 2osx.dummy.bmp
3#endif 3#endif
4 4
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];
1185static unsigned long starttimer; /* Timer value at the beginning */ 1185static unsigned long starttimer; /* Timer value at the beginning */
1186static unsigned long cycles; /* Number of update cycles (50Hz) */ 1186static unsigned long cycles; /* Number of update cycles (50Hz) */
1187 1187
1188#ifndef SIMULATOR 1188#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1189static bool is_playing; 1189static bool is_playing;
1190 1190
1191/* one frame of bitswapped mp3 data */ 1191/* one frame of bitswapped mp3 data */
@@ -1208,14 +1208,14 @@ static void callback(unsigned char** start, size_t* size)
1208 *start = beep; /* give it the same frame again */ 1208 *start = beep; /* give it the same frame again */
1209 *size = sizeof(beep); 1209 *size = sizeof(beep);
1210} 1210}
1211#endif /* !SIMULATOR */ 1211#endif /* PLATFORM_NATIVE */
1212 1212
1213/****************************************************************************/ 1213/****************************************************************************/
1214/* Turn sound on */ 1214/* Turn sound on */
1215/****************************************************************************/ 1215/****************************************************************************/
1216static void chip8_sound_on (void) 1216static void chip8_sound_on (void)
1217{ 1217{
1218#ifndef SIMULATOR 1218#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1219 if (!is_playing) 1219 if (!is_playing)
1220 rb->mp3_play_pause(true); /* kickoff audio */ 1220 rb->mp3_play_pause(true); /* kickoff audio */
1221#endif 1221#endif
@@ -1226,7 +1226,7 @@ static void chip8_sound_on (void)
1226/****************************************************************************/ 1226/****************************************************************************/
1227static void chip8_sound_off (void) 1227static void chip8_sound_off (void)
1228{ 1228{
1229#ifndef SIMULATOR 1229#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1230 if (!is_playing) 1230 if (!is_playing)
1231 rb->mp3_play_pause(false); /* pause audio */ 1231 rb->mp3_play_pause(false); /* pause audio */
1232#endif 1232#endif
@@ -1266,7 +1266,7 @@ static void chip8_update_display(void)
1266 *row++ = w; 1266 *row++ = w;
1267 } 1267 }
1268 } 1268 }
1269#if defined(SIMULATOR) || (LCD_DEPTH > 1) 1269#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || (LCD_DEPTH > 1)
1270 rb->lcd_set_drawmode(DRMODE_SOLID); 1270 rb->lcd_set_drawmode(DRMODE_SOLID);
1271 rb->lcd_mono_bitmap(lcd_framebuf[0], CHIP8_X, CHIP8_Y, CHIP8_LCDWIDTH, 1271 rb->lcd_mono_bitmap(lcd_framebuf[0], CHIP8_X, CHIP8_Y, CHIP8_LCDWIDTH,
1272 CHIP8_HEIGHT); 1272 CHIP8_HEIGHT);
@@ -1428,7 +1428,7 @@ static bool chip8_run(const char* file)
1428#endif 1428#endif
1429 rb->lcd_update(); 1429 rb->lcd_update();
1430 1430
1431#ifndef SIMULATOR 1431#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1432 /* init sound */ 1432 /* init sound */
1433 is_playing = rb->mp3_is_playing(); /* would we disturb playback? */ 1433 is_playing = rb->mp3_is_playing(); /* would we disturb playback? */
1434 if (!is_playing) /* no? then we can make sound */ 1434 if (!is_playing) /* no? then we can make sound */
@@ -1442,7 +1442,7 @@ static bool chip8_run(const char* file)
1442 cycles = 0; 1442 cycles = 0;
1443 chip8(); 1443 chip8();
1444 1444
1445#ifndef SIMULATOR 1445#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1446 if (!is_playing) 1446 if (!is_playing)
1447 { /* stop it if we used audio */ 1447 { /* stop it if we used audio */
1448 rb->mp3_play_stop(); /* Stop audio playback */ 1448 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)
62 return -1; 62 return -1;
63} 63}
64 64
65#ifndef SIMULATOR 65#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
66int my_open(const char *file, int flags, ...) 66int my_open(const char *file, int flags, ...)
67{ 67{
68 if(fpoint==8) 68 if(fpoint==8)
@@ -111,7 +111,7 @@ int my_close(int id)
111 111
112bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates 112bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates
113 113
114#ifndef SIMULATOR 114#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
115// Here is a hacked up printf command to get the output from the game. 115// Here is a hacked up printf command to get the output from the game.
116int printf(const char *fmt, ...) 116int printf(const char *fmt, ...)
117{ 117{
@@ -751,7 +751,7 @@ enum plugin_status plugin_start(const void* parameter)
751 printf("There were still: %d files open\n", fpoint); 751 printf("There were still: %d files open\n", fpoint);
752 while(fpoint>0) 752 while(fpoint>0)
753 { 753 {
754#ifdef SIMULATOR 754#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
755 close(filearray[fpoint]); 755 close(filearray[fpoint]);
756#else 756#else
757 rb->close(filearray[fpoint]); 757 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 );
42#undef read_line 42#undef read_line
43#define read_line(a,b,c) rb->read_line((a),(b),(c)) 43#define read_line(a,b,c) rb->read_line((a),(b),(c))
44 44
45#ifdef SIMULATOR 45#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
46#define open(a, ...) rb->open((a), __VA_ARGS__) 46#define open(a, ...) rb->open((a), __VA_ARGS__)
47#define close(a) rb->close((a)) 47#define close(a) rb->close((a))
48#else 48#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 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22 22
23#if PLUGIN_BUFFER_SIZE < 0x10000 && !defined(SIMULATOR) 23#if PLUGIN_BUFFER_SIZE < 0x10000 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
24 24
25#include "lib/overlay.h" 25#include "lib/overlay.h"
26 26
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 @@
386#define PLUGIN_ABORT 11 386#define PLUGIN_ABORT 11
387#define PLUGIN_OUTOFMEM 12 387#define PLUGIN_OUTOFMEM 12
388 388
389#if !defined(SIMULATOR) && defined(HAVE_DISK_STORAGE) 389#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && defined(HAVE_DISK_STORAGE)
390#define DISK_SPINDOWN 390#define DISK_SPINDOWN
391#endif 391#endif
392#if PLUGIN_BUFFER_SIZE >= MIN_MEM 392#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
28 28
29#endif /* HAVE_LCD_BITMAP && LCD_DEPTH < 4 */ 29#endif /* HAVE_LCD_BITMAP && LCD_DEPTH < 4 */
30 30
31#ifndef SIMULATOR 31#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
32overlay.c 32overlay.c
33#endif 33#endif
34 34
@@ -76,7 +76,7 @@ pluginlib_albumart.c
76pluginlib_touchscreen.c 76pluginlib_touchscreen.c
77#endif 77#endif
78 78
79#ifndef SIMULATOR 79#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
80 80
81#ifdef CPU_ARM 81#ifdef CPU_ARM
82../../codecs/lib/setjmp_arm.S 82../../codecs/lib/setjmp_arm.S
@@ -90,4 +90,4 @@ pluginlib_touchscreen.c
90../../codecs/lib/setjmp_mips.S 90../../codecs/lib/setjmp_mips.S
91#endif 91#endif
92 92
93#endif /* !SIMULATOR */ 93#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 @@
23#define __PLUGINLIB_EXIT_H__ 23#define __PLUGINLIB_EXIT_H__
24 24
25#include "config.h" 25#include "config.h"
26#ifndef SIMULATOR 26#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
27#include "../../codecs/lib/setjmp.h" 27#include "../../codecs/lib/setjmp.h"
28#else 28#else
29#include <setjmp.h> 29#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 @@
24#define _ROCKCONF_H_ /* Protect against unwanted include */ 24#define _ROCKCONF_H_ /* Protect against unwanted include */
25#include "lua.h" 25#include "lua.h"
26 26
27#if !defined(SIMULATOR) 27#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
28int errno = 0; 28int errno = 0;
29#endif 29#endif
30 30
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 @@
31#undef LUA_PATH_DEFAULT 31#undef LUA_PATH_DEFAULT
32#define LUA_PATH_DEFAULT "$/?.lua;" "$/?/init.lua;" VIEWERS_DIR"/lua/?.lua;" VIEWERS_DIR"/lua/?/init.lua;" 32#define LUA_PATH_DEFAULT "$/?.lua;" "$/?/init.lua;" VIEWERS_DIR"/lua/?.lua;" VIEWERS_DIR"/lua/?/init.lua;"
33 33
34#ifndef SIMULATOR 34#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
35#include "../../codecs/lib/setjmp.h" 35#include "../../codecs/lib/setjmp.h"
36#else 36#else
37#include <setjmp.h> 37#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 @@
26#include <ctype.h> 26#include <ctype.h>
27#include "plugin.h" 27#include "plugin.h"
28 28
29#ifdef SIMULATOR 29#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
30#include <errno.h> 30#include <errno.h>
31#define PREFIX(_x_) sim_ ## _x_ 31#define PREFIX(_x_) sim_ ## _x_
32#else 32#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 @@
39 improved to increase MAX_VOICES for targets that can do 22kHz */ 39 improved to increase MAX_VOICES for targets that can do 22kHz */
40#ifdef CPU_PP 40#ifdef CPU_PP
41#define MAX_VOICES 16 41#define MAX_VOICES 16
42#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
43#define MAX_VOICES 48
42#else 44#else
43#define MAX_VOICES 24 /* Note: 24 midi channels is the minimum general midi spec implementation */ 45#define MAX_VOICES 24 /* Note: 24 midi channels is the minimum general midi spec implementation */
44#endif /* CPU_PP */ 46#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 @@
28#include "arcade.h" 28#include "arcade.h"
29#include "hardware.h" 29#include "hardware.h"
30 30
31#if defined(SIMULATOR) || !defined(IRIVER_H300_SERIES) 31#if (CONFIG_PLATFORM & PLATFORM_HOSTED) || !defined(IRIVER_H300_SERIES)
32 32
33void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf) 33void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf)
34{ 34{
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)
403 = rb->plugin_get_audio_buffer(&audio_buffer_free); 403 = rb->plugin_get_audio_buffer(&audio_buffer_free);
404 plugbuf=false; 404 plugbuf=false;
405 } 405 }
406#if MEM <= 8 && !defined(SIMULATOR) 406#if MEM <= 8 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
407 /* loaded as an overlay plugin, protect from overwriting ourselves */ 407 /* loaded as an overlay plugin, protect from overwriting ourselves */
408 if ((unsigned)(plugin_start_addr - (unsigned char *)audio_bufferbase) 408 if ((unsigned)(plugin_start_addr - (unsigned char *)audio_bufferbase)
409 < audio_buffer_free) 409 < 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)
697 rb->snprintf(str,sizeof(str),"%d.%02d%% realtime",(int)speed/100,(int)speed%100); 697 rb->snprintf(str,sizeof(str),"%d.%02d%% realtime",(int)speed/100,(int)speed%100);
698 log_text(str,true); 698 log_text(str,true);
699 699
700#ifndef SIMULATOR 700#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
701 /* show effective clockrate in MHz needed for realtime decoding */ 701 /* show effective clockrate in MHz needed for realtime decoding */
702 if (speed > 0) 702 if (speed > 0)
703 { 703 {
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)
114 114
115 log_init(); 115 log_init();
116 log_text("test_disk WRITE&VERIFY", true); 116 log_text("test_disk WRITE&VERIFY", true);
117#ifndef SIMULATOR 117#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
118 rb->snprintf(text_buf, sizeof(text_buf), "CPU clock: %ld Hz", 118 rb->snprintf(text_buf, sizeof(text_buf), "CPU clock: %ld Hz",
119 *rb->cpu_frequency); 119 *rb->cpu_frequency);
120 log_text(text_buf, true); 120 log_text(text_buf, true);
@@ -304,7 +304,7 @@ static bool test_speed(void)
304 rb->memset(audiobuf, 'T', audiobuflen); 304 rb->memset(audiobuf, 'T', audiobuflen);
305 log_init(); 305 log_init();
306 log_text("test_disk SPEED TEST", true); 306 log_text("test_disk SPEED TEST", true);
307#ifndef SIMULATOR 307#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
308 rb->snprintf(text_buf, sizeof(text_buf), "CPU clock: %ld Hz", 308 rb->snprintf(text_buf, sizeof(text_buf), "CPU clock: %ld Hz",
309 *rb->cpu_frequency); 309 *rb->cpu_frequency);
310 log_text(text_buf, true); 310 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)
340/* plugin entry point */ 340/* plugin entry point */
341enum plugin_status plugin_start(const void* parameter) 341enum plugin_status plugin_start(const void* parameter)
342{ 342{
343#ifndef SIMULATOR 343#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
344 char str[32]; 344 char str[32];
345 int cpu_freq; 345 int cpu_freq;
346#endif 346#endif
@@ -350,7 +350,7 @@ enum plugin_status plugin_start(const void* parameter)
350 (void)parameter; 350 (void)parameter;
351 351
352 log_init(); 352 log_init();
353#ifndef SIMULATOR 353#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
354 cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */ 354 cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */
355#endif 355#endif
356 backlight_force_on(); /* backlight control in lib/helper.c */ 356 backlight_force_on(); /* backlight control in lib/helper.c */
@@ -370,7 +370,7 @@ enum plugin_status plugin_start(const void* parameter)
370 time_remote_update(); 370 time_remote_update();
371#endif 371#endif
372 372
373#ifndef SIMULATOR 373#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
374 if (*rb->cpu_frequency != cpu_freq) 374 if (*rb->cpu_frequency != cpu_freq)
375 rb->snprintf(str, sizeof(str), "CPU clock changed!"); 375 rb->snprintf(str, sizeof(str), "CPU clock changed!");
376 else 376 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)
194 194
195 rb->screens[0]->clear_display(); 195 rb->screens[0]->clear_display();
196 rb->screens[0]->putsf(0, line++, "%s", boost?"boosted":"unboosted"); 196 rb->screens[0]->putsf(0, line++, "%s", boost?"boosted":"unboosted");
197#ifndef SIMULATOR 197#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
198 rb->screens[0]->putsf(0, line++, "clock: %d Hz", *rb->cpu_frequency); 198 rb->screens[0]->putsf(0, line++, "clock: %d Hz", *rb->cpu_frequency);
199#endif 199#endif
200 rb->screens[0]->putsf(0, line++, "loop#: %d", ++count); 200 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)
420 bool have_recorded = false; 420 bool have_recorded = false;
421 int timeout = current_tick + HZ/10; 421 int timeout = current_tick + HZ/10;
422 unsigned int last_seconds = 0; 422 unsigned int last_seconds = 0;
423#ifndef SIMULATOR 423#if !defined(SIMULATOR)
424 unsigned int seconds = 0; 424 unsigned int seconds = 0;
425 struct audio_recording_options rec_options; 425 struct audio_recording_options rec_options;
426#endif 426#endif /* SIMULATOR */
427#endif /* CONFIG_CODEC != SWCODEC */ 427#endif /* CONFIG_CODEC != SWCODEC */
428#ifndef HAVE_NOISY_IDLE_MODE 428#ifndef HAVE_NOISY_IDLE_MODE
429 int button_timeout = current_tick + (2*HZ); 429 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 @@
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#ifdef SIMULATOR 21#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
22#include <stdlib.h> /* sim uses rand for peakmeter simulation */ 22#include <stdlib.h> /* sim uses rand for peakmeter simulation */
23#endif 23#endif
24#include "config.h" 24#include "config.h"
@@ -538,7 +538,7 @@ void pm_reset_clipcount(void)
538void peak_meter_playback(bool playback) 538void peak_meter_playback(bool playback)
539{ 539{
540 int i; 540 int i;
541#ifdef SIMULATOR 541#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
542 (void)playback; 542 (void)playback;
543#elif CONFIG_CODEC == SWCODEC 543#elif CONFIG_CODEC == SWCODEC
544 pm_playback = playback; 544 pm_playback = playback;
@@ -595,7 +595,7 @@ void peak_meter_peek(void)
595 left = pm_cur_left; 595 left = pm_cur_left;
596 right = pm_cur_right; 596 right = pm_cur_right;
597#else 597#else
598#ifndef SIMULATOR 598#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
599 pm_cur_left = left = mas_codec_readreg(pm_src_left); 599 pm_cur_left = left = mas_codec_readreg(pm_src_left);
600 pm_cur_right = right = mas_codec_readreg(pm_src_right); 600 pm_cur_right = right = mas_codec_readreg(pm_src_right);
601#else 601#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
24*/ 24*/
25 25
26#include <stdio.h> 26#include <stdio.h>
27#include <config.h>
27#include "file.h" 28#include "file.h"
28#include "logf.h" 29#include "logf.h"
29#include "metadata.h" 30#include "metadata.h"
@@ -70,7 +71,7 @@ static unsigned long timestamp;
70#endif 71#endif
71 72
72/* Crude work-around for Archos Sims - return a set amount */ 73/* Crude work-around for Archos Sims - return a set amount */
73#if (CONFIG_CODEC != SWCODEC) && defined(SIMULATOR) 74#if (CONFIG_CODEC != SWCODEC) && (CONFIG_PLATFORM & PLATFORM_HOSTED)
74unsigned long audio_prev_elapsed(void) 75unsigned long audio_prev_elapsed(void)
75{ 76{
76 return 120000; 77 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)
837#ifdef HAVE_DISK_STORAGE 837#ifdef HAVE_DISK_STORAGE
838 storage_spindown(global_settings.disk_spindown); 838 storage_spindown(global_settings.disk_spindown);
839#endif 839#endif
840#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR) 840#if (CONFIG_CODEC == MAS3507D) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
841 dac_line_in(global_settings.line_in); 841 dac_line_in(global_settings.line_in);
842#endif 842#endif
843 set_poweroff_timeout(global_settings.poweroff); 843 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);
45enum playmode status_get_ffmode(void); 45enum playmode status_get_ffmode(void);
46int current_playmode(void); 46int current_playmode(void);
47 47
48#ifdef SIMULATOR 48#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
49#include <time.h> 49#include <time.h>
50#endif 50#endif
51#ifdef HAVE_LCD_CHARCELLS 51#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)
4442 case SYS_POWEROFF: 4442 case SYS_POWEROFF:
4443 break ; 4443 break ;
4444 4444
4445#ifndef SIMULATOR 4445#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
4446 case SYS_USB_CONNECTED: 4446 case SYS_USB_CONNECTED:
4447 logf("USB: TagCache"); 4447 logf("USB: TagCache");
4448 usb_acknowledge(SYS_USB_CONNECTED_ACK); 4448 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
10logf.c 10logf.c
11#endif /* ROCKBOX_HAS_LOGF */ 11#endif /* ROCKBOX_HAS_LOGF */
12kernel.c 12kernel.c
13#ifndef SIMULATOR 13#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
14#ifdef RB_PROFILE 14#ifdef RB_PROFILE
15profile.c 15profile.c
16#endif /* RB_PROFILE */ 16#endif /* RB_PROFILE */
@@ -19,7 +19,7 @@ rolo.c
19#endif /* !defined(BOOTLOADER) || defined(CPU_SH) */ 19#endif /* !defined(BOOTLOADER) || defined(CPU_SH) */
20thread.c 20thread.c
21timer.c 21timer.c
22#endif /* SIMULATOR */ 22#endif /* PLATFORM_NATIVE */
23#ifdef HAVE_SDL 23#ifdef HAVE_SDL
24target/hosted/sdl/button-sdl.c 24target/hosted/sdl/button-sdl.c
25target/hosted/sdl/kernel-sdl.c 25target/hosted/sdl/kernel-sdl.c
@@ -40,13 +40,13 @@ panic.c
40debug.c 40debug.c
41 41
42/* Standard library */ 42/* Standard library */
43#if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) 43#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(__MINGW32__) || defined(__CYGWIN__)
44libc/errno.c 44libc/errno.c
45libc/strtok.c 45libc/strtok.c
46/* alsa on linux requires a more advanced sprintf, i.e. not ours */ 46/* alsa on linux requires a more advanced sprintf, i.e. not ours */
47libc/sprintf.c 47libc/sprintf.c
48#endif /* !SIMULATOR || __MINGW32__ || __CYGWIN__ */ 48#endif /* PLATFORM_NATIVE || __MINGW32__ || __CYGWIN__ */
49#if !defined(SIMULATOR) 49#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
50libc/atoi.c 50libc/atoi.c
51libc/ctype.c 51libc/ctype.c
52libc/memcmp.c 52libc/memcmp.c
@@ -70,11 +70,11 @@ common/crc32.c
70#ifdef MI4_FORMAT 70#ifdef MI4_FORMAT
71common/crc32-mi4.c 71common/crc32-mi4.c
72#endif 72#endif
73#ifndef SIMULATOR 73#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
74common/dir_uncached.c 74common/dir_uncached.c
75common/file.c 75common/file.c
76common/disk.c 76common/disk.c
77#endif /* SIMULATOR */ 77#endif /* PLATFORM_NATIVE */
78#ifdef HAVE_DIRCACHE 78#ifdef HAVE_DIRCACHE
79common/dircache.c 79common/dircache.c
80#endif /* HAVE_DIRCACHE */ 80#endif /* HAVE_DIRCACHE */
@@ -143,21 +143,21 @@ backlight-sw-fading.c
143/* Misc. */ 143/* Misc. */
144drivers/led.c 144drivers/led.c
145drivers/button.c 145drivers/button.c
146#ifndef SIMULATOR 146#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
147#ifdef HAVE_DAC3550A 147#ifdef HAVE_DAC3550A
148drivers/dac.c 148drivers/dac.c
149#endif 149#endif
150#ifdef HAVE_SERIAL 150#ifdef HAVE_SERIAL
151drivers/serial.c 151drivers/serial.c
152#endif 152#endif
153#endif /* SIMULATOR */ 153#endif /* PLATFORM_NATIVE */
154#ifdef HAVE_TOUCHSCREEN 154#ifdef HAVE_TOUCHSCREEN
155drivers/touchscreen.c 155drivers/touchscreen.c
156#endif 156#endif
157 157
158 158
159/* Storage */ 159/* Storage */
160#ifndef SIMULATOR 160#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
161#if (CONFIG_STORAGE & STORAGE_MMC) 161#if (CONFIG_STORAGE & STORAGE_MMC)
162drivers/ata_mmc.c 162drivers/ata_mmc.c
163#endif 163#endif
@@ -184,7 +184,7 @@ drivers/fat.c
184#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD) 184#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
185sdmmc.c 185sdmmc.c
186#endif 186#endif
187#endif /* SIMULATOR */ 187#endif /* PLATFORM_NATIVE */
188 188
189/* EEPROM */ 189/* EEPROM */
190#ifdef HAVE_EEPROM 190#ifdef HAVE_EEPROM
@@ -195,7 +195,7 @@ eeprom_settings.c
195#endif /* HAVE_EEPROM */ 195#endif /* HAVE_EEPROM */
196 196
197/* RTC */ 197/* RTC */
198#ifndef SIMULATOR 198#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
199#if (CONFIG_RTC == RTC_M41ST84W) 199#if (CONFIG_RTC == RTC_M41ST84W)
200drivers/rtc/rtc_m41st84w.c 200drivers/rtc/rtc_m41st84w.c
201#elif (CONFIG_RTC == RTC_PCF50606) 201#elif (CONFIG_RTC == RTC_PCF50606)
@@ -225,13 +225,13 @@ drivers/rtc/rtc_s35390a.c
225#elif (CONFIG_RTC == RTC_D2) 225#elif (CONFIG_RTC == RTC_D2)
226drivers/rtc/rtc_d2.c 226drivers/rtc/rtc_d2.c
227#endif /* (CONFIG_RTC == RTC_) */ 227#endif /* (CONFIG_RTC == RTC_) */
228#endif /* SIMULATOR */ 228#endif /* PLATFORM_NATIVE */
229 229
230#ifndef BOOTLOADER 230#ifndef BOOTLOADER
231/* Tuner */ 231/* Tuner */
232#if CONFIG_TUNER 232#if CONFIG_TUNER
233tuner.c 233tuner.c
234#ifndef SIMULATOR 234#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
235#if (CONFIG_TUNER & LV24020LP) 235#if (CONFIG_TUNER & LV24020LP)
236drivers/tuner/lv24020lp.c 236drivers/tuner/lv24020lp.c
237#endif /* (CONFIG_TUNER & LV24020LP) */ 237#endif /* (CONFIG_TUNER & LV24020LP) */
@@ -254,7 +254,7 @@ drivers/tuner/ipod_remote_tuner.c
254#if (CONFIG_TUNER & RDA5802) 254#if (CONFIG_TUNER & RDA5802)
255drivers/tuner/rda5802.c 255drivers/tuner/rda5802.c
256#endif /* (CONFIG_TUNER & RDA5802) */ 256#endif /* (CONFIG_TUNER & RDA5802) */
257#endif /*SIMULATOR */ 257#endif /* PLATFORM_NATIVE */
258#endif /* CONFIG_TUNER */ 258#endif /* CONFIG_TUNER */
259#endif /* BOOTLOADER */ 259#endif /* BOOTLOADER */
260 260
@@ -285,7 +285,7 @@ drivers/mas.c
285#endif /* SWCODEC */ 285#endif /* SWCODEC */
286 286
287/* Audio codec */ 287/* Audio codec */
288#if !defined(SIMULATOR) && !defined(BOOTLOADER) 288#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER)
289#if defined(HAVE_UDA1380) 289#if defined(HAVE_UDA1380)
290drivers/audio/uda1380.c 290drivers/audio/uda1380.c
291#elif defined(HAVE_WM8751) \ 291#elif defined(HAVE_WM8751) \
@@ -319,7 +319,7 @@ drivers/audio/sdl.c
319#if CONFIG_CODEC == SWCODEC 319#if CONFIG_CODEC == SWCODEC
320target/hosted/sdl/pcm-sdl.c 320target/hosted/sdl/pcm-sdl.c
321#endif 321#endif
322#endif /* !defined(SIMULATOR) && !defined(BOOTLOADER) */ 322#endif /* (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER) */
323 323
324/* USB Stack */ 324/* USB Stack */
325#if !defined(SIMULATOR) 325#if !defined(SIMULATOR)
@@ -531,10 +531,10 @@ libc/memmove.c
531libc/memset.c 531libc/memset.c
532common/memset16.c 532common/memset16.c
533libc/strlen.c 533libc/strlen.c
534#ifndef SIMULATOR 534#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
535crt0.S 535crt0.S
536drivers/i2c.c 536drivers/i2c.c
537#endif /* SIMULATOR */ 537#endif /* PLATFORM_NATIVE */
538 538
539#endif /* defined(CPU_*) */ 539#endif /* defined(CPU_*) */
540 540
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 @@
40#ifdef HAVE_REMOTE_LCD 40#ifdef HAVE_REMOTE_LCD
41#include "lcd-remote.h" 41#include "lcd-remote.h"
42#endif 42#endif
43
44#if defined(HAVE_BACKLIGHT) && defined(BACKLIGHT_FULL_INIT)
45
43#ifndef SIMULATOR 46#ifndef SIMULATOR
44#include "backlight-target.h" 47#include "backlight-target.h"
45#else 48#else
@@ -51,8 +54,6 @@
51#include "backlight-sw-fading.h" 54#include "backlight-sw-fading.h"
52#endif 55#endif
53 56
54#if defined(HAVE_BACKLIGHT) && defined(BACKLIGHT_FULL_INIT)
55
56#define BACKLIGHT_FADE_IN_THREAD \ 57#define BACKLIGHT_FADE_IN_THREAD \
57 (CONFIG_BACKLIGHT_FADING & (BACKLIGHT_FADING_SW_SETTING \ 58 (CONFIG_BACKLIGHT_FADING & (BACKLIGHT_FADING_SW_SETTING \
58 |BACKLIGHT_FADING_SW_HW_REG \ 59 |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 @@
21#include <stdio.h> 21#include <stdio.h>
22#include "buffer.h" 22#include "buffer.h"
23 23
24#ifdef SIMULATOR 24#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
25unsigned char audiobuffer[(MEM*1024-256)*1024]; 25unsigned char audiobuffer[(MEM*1024-256)*1024];
26unsigned char *audiobufend = audiobuffer + sizeof(audiobuffer); 26unsigned char *audiobufend = audiobuffer + sizeof(audiobuffer);
27#else 27#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)
171 return false; 171 return false;
172} 172}
173 173
174#ifndef SIMULATOR 174#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
175/* scan and build static data (avoid redundancy on stack) */ 175/* scan and build static data (avoid redundancy on stack) */
176static struct 176static struct
177{ 177{
@@ -301,7 +301,7 @@ static int dircache_scan_and_build(IF_MV2(int volume,) struct dircache_entry *ce
301 301
302 return sab_process_dir(0, ce); 302 return sab_process_dir(0, ce);
303} 303}
304#else /* !SIMULATOR */ 304#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) /* PLATFORM_HOSTED */
305static char sab_path[MAX_PATH]; 305static char sab_path[MAX_PATH];
306 306
307static int sab_process_dir(struct dircache_entry *ce) 307static 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
400 strlcpy(sab_path, "/", sizeof sab_path); 400 strlcpy(sab_path, "/", sizeof sab_path);
401 return sab_process_dir(ce); 401 return sab_process_dir(ce);
402} 402}
403#endif /* SIMULATOR */ 403#endif /* PLATFORM_NATIVE */
404 404
405/** 405/**
406 * Internal function to get a pointer to dircache_entry for a given filename. 406 * Internal function to get a pointer to dircache_entry for a given filename.
@@ -689,7 +689,7 @@ static void dircache_thread(void)
689 dircache_initialized = false; 689 dircache_initialized = false;
690 break ; 690 break ;
691 691
692#ifndef SIMULATOR 692#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
693 case SYS_USB_CONNECTED: 693 case SYS_USB_CONNECTED:
694 usb_acknowledge(SYS_USB_CONNECTED_ACK); 694 usb_acknowledge(SYS_USB_CONNECTED_ACK);
695 usb_wait_for_disconnect(&dircache_queue); 695 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 @@
33#include "serial.h" 33#include "serial.h"
34#include "power.h" 34#include "power.h"
35#include "powermgmt.h" 35#include "powermgmt.h"
36#ifdef SIMULATOR 36#ifdef HAVE_SDL
37#include "button-sdl.h" 37#include "button-sdl.h"
38#else 38#else
39#include "button-target.h" 39#include "button-target.h"
@@ -215,7 +215,7 @@ static void button_tick(void)
215 215
216 /* Safety net for players without hardware 216 /* Safety net for players without hardware
217 poweroff */ 217 poweroff */
218#ifndef SIMULATOR 218#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
219 if(repeat_count > POWEROFF_COUNT * 10) 219 if(repeat_count > POWEROFF_COUNT * 10)
220 power_off(); 220 power_off();
221#endif 221#endif
@@ -440,7 +440,7 @@ static int button_flip(int button)
440{ 440{
441 int newbutton = button; 441 int newbutton = button;
442 442
443#ifndef SIMULATOR 443#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
444 newbutton &= 444 newbutton &=
445 ~(BUTTON_LEFT | BUTTON_RIGHT 445 ~(BUTTON_LEFT | BUTTON_RIGHT
446#if defined(BUTTON_UP) && defined(BUTTON_DOWN) 446#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 {
43 DISK_EVENT_SPINUP = (EVENT_CLASS_DISK|1), 43 DISK_EVENT_SPINUP = (EVENT_CLASS_DISK|1),
44}; 44};
45 45
46#define USING_STORAGE_CALLBACK !defined(SIMULATOR) \ 46#define USING_STORAGE_CALLBACK (CONFIG_PLATFORM & PLATFORM_NATIVE) \
47 && ! ((CONFIG_STORAGE & STORAGE_NAND) \ 47 && ! ((CONFIG_STORAGE & STORAGE_NAND) \
48 && (CONFIG_NAND == NAND_IFP7XX)) \ 48 && (CONFIG_NAND == NAND_IFP7XX)) \
49 && !defined(BOOTLOADER) 49 && !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 @@
36#endif /* CONFIG_CODEC == SWCODEC */ 36#endif /* CONFIG_CODEC == SWCODEC */
37 37
38 38
39#ifdef SIMULATOR 39#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
40#define audio_play(x) sim_audio_play(x) 40#define audio_play(x) sim_audio_play(x)
41#endif 41#endif
42 42
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 @@
23 23
24#include "config.h" 24#include "config.h"
25/* defined in linker script */ 25/* defined in linker script */
26#ifdef SIMULATOR 26#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
27extern unsigned char *audiobufend;
28#else
29extern unsigned char audiobufend[]; 27extern unsigned char audiobufend[];
28#else
29extern unsigned char *audiobufend;
30#endif 30#endif
31 31
32extern unsigned char *audiobuf; 32extern 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 @@
74#define AT91SAM9260 9260 74#define AT91SAM9260 9260
75#define AS3525v2 35252 75#define AS3525v2 35252
76 76
77/* platforms
78 * bit fields to allow PLATFORM_HOSTED to be OR'ed e.g. with a
79 * possible future PLATFORM_ANDROID (some OSes might need totally different
80 * handling to run on them than a stand-alone application) */
81#define PLATFORM_NATIVE (1<<0)
82#define PLATFORM_HOSTED (1<<1)
83
77/* CONFIG_KEYPAD */ 84/* CONFIG_KEYPAD */
78#define PLAYER_PAD 1 85#define PLAYER_PAD 1
79#define RECORDER_PAD 2 86#define RECORDER_PAD 2
@@ -497,6 +504,10 @@ Lyre prototype 1 */
497#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING 504#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING
498#endif 505#endif
499 506
507#ifndef CONFIG_PLATFORM
508#define CONFIG_PLATFORM PLATFORM_NATIVE
509#endif
510
500#ifndef CONFIG_TUNER 511#ifndef CONFIG_TUNER
501#define CONFIG_TUNER 0 512#define CONFIG_TUNER 0
502#endif 513#endif
@@ -675,10 +686,10 @@ Lyre prototype 1 */
675#define HAVE_EXTENDED_MESSAGING_AND_NAME 686#define HAVE_EXTENDED_MESSAGING_AND_NAME
676#define HAVE_WAKEUP_EXT_CB 687#define HAVE_WAKEUP_EXT_CB
677 688
678#ifndef SIMULATOR 689#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
679#define HAVE_PRIORITY_SCHEDULING 690#define HAVE_PRIORITY_SCHEDULING
680#define HAVE_SCHEDULER_BOOSTCTRL 691#define HAVE_SCHEDULER_BOOSTCTRL
681#endif /* SIMULATOR */ 692#endif /* PLATFORM_NATIVE */
682 693
683#define HAVE_SEMAPHORE_OBJECTS 694#define HAVE_SEMAPHORE_OBJECTS
684 695
@@ -744,7 +755,7 @@ Lyre prototype 1 */
744#endif 755#endif
745 756
746/* IRAM usage */ 757/* IRAM usage */
747#if !defined(SIMULATOR) && /* Not for simulators */ \ 758#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && /* Not for hosted environments */ \
748 (((CONFIG_CPU == SH7034) && !defined(PLUGIN)) || /* SH1 archos: core only */ \ 759 (((CONFIG_CPU == SH7034) && !defined(PLUGIN)) || /* SH1 archos: core only */ \
749 defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \ 760 defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \
750 defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \ 761 defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \
@@ -780,9 +791,10 @@ Lyre prototype 1 */
780#define IBSS_ATTR 791#define IBSS_ATTR
781#define STATICIRAM static 792#define STATICIRAM static
782#endif 793#endif
794
783#if (defined(CPU_PP) || (CONFIG_CPU == AS3525) || (CONFIG_CPU == AS3525v2) || \ 795#if (defined(CPU_PP) || (CONFIG_CPU == AS3525) || (CONFIG_CPU == AS3525v2) || \
784 (CONFIG_CPU == IMX31L)) \ 796 (CONFIG_CPU == IMX31L)) \
785 && !defined(SIMULATOR) && !defined(BOOTLOADER) 797 && (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER)
786/* Functions that have INIT_ATTR attached are NOT guaranteed to survive after 798/* Functions that have INIT_ATTR attached are NOT guaranteed to survive after
787 * root_menu() has been called. Their code may be overwritten by other data or 799 * root_menu() has been called. Their code may be overwritten by other data or
788 * code in order to save RAM, and references to them might point into 800 * code in order to save RAM, and references to them might point into
@@ -799,7 +811,7 @@ Lyre prototype 1 */
799#define INIT_ATTR 811#define INIT_ATTR
800#endif 812#endif
801 813
802#if defined(SIMULATOR) && defined(__APPLE__) 814#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
803#define DATA_ATTR __attribute__ ((section("__DATA, .data"))) 815#define DATA_ATTR __attribute__ ((section("__DATA, .data")))
804#else 816#else
805#define DATA_ATTR __attribute__ ((section(".data"))) 817#define DATA_ATTR __attribute__ ((section(".data")))
@@ -923,7 +935,7 @@ Lyre prototype 1 */
923 935
924#else /* BOOTLOADER */ 936#else /* BOOTLOADER */
925 937
926#ifndef SIMULATOR 938#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
927//#define USB_ENABLE_SERIAL 939//#define USB_ENABLE_SERIAL
928#define USB_ENABLE_STORAGE 940#define USB_ENABLE_STORAGE
929 941
@@ -941,11 +953,11 @@ Lyre prototype 1 */
941/* This attribute can be used to enable to detection of plugin file handles leaks. 953/* This attribute can be used to enable to detection of plugin file handles leaks.
942 * When enabled, the plugin core will monitor open/close/creat and when the plugin exits 954 * When enabled, the plugin core will monitor open/close/creat and when the plugin exits
943 * will display an error message if the plugin leaked some file handles */ 955 * will display an error message if the plugin leaked some file handles */
944#ifndef SIMULATOR 956#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
945#define HAVE_PLUGIN_CHECK_OPEN_CLOSE 957#define HAVE_PLUGIN_CHECK_OPEN_CLOSE
946#endif 958#endif
947 959
948#if defined(HAVE_DIRCACHE) && !defined(SIMULATOR) 960#if defined(HAVE_DIRCACHE) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
949#define HAVE_IO_PRIORITY 961#define HAVE_IO_PRIORITY
950#endif 962#endif
951 963
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 @@
101 101
102#define HAVE_SDL 102#define HAVE_SDL
103#define HAVE_SDL_AUDIO 103#define HAVE_SDL_AUDIO
104#define CONFIG_PLATFORM PLATFORM_HOSTED
104#define _ISOC99_SOURCE 1 105#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 @@
28 */ 28 */
29#include "config.h" 29#include "config.h"
30 30
31#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) 31#if defined(HAVE_LCD_BITMAP) || (CONFIG_PLATFORM & PLATFORM_HOSTED)
32#ifndef __PCTOOL__ 32#ifndef __PCTOOL__
33#include "font_cache.h" 33#include "font_cache.h"
34#include "sysfont.h" 34#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 @@
24#include <stdbool.h> 24#include <stdbool.h>
25#include "config.h" 25#include "config.h"
26 26
27#if (CONFIG_CPU == SH7034) && !defined(SIMULATOR) 27#if (CONFIG_CPU == SH7034) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
28 28
29#define ROM_VERSION (*(short *)0x020000fe) 29#define ROM_VERSION (*(short *)0x020000fe)
30 30
@@ -49,7 +49,7 @@ static inline int tuner_detect_type(void)
49} 49}
50#endif 50#endif
51 51
52#endif /* (CONFIG_CPU == SH7034) && !SIMULATOR */ 52#endif /* (CONFIG_CPU == SH7034) && (CONFIG_PLATFORM & PLATFORM_NATIVE) */
53 53
54#ifdef ARCHOS_PLAYER 54#ifdef ARCHOS_PLAYER
55bool is_new_player(void); 55bool 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)
201} 201}
202#endif 202#endif
203 203
204#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC) 204#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && !defined(PLUGIN) && !defined(CODEC)
205#define sleep(x) sim_sleep(x) 205#define sleep(x) sim_sleep(x)
206#endif 206#endif
207 207
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);
81bool charging_state(void); 81bool charging_state(void);
82#endif 82#endif
83 83
84#ifndef SIMULATOR 84#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
85 85
86void power_init(void) INIT_ATTR; 86void power_init(void) INIT_ATTR;
87 87
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;
74#include "powermgmt-target.h" 74#include "powermgmt-target.h"
75#endif 75#endif
76 76
77#ifndef SIMULATOR 77#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
78 78
79/* Generic current values that are intentionally meaningless - config header 79/* Generic current values that are intentionally meaningless - config header
80 * should define proper numbers.*/ 80 * should define proper numbers.*/
@@ -129,7 +129,7 @@ extern const unsigned short percent_to_volt_charge[11];
129/* Start up power management thread */ 129/* Start up power management thread */
130void powermgmt_init(void) INIT_ATTR; 130void powermgmt_init(void) INIT_ATTR;
131 131
132#endif /* SIMULATOR */ 132#endif /* PLATFORM_NATIVE */
133 133
134/* Returns battery statust */ 134/* Returns battery statust */
135int battery_level(void); /* percent */ 135int 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
51 char *revision; 51 char *revision;
52}; 52};
53 53
54#if !defined(SIMULATOR) && !defined(CONFIG_STORAGE_MULTI) 54#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(CONFIG_STORAGE_MULTI)
55/* storage_spindown, storage_sleep and storage_spin are passed as 55/* storage_spindown, storage_sleep and storage_spin are passed as
56 * pointers, which doesn't work with argument-macros. 56 * pointers, which doesn't work with argument-macros.
57 */ 57 */
@@ -185,7 +185,7 @@ struct storage_info
185 #else 185 #else
186 //#error No storage driver! 186 //#error No storage driver!
187 #endif 187 #endif
188#else /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/ 188#else /* NOT CONFIG_STORAGE_MULTI and PLATFORM_NATIVE*/
189 189
190/* Simulator and multi-driver use normal functions */ 190/* Simulator and multi-driver use normal functions */
191 191
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);
125 125
126 126
127/* newer? SDL includes endian.h, So we ignore it */ 127/* newer? SDL includes endian.h, So we ignore it */
128#if defined(SIMULATOR) || defined(__PCTOOL__) 128#if (CONFIG_PLATFORM & PLATFORM_HOSTED) || defined(__PCTOOL__)
129#undef letoh16 129#undef letoh16
130#undef letoh32 130#undef letoh32
131#undef htole16 131#undef htole16
@@ -234,8 +234,11 @@ enum {
234 234
235#if !defined(SIMULATOR) && !defined(__PCTOOL__) 235#if !defined(SIMULATOR) && !defined(__PCTOOL__)
236#include "system-target.h" 236#include "system-target.h"
237#elif defined(HAVE_SDL) /* SIMULATOR */ 237#elif defined(HAVE_SDL) /* SDL build */
238#include "system-sdl.h" 238#include "system-sdl.h"
239#endif
240
241#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
239static inline uint16_t swap16(uint16_t value) 242static inline uint16_t swap16(uint16_t value)
240 /* 243 /*
241 result[15..8] = value[ 7..0]; 244 result[15..8] = value[ 7..0];
@@ -268,7 +271,7 @@ static inline uint32_t swap_odd_even32(uint32_t value)
268 return (t >> 8) | ((t ^ value) << 8); 271 return (t >> 8) | ((t ^ value) << 8);
269} 272}
270 273
271#endif /* !SIMULATOR */ 274#endif /* PLATFORM_HOSTED */
272 275
273#ifndef BIT_N 276#ifndef BIT_N
274#define BIT_N(n) (1U << (n)) 277#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 @@
81 81
82#define DEFAULT_STACK_SIZE 0x400 /* Bytes */ 82#define DEFAULT_STACK_SIZE 0x400 /* Bytes */
83 83
84#ifndef SIMULATOR 84#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
85/* Need to keep structures inside the header file because debug_menu 85/* Need to keep structures inside the header file because debug_menu
86 * needs them. */ 86 * needs them. */
87#ifdef CPU_COLDFIRE 87#ifdef CPU_COLDFIRE
@@ -135,15 +135,15 @@ struct regs
135 uint32_t start; /* 44 - Thread start address, or NULL when started */ 135 uint32_t start; /* 44 - Thread start address, or NULL when started */
136}; 136};
137#endif /* CONFIG_CPU */ 137#endif /* CONFIG_CPU */
138#else 138#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
139struct regs 139struct regs
140{ 140{
141 void *t; /* Simulator OS thread */ 141 void *t; /* OS thread */
142 void *told; /* Last thread in slot (explained in thead-sdl.c) */ 142 void *told; /* Last thread in slot (explained in thead-sdl.c) */
143 void *s; /* Semaphore for blocking and wakeup */ 143 void *s; /* Semaphore for blocking and wakeup */
144 void (*start)(void); /* Start function */ 144 void (*start)(void); /* Start function */
145}; 145};
146#endif /* !SIMULATOR */ 146#endif /* PLATFORM_NATIVE */
147 147
148/* NOTE: The use of the word "queue" may also refer to a linked list of 148/* NOTE: The use of the word "queue" may also refer to a linked list of
149 threads being maintained that are normally dealt with in FIFO order 149 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 @@
26#include "config.h" 26#include "config.h"
27#include "cpu.h" 27#include "cpu.h"
28 28
29#if defined(SIMULATOR) 29#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
30#define TIMER_FREQ 1000000 30#define TIMER_FREQ 1000000
31#endif 31#endif
32 32
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];
90 90
91#if CONFIG_TUNER 91#if CONFIG_TUNER
92 92
93#ifdef SIMULATOR 93#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
94int tuner_set(int setting, int value); 94int tuner_set(int setting, int value);
95int tuner_get(int setting); 95int tuner_get(int setting);
96#ifdef HAVE_RDS_CAP 96#ifdef HAVE_RDS_CAP
@@ -142,7 +142,7 @@ extern int (*tuner_get)(int setting);
142#include "ipod_remote_tuner.h" 142#include "ipod_remote_tuner.h"
143#endif 143#endif
144 144
145#endif /* SIMULATOR */ 145#endif /* PLATFORM_HOSTED */
146 146
147/* Additional messages that get enumerated after tuner driver headers */ 147/* Additional messages that get enumerated after tuner driver headers */
148 148
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 @@
4#include <stdbool.h> 4#include <stdbool.h>
5 5
6#ifdef DEBUG 6#ifdef DEBUG
7 #ifndef SIMULATOR 7 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
8 /* check whether a function is inside the valid memory location */ 8 /* check whether a function is inside the valid memory location */
9 #define IS_FUNCPTR(fp) ({/ 9 #define IS_FUNCPTR(fp) ({/
10 extern char _text[];/ 10 extern char _text[];/
@@ -21,4 +21,4 @@
21#endif 21#endif
22 22
23 23
24#endif // #ifndef __DBGCHECK_H__ \ No newline at end of file 24#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 @@
32#define ATTR_ARCHIVE 0x20 32#define ATTR_ARCHIVE 0x20
33#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ 33#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */
34 34
35#ifdef SIMULATOR 35#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
36#define dirent_uncached sim_dirent 36#define dirent_uncached sim_dirent
37#define DIR_UNCACHED SIM_DIR 37#define DIR_UNCACHED SIM_DIR
38#define opendir_uncached sim_opendir 38#define opendir_uncached sim_opendir
@@ -57,7 +57,7 @@ struct dirent_uncached {
57#include "fat.h" 57#include "fat.h"
58 58
59typedef struct { 59typedef struct {
60#ifndef SIMULATOR 60#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
61 bool busy; 61 bool busy;
62 long startcluster; 62 long startcluster;
63 struct fat_dir fatdir; 63 struct fat_dir fatdir;
@@ -66,7 +66,7 @@ typedef struct {
66 int volumecounter; /* running counter for faked volume entries */ 66 int volumecounter; /* running counter for faked volume entries */
67#endif 67#endif
68#else 68#else
69 /* simulator: */ 69 /* simulator/application: */
70 void *dir; /* actually a DIR* dir */ 70 void *dir; /* actually a DIR* dir */
71 char *name; 71 char *name;
72#endif 72#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 {
36 struct dircache_entry *first; 36 struct dircache_entry *first;
37 struct dircache_entry *ce; 37 struct dircache_entry *ce;
38 struct dircache_entry *down_entry; 38 struct dircache_entry *down_entry;
39#ifdef SIMULATOR 39#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
40 DIR_UNCACHED *dir, *newdir; 40 DIR_UNCACHED *dir, *newdir;
41 struct dirent_uncached *entry; 41 struct dirent_uncached *entry;
42#else 42#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 @@
26#define MAX_PATH 260 26#define MAX_PATH 260
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include "config.h"
29#include "_ansi.h" 30#include "_ansi.h"
30 31
31#define MAX_OPEN_FILES 11 32#define MAX_OPEN_FILES 11
@@ -49,7 +50,7 @@
49#define O_TRUNC 0x10 50#define O_TRUNC 0x10
50#endif 51#endif
51 52
52#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC) 53#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && !defined(PLUGIN) && !defined(CODEC)
53#define open(x, ...) sim_open(x, __VA_ARGS__) 54#define open(x, ...) sim_open(x, __VA_ARGS__)
54#define creat(x,m) sim_creat(x,m) 55#define creat(x,m) sim_creat(x,m)
55#define remove(x) sim_remove(x) 56#define remove(x) sim_remove(x)
@@ -78,7 +79,7 @@ extern int fsync(int fd);
78extern ssize_t read(int fd, void *buf, size_t count); 79extern ssize_t read(int fd, void *buf, size_t count);
79extern off_t lseek(int fildes, off_t offset, int whence); 80extern off_t lseek(int fildes, off_t offset, int whence);
80extern int file_creat(const char *pathname); 81extern int file_creat(const char *pathname);
81#ifndef SIMULATOR 82#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
82/* posix compatibility function */ 83/* posix compatibility function */
83static inline int creat(const char *pathname, mode_t mode) 84static inline int creat(const char *pathname, mode_t mode)
84{ 85{
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, ...)
208 208
209 va_start(ap, fmt); 209 va_start(ap, fmt);
210 210
211#ifdef SIMULATOR 211#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
212 char buf[1024]; 212 char buf[1024];
213 vsnprintf(buf, sizeof buf, fmt, ap); 213 vsnprintf(buf, sizeof buf, fmt, ap);
214 DEBUGF("%s\n", buf); 214 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, ...)
41{ 41{
42 va_list ap; 42 va_list ap;
43 43
44#ifndef SIMULATOR 44#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
45 /* Disable interrupts */ 45 /* Disable interrupts */
46#ifdef CPU_ARM 46#ifdef CPU_ARM
47 disable_interrupt(IRQ_FIQ_STATUS); 47 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 @@
44#endif 44#endif
45#include "logf.h" 45#include "logf.h"
46#include "lcd-remote.h" 46#include "lcd-remote.h"
47#ifdef SIMULATOR 47#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
48#include <time.h> 48#include <time.h>
49#endif 49#endif
50 50
@@ -73,7 +73,7 @@ enum charge_state_type charge_state = DISCHARGING;
73#endif 73#endif
74#endif /* CONFIG_CHARGING */ 74#endif /* CONFIG_CHARGING */
75 75
76#ifndef SIMULATOR 76#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
77static int shutdown_timeout = 0; 77static int shutdown_timeout = 0;
78/* 78/*
79 * Average battery voltage and charger voltage, filtered via a digital 79 * Average battery voltage and charger voltage, filtered via a digital
@@ -830,7 +830,7 @@ void cancel_shutdown(void)
830 830
831 shutdown_timeout = 0; 831 shutdown_timeout = 0;
832} 832}
833#endif /* SIMULATOR */ 833#endif /* PLATFORM_NATIVE */
834 834
835/* Send system battery level update events on reaching certain significant 835/* Send system battery level update events on reaching certain significant
836 levels. This must be called after battery_percent has been updated. */ 836 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)
242 usb_wait_for_disconnect(&scroll_queue); 242 usb_wait_for_disconnect(&scroll_queue);
243 sync_display_ticks(); 243 sync_display_ticks();
244 return true; 244 return true;
245#ifndef SIMULATOR 245#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
246 case SYS_REMOTE_PLUGGED: 246 case SYS_REMOTE_PLUGGED:
247 if (!remote_initialized) 247 if (!remote_initialized)
248 sync_display_ticks(); 248 sync_display_ticks();
@@ -280,7 +280,7 @@ static void scroll_thread(void)
280 delay = current_tick; 280 delay = current_tick;
281 281
282 if ( 282 if (
283#ifndef SIMULATOR 283#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
284 !remote_initialized || 284 !remote_initialized ||
285#endif 285#endif
286 (tick_remote = lcd_remote_scroll_info.last_scroll + 286 (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 @@
27#include "system.h" 27#include "system.h"
28#include "i2c.h" 28#include "i2c.h"
29#include "mas.h" 29#include "mas.h"
30#ifndef SIMULATOR 30#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
31#if CONFIG_CPU == PNX0101 31#if CONFIG_CPU == PNX0101
32#include "pnx0101.h" 32#include "pnx0101.h"
33#endif 33#endif
@@ -257,7 +257,7 @@ static void set_prescaled_volume(void)
257 dsp_callback(DSP_CALLBACK_SET_SW_VOLUME, 0); 257 dsp_callback(DSP_CALLBACK_SET_SW_VOLUME, 0);
258#endif 258#endif
259 259
260#ifndef SIMULATOR 260#ifndef HAVE_SDL_AUDIO
261#if CONFIG_CODEC == MAS3507D 261#if CONFIG_CODEC == MAS3507D
262 dac_volume(tenthdb2reg(l), tenthdb2reg(r), false); 262 dac_volume(tenthdb2reg(l), tenthdb2reg(r), false);
263#elif defined(HAVE_UDA1380) || defined(HAVE_WM8975) || defined(HAVE_WM8758) \ 263#elif defined(HAVE_UDA1380) || defined(HAVE_WM8975) || defined(HAVE_WM8758) \
@@ -276,9 +276,9 @@ static void set_prescaled_volume(void)
276#elif defined(HAVE_JZ4740_CODEC) || defined(HAVE_SDL_AUDIO) 276#elif defined(HAVE_JZ4740_CODEC) || defined(HAVE_SDL_AUDIO)
277 audiohw_set_volume(current_volume); 277 audiohw_set_volume(current_volume);
278#endif 278#endif
279#else /* SIMULATOR */ 279#else /* HAVE_SDL_AUDIO */
280 audiohw_set_volume(current_volume); 280 audiohw_set_volume(current_volume);
281#endif /* !SIMULATOR */ 281#endif /* !HAVE_SDL_AUDIO */
282} 282}
283#endif /* (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 */ 283#endif /* (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 */
284 284
@@ -714,7 +714,7 @@ void sound_set(int setting, int value)
714 && !defined(HAVE_WM8758) && !defined(HAVE_TSC2100) \ 714 && !defined(HAVE_WM8758) && !defined(HAVE_TSC2100) \
715 && !defined (HAVE_WM8711) && !defined (HAVE_WM8721) \ 715 && !defined (HAVE_WM8711) && !defined (HAVE_WM8721) \
716 && !defined (HAVE_WM8731) && !defined (HAVE_WM8978) \ 716 && !defined (HAVE_WM8731) && !defined (HAVE_WM8978) \
717 && !defined(HAVE_AK4537)) || defined(SIMULATOR) 717 && !defined(HAVE_AK4537)) || (CONFIG_PLATFORM & PLATFORM_HOSTED)
718int sound_val2phys(int setting, int value) 718int sound_val2phys(int setting, int value)
719{ 719{
720#if CONFIG_CODEC == MAS3587F 720#if CONFIG_CODEC == MAS3587F
@@ -820,7 +820,7 @@ int sound_val2phys(int setting, int value)
820 return value; 820 return value;
821#endif 821#endif
822} 822}
823#endif /* !defined(HAVE_AS3514) || defined(SIMULATOR) */ 823#endif /* CONFIG_CODECs || PLATFORM_HOSTED */
824 824
825#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 825#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
826/* This function works by telling the decoder that we have another 826/* 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 @@
26#include "string.h" 26#include "string.h"
27#include "file.h" 27#include "file.h"
28 28
29#ifndef SIMULATOR 29#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
30long cpu_frequency SHAREDBSS_ATTR = CPU_FREQ; 30long cpu_frequency SHAREDBSS_ATTR = CPU_FREQ;
31#endif 31#endif
32 32