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
This commit is contained in:
Thomas Martitz 2010-06-21 16:53:00 +00:00
parent 02e04585bd
commit 35e8b1429a
81 changed files with 233 additions and 209 deletions

View File

@ -42,7 +42,7 @@
#endif
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef AUDIO_CPU_BOOST
static void audio_cpu_boost(bool state)
@ -115,7 +115,7 @@ int audio_get_spdif_sample_rate(void)
} /* audio_get_spdif_sample_rate */
#endif /* HAVE_SPDIF_IN */
#else /* SIMULATOR */
#else /* PLATFORM_HOSTED */
/** Sim stubs **/
@ -153,4 +153,4 @@ int audio_get_spdif_sample_rate(void)
} /* audio_get_spdif_sample_rate */
#endif /* HAVE_SPDIF_IN */
#endif /* !SIMULATOR */
#endif /* PLATFORM_NATIVE */

View File

@ -1,3 +1,3 @@
#if defined(SIMULATOR) && defined(__APPLE__)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx_dummy.bmp
#endif

View File

@ -1,3 +1,3 @@
#if defined(SIMULATOR) && defined(__APPLE__)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx_remote_dummy.bmp
#endif

View File

@ -1488,7 +1488,7 @@ void buffering_thread(void)
base_handle_id = (int)ev.data;
break;
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_USB_CONNECTED:
LOGFQUEUE("buffering < SYS_USB_CONNECTED");
usb_acknowledge(SYS_USB_CONNECTED_ACK);

View File

@ -54,20 +54,20 @@
#define LOGF_ENABLE
#include "logf.h"
#ifdef SIMULATOR
#define PREFIX(_x_) sim_ ## _x_
#else
#define PREFIX
#endif
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#ifdef SIMULATOR
#define PREFIX(_x_) sim_ ## _x_
#if CONFIG_CODEC == SWCODEC
unsigned char codecbuf[CODEC_SIZE];
#endif
void *sim_codec_load_ram(char* codecptr, int size, void **pd);
void sim_codec_close(void *pd);
#else
#else /* !PLATFORM_HOSTED */
#define PREFIX
#define sim_codec_close(x)
#endif
size_t codec_size;
@ -77,7 +77,7 @@ extern void* plugin_get_audio_buffer(size_t *buffer_size);
#undef open
static int open(const char* pathname, int flags, ...)
{
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
int fd;
if (flags & O_CREAT)
{
@ -201,7 +201,7 @@ static int codec_load_ram(int size, struct codec_api *api)
{
struct codec_header *hdr;
int status;
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
hdr = (struct codec_header *)codecbuf;
if (size <= (signed)sizeof(struct codec_header)
@ -220,7 +220,7 @@ static int codec_load_ram(int size, struct codec_api *api)
codec_size = hdr->end_addr - codecbuf;
#else /* SIMULATOR */
#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
void *pd;
hdr = sim_codec_load_ram(codecbuf, size, &pd);
@ -241,7 +241,7 @@ static int codec_load_ram(int size, struct codec_api *api)
codec_size = codecbuf - codecbuf;
#endif /* SIMULATOR */
#endif /* CONFIG_PLATFORM */
if (hdr->api_version > CODEC_API_VERSION
|| hdr->api_version < CODEC_MIN_API_VERSION) {
sim_codec_close(pd);

View File

@ -254,7 +254,7 @@ extern unsigned char codecbuf[];
extern size_t codec_size;
#ifdef CODEC
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* plugin_* is correct, codecs use the plugin linker script */
extern unsigned char plugin_start_addr[];
extern unsigned char plugin_end_addr[];

View File

@ -36,7 +36,7 @@ extern enum codec_status codec_main(void);
enum codec_status codec_start(void)
{
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef USE_IRAM
ci->memcpy(iramstart, iramcopy, iramend - iramstart);
ci->memset(iedata, 0, iend - iedata);

View File

@ -24,6 +24,6 @@ setjmp_cf.S
setjmp_mips.S
#endif
#elif defined(SIMULATOR) && defined(__APPLE__)
#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx.dummy.c
#endif

View File

@ -104,6 +104,7 @@
#include <sys/mman.h>
#endif
#include "config.h"
#include "tlsf.h"
#if !defined(__GNUC__)
@ -164,7 +165,8 @@
#define PAGE_SIZE (getpagesize())
#endif
#if defined(ROCKBOX) && defined(SIMULATOR) || !defined(ROCKBOX)
#if defined(ROCKBOX) && (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(DEBUG) \
|| !defined(ROCKBOX)
int printf(const char* fmt, ...);
#define PRINT_MSG(fmt, args...) printf(fmt, ## args)
#define ERROR_MSG(fmt, args...) printf(fmt, ## args)

View File

@ -37,10 +37,8 @@
#include "m4a.h"
#if defined(DEBUG) || defined(SIMULATOR)
#ifdef DEBUGF
#undef DEBUGF
#endif
#if defined(DEBUG)
#define DEBUGF qtmovie->stream->ci->debugf
#else
#define DEBUGF(...)

View File

@ -51,7 +51,7 @@
/* TGB is the only target fast enough for gaussian and realtime BRR decode */
/* echo is almost fast enough but not quite */
#if defined(TOSHIBA_GIGABEAT_F) || defined(TOSHIBA_GIGABEAT_S) ||\
defined(SIMULATOR) || MEMORYSIZE <= 2
(CONFIG_PLATFORM & PLATFORM_HOSTED) || MEMORYSIZE <= 2
/* Don't cache BRR waves */
#define SPC_BRRCACHE 0

View File

@ -1,3 +1,4 @@
#ifndef SIMULATOR
#include "config.h"
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "libc/ctype.c"
#endif

View File

@ -53,7 +53,7 @@
#include "lcd-remote.h"
#include "crc32.h"
#include "logf.h"
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "disk.h"
#include "adc.h"
#include "power.h"
@ -276,7 +276,7 @@ static unsigned int ticks, boost_ticks, freq_sum;
static void dbg_audio_task(void)
{
#ifndef SIMULATOR
#ifdef CPUFREQ_NORMAL
if(FREQ > CPUFREQ_NORMAL)
boost_ticks++;
freq_sum += FREQ/1000000; /* in MHz */
@ -371,7 +371,7 @@ static bool dbg_buffering_thread(void)
screens[i].putsf(0, line++, "handle count: %d", (int)d.num_handles);
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
screens[i].putsf(0, line++, "cpu freq: %3dMHz",
(int)((FREQ + 500000) / 1000000));
#endif
@ -758,7 +758,7 @@ static bool dbg_hw_info(void)
#endif /* !HAVE_LCD_BITMAP */
#endif /* !SIMULATOR */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
static const char* dbg_partitions_getname(int selected_item, void *data,
char *buffer, size_t buffer_len)
{
@ -786,7 +786,7 @@ bool dbg_partitions(void)
info.get_name = dbg_partitions_getname;
return simplelist_show_list(&info);
}
#endif
#endif /* PLATFORM_NATIVE */
#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
static bool dbg_spdif(void)
@ -928,7 +928,7 @@ static bool dbg_spdif(void)
lcd_putsf(0, line++, "Clock accuracy: %d", x);
line++;
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
lcd_putsf(0, line++, "Measured freq: %ldHz",
spdif_measure_frequency());
#endif
@ -950,7 +950,7 @@ static bool dbg_spdif(void)
}
#endif /* CPU_COLDFIRE */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef HAVE_LCD_BITMAP
/* button definitions */
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
@ -1334,9 +1334,9 @@ bool dbg_ports(void)
return false;
}
#endif /* !HAVE_LCD_BITMAP */
#endif /* !SIMULATOR */
#endif /* PLATFORM_NATIVE */
#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
static bool dbg_pcf(void)
{
int line;
@ -1423,7 +1423,7 @@ static bool dbg_cpufreq(void)
}
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
#if defined(HAVE_TSC2100) && !defined(SIMULATOR)
#if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "tsc2100.h"
static char *itob(int n, int len)
{
@ -1493,7 +1493,7 @@ static bool tsc2100_debug(void)
return simplelist_show_list(&info);
}
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef HAVE_LCD_BITMAP
/*
* view_battery() shows a automatically scaled graph of the battery voltage
@ -1785,7 +1785,7 @@ static bool view_battery(void)
#endif /* HAVE_LCD_BITMAP */
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
#if (CONFIG_STORAGE & STORAGE_MMC)
@ -2106,7 +2106,7 @@ static bool dbg_disk_info(void)
info.scroll_all = true;
return simplelist_show_list(&info);
}
#endif /* !SIMULATOR */
#endif /* PLATFORM_NATIVE */
#ifdef HAVE_DIRCACHE
static int dircache_callback(int btn, struct gui_synclist *lists)
@ -2672,10 +2672,10 @@ static const struct the_menu_item menuitems[] = {
|| CONFIG_CPU == DM320 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2
{ "View I/O ports", dbg_ports },
#endif
#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "View PCF registers", dbg_pcf },
#endif
#if defined(HAVE_TSC2100) && !defined(SIMULATOR)
#if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "TSC2100 debug", tsc2100_debug },
#endif
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@ -2689,18 +2689,18 @@ static const struct the_menu_item menuitems[] = {
#endif
{ "View OS stacks", dbg_os },
#ifdef HAVE_LCD_BITMAP
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "View battery", view_battery },
#endif
{ "Screendump", dbg_screendump },
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "View HW info", dbg_hw_info },
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "View partitions", dbg_partitions },
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
{ "View disk info", dbg_disk_info },
#if (CONFIG_STORAGE & STORAGE_ATA)
{ "Dump ATA identify info", dbg_identify_info},

View File

@ -597,7 +597,7 @@ int ft_enter(struct tree_context* c)
break;
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* firmware file */
case FILE_ATTR_MOD:
splash(0, ID2P(LANG_WAIT));

View File

@ -115,6 +115,8 @@
#ifdef SIMULATOR
#include "sim_tasks.h"
#endif
#ifdef HAVE_SDL
#include "system-sdl.h"
#endif
@ -313,7 +315,7 @@ static void init_tagcache(void)
}
#endif
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
static void init(void)
{

View File

@ -347,7 +347,7 @@ static int info_action_callback(int action, struct gui_synclist *lists)
#endif
)
{
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
struct info_data *info = (struct info_data *)lists->data;
int i;
info->new_data = true;

View File

@ -251,7 +251,7 @@ static void system_restore(void)
static bool clean_shutdown(void (*callback)(void *), void *parameter)
{
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
(void)callback;
(void)parameter;
bookmark_autobookmark(false);

View File

@ -30,7 +30,7 @@
/* Define LOGF_ENABLE to enable logf output in this file */
/*#define LOGF_ENABLE*/
#include "logf.h"
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "cpu.h"
#endif
#include <string.h>

View File

@ -468,7 +468,7 @@ unsigned char *audio_get_recording_buffer(size_t *buffer_size)
bool audio_load_encoder(int afmt)
{
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
const char *enc_fn = get_codec_filename(afmt | CODEC_TYPE_ENCODER);
if (!enc_fn)
return false;
@ -493,7 +493,7 @@ bool audio_load_encoder(int afmt)
void audio_remove_encoder(void)
{
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* force encoder codec unload (if currently loaded) */
if (ci.enc_codec_loaded <= 0)
return;
@ -2008,7 +2008,7 @@ static void audio_thread(void)
LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED");
audio_finalise_track_change();
break;
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_USB_CONNECTED:
LOGFQUEUE("audio < SYS_USB_CONNECTED");
if (playing)

View File

@ -1318,7 +1318,7 @@ static void playlist_thread(void)
dirty_pointers = false;
break ;
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_USB_CONNECTED:
usb_acknowledge(SYS_USB_CONNECTED_ACK);
usb_wait_for_disconnect(&playlist_queue);

View File

@ -57,7 +57,7 @@
#include "usbstack/usb_hid.h"
#endif
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define PREFIX(_x_) sim_ ## _x_
#else
#define PREFIX
@ -72,7 +72,7 @@
static unsigned int open_files;
#endif
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
void *sim_plugin_load(char *plugin, void **pd);
void sim_plugin_close(void *pd);
@ -157,7 +157,7 @@ static const struct plugin_api rockbox_api = {
lcd_yuv_set_options,
#endif
#endif /* MEMORYSIZE > 2 */
#elif (LCD_DEPTH < 4) && !defined(SIMULATOR)
#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
lcd_blit_mono,
lcd_blit_grey_phase,
#endif /* LCD_DEPTH */
@ -366,7 +366,7 @@ static const struct plugin_api rockbox_api = {
#endif
reset_poweroff_timer,
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
system_memory_guard,
&cpu_frequency,
@ -377,7 +377,7 @@ static const struct plugin_api rockbox_api = {
cpu_boost,
#endif
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
#endif /* !SIMULATOR */
#endif /* PLATFORM_NATIVE */
#ifdef HAVE_SCHEDULER_BOOSTCTRL
trigger_cpu_boost,
cancel_cpu_boost,
@ -415,7 +415,7 @@ static const struct plugin_api rockbox_api = {
remove_event,
send_event,
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
/* special simulator hooks */
#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
sim_lcd_ex_init,
@ -437,7 +437,7 @@ static const struct plugin_api rockbox_api = {
memset,
memcpy,
memmove,
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
_ctype_,
#endif
atoi,
@ -467,7 +467,7 @@ static const struct plugin_api rockbox_api = {
#ifdef AUDIOHW_HAVE_EQ
sound_enum_hw_eq_band_setting,
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
mp3_play_data,
mp3_play_pause,
mp3_play_stop,
@ -589,7 +589,7 @@ static const struct plugin_api rockbox_api = {
battery_level,
battery_level_safe,
battery_time,
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
battery_voltage,
#endif
#if CONFIG_CHARGING
@ -603,7 +603,7 @@ static const struct plugin_api rockbox_api = {
#endif
/* misc */
#if !defined(SIMULATOR)
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
&errno,
#endif
srand,
@ -727,15 +727,15 @@ int plugin_load(const char* plugin, const void* parameter)
{
int rc, i;
struct plugin_header *hdr;
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
void *pd;
#else /* !SIMULATOR */
#else /* PLATFOR_NATIVE */
int fd;
ssize_t readsize;
#if NUM_CORES > 1
unsigned my_core;
#endif
#endif /* !SIMULATOR */
#endif /* CONFIG_PLATFORM */
#if LCD_DEPTH > 1
fb_data* old_backdrop;
@ -755,7 +755,7 @@ int plugin_load(const char* plugin, const void* parameter)
splash(0, ID2P(LANG_WAIT));
strcpy(current_plugin, plugin);
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
hdr = sim_plugin_load((char *)plugin, &pd);
if (pd == NULL) {
splashf(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin);
@ -990,7 +990,7 @@ static int open_wrapper(const char* pathname, int flags, ...)
/* we don't have an 'open' function. it's a define. and we need
* the real file_open, hence PREFIX() doesn't work here */
int fd;
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
if (flags & O_CREAT)
{
va_list ap;

View File

@ -233,7 +233,7 @@ struct plugin_api {
void (*lcd_yuv_set_options)(unsigned options);
#endif
#endif /* MEMORYSIZE > 2 */
#elif (LCD_DEPTH < 4) && !defined(SIMULATOR)
#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
void (*lcd_blit_mono)(const unsigned char *data, int x, int by, int width,
int bheight, int stride);
void (*lcd_blit_grey_phase)(unsigned char *values, unsigned char *phases,
@ -474,7 +474,7 @@ struct plugin_api {
#endif
void (*reset_poweroff_timer)(void);
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int (*system_memory_guard)(int newmode);
long *cpu_frequency;
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@ -484,7 +484,7 @@ struct plugin_api {
void (*cpu_boost)(bool on_off);
#endif
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
#endif /* !SIMULATOR */
#endif /* PLATFORM_NATIVE */
#ifdef HAVE_SCHEDULER_BOOSTCTRL
void (*trigger_cpu_boost)(void);
void (*cancel_cpu_boost)(void);
@ -530,7 +530,7 @@ struct plugin_api {
void (*remove_event)(unsigned short id, void (*handler)(void *data));
void (*send_event)(unsigned short id, void *data);
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
/* special simulator hooks */
#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
void (*sim_lcd_ex_init)(unsigned long (*getpixel)(int, int));
@ -553,7 +553,7 @@ struct plugin_api {
void* (*memset)(void *dst, int c, size_t length);
void* (*memcpy)(void *out, const void *in, size_t n);
void* (*memmove)(void *out, const void *in, size_t n);
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
const unsigned char *_rbctype_;
#endif
int (*atoi)(const char *str);
@ -584,7 +584,7 @@ struct plugin_api {
int (*sound_enum_hw_eq_band_setting)(unsigned int band,
unsigned int band_setting);
#endif /* AUDIOHW_HAVE_EQ */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
void (*mp3_play_data)(const unsigned char* start, int size,
void (*get_more)(unsigned char** start, size_t* size));
void (*mp3_play_pause)(bool play);
@ -593,7 +593,7 @@ struct plugin_api {
#if CONFIG_CODEC != SWCODEC
void (*bitswap)(unsigned char *data, int length);
#endif
#endif /* !SIMULATOR */
#endif /* PLATFORM_NATIVE */
#if CONFIG_CODEC == SWCODEC
const unsigned long *audio_master_sampr_list;
const unsigned long *hw_freq_sampr;
@ -731,7 +731,7 @@ struct plugin_api {
int (*battery_level)(void);
bool (*battery_level_safe)(void);
int (*battery_time)(void);
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
unsigned int (*battery_voltage)(void);
#endif
#if CONFIG_CHARGING
@ -745,7 +745,7 @@ struct plugin_api {
#endif
/* misc */
#if !defined(SIMULATOR)
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int* __errno;
#endif
void (*srand)(unsigned int seed);
@ -902,7 +902,7 @@ struct plugin_header {
};
#ifdef PLUGIN
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
extern unsigned char plugin_start_addr[];
extern unsigned char plugin_end_addr[];
#define PLUGIN_HEADER \
@ -911,14 +911,14 @@ extern unsigned char plugin_end_addr[];
__attribute__ ((section (".header")))= { \
PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
plugin_start_addr, plugin_end_addr, plugin_start, &rb };
#else /* SIMULATOR */
#else /* PLATFORM_HOSTED */
#define PLUGIN_HEADER \
const struct plugin_api *rb DATA_ATTR; \
const struct plugin_header __header \
__attribute__((visibility("default"))) = { \
PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
NULL, NULL, plugin_start, &rb };
#endif /* SIMULATOR */
#endif /* CONFIG_PLATFORM */
#ifdef PLUGIN_USE_IRAM
/* Declare IRAM variables */

View File

@ -4,6 +4,6 @@
* they will grep for "YES" to see if overlay plugins must be built
*/
#if PLUGIN_BUFFER_SIZE <= 0x20000 && !defined(SIMULATOR)
#if PLUGIN_BUFFER_SIZE <= 0x20000 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
YES
#endif

View File

@ -65,7 +65,7 @@ iriverify.c
#ifndef SIMULATOR /* those plugins only run on hardware */
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) /* those plugins only run on hardware */
/* Overlays loaders */
#if PLUGIN_BUFFER_SIZE <= 0x20000 && defined(HAVE_LCD_BITMAP)
@ -132,7 +132,7 @@ wavplay.c
wavrecord.c
#endif
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */

View File

@ -125,7 +125,7 @@ PLUGIN_IRAM_DECLARE
#undef SYNC
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define SYNC
#endif

View File

@ -61,6 +61,6 @@ superdom_boarditems.160x128x1.bmp
#endif
#endif /* HAVE_LCD_BITMAP */
#if defined(SIMULATOR) && defined(__APPLE__)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx.dummy.bmp
#endif

View File

@ -1,3 +1,3 @@
#if defined(SIMULATOR) && defined(__APPLE__)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx.dummy.bmp
#endif

View File

@ -1,4 +1,4 @@
#if defined(SIMULATOR) && defined(__APPLE__)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx.dummy.bmp
#endif

View File

@ -1185,7 +1185,7 @@ static byte chip8_keymap[16];
static unsigned long starttimer; /* Timer value at the beginning */
static unsigned long cycles; /* Number of update cycles (50Hz) */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
static bool is_playing;
/* one frame of bitswapped mp3 data */
@ -1208,14 +1208,14 @@ static void callback(unsigned char** start, size_t* size)
*start = beep; /* give it the same frame again */
*size = sizeof(beep);
}
#endif /* !SIMULATOR */
#endif /* PLATFORM_NATIVE */
/****************************************************************************/
/* Turn sound on */
/****************************************************************************/
static void chip8_sound_on (void)
{
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
if (!is_playing)
rb->mp3_play_pause(true); /* kickoff audio */
#endif
@ -1226,7 +1226,7 @@ static void chip8_sound_on (void)
/****************************************************************************/
static void chip8_sound_off (void)
{
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
if (!is_playing)
rb->mp3_play_pause(false); /* pause audio */
#endif
@ -1266,7 +1266,7 @@ static void chip8_update_display(void)
*row++ = w;
}
}
#if defined(SIMULATOR) || (LCD_DEPTH > 1)
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || (LCD_DEPTH > 1)
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_mono_bitmap(lcd_framebuf[0], CHIP8_X, CHIP8_Y, CHIP8_LCDWIDTH,
CHIP8_HEIGHT);
@ -1428,7 +1428,7 @@ static bool chip8_run(const char* file)
#endif
rb->lcd_update();
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* init sound */
is_playing = rb->mp3_is_playing(); /* would we disturb playback? */
if (!is_playing) /* no? then we can make sound */
@ -1442,7 +1442,7 @@ static bool chip8_run(const char* file)
cycles = 0;
chip8();
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
if (!is_playing)
{ /* stop it if we used audio */
rb->mp3_play_stop(); /* Stop audio playback */

View File

@ -62,7 +62,7 @@ int fileexists(const char * fname)
return -1;
}
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int my_open(const char *file, int flags, ...)
{
if(fpoint==8)
@ -111,7 +111,7 @@ int my_close(int id)
bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
// Here is a hacked up printf command to get the output from the game.
int printf(const char *fmt, ...)
{
@ -751,7 +751,7 @@ enum plugin_status plugin_start(const void* parameter)
printf("There were still: %d files open\n", fpoint);
while(fpoint>0)
{
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
close(filearray[fpoint]);
#else
rb->close(filearray[fpoint]);

View File

@ -42,7 +42,7 @@ char *my_strtok( char * s, const char * delim );
#undef read_line
#define read_line(a,b,c) rb->read_line((a),(b),(c))
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define open(a, ...) rb->open((a), __VA_ARGS__)
#define close(a) rb->close((a))
#else

View File

@ -20,7 +20,7 @@
****************************************************************************/
#include "plugin.h"
#if PLUGIN_BUFFER_SIZE < 0x10000 && !defined(SIMULATOR)
#if PLUGIN_BUFFER_SIZE < 0x10000 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "lib/overlay.h"

View File

@ -386,7 +386,7 @@
#define PLUGIN_ABORT 11
#define PLUGIN_OUTOFMEM 12
#if !defined(SIMULATOR) && defined(HAVE_DISK_STORAGE)
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && defined(HAVE_DISK_STORAGE)
#define DISK_SPINDOWN
#endif
#if PLUGIN_BUFFER_SIZE >= MIN_MEM

View File

@ -28,7 +28,7 @@ grey_sh.S
#endif /* HAVE_LCD_BITMAP && LCD_DEPTH < 4 */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
overlay.c
#endif
@ -76,7 +76,7 @@ pluginlib_albumart.c
pluginlib_touchscreen.c
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef CPU_ARM
../../codecs/lib/setjmp_arm.S
@ -90,4 +90,4 @@ pluginlib_touchscreen.c
../../codecs/lib/setjmp_mips.S
#endif
#endif /* !SIMULATOR */
#endif /* PLATFORM_NATIVE */

View File

@ -23,7 +23,7 @@
#define __PLUGINLIB_EXIT_H__
#include "config.h"
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "../../codecs/lib/setjmp.h"
#else
#include <setjmp.h>

View File

@ -24,7 +24,7 @@
#define _ROCKCONF_H_ /* Protect against unwanted include */
#include "lua.h"
#if !defined(SIMULATOR)
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int errno = 0;
#endif

View File

@ -31,7 +31,7 @@
#undef LUA_PATH_DEFAULT
#define LUA_PATH_DEFAULT "$/?.lua;" "$/?/init.lua;" VIEWERS_DIR"/lua/?.lua;" VIEWERS_DIR"/lua/?/init.lua;"
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#include "../../codecs/lib/setjmp.h"
#else
#include <setjmp.h>

View File

@ -26,7 +26,7 @@
#include <ctype.h>
#include "plugin.h"
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#include <errno.h>
#define PREFIX(_x_) sim_ ## _x_
#else

View File

@ -39,6 +39,8 @@
improved to increase MAX_VOICES for targets that can do 22kHz */
#ifdef CPU_PP
#define MAX_VOICES 16
#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define MAX_VOICES 48
#else
#define MAX_VOICES 24 /* Note: 24 midi channels is the minimum general midi spec implementation */
#endif /* CPU_PP */

View File

@ -28,7 +28,7 @@
#include "arcade.h"
#include "hardware.h"
#if defined(SIMULATOR) || !defined(IRIVER_H300_SERIES)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) || !defined(IRIVER_H300_SERIES)
void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf)
{

View File

@ -403,7 +403,7 @@ enum plugin_status plugin_start(const void* parameter)
= rb->plugin_get_audio_buffer(&audio_buffer_free);
plugbuf=false;
}
#if MEM <= 8 && !defined(SIMULATOR)
#if MEM <= 8 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* loaded as an overlay plugin, protect from overwriting ourselves */
if ((unsigned)(plugin_start_addr - (unsigned char *)audio_bufferbase)
< audio_buffer_free)

View File

@ -697,7 +697,7 @@ static enum plugin_status test_track(const char* filename)
rb->snprintf(str,sizeof(str),"%d.%02d%% realtime",(int)speed/100,(int)speed%100);
log_text(str,true);
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* show effective clockrate in MHz needed for realtime decoding */
if (speed > 0)
{

View File

@ -114,7 +114,7 @@ static bool test_fs(void)
log_init();
log_text("test_disk WRITE&VERIFY", true);
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
rb->snprintf(text_buf, sizeof(text_buf), "CPU clock: %ld Hz",
*rb->cpu_frequency);
log_text(text_buf, true);
@ -304,7 +304,7 @@ static bool test_speed(void)
rb->memset(audiobuf, 'T', audiobuflen);
log_init();
log_text("test_disk SPEED TEST", true);
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
rb->snprintf(text_buf, sizeof(text_buf), "CPU clock: %ld Hz",
*rb->cpu_frequency);
log_text(text_buf, true);

View File

@ -340,7 +340,7 @@ static void time_greyscale(void)
/* plugin entry point */
enum plugin_status plugin_start(const void* parameter)
{
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
char str[32];
int cpu_freq;
#endif
@ -350,7 +350,7 @@ enum plugin_status plugin_start(const void* parameter)
(void)parameter;
log_init();
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */
#endif
backlight_force_on(); /* backlight control in lib/helper.c */
@ -370,7 +370,7 @@ enum plugin_status plugin_start(const void* parameter)
time_remote_update();
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
if (*rb->cpu_frequency != cpu_freq)
rb->snprintf(str, sizeof(str), "CPU clock changed!");
else

View File

@ -194,7 +194,7 @@ enum plugin_status plugin_start(const void* parameter)
rb->screens[0]->clear_display();
rb->screens[0]->putsf(0, line++, "%s", boost?"boosted":"unboosted");
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
rb->screens[0]->putsf(0, line++, "clock: %d Hz", *rb->cpu_frequency);
#endif
rb->screens[0]->putsf(0, line++, "loop#: %d", ++count);

View File

@ -420,10 +420,10 @@ int radio_screen(void)
bool have_recorded = false;
int timeout = current_tick + HZ/10;
unsigned int last_seconds = 0;
#ifndef SIMULATOR
#if !defined(SIMULATOR)
unsigned int seconds = 0;
struct audio_recording_options rec_options;
#endif
#endif /* SIMULATOR */
#endif /* CONFIG_CODEC != SWCODEC */
#ifndef HAVE_NOISY_IDLE_MODE
int button_timeout = current_tick + (2*HZ);

View File

@ -18,7 +18,7 @@
* KIND, either express or implied.
*
****************************************************************************/
#ifdef SIMULATOR
#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
#include <stdlib.h> /* sim uses rand for peakmeter simulation */
#endif
#include "config.h"
@ -538,7 +538,7 @@ void pm_reset_clipcount(void)
void peak_meter_playback(bool playback)
{
int i;
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
(void)playback;
#elif CONFIG_CODEC == SWCODEC
pm_playback = playback;
@ -595,7 +595,7 @@ void peak_meter_peek(void)
left = pm_cur_left;
right = pm_cur_right;
#else
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
pm_cur_left = left = mas_codec_readreg(pm_src_left);
pm_cur_right = right = mas_codec_readreg(pm_src_right);
#else

View File

@ -24,6 +24,7 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging
*/
#include <stdio.h>
#include <config.h>
#include "file.h"
#include "logf.h"
#include "metadata.h"
@ -70,7 +71,7 @@ static unsigned long timestamp;
#endif
/* Crude work-around for Archos Sims - return a set amount */
#if (CONFIG_CODEC != SWCODEC) && defined(SIMULATOR)
#if (CONFIG_CODEC != SWCODEC) && (CONFIG_PLATFORM & PLATFORM_HOSTED)
unsigned long audio_prev_elapsed(void)
{
return 120000;

View File

@ -837,7 +837,7 @@ void settings_apply(bool read_disk)
#ifdef HAVE_DISK_STORAGE
storage_spindown(global_settings.disk_spindown);
#endif
#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
#if (CONFIG_CODEC == MAS3507D) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
dac_line_in(global_settings.line_in);
#endif
set_poweroff_timeout(global_settings.poweroff);

View File

@ -45,7 +45,7 @@ void status_set_ffmode(enum playmode mode);
enum playmode status_get_ffmode(void);
int current_playmode(void);
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#include <time.h>
#endif
#ifdef HAVE_LCD_CHARCELLS

View File

@ -4442,7 +4442,7 @@ static void tagcache_thread(void)
case SYS_POWEROFF:
break ;
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_USB_CONNECTED:
logf("USB: TagCache");
usb_acknowledge(SYS_USB_CONNECTED_ACK);

View File

@ -10,7 +10,7 @@ usb.c
logf.c
#endif /* ROCKBOX_HAS_LOGF */
kernel.c
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef RB_PROFILE
profile.c
#endif /* RB_PROFILE */
@ -19,7 +19,7 @@ rolo.c
#endif /* !defined(BOOTLOADER) || defined(CPU_SH) */
thread.c
timer.c
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */
#ifdef HAVE_SDL
target/hosted/sdl/button-sdl.c
target/hosted/sdl/kernel-sdl.c
@ -40,13 +40,13 @@ panic.c
debug.c
/* Standard library */
#if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__)
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(__MINGW32__) || defined(__CYGWIN__)
libc/errno.c
libc/strtok.c
/* alsa on linux requires a more advanced sprintf, i.e. not ours */
libc/sprintf.c
#endif /* !SIMULATOR || __MINGW32__ || __CYGWIN__ */
#if !defined(SIMULATOR)
#endif /* PLATFORM_NATIVE || __MINGW32__ || __CYGWIN__ */
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
libc/atoi.c
libc/ctype.c
libc/memcmp.c
@ -70,11 +70,11 @@ common/crc32.c
#ifdef MI4_FORMAT
common/crc32-mi4.c
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
common/dir_uncached.c
common/file.c
common/disk.c
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */
#ifdef HAVE_DIRCACHE
common/dircache.c
#endif /* HAVE_DIRCACHE */
@ -143,21 +143,21 @@ backlight-sw-fading.c
/* Misc. */
drivers/led.c
drivers/button.c
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef HAVE_DAC3550A
drivers/dac.c
#endif
#ifdef HAVE_SERIAL
drivers/serial.c
#endif
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */
#ifdef HAVE_TOUCHSCREEN
drivers/touchscreen.c
#endif
/* Storage */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#if (CONFIG_STORAGE & STORAGE_MMC)
drivers/ata_mmc.c
#endif
@ -184,7 +184,7 @@ drivers/fat.c
#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
sdmmc.c
#endif
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */
/* EEPROM */
#ifdef HAVE_EEPROM
@ -195,7 +195,7 @@ eeprom_settings.c
#endif /* HAVE_EEPROM */
/* RTC */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#if (CONFIG_RTC == RTC_M41ST84W)
drivers/rtc/rtc_m41st84w.c
#elif (CONFIG_RTC == RTC_PCF50606)
@ -225,13 +225,13 @@ drivers/rtc/rtc_s35390a.c
#elif (CONFIG_RTC == RTC_D2)
drivers/rtc/rtc_d2.c
#endif /* (CONFIG_RTC == RTC_) */
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */
#ifndef BOOTLOADER
/* Tuner */
#if CONFIG_TUNER
tuner.c
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#if (CONFIG_TUNER & LV24020LP)
drivers/tuner/lv24020lp.c
#endif /* (CONFIG_TUNER & LV24020LP) */
@ -254,7 +254,7 @@ drivers/tuner/ipod_remote_tuner.c
#if (CONFIG_TUNER & RDA5802)
drivers/tuner/rda5802.c
#endif /* (CONFIG_TUNER & RDA5802) */
#endif /*SIMULATOR */
#endif /* PLATFORM_NATIVE */
#endif /* CONFIG_TUNER */
#endif /* BOOTLOADER */
@ -285,7 +285,7 @@ drivers/mas.c
#endif /* SWCODEC */
/* Audio codec */
#if !defined(SIMULATOR) && !defined(BOOTLOADER)
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER)
#if defined(HAVE_UDA1380)
drivers/audio/uda1380.c
#elif defined(HAVE_WM8751) \
@ -319,7 +319,7 @@ drivers/audio/sdl.c
#if CONFIG_CODEC == SWCODEC
target/hosted/sdl/pcm-sdl.c
#endif
#endif /* !defined(SIMULATOR) && !defined(BOOTLOADER) */
#endif /* (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER) */
/* USB Stack */
#if !defined(SIMULATOR)
@ -531,10 +531,10 @@ libc/memmove.c
libc/memset.c
common/memset16.c
libc/strlen.c
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
crt0.S
drivers/i2c.c
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */
#endif /* defined(CPU_*) */

View File

@ -40,6 +40,9 @@
#ifdef HAVE_REMOTE_LCD
#include "lcd-remote.h"
#endif
#if defined(HAVE_BACKLIGHT) && defined(BACKLIGHT_FULL_INIT)
#ifndef SIMULATOR
#include "backlight-target.h"
#else
@ -51,8 +54,6 @@
#include "backlight-sw-fading.h"
#endif
#if defined(HAVE_BACKLIGHT) && defined(BACKLIGHT_FULL_INIT)
#define BACKLIGHT_FADE_IN_THREAD \
(CONFIG_BACKLIGHT_FADING & (BACKLIGHT_FADING_SW_SETTING \
|BACKLIGHT_FADING_SW_HW_REG \

View File

@ -21,7 +21,7 @@
#include <stdio.h>
#include "buffer.h"
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
unsigned char audiobuffer[(MEM*1024-256)*1024];
unsigned char *audiobufend = audiobuffer + sizeof(audiobuffer);
#else

View File

@ -171,7 +171,7 @@ static bool check_event_queue(void)
return false;
}
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* scan and build static data (avoid redundancy on stack) */
static struct
{
@ -301,7 +301,7 @@ static int dircache_scan_and_build(IF_MV2(int volume,) struct dircache_entry *ce
return sab_process_dir(0, ce);
}
#else /* !SIMULATOR */
#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) /* PLATFORM_HOSTED */
static char sab_path[MAX_PATH];
static int sab_process_dir(struct dircache_entry *ce)
@ -400,7 +400,7 @@ static int dircache_scan_and_build(IF_MV2(int volume,) struct dircache_entry *ce
strlcpy(sab_path, "/", sizeof sab_path);
return sab_process_dir(ce);
}
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */
/**
* Internal function to get a pointer to dircache_entry for a given filename.
@ -689,7 +689,7 @@ static void dircache_thread(void)
dircache_initialized = false;
break ;
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_USB_CONNECTED:
usb_acknowledge(SYS_USB_CONNECTED_ACK);
usb_wait_for_disconnect(&dircache_queue);

View File

@ -33,7 +33,7 @@
#include "serial.h"
#include "power.h"
#include "powermgmt.h"
#ifdef SIMULATOR
#ifdef HAVE_SDL
#include "button-sdl.h"
#else
#include "button-target.h"
@ -215,7 +215,7 @@ static void button_tick(void)
/* Safety net for players without hardware
poweroff */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
if(repeat_count > POWEROFF_COUNT * 10)
power_off();
#endif
@ -440,7 +440,7 @@ static int button_flip(int button)
{
int newbutton = button;
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
newbutton &=
~(BUTTON_LEFT | BUTTON_RIGHT
#if defined(BUTTON_UP) && defined(BUTTON_DOWN)

View File

@ -43,7 +43,7 @@ enum {
DISK_EVENT_SPINUP = (EVENT_CLASS_DISK|1),
};
#define USING_STORAGE_CALLBACK !defined(SIMULATOR) \
#define USING_STORAGE_CALLBACK (CONFIG_PLATFORM & PLATFORM_NATIVE) \
&& ! ((CONFIG_STORAGE & STORAGE_NAND) \
&& (CONFIG_NAND == NAND_IFP7XX)) \
&& !defined(BOOTLOADER)

View File

@ -36,7 +36,7 @@
#endif /* CONFIG_CODEC == SWCODEC */
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define audio_play(x) sim_audio_play(x)
#endif

View File

@ -23,10 +23,10 @@
#include "config.h"
/* defined in linker script */
#ifdef SIMULATOR
extern unsigned char *audiobufend;
#else
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
extern unsigned char audiobufend[];
#else
extern unsigned char *audiobufend;
#endif
extern unsigned char *audiobuf;

View File

@ -74,6 +74,13 @@
#define AT91SAM9260 9260
#define AS3525v2 35252
/* platforms
* bit fields to allow PLATFORM_HOSTED to be OR'ed e.g. with a
* possible future PLATFORM_ANDROID (some OSes might need totally different
* handling to run on them than a stand-alone application) */
#define PLATFORM_NATIVE (1<<0)
#define PLATFORM_HOSTED (1<<1)
/* CONFIG_KEYPAD */
#define PLAYER_PAD 1
#define RECORDER_PAD 2
@ -497,6 +504,10 @@ Lyre prototype 1 */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING
#endif
#ifndef CONFIG_PLATFORM
#define CONFIG_PLATFORM PLATFORM_NATIVE
#endif
#ifndef CONFIG_TUNER
#define CONFIG_TUNER 0
#endif
@ -675,10 +686,10 @@ Lyre prototype 1 */
#define HAVE_EXTENDED_MESSAGING_AND_NAME
#define HAVE_WAKEUP_EXT_CB
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define HAVE_PRIORITY_SCHEDULING
#define HAVE_SCHEDULER_BOOSTCTRL
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */
#define HAVE_SEMAPHORE_OBJECTS
@ -744,7 +755,7 @@ Lyre prototype 1 */
#endif
/* IRAM usage */
#if !defined(SIMULATOR) && /* Not for simulators */ \
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && /* Not for hosted environments */ \
(((CONFIG_CPU == SH7034) && !defined(PLUGIN)) || /* SH1 archos: core only */ \
defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \
defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \
@ -780,9 +791,10 @@ Lyre prototype 1 */
#define IBSS_ATTR
#define STATICIRAM static
#endif
#if (defined(CPU_PP) || (CONFIG_CPU == AS3525) || (CONFIG_CPU == AS3525v2) || \
(CONFIG_CPU == IMX31L)) \
&& !defined(SIMULATOR) && !defined(BOOTLOADER)
&& (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER)
/* Functions that have INIT_ATTR attached are NOT guaranteed to survive after
* root_menu() has been called. Their code may be overwritten by other data or
* code in order to save RAM, and references to them might point into
@ -799,7 +811,7 @@ Lyre prototype 1 */
#define INIT_ATTR
#endif
#if defined(SIMULATOR) && defined(__APPLE__)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
#define DATA_ATTR __attribute__ ((section("__DATA, .data")))
#else
#define DATA_ATTR __attribute__ ((section(".data")))
@ -923,7 +935,7 @@ Lyre prototype 1 */
#else /* BOOTLOADER */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
//#define USB_ENABLE_SERIAL
#define USB_ENABLE_STORAGE
@ -941,11 +953,11 @@ Lyre prototype 1 */
/* This attribute can be used to enable to detection of plugin file handles leaks.
* When enabled, the plugin core will monitor open/close/creat and when the plugin exits
* will display an error message if the plugin leaked some file handles */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define HAVE_PLUGIN_CHECK_OPEN_CLOSE
#endif
#if defined(HAVE_DIRCACHE) && !defined(SIMULATOR)
#if defined(HAVE_DIRCACHE) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define HAVE_IO_PRIORITY
#endif

View File

@ -101,4 +101,5 @@
#define HAVE_SDL
#define HAVE_SDL_AUDIO
#define CONFIG_PLATFORM PLATFORM_HOSTED
#define _ISOC99_SOURCE 1

View File

@ -28,7 +28,7 @@
*/
#include "config.h"
#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
#if defined(HAVE_LCD_BITMAP) || (CONFIG_PLATFORM & PLATFORM_HOSTED)
#ifndef __PCTOOL__
#include "font_cache.h"
#include "sysfont.h"

View File

@ -24,7 +24,7 @@
#include <stdbool.h>
#include "config.h"
#if (CONFIG_CPU == SH7034) && !defined(SIMULATOR)
#if (CONFIG_CPU == SH7034) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define ROM_VERSION (*(short *)0x020000fe)
@ -49,7 +49,7 @@ static inline int tuner_detect_type(void)
}
#endif
#endif /* (CONFIG_CPU == SH7034) && !SIMULATOR */
#endif /* (CONFIG_CPU == SH7034) && (CONFIG_PLATFORM & PLATFORM_NATIVE) */
#ifdef ARCHOS_PLAYER
bool is_new_player(void);

View File

@ -201,7 +201,7 @@ static inline void call_tick_tasks(void)
}
#endif
#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && !defined(PLUGIN) && !defined(CODEC)
#define sleep(x) sim_sleep(x)
#endif

View File

@ -81,7 +81,7 @@ void ide_power_enable(bool on);
bool charging_state(void);
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
void power_init(void) INIT_ATTR;

View File

@ -74,7 +74,7 @@ extern unsigned int power_thread_inputs;
#include "powermgmt-target.h"
#endif
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* Generic current values that are intentionally meaningless - config header
* should define proper numbers.*/
@ -129,7 +129,7 @@ extern const unsigned short percent_to_volt_charge[11];
/* Start up power management thread */
void powermgmt_init(void) INIT_ATTR;
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */
/* Returns battery statust */
int battery_level(void); /* percent */

View File

@ -51,7 +51,7 @@ struct storage_info
char *revision;
};
#if !defined(SIMULATOR) && !defined(CONFIG_STORAGE_MULTI)
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(CONFIG_STORAGE_MULTI)
/* storage_spindown, storage_sleep and storage_spin are passed as
* pointers, which doesn't work with argument-macros.
*/
@ -185,7 +185,7 @@ struct storage_info
#else
//#error No storage driver!
#endif
#else /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/
#else /* NOT CONFIG_STORAGE_MULTI and PLATFORM_NATIVE*/
/* Simulator and multi-driver use normal functions */

View File

@ -125,7 +125,7 @@ int get_cpu_boost_counter(void);
/* newer? SDL includes endian.h, So we ignore it */
#if defined(SIMULATOR) || defined(__PCTOOL__)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) || defined(__PCTOOL__)
#undef letoh16
#undef letoh32
#undef htole16
@ -234,8 +234,11 @@ enum {
#if !defined(SIMULATOR) && !defined(__PCTOOL__)
#include "system-target.h"
#elif defined(HAVE_SDL) /* SIMULATOR */
#elif defined(HAVE_SDL) /* SDL build */
#include "system-sdl.h"
#endif
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
static inline uint16_t swap16(uint16_t value)
/*
result[15..8] = value[ 7..0];
@ -268,7 +271,7 @@ static inline uint32_t swap_odd_even32(uint32_t value)
return (t >> 8) | ((t ^ value) << 8);
}
#endif /* !SIMULATOR */
#endif /* PLATFORM_HOSTED */
#ifndef BIT_N
#define BIT_N(n) (1U << (n))

View File

@ -81,7 +81,7 @@
#define DEFAULT_STACK_SIZE 0x400 /* Bytes */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* Need to keep structures inside the header file because debug_menu
* needs them. */
#ifdef CPU_COLDFIRE
@ -135,15 +135,15 @@ struct regs
uint32_t start; /* 44 - Thread start address, or NULL when started */
};
#endif /* CONFIG_CPU */
#else
#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
struct regs
{
void *t; /* Simulator OS thread */
void *t; /* OS thread */
void *told; /* Last thread in slot (explained in thead-sdl.c) */
void *s; /* Semaphore for blocking and wakeup */
void (*start)(void); /* Start function */
};
#endif /* !SIMULATOR */
#endif /* PLATFORM_NATIVE */
/* NOTE: The use of the word "queue" may also refer to a linked list of
threads being maintained that are normally dealt with in FIFO order

View File

@ -26,7 +26,7 @@
#include "config.h"
#include "cpu.h"
#if defined(SIMULATOR)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define TIMER_FREQ 1000000
#endif

View File

@ -90,7 +90,7 @@ extern const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS];
#if CONFIG_TUNER
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
int tuner_set(int setting, int value);
int tuner_get(int setting);
#ifdef HAVE_RDS_CAP
@ -142,7 +142,7 @@ extern int (*tuner_get)(int setting);
#include "ipod_remote_tuner.h"
#endif
#endif /* SIMULATOR */
#endif /* PLATFORM_HOSTED */
/* Additional messages that get enumerated after tuner driver headers */

View File

@ -4,7 +4,7 @@
#include <stdbool.h>
#ifdef DEBUG
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* check whether a function is inside the valid memory location */
#define IS_FUNCPTR(fp) ({/
extern char _text[];/
@ -21,4 +21,4 @@
#endif
#endif // #ifndef __DBGCHECK_H__
#endif // #ifndef __DBGCHECK_H__

View File

@ -32,7 +32,7 @@
#define ATTR_ARCHIVE 0x20
#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define dirent_uncached sim_dirent
#define DIR_UNCACHED SIM_DIR
#define opendir_uncached sim_opendir
@ -57,7 +57,7 @@ struct dirent_uncached {
#include "fat.h"
typedef struct {
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
bool busy;
long startcluster;
struct fat_dir fatdir;
@ -66,7 +66,7 @@ typedef struct {
int volumecounter; /* running counter for faked volume entries */
#endif
#else
/* simulator: */
/* simulator/application: */
void *dir; /* actually a DIR* dir */
char *name;
#endif

View File

@ -36,7 +36,7 @@ struct travel_data {
struct dircache_entry *first;
struct dircache_entry *ce;
struct dircache_entry *down_entry;
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
DIR_UNCACHED *dir, *newdir;
struct dirent_uncached *entry;
#else

View File

@ -26,6 +26,7 @@
#define MAX_PATH 260
#include <sys/types.h>
#include "config.h"
#include "_ansi.h"
#define MAX_OPEN_FILES 11
@ -49,7 +50,7 @@
#define O_TRUNC 0x10
#endif
#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC)
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && !defined(PLUGIN) && !defined(CODEC)
#define open(x, ...) sim_open(x, __VA_ARGS__)
#define creat(x,m) sim_creat(x,m)
#define remove(x) sim_remove(x)
@ -78,7 +79,7 @@ extern int fsync(int fd);
extern ssize_t read(int fd, void *buf, size_t count);
extern off_t lseek(int fildes, off_t offset, int whence);
extern int file_creat(const char *pathname);
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* posix compatibility function */
static inline int creat(const char *pathname, mode_t mode)
{

View File

@ -208,7 +208,7 @@ void _logf(const char *fmt, ...)
va_start(ap, fmt);
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
char buf[1024];
vsnprintf(buf, sizeof buf, fmt, ap);
DEBUGF("%s\n", buf);

View File

@ -41,7 +41,7 @@ void panicf( const char *fmt, ...)
{
va_list ap;
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* Disable interrupts */
#ifdef CPU_ARM
disable_interrupt(IRQ_FIQ_STATUS);

View File

@ -44,7 +44,7 @@
#endif
#include "logf.h"
#include "lcd-remote.h"
#ifdef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#include <time.h>
#endif
@ -73,7 +73,7 @@ enum charge_state_type charge_state = DISCHARGING;
#endif
#endif /* CONFIG_CHARGING */
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
static int shutdown_timeout = 0;
/*
* Average battery voltage and charger voltage, filtered via a digital
@ -830,7 +830,7 @@ void cancel_shutdown(void)
shutdown_timeout = 0;
}
#endif /* SIMULATOR */
#endif /* PLATFORM_NATIVE */
/* Send system battery level update events on reaching certain significant
levels. This must be called after battery_percent has been updated. */

View File

@ -242,7 +242,7 @@ static bool scroll_process_message(int delay)
usb_wait_for_disconnect(&scroll_queue);
sync_display_ticks();
return true;
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
case SYS_REMOTE_PLUGGED:
if (!remote_initialized)
sync_display_ticks();
@ -280,7 +280,7 @@ static void scroll_thread(void)
delay = current_tick;
if (
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
!remote_initialized ||
#endif
(tick_remote = lcd_remote_scroll_info.last_scroll +

View File

@ -27,7 +27,7 @@
#include "system.h"
#include "i2c.h"
#include "mas.h"
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#if CONFIG_CPU == PNX0101
#include "pnx0101.h"
#endif
@ -257,7 +257,7 @@ static void set_prescaled_volume(void)
dsp_callback(DSP_CALLBACK_SET_SW_VOLUME, 0);
#endif
#ifndef SIMULATOR
#ifndef HAVE_SDL_AUDIO
#if CONFIG_CODEC == MAS3507D
dac_volume(tenthdb2reg(l), tenthdb2reg(r), false);
#elif defined(HAVE_UDA1380) || defined(HAVE_WM8975) || defined(HAVE_WM8758) \
@ -276,9 +276,9 @@ static void set_prescaled_volume(void)
#elif defined(HAVE_JZ4740_CODEC) || defined(HAVE_SDL_AUDIO)
audiohw_set_volume(current_volume);
#endif
#else /* SIMULATOR */
#else /* HAVE_SDL_AUDIO */
audiohw_set_volume(current_volume);
#endif /* !SIMULATOR */
#endif /* !HAVE_SDL_AUDIO */
}
#endif /* (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 */
@ -714,7 +714,7 @@ void sound_set(int setting, int value)
&& !defined(HAVE_WM8758) && !defined(HAVE_TSC2100) \
&& !defined (HAVE_WM8711) && !defined (HAVE_WM8721) \
&& !defined (HAVE_WM8731) && !defined (HAVE_WM8978) \
&& !defined(HAVE_AK4537)) || defined(SIMULATOR)
&& !defined(HAVE_AK4537)) || (CONFIG_PLATFORM & PLATFORM_HOSTED)
int sound_val2phys(int setting, int value)
{
#if CONFIG_CODEC == MAS3587F
@ -820,7 +820,7 @@ int sound_val2phys(int setting, int value)
return value;
#endif
}
#endif /* !defined(HAVE_AS3514) || defined(SIMULATOR) */
#endif /* CONFIG_CODECs || PLATFORM_HOSTED */
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
/* This function works by telling the decoder that we have another

View File

@ -26,7 +26,7 @@
#include "string.h"
#include "file.h"
#ifndef SIMULATOR
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
long cpu_frequency SHAREDBSS_ATTR = CPU_FREQ;
#endif