From 6e9e6a7571275f1942630e0383d3fdf912178c8d Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Sun, 27 Feb 2011 23:42:37 +0000 Subject: [PATCH] RaaA: Add initial Pandora support More information: www.openpandora.org Possible things to implement: - Special button mappings - Battery monitoring - ALSA audio backend - Automate creation of "pnd" (=binary) file git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29451 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs.c | 2 +- apps/main.c | 4 +- apps/settings_list.c | 2 +- firmware/common/filefuncs.c | 2 +- firmware/common/rbpaths.c | 2 +- firmware/export/config.h | 6 +- firmware/export/config/pandora.h | 96 ++++++++++++++++++++++ firmware/export/debug.h | 2 +- firmware/include/dir_uncached.h | 2 +- firmware/include/file.h | 2 +- .../target/hosted/sdl/app/button-application.c | 2 +- firmware/target/hosted/sdl/system-sdl.c | 4 +- tools/configure | 75 +++++++++++++++++ 13 files changed, 188 insertions(+), 13 deletions(-) create mode 100644 firmware/export/config/pandora.h diff --git a/apps/codecs.c b/apps/codecs.c index 86e36edcf0..c9f612b3f4 100644 --- a/apps/codecs.c +++ b/apps/codecs.c @@ -54,7 +54,7 @@ #define LOGF_ENABLE #include "logf.h" -#if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO)) +#if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) #define PREFIX(_x_) sim_ ## _x_ #else #define PREFIX(_x_) _x_ diff --git a/apps/main.c b/apps/main.c index bd04223f97..001f368f50 100644 --- a/apps/main.c +++ b/apps/main.c @@ -125,7 +125,7 @@ #define MAIN_NORETURN_ATTR #endif -#if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO)) +#if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) #include "sim_tasks.h" #include "system-sdl.h" #define HAVE_ARGV_MAIN @@ -351,7 +351,7 @@ static void init(void) show_logo(); button_init(); backlight_init(); -#if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO)) +#if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) sim_tasks_init(); #endif #if (CONFIG_PLATFORM & PLATFORM_ANDROID) diff --git a/apps/settings_list.c b/apps/settings_list.c index 154479b63b..2d73028968 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -217,7 +217,7 @@ static const char graphic_numeric[] = "graphic,numeric"; #define DEFAULT_FONTNAME "15-Adobe-Helvetica" #elif LCD_HEIGHT <= 400 #define DEFAULT_FONTNAME "16-Adobe-Helvetica" -#elif LCD_HEIGHT <= 480 && !(CONFIG_PLATFORM & PLATFORM_MAEMO) +#elif LCD_HEIGHT <= 480 && !(CONFIG_PLATFORM & (PLATFORM_MAEMO|PLATFORM_PANDORA)) #define DEFAULT_FONTNAME "27-Adobe-Helvetica" #else #define DEFAULT_FONTNAME "35-Adobe-Helvetica" diff --git a/firmware/common/filefuncs.c b/firmware/common/filefuncs.c index 3811f06ec9..6eb2bafa40 100644 --- a/firmware/common/filefuncs.c +++ b/firmware/common/filefuncs.c @@ -91,7 +91,7 @@ bool dir_exists(const char *path) #endif /* __PCTOOL__ */ -#if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_SDL|PLATFORM_MAEMO)) +#if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) struct dirinfo dir_get_info(DIR* parent, struct dirent *entry) { (void)parent; diff --git a/firmware/common/rbpaths.c b/firmware/common/rbpaths.c index 10fceb69d9..cb56ab4845 100644 --- a/firmware/common/rbpaths.c +++ b/firmware/common/rbpaths.c @@ -43,7 +43,7 @@ #define opendir opendir_android #define mkdir mkdir_android #define rmdir rmdir_android -#elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO)) +#elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) #define open sim_open #define remove sim_remove #define rename sim_rename diff --git a/firmware/export/config.h b/firmware/export/config.h index 1783cc137d..d00958a71d 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -86,6 +86,7 @@ #define PLATFORM_MAEMO4 (1<<4) #define PLATFORM_MAEMO5 (1<<5) #define PLATFORM_MAEMO (PLATFORM_MAEMO4|PLATFORM_MAEMO5) +#define PLATFORM_PANDORA (1<<6) /* CONFIG_KEYPAD */ #define PLAYER_PAD 1 @@ -448,6 +449,8 @@ Lyre prototype 1 */ #include "config/nokian8xx.h" #elif defined(NOKIAN900) #include "config/nokian900.h" +#elif defined(PANDORA) +#include "config/pandora.h" #else /* no known platform */ #endif @@ -511,7 +514,8 @@ Lyre prototype 1 */ #endif /* define for all cpus from ARM family */ -#if (CONFIG_PLATFORM & PLATFORM_MAEMO5) && defined(MAEMO_ARM_BUILD) +#if ((CONFIG_PLATFORM & PLATFORM_MAEMO5) && defined(MAEMO_ARM_BUILD)) \ + || (CONFIG_PLATFORM & PLATFORM_PANDORA) #define CPU_ARM #define ARM_ARCH 7 /* ARMv7 */ diff --git a/firmware/export/config/pandora.h b/firmware/export/config/pandora.h new file mode 100644 index 0000000000..81dd75b975 --- /dev/null +++ b/firmware/export/config/pandora.h @@ -0,0 +1,96 @@ +/* + * This config file is for Rockbox as an application on the Nokia N8xx + */ +#define TARGET_TREE /* this target is using the target tree system */ + +/* We don't run on hardware directly */ +#define CONFIG_PLATFORM (PLATFORM_HOSTED|PLATFORM_PANDORA) + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 100 + +#define MODEL_NAME "Rockbox" + +#define USB_NONE + +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP + +/* define this if you have a colour LCD */ +#define HAVE_LCD_COLOR + +/* define this if you want album art for this target */ +#define HAVE_ALBUMART + +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + +/* define this if you have access to the quickscreen */ +#define HAVE_QUICKSCREEN +/* define this if you have access to the pitchscreen */ +#define HAVE_PITCHSCREEN + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + +/* LCD dimensions */ +#define LCD_WIDTH 800 +#define LCD_HEIGHT 480 +#define LCD_DEPTH 16 +#define LCD_PIXELFORMAT 565 + +/* define this to indicate your device's keypad */ +#define HAVE_TOUCHSCREEN +#define HAVE_BUTTON_DATA + +/* define this if you have RTC RAM available for settings */ +//#define HAVE_RTC_RAM + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x100000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x80000 + +#define AB_REPEAT_ENABLE + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +/* Work around debug macro expansion of strncmp in scratchbox */ +#define _HAVE_STRING_ARCH_strncmp + +#define HAVE_SCROLLWHEEL +#define CONFIG_KEYPAD SDL_PAD + +/* Use SDL audio/pcm in a SDL app build */ +#define HAVE_SDL +#define HAVE_SDL_AUDIO + +#define HAVE_SW_TONE_CONTROLS + +/* Define current usage levels. */ +#define CURRENT_NORMAL 88 /* 18 hours from a 1600 mAh battery */ +#define CURRENT_BACKLIGHT 30 /* TBD */ +#define CURRENT_RECORD 0 /* no recording yet */ + +/* Define this to the CPU frequency */ +/* +#define CPU_FREQ 48000000 +*/ + +/* Offset ( in the firmware file's header ) to the file CRC */ +#define FIRMWARE_OFFSET_FILE_CRC 0 + +/* Offset ( in the firmware file's header ) to the real data */ +#define FIRMWARE_OFFSET_FILE_DATA 8 + +#define CONFIG_LCD LCD_COWOND2 + +/* Define this if a programmable hotkey is mapped */ +//#define HAVE_HOTKEY + +#define BOOTDIR "/.rockbox" diff --git a/firmware/export/debug.h b/firmware/export/debug.h index 99cdf42c05..b5458af487 100644 --- a/firmware/export/debug.h +++ b/firmware/export/debug.h @@ -34,7 +34,7 @@ extern void ldebugf(const char* file, int line, const char *fmt, ...) /* */ #if defined(SIMULATOR) && !defined(__PCTOOL__) \ - || ((CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO)) && defined(DEBUG)) + || ((CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO|PLATFORM_PANDORA)) && defined(DEBUG)) #define DEBUGF debugf #define LDEBUGF(...) ldebugf(__FILE__, __LINE__, __VA_ARGS__) #else diff --git a/firmware/include/dir_uncached.h b/firmware/include/dir_uncached.h index 19bed9af5d..d9a29fbada 100644 --- a/firmware/include/dir_uncached.h +++ b/firmware/include/dir_uncached.h @@ -33,7 +33,7 @@ struct dirinfo { #include #include "file.h" -#if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO)) +#if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) # define dirent_uncached sim_dirent # define DIR_UNCACHED SIM_DIR # define opendir_uncached sim_opendir diff --git a/firmware/include/file.h b/firmware/include/file.h index 69ed394828..48354505f5 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h @@ -46,7 +46,7 @@ extern int app_open(const char *name, int o, ...); extern int app_creat(const char *name, mode_t mode); extern int app_remove(const char* pathname); extern int app_rename(const char* path, const char* newname); -# if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO)) +# if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) # define filesize(x) sim_filesize(x) # define fsync(x) sim_fsync(x) # define ftruncate(x,y) sim_ftruncate(x,y) diff --git a/firmware/target/hosted/sdl/app/button-application.c b/firmware/target/hosted/sdl/app/button-application.c index 72f4a1770d..bb43d904ed 100644 --- a/firmware/target/hosted/sdl/app/button-application.c +++ b/firmware/target/hosted/sdl/app/button-application.c @@ -50,7 +50,7 @@ int key_to_button(int keyboard_key) case SDLK_LEFT: new_btn = BUTTON_MIDLEFT; break; -#if (CONFIG_PLATFORM & PLATFORM_MAEMO) +#if (CONFIG_PLATFORM & PLATFORM_MAEMO|PLATFORM_PANDORA) case SDLK_RETURN: case SDLK_KP_ENTER: #endif diff --git a/firmware/target/hosted/sdl/system-sdl.c b/firmware/target/hosted/sdl/system-sdl.c index 1cc9b2c919..4dc5509397 100644 --- a/firmware/target/hosted/sdl/system-sdl.c +++ b/firmware/target/hosted/sdl/system-sdl.c @@ -133,7 +133,7 @@ static int sdl_event_thread(void * param) depth = 16; flags = SDL_HWSURFACE|SDL_DOUBLEBUF; -#if (CONFIG_PLATFORM & PLATFORM_MAEMO) +#if (CONFIG_PLATFORM & (PLATFORM_MAEMO|PLATFORM_PANDORA)) /* Fullscreen mode for maemo app */ flags |= SDL_FULLSCREEN; #endif @@ -142,7 +142,7 @@ static int sdl_event_thread(void * param) panicf("%s", SDL_GetError()); } -#if (CONFIG_PLATFORM & PLATFORM_MAEMO) +#if (CONFIG_PLATFORM & PLATFORM_MAEMO|PLATFORM_PANDORA) /* Hide mouse cursor on real touchscreen device */ SDL_ShowCursor(SDL_DISABLE); #endif diff --git a/tools/configure b/tools/configure index 959467029f..eaa391c3e7 100755 --- a/tools/configure +++ b/tools/configure @@ -592,6 +592,48 @@ maemocc () { fi } +pandoracc () { + # Note: The new "Ivanovic" pandora toolchain is not able to compile rockbox. + # You have to use the sebt3 toolchain: + # http://www.gp32x.com/board/index.php?/topic/58490-yactfeau/ + + PNDSDK="/usr/local/angstrom/arm" + if [ ! -x $PNDSDK/bin/arm-angstrom-linux-gnueabi-gcc ]; then + echo "Pandora SDK gcc not found in $PNDSDK/bin/arm-angstrom-linux-gnueabi-gcc" + exit + fi + + PATH=$PNDSDK/bin:$PATH:$PNDSDK/arm-angstrom-linux-gnueabi/usr/bin + PKG_CONFIG_PATH=$PNDSDK/arm-angstrom-linux-gnueabi/usr/lib/pkgconfig + LDOPTS="-L$PNDSDK/arm-angstrom-linux-gnueabi/usr/lib -Wl,-rpath,$PNDSDK/arm-angstrom-linux-gnueabi/usr/lib $LDOPTS" + PKG_CONFIG="pkg-config" + + GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib// -e s/-Wundef//` + GCCOPTS="$GCCOPTS -fno-builtin -g -I\$(SIMDIR)" + GCCOPTIMIZE='' + LDOPTS="-lm -ldl $LDOPTS" + GLOBAL_LDOPTS="$GLOBAL_LDOPTS -Wl,-z,defs" + SHARED_FLAG="-shared" + endian="little" + thread_support="HAVE_SIGALTSTACK_THREADS" + + # Include path + GCCOPTS="-I$PNDSDK/arm-angstrom-linux-gnueabi/usr/include" + + # Set up compiler + gccchoice="4.3.3" + prefixtools "$PNDSDK/bin/arm-angstrom-linux-gnueabi-" + + # Detect SDL + GCCOPTS="$GCCOPTS `$PKG_CONFIG --cflags sdl`" + LDOPTS="$LDOPTS `$PKG_CONFIG --libs sdl`" + + # Compiler options + GCCOPTS="$GCCOPTS -O2 -fno-strict-aliasing" + GCCOPTS="$GCCOPTS -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp" + GCCOPTS="$GCCOPTS -ffast-math -fsingle-precision-constant" +} + androidcc () { if [ -z "$ANDROID_SDK_PATH" ]; then echo "ERROR: You need the Android SDK installed and have the ANDROID_SDK_PATH" @@ -1230,6 +1272,7 @@ cat <