summaryrefslogtreecommitdiff
path: root/firmware/export
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 /firmware/export
parent02e04585bdf1fbd00cf84d2000f59ec198440cb3 (diff)
downloadrockbox-35e8b1429a2cdcf6580f6d25890fed9865165d0b.zip
rockbox-35e8b1429a2cdcf6580f6d25890fed9865165d0b.tar.gz
rockbox-35e8b1429a2cdcf6580f6d25890fed9865165d0b.tar.bz2
rockbox-35e8b1429a2cdcf6580f6d25890fed9865165d0b.tar.xz
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
Diffstat (limited to 'firmware/export')
-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
15 files changed, 48 insertions, 32 deletions
diff --git a/firmware/export/ata_idle_notify.h b/firmware/export/ata_idle_notify.h
index 348165f..439b883 100644
--- a/firmware/export/ata_idle_notify.h
+++ b/firmware/export/ata_idle_notify.h
@@ -43,7 +43,7 @@ enum {
DISK_EVENT_SPINUP = (EVENT_CLASS_DISK|1),
};
-#define USING_STORAGE_CALLBACK !defined(SIMULATOR) \
+#define USING_STORAGE_CALLBACK (CONFIG_PLATFORM & PLATFORM_NATIVE) \
&& ! ((CONFIG_STORAGE & STORAGE_NAND) \
&& (CONFIG_NAND == NAND_IFP7XX)) \
&& !defined(BOOTLOADER)
diff --git a/firmware/export/audio.h b/firmware/export/audio.h
index 1e09081..b81597a 100644
--- a/firmware/export/audio.h
+++ b/firmware/export/audio.h
@@ -36,7 +36,7 @@
#endif /* CONFIG_CODEC == SWCODEC */
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define audio_play(x) sim_audio_play(x)
#endif
diff --git a/firmware/export/buffer.h b/firmware/export/buffer.h
index 4c80471..ae8886b 100644
--- a/firmware/export/buffer.h
+++ b/firmware/export/buffer.h
@@ -23,10 +23,10 @@
#include "config.h"
/* defined in linker script */
-#ifdef SIMULATOR
-extern unsigned char *audiobufend;
-#else
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
extern unsigned char audiobufend[];
+#else
+extern unsigned char *audiobufend;
#endif
extern unsigned char *audiobuf;
diff --git a/firmware/export/config.h b/firmware/export/config.h
index de84dc3..c06e5d1 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -74,6 +74,13 @@
#define AT91SAM9260 9260
#define AS3525v2 35252
+/* platforms
+ * bit fields to allow PLATFORM_HOSTED to be OR'ed e.g. with a
+ * possible future PLATFORM_ANDROID (some OSes might need totally different
+ * handling to run on them than a stand-alone application) */
+#define PLATFORM_NATIVE (1<<0)
+#define PLATFORM_HOSTED (1<<1)
+
/* CONFIG_KEYPAD */
#define PLAYER_PAD 1
#define RECORDER_PAD 2
@@ -497,6 +504,10 @@ Lyre prototype 1 */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING
#endif
+#ifndef CONFIG_PLATFORM
+#define CONFIG_PLATFORM PLATFORM_NATIVE
+#endif
+
#ifndef CONFIG_TUNER
#define CONFIG_TUNER 0
#endif
@@ -675,10 +686,10 @@ Lyre prototype 1 */
#define HAVE_EXTENDED_MESSAGING_AND_NAME
#define HAVE_WAKEUP_EXT_CB
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define HAVE_PRIORITY_SCHEDULING
#define HAVE_SCHEDULER_BOOSTCTRL
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
#define HAVE_SEMAPHORE_OBJECTS
@@ -744,7 +755,7 @@ Lyre prototype 1 */
#endif
/* IRAM usage */
-#if !defined(SIMULATOR) && /* Not for simulators */ \
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && /* Not for hosted environments */ \
(((CONFIG_CPU == SH7034) && !defined(PLUGIN)) || /* SH1 archos: core only */ \
defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \
defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \
@@ -780,9 +791,10 @@ Lyre prototype 1 */
#define IBSS_ATTR
#define STATICIRAM static
#endif
+
#if (defined(CPU_PP) || (CONFIG_CPU == AS3525) || (CONFIG_CPU == AS3525v2) || \
(CONFIG_CPU == IMX31L)) \
- && !defined(SIMULATOR) && !defined(BOOTLOADER)
+ && (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER)
/* Functions that have INIT_ATTR attached are NOT guaranteed to survive after
* root_menu() has been called. Their code may be overwritten by other data or
* code in order to save RAM, and references to them might point into
@@ -799,7 +811,7 @@ Lyre prototype 1 */
#define INIT_ATTR
#endif
-#if defined(SIMULATOR) && defined(__APPLE__)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
#define DATA_ATTR __attribute__ ((section("__DATA, .data")))
#else
#define DATA_ATTR __attribute__ ((section(".data")))
@@ -923,7 +935,7 @@ Lyre prototype 1 */
#else /* BOOTLOADER */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
//#define USB_ENABLE_SERIAL
#define USB_ENABLE_STORAGE
@@ -941,11 +953,11 @@ Lyre prototype 1 */
/* This attribute can be used to enable to detection of plugin file handles leaks.
* When enabled, the plugin core will monitor open/close/creat and when the plugin exits
* will display an error message if the plugin leaked some file handles */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define HAVE_PLUGIN_CHECK_OPEN_CLOSE
#endif
-#if defined(HAVE_DIRCACHE) && !defined(SIMULATOR)
+#if defined(HAVE_DIRCACHE) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define HAVE_IO_PRIORITY
#endif
diff --git a/firmware/export/config/sim.h b/firmware/export/config/sim.h
index d65b0fb..5dcb4f6 100644
--- a/firmware/export/config/sim.h
+++ b/firmware/export/config/sim.h
@@ -101,4 +101,5 @@
#define HAVE_SDL
#define HAVE_SDL_AUDIO
+#define CONFIG_PLATFORM PLATFORM_HOSTED
#define _ISOC99_SOURCE 1
diff --git a/firmware/export/font.h b/firmware/export/font.h
index f6915d9..7284564 100644
--- a/firmware/export/font.h
+++ b/firmware/export/font.h
@@ -28,7 +28,7 @@
*/
#include "config.h"
-#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
+#if defined(HAVE_LCD_BITMAP) || (CONFIG_PLATFORM & PLATFORM_HOSTED)
#ifndef __PCTOOL__
#include "font_cache.h"
#include "sysfont.h"
diff --git a/firmware/export/hwcompat.h b/firmware/export/hwcompat.h
index 27fcb25..c37add4 100644
--- a/firmware/export/hwcompat.h
+++ b/firmware/export/hwcompat.h
@@ -24,7 +24,7 @@
#include <stdbool.h>
#include "config.h"
-#if (CONFIG_CPU == SH7034) && !defined(SIMULATOR)
+#if (CONFIG_CPU == SH7034) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
#define ROM_VERSION (*(short *)0x020000fe)
@@ -49,7 +49,7 @@ static inline int tuner_detect_type(void)
}
#endif
-#endif /* (CONFIG_CPU == SH7034) && !SIMULATOR */
+#endif /* (CONFIG_CPU == SH7034) && (CONFIG_PLATFORM & PLATFORM_NATIVE) */
#ifdef ARCHOS_PLAYER
bool is_new_player(void);
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h
index bcf51c1..9ef5af8 100644
--- a/firmware/export/kernel.h
+++ b/firmware/export/kernel.h
@@ -201,7 +201,7 @@ static inline void call_tick_tasks(void)
}
#endif
-#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && !defined(PLUGIN) && !defined(CODEC)
#define sleep(x) sim_sleep(x)
#endif
diff --git a/firmware/export/power.h b/firmware/export/power.h
index 1071587..137f40c 100644
--- a/firmware/export/power.h
+++ b/firmware/export/power.h
@@ -81,7 +81,7 @@ void ide_power_enable(bool on);
bool charging_state(void);
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
void power_init(void) INIT_ATTR;
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index d86118c..03b9d34 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -74,7 +74,7 @@ extern unsigned int power_thread_inputs;
#include "powermgmt-target.h"
#endif
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* Generic current values that are intentionally meaningless - config header
* should define proper numbers.*/
@@ -129,7 +129,7 @@ extern const unsigned short percent_to_volt_charge[11];
/* Start up power management thread */
void powermgmt_init(void) INIT_ATTR;
-#endif /* SIMULATOR */
+#endif /* PLATFORM_NATIVE */
/* Returns battery statust */
int battery_level(void); /* percent */
diff --git a/firmware/export/storage.h b/firmware/export/storage.h
index e62cf0d..e59a5e5 100644
--- a/firmware/export/storage.h
+++ b/firmware/export/storage.h
@@ -51,7 +51,7 @@ struct storage_info
char *revision;
};
-#if !defined(SIMULATOR) && !defined(CONFIG_STORAGE_MULTI)
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(CONFIG_STORAGE_MULTI)
/* storage_spindown, storage_sleep and storage_spin are passed as
* pointers, which doesn't work with argument-macros.
*/
@@ -185,7 +185,7 @@ struct storage_info
#else
//#error No storage driver!
#endif
-#else /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/
+#else /* NOT CONFIG_STORAGE_MULTI and PLATFORM_NATIVE*/
/* Simulator and multi-driver use normal functions */
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 5ac92e0..7a04422 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -125,7 +125,7 @@ int get_cpu_boost_counter(void);
/* newer? SDL includes endian.h, So we ignore it */
-#if defined(SIMULATOR) || defined(__PCTOOL__)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) || defined(__PCTOOL__)
#undef letoh16
#undef letoh32
#undef htole16
@@ -234,8 +234,11 @@ enum {
#if !defined(SIMULATOR) && !defined(__PCTOOL__)
#include "system-target.h"
-#elif defined(HAVE_SDL) /* SIMULATOR */
+#elif defined(HAVE_SDL) /* SDL build */
#include "system-sdl.h"
+#endif
+
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
static inline uint16_t swap16(uint16_t value)
/*
result[15..8] = value[ 7..0];
@@ -268,7 +271,7 @@ static inline uint32_t swap_odd_even32(uint32_t value)
return (t >> 8) | ((t ^ value) << 8);
}
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_HOSTED */
#ifndef BIT_N
#define BIT_N(n) (1U << (n))
diff --git a/firmware/export/thread.h b/firmware/export/thread.h
index d907e5d..c4b7d1f 100644
--- a/firmware/export/thread.h
+++ b/firmware/export/thread.h
@@ -81,7 +81,7 @@
#define DEFAULT_STACK_SIZE 0x400 /* Bytes */
-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* Need to keep structures inside the header file because debug_menu
* needs them. */
#ifdef CPU_COLDFIRE
@@ -135,15 +135,15 @@ struct regs
uint32_t start; /* 44 - Thread start address, or NULL when started */
};
#endif /* CONFIG_CPU */
-#else
+#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
struct regs
{
- void *t; /* Simulator OS thread */
+ void *t; /* OS thread */
void *told; /* Last thread in slot (explained in thead-sdl.c) */
void *s; /* Semaphore for blocking and wakeup */
void (*start)(void); /* Start function */
};
-#endif /* !SIMULATOR */
+#endif /* PLATFORM_NATIVE */
/* NOTE: The use of the word "queue" may also refer to a linked list of
threads being maintained that are normally dealt with in FIFO order
diff --git a/firmware/export/timer.h b/firmware/export/timer.h
index b070aca..b12ec55 100644
--- a/firmware/export/timer.h
+++ b/firmware/export/timer.h
@@ -26,7 +26,7 @@
#include "config.h"
#include "cpu.h"
-#if defined(SIMULATOR)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
#define TIMER_FREQ 1000000
#endif
diff --git a/firmware/export/tuner.h b/firmware/export/tuner.h
index fa894a4..461c9a3 100644
--- a/firmware/export/tuner.h
+++ b/firmware/export/tuner.h
@@ -90,7 +90,7 @@ extern const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS];
#if CONFIG_TUNER
-#ifdef SIMULATOR
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
int tuner_set(int setting, int value);
int tuner_get(int setting);
#ifdef HAVE_RDS_CAP
@@ -142,7 +142,7 @@ extern int (*tuner_get)(int setting);
#include "ipod_remote_tuner.h"
#endif
-#endif /* SIMULATOR */
+#endif /* PLATFORM_HOSTED */
/* Additional messages that get enumerated after tuner driver headers */