From d83e929f3fc369a5981e1e40e1c5307169a46cfc Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Thu, 12 Jan 2006 00:35:50 +0000 Subject: [PATCH] Work-in-progress iriver iFP-7xx port by Tomasz Malesinski git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8342 a1c6a512-1295-4272-9138-f99709370657 --- apps/bookmark.h | 5 ++ apps/codecs/SOURCES | 2 + apps/debug_menu.c | 6 ++ apps/gui/gwps.h | 19 ++++++ apps/gui/list.h | 4 ++ apps/gui/select.h | 8 +++ apps/gui/yesno.h | 3 + apps/menu.h | 8 +++ apps/plugins/Makefile | 2 + apps/plugins/SOURCES | 2 + apps/plugins/battery_test.c | 2 + apps/plugins/chessclock.c | 10 ++++ apps/plugins/cube.c | 12 ++++ apps/plugins/databox/databox.c | 3 + apps/plugins/dict.c | 2 + apps/plugins/jewels.c | 6 ++ apps/plugins/logo.c | 6 ++ apps/plugins/metronome.c | 9 +++ apps/plugins/mosaique.c | 6 ++ apps/plugins/plugin.lds | 14 +++-- apps/plugins/rockboy/sys_rockbox.c | 7 +++ apps/plugins/snow.c | 2 + apps/plugins/stats.c | 2 + apps/plugins/stopwatch.c | 7 +++ apps/plugins/viewer.c | 11 ++++ apps/recorder/keyboard.c | 14 +++++ apps/settings.h | 6 ++ apps/tree.h | 14 +++++ docs/CREDITS | 1 + firmware/SOURCES | 6 ++ firmware/app.lds | 12 ++-- firmware/backlight.c | 4 ++ firmware/crt0.S | 6 +- firmware/drivers/adc.c | 34 +++++++++++ firmware/drivers/button.c | 50 +++++++++++++++- firmware/drivers/lcd-recorder.c | 31 ++++++++++ firmware/drivers/power.c | 5 ++ firmware/drivers/serial.c | 3 +- firmware/export/adc.h | 9 +++ firmware/export/button.h | 13 ++++ firmware/export/config-ifp7xx.h | 96 ++++++++++++++++++++++++++++++ firmware/export/config.h | 12 +++- firmware/export/cpu.h | 3 + firmware/export/pnx0101.h | 67 +++++++++++++++++++++ firmware/export/system.h | 18 +++++- firmware/kernel.c | 35 +++++++++++ firmware/pcm_playback.c | 51 ++++++++++++++++ firmware/system.c | 81 +++++++++++++++++++++++++ firmware/thread.c | 2 +- firmware/usb.c | 7 +++ tools/configure | 15 +++++ tools/scramble.c | 2 + 52 files changed, 737 insertions(+), 18 deletions(-) create mode 100644 firmware/export/config-ifp7xx.h create mode 100644 firmware/export/pnx0101.h diff --git a/apps/bookmark.h b/apps/bookmark.h index dff4473167..284c0ceffb 100644 --- a/apps/bookmark.h +++ b/apps/bookmark.h @@ -38,6 +38,11 @@ #define BOOKMARK_DELETE (BUTTON_RIGHT | BUTTON_REPEAT) #define BOOKMARK_DOWN BUTTON_SCROLL_FWD +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define BOOKMARK_SELECT BUTTON_SELECT +#define BOOKMARK_DELETE (BUTTON_PLAY | BUTTON_SELECT) +#define BOOKMARK_DOWN BUTTON_DOWN + #else /* player, recorder, gmini */ #define BOOKMARK_SELECT BUTTON_PLAY #define BOOKMARK_DELETE (BUTTON_ON | BUTTON_PLAY) diff --git a/apps/codecs/SOURCES b/apps/codecs/SOURCES index 69d925248b..911ee3b705 100644 --- a/apps/codecs/SOURCES +++ b/apps/codecs/SOURCES @@ -7,6 +7,8 @@ a52.c mpc.c wavpack.c alac.c +#if MEMORYSIZE > 1 aac.c +#endif shorten.c #endif diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 4bb2cfbe75..69c0e2fceb 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -359,6 +359,12 @@ bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device, (void)p_device; (void)addr1; (void)addr2; +#elif CONFIG_CPU == PNX0101 + /* TODO: Implement for iFP7xx */ + (void)p_manufacturer; + (void)p_device; + (void)addr1; + (void)addr2; #else unsigned not_manu, not_id; /* read values before switching to ID mode */ unsigned manu, id; /* read values when in ID mode */ diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 610c3021bf..b6d06a645a 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h @@ -191,6 +191,25 @@ #define WPS_EXIT (BUTTON_PLAY | BUTTON_REPEAT) #define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT) +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD + +/* TODO: Check WPS button assignments */ + +#define WPS_NEXT (BUTTON_RIGHT | BUTTON_REL) +#define WPS_NEXT_PRE BUTTON_RIGHT +#define WPS_PREV (BUTTON_LEFT | BUTTON_REL) +#define WPS_PREV_PRE BUTTON_LEFT +#define WPS_FFWD (BUTTON_RIGHT | BUTTON_REPEAT) +#define WPS_REW (BUTTON_LEFT | BUTTON_REPEAT) +#define WPS_INCVOL BUTTON_UP +#define WPS_DECVOL BUTTON_DOWN +#define WPS_PAUSE BUTTON_PLAY +/* #define WPS_MENU iFP7xx can't have both main menu and context menu in wps */ +#define WPS_BROWSE (BUTTON_SELECT | BUTTON_REL) +#define WPS_BROWSE_PRE BUTTON_SELECT +#define WPS_EXIT (BUTTON_PLAY | BUTTON_REPEAT) +#define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT) + #endif /* constants used in line_type and as refresh_mode for wps_refresh */ diff --git a/apps/gui/list.h b/apps/gui/list.h index 3ae1b80dc2..4f02693127 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h @@ -69,6 +69,10 @@ #define LIST_NEXT BUTTON_SCROLL_FWD #define LIST_PREV BUTTON_SCROLL_BACK +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define LIST_NEXT BUTTON_DOWN +#define LIST_PREV BUTTON_UP + #elif CONFIG_KEYPAD == GMINI100_PAD #define LIST_NEXT BUTTON_DOWN #define LIST_PREV BUTTON_UP diff --git a/apps/gui/select.h b/apps/gui/select.h index b6a9afd55c..3f6dd1413b 100644 --- a/apps/gui/select.h +++ b/apps/gui/select.h @@ -61,6 +61,14 @@ #define SELECT_OK2 BUTTON_RIGHT #define SELECT_CANCEL BUTTON_MENU +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define SELECT_INC BUTTON_UP +#define SELECT_DEC BUTTON_DOWN +#define SELECT_OK BUTTON_RIGHT +#define SELECT_OK2 BUTTON_LEFT +#define SELECT_CANCEL BUTTON_PLAY +#define SELECT_CANCEL2 BUTTON_MODE + #elif CONFIG_KEYPAD == ONDIO_PAD #define SELECT_INC BUTTON_UP #define SELECT_DEC BUTTON_DOWN diff --git a/apps/gui/yesno.h b/apps/gui/yesno.h index 5399c88391..98bf84f504 100644 --- a/apps/gui/yesno.h +++ b/apps/gui/yesno.h @@ -25,6 +25,9 @@ #elif (CONFIG_KEYPAD == IPOD_4G_PAD) #define YESNO_OK BUTTON_RIGHT + +#elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) +#define YESNO_OK BUTTON_RIGHT #endif enum yesno_res { diff --git a/apps/menu.h b/apps/menu.h index 2d5c036a34..143933d833 100644 --- a/apps/menu.h +++ b/apps/menu.h @@ -78,6 +78,14 @@ #define MENU_EXIT_MENU BUTTON_MENU #define MENU_ENTER BUTTON_RIGHT +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD + +#define MENU_NEXT BUTTON_DOWN +#define MENU_PREV BUTTON_UP +#define MENU_EXIT BUTTON_LEFT +#define MENU_EXIT_MENU BUTTON_PLAY +#define MENU_ENTER BUTTON_RIGHT + #endif struct menu_item { diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile index 98c66c6d46..45fa7a469d 100644 --- a/apps/plugins/Makefile +++ b/apps/plugins/Makefile @@ -43,8 +43,10 @@ SUBDIRS += searchengine databox #for any recorder and iRiver model ifneq (,$(strip $(foreach tgt,RECORDER IRIVER,$(findstring $(tgt),$(TARGET))))) +ifneq (-DIRIVER_IFP7XX,$(TARGET)) SUBDIRS += rockboy endif +endif .PHONY: $(SUBDIRS) diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 6742b88218..98ffcc2be8 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES @@ -18,6 +18,7 @@ viewer.c dict.c metronome.c +#ifndef IRIVER_IFP7XX_SERIES /* Temporarily disable plugin building for iFP7xx */ #ifdef HAVE_LCD_BITMAP /* Recorder/Ondio models only */ solitaire.c #ifndef HAVE_LCD_COLOR @@ -89,4 +90,5 @@ wav2wv.c midi2wav.c #else splitedit.c +#endif /* iFP7xx */ #endif diff --git a/apps/plugins/battery_test.c b/apps/plugins/battery_test.c index b559ed53af..ac47b001f2 100644 --- a/apps/plugins/battery_test.c +++ b/apps/plugins/battery_test.c @@ -39,6 +39,8 @@ #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ (CONFIG_KEYPAD == IRIVER_H300_PAD) #define BATTERY_TEST_QUIT BUTTON_OFF +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define BATTERY_TEST_QUIT BUTTON_PLAY #elif (CONFIG_KEYPAD == IPOD_4G_PAD) #define BATTERY_TEST_QUIT BUTTON_MENU #endif diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index 3291f3e32e..18ba68014f 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c @@ -74,6 +74,16 @@ #define CHC_SETTINGS_OK BUTTON_SELECT #define CHC_SETTINGS_CANCEL BUTTON_MENU +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define CHC_QUIT BUTTON_PLAY +#define CHC_STARTSTOP BUTTON_MODE +#define CHC_RESET BUTTON_EQ +#define CHC_MENU BUTTON_SELECT +#define CHC_SETTINGS_INC BUTTON_RIGHT +#define CHC_SETTINGS_DEC BUTTON_LEFT +#define CHC_SETTINGS_OK BUTTON_SELECT +#define CHC_SETTINGS_CANCEL BUTTON_PLAY + #endif diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c index cebc36a016..e71d8b6e4e 100644 --- a/apps/plugins/cube.c +++ b/apps/plugins/cube.c @@ -92,6 +92,18 @@ #define CUBE_PAUSE (BUTTON_PLAY | BUTTON_REL) #define CUBE_HIGHSPEED (BUTTON_SELECT | BUTTON_PLAY) +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define CUBE_QUIT BUTTON_PLAY +#define CUBE_X_INC BUTTON_RIGHT +#define CUBE_X_DEC BUTTON_LEFT +#define CUBE_Y_INC BUTTON_UP +#define CUBE_Y_DEC BUTTON_DOWN +#define CUBE_Z_INC BUTTON_MODE +#define CUBE_Z_DEC BUTTON_EQ +#define CUBE_MODE (BUTTON_SELECT | BUTTON_REPEAT) +#define CUBE_PAUSE (BUTTON_SELECT | BUTTON_REL) +#define CUBE_HIGHSPEED (BUTTON_MODE | BUTTON_EQ) /* TODO: this is impossible */ + #endif #ifdef HAVE_LCD_BITMAP diff --git a/apps/plugins/databox/databox.c b/apps/plugins/databox/databox.c index d9b513c378..ebed139020 100644 --- a/apps/plugins/databox/databox.c +++ b/apps/plugins/databox/databox.c @@ -35,6 +35,9 @@ #elif CONFIG_KEYPAD == PLAYER_PAD #define DBX_SELECT BUTTON_PLAY #define DBX_STOP BUTTON_STOP +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define DBX_SELECT BUTTON_SELECT +#define DBX_STOP BUTTON_PLAY #endif #define MAX_TOKENS 70 diff --git a/apps/plugins/dict.c b/apps/plugins/dict.c index aea7c44a6c..c432b564f4 100644 --- a/apps/plugins/dict.c +++ b/apps/plugins/dict.c @@ -104,6 +104,8 @@ long reverse (long N) { #define LP_QUIT BUTTON_STOP #elif (CONFIG_KEYPAD == IPOD_4G_PAD) #define LP_QUIT BUTTON_MENU +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define LP_QUIT BUTTON_PLAY #else #define LP_QUIT BUTTON_OFF #endif diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index 739e8141a6..af5a3743c7 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c @@ -81,6 +81,12 @@ #define BEJEWELED_SELECT_PRE BUTTON_SELECT #define BEJEWELED_RESUME (BUTTON_SELECT|BUTTON_PLAY) +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define BEJEWELED_QUIT BUTTON_PLAY +#define BEJEWELED_START BUTTON_MODE +#define BEJEWELED_SELECT BUTTON_SELECT +#define BEJEWELED_RESUME BUTTON_EQ + #else #error BEJEWELED: Unsupported keypad #endif diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c index ba5451410b..9472de9110 100644 --- a/apps/plugins/logo.c +++ b/apps/plugins/logo.c @@ -187,6 +187,12 @@ const unsigned char rockbox16x7[] = { #define LP_INC_X BUTTON_RIGHT #define LP_DEC_Y BUTTON_SCROLL_BACK #define LP_INC_Y BUTTON_SCROLL_FWD +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define LP_QUIT BUTTON_PLAY +#define LP_DEC_X BUTTON_LEFT +#define LP_INC_X BUTTON_RIGHT +#define LP_DEC_Y BUTTON_DOWN +#define LP_INC_Y BUTTON_UP #else #define LP_QUIT BUTTON_OFF #define LP_DEC_X BUTTON_LEFT diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index c1e156075b..f8c5445542 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c @@ -64,6 +64,15 @@ #define METRONOME_TAP BUTTON_SELECT #define METRONOME_MSG_START "press play" #define METRONOME_MSG_STOP "press pause" + +#elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) +#define METRONOME_QUIT BUTTON_MODE +#define METRONOME_PLAYPAUSE BUTTON_PLAY +#define METRONOME_VOL_UP BUTTON_UP +#define METRONOME_VOL_DOWN BUTTON_DOWN +#define METRONOME_TAP BUTTON_EQ +#define METRONOME_MSG_START "press play" +#define METRONOME_MSG_STOP "press pause" #endif #if CONFIG_REMOTE_KEYPAD == H100_REMOTE diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c index 0773236140..7a18bc2d42 100644 --- a/apps/plugins/mosaique.c +++ b/apps/plugins/mosaique.c @@ -55,6 +55,12 @@ #define MOSAIQUE_QUIT BUTTON_MENU #define MOSAIQUE_SPEED BUTTON_SELECT #define MOSAIQUE_RESTART BUTTON_PLAY + +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define MOSAIQUE_QUIT BUTTON_PLAY +#define MOSAIQUE_SPEED BUTTON_MODE +#define MOSAIQUE_RESTART BUTTON_SELECT + #endif enum plugin_status plugin_start(struct plugin_api* api, void* parameter) diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index 84617b9b4e..c8ac88fb62 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds @@ -4,7 +4,7 @@ #ifdef CPU_COLDFIRE OUTPUT_FORMAT(elf32-m68k) -#elif CONFIG_CPU==PP5020 +#elif defined(CPU_ARM) OUTPUT_FORMAT(elf32-littlearm) #else OUTPUT_FORMAT(elf32-sh) @@ -32,6 +32,10 @@ OUTPUT_FORMAT(elf32-sh) #define DRAMORIG 0x10000000 #define IRAMORIG 0x4000c000 #define IRAMSIZE 0xc000 +#elif CONFIG_CPU == PNX0101 +#define DRAMORIG 0x24000000 +#define IRAMORIG 0x408000 +#define IRAMSIZE 0x8000 #else #define DRAMORIG 0x09000000 + STUBOFFSET #endif @@ -53,7 +57,7 @@ OUTPUT_FORMAT(elf32-sh) MEMORY { PLUGIN_RAM : ORIGIN = THIS_ORIGIN, LENGTH = THIS_LENGTH -#if defined(ARCH_IRIVER) || defined(ARCH_IPOD) +#if defined(ARCH_IRIVER) || defined(ARCH_IPOD) || (CONFIG_CPU==PNX0101) PLUGIN_IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE #endif } @@ -64,7 +68,7 @@ SECTIONS { KEEP(*(.entry)) *(.text*) -#if CONFIG_CPU==PP5020 +#if (CONFIG_CPU==PP5020) || (CONFIG_CPU==PNX0101) *(.glue_7) *(.glue_7t) #endif @@ -79,7 +83,7 @@ SECTIONS .data : { *(.data*) -#if defined(ARCH_IRIVER) || defined(ARCH_IPOD) +#if defined(ARCH_IRIVER) || defined(ARCH_IPOD) || (CONFIG_CPU==PNX0101) iramcopy = .; #endif } > PLUGIN_RAM @@ -89,7 +93,7 @@ SECTIONS *(.eh_frame) } -#if defined(ARCH_IRIVER) || defined(ARCH_IPOD) +#if defined(ARCH_IRIVER) || defined(ARCH_IPOD) || (CONFIG_CPU==PNX0101) .iram IRAMORIG : AT ( iramcopy) { iramstart = .; diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c index b8bb65e6fc..53fe19b199 100644 --- a/apps/plugins/rockboy/sys_rockbox.c +++ b/apps/plugins/rockboy/sys_rockbox.c @@ -75,6 +75,13 @@ void joy_close(void) #define ROCKBOY_PAD_SELECT BUTTON_PLAY #define ROCKBOY_MENU BUTTON_OFF +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define ROCKBOY_PAD_A BUTTON_PLAY +#define ROCKBOY_PAD_B BUTTON_EQ +#define ROCKBOY_PAD_START BUTTON_MODE +#define ROCKBOY_PAD_SELECT (BUTTON_SELECT | BUTTON_REL) +#define ROCKBOY_MENU (BUTTON_SELECT | BUTTON_REPEAT) + #endif unsigned int oldbuttonstate = 0, newbuttonstate,holdbutton; diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c index ec4a240894..7fd0c8a3d6 100644 --- a/apps/plugins/snow.c +++ b/apps/plugins/snow.c @@ -36,6 +36,8 @@ #define SNOW_QUIT BUTTON_STOP #elif (CONFIG_KEYPAD == IPOD_4G_PAD) #define SNOW_QUIT BUTTON_MENU +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define SNOW_QUIT BUTTON_PLAY #else #define SNOW_QUIT BUTTON_OFF #endif diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c index 0dfac24c6d..e1b8b6fc21 100644 --- a/apps/plugins/stats.c +++ b/apps/plugins/stats.c @@ -30,6 +30,8 @@ static int fontwidth, fontheight; #define STATS_STOP BUTTON_STOP #elif (CONFIG_KEYPAD == IPOD_4G_PAD) #define STATS_STOP BUTTON_MENU +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define STATS_STOP BUTTON_PLAY #else #define STATS_STOP BUTTON_OFF #endif diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c index 9df064d36f..4a1382ef65 100644 --- a/apps/plugins/stopwatch.c +++ b/apps/plugins/stopwatch.c @@ -68,6 +68,13 @@ #define STOPWATCH_LAP_TIMER BUTTON_RIGHT #define STOPWATCH_SCROLL_UP BUTTON_SCROLL_FWD #define STOPWATCH_SCROLL_DOWN BUTTON_SCROLL_BACK +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define STOPWATCH_QUIT BUTTON_PLAY +#define STOPWATCH_START_STOP BUTTON_MODE +#define STOPWATCH_RESET_TIMER BUTTON_EQ +#define STOPWATCH_LAP_TIMER BUTTON_SELECT +#define STOPWATCH_SCROLL_UP BUTTON_UP +#define STOPWATCH_SCROLL_DOWN BUTTON_DOWN #endif static struct plugin_api* rb; diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index 60438c9dc9..823072e145 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -131,6 +131,17 @@ #define VIEWER_MODE_PAGE (BUTTON_SELECT | BUTTON_LEFT | BUTTON_MENU) #define VIEWER_MODE_SCROLLBAR (BUTTON_SELECT | BUTTON_LEFT | BUTTON_RIGHT) +/* iFP7xx keys */ +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define VIEWER_QUIT BUTTON_PLAY +#define VIEWER_PAGE_UP BUTTON_UP +#define VIEWER_PAGE_DOWN BUTTON_DOWN +#define VIEWER_SCREEN_LEFT BUTTON_LEFT +#define VIEWER_SCREEN_RIGHT BUTTON_RIGHT +#define VIEWER_MODE_WRAP (BUTTON_EQ | BUTTON_REL) +#define VIEWER_MODE_LINE (BUTTON_EQ | BUTTON_REPEAT) +#define VIEWER_MODE_WIDTH BUTTON_MODE + #endif enum { diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 5f56274026..3cff78bbc5 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c @@ -114,6 +114,20 @@ #define KBD_UP BUTTON_SCROLL_BACK #define KBD_DOWN BUTTON_SCROLL_FWD +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD + +/* TODO: Check keyboard mappings */ + +#define KBD_MODES /* iFP7xx uses 2 modes, picker and line edit */ +#define KBD_SELECT (BUTTON_SELECT | BUTTON_REL) /* backspace in line edit */ +#define KBD_SELECT_PRE BUTTON_SELECT +#define KBD_DONE BUTTON_MODE +#define KBD_ABORT BUTTON_PLAY +#define KBD_LEFT BUTTON_LEFT +#define KBD_RIGHT BUTTON_RIGHT +#define KBD_UP BUTTON_UP +#define KBD_DOWN BUTTON_DOWN + #endif #if KEYBOARD_PAGES == 1 diff --git a/apps/settings.h b/apps/settings.h index 263147c92c..2490635620 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -101,6 +101,12 @@ #define SETTINGS_NEXT BUTTON_RIGHT #define SETTINGS_ACCEPT BUTTON_PLAY +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define SETTINGS_INC BUTTON_RIGHT +#define SETTINGS_DEC BUTTON_LEFT +#define SETTINGS_OK BUTTON_SELECT +#define SETTINGS_CANCEL BUTTON_PLAY + #endif /* data structures */ diff --git a/apps/tree.h b/apps/tree.h index 05800ae68a..ad4a4a91aa 100644 --- a/apps/tree.h +++ b/apps/tree.h @@ -150,6 +150,20 @@ #define TREE_WPS_PRE BUTTON_MENU #define TREE_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT) +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD + +#define TREE_NEXT BUTTON_DOWN +#define TREE_PREV BUTTON_UP +#define TREE_EXIT BUTTON_LEFT +#define TREE_ABORT BUTTON_PLAY +#define TREE_RUN (BUTTON_RIGHT | BUTTON_REL) +#define TREE_RUN_PRE BUTTON_RIGHT +#define TREE_MENU (BUTTON_SELECT | BUTTON_REPEAT) +#define TREE_MENU_PRE BUTTON_SELECT +#define TREE_WPS (BUTTON_SELECT | BUTTON_REL) +#define TREE_WPS_PRE BUTTON_SELECT +#define TREE_CONTEXT (BUTTON_RIGHT | BUTTON_REPEAT) +#define TREE_POWER_BTN (BUTTON_PLAY | BUTTON_REPEAT) #endif struct entry { diff --git a/docs/CREDITS b/docs/CREDITS index 2e15a6b986..f388d1452b 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -157,3 +157,4 @@ Nick Lanham Sebastian Henriksen Martin Scarratt Karl Kurbjun +Tomasz Malesinski diff --git a/firmware/SOURCES b/firmware/SOURCES index 7f07598273..4fe5fc91f5 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -74,8 +74,12 @@ drivers/adc.c #ifdef HAVE_MMC drivers/ata_mmc.c #else +#ifdef HAVE_FLASH_DISK +drivers/ata_flash.c +#else drivers/ata.c #endif +#endif drivers/button.c drivers/dac.c drivers/fat.c @@ -93,6 +97,8 @@ tuner_philips.c drivers/i2c-coldfire.c #elif CONFIG_I2C == I2C_PP5020 drivers/i2c-pp5020.c +#elif CONFIG_I2C == I2C_PNX0101 +drivers/i2c-pnx0101.c #else drivers/i2c.c #endif diff --git a/firmware/app.lds b/firmware/app.lds index e17e5a97b9..feff264d39 100644 --- a/firmware/app.lds +++ b/firmware/app.lds @@ -7,7 +7,7 @@ INPUT(crt0.o) #elif CONFIG_CPU == TCC730 OUTPUT_FORMAT(elf32-calmrisc16) INPUT(crt0.o) -#elif CONFIG_CPU == PP5020 +#elif defined(CPU_ARM) OUTPUT_FORMAT(elf32-littlearm) OUTPUT_ARCH(arm) INPUT(crt0.o) @@ -126,6 +126,10 @@ _pluginbuf = 0; #define DRAMORIG 0x00000000 + STUBOFFSET #define IRAMORIG 0x40000000 #define IRAMSIZE 0xc000 +#elif CONFIG_CPU==PNX0101 +#define DRAMORIG 0x24000000 + STUBOFFSET +#define IRAMORIG 0x400100 +#define IRAMSIZE 0x7f00 #else #define DRAMORIG 0x09000000 + STUBOFFSET #define IRAMORIG 0x0f000000 @@ -161,7 +165,7 @@ SECTIONS . = ALIGN(0x200); *(.init.text) *(.text*) -#if CONFIG_CPU==PP5020 +#ifdef CPU_ARM *(.glue_7) *(.glue_7t) #endif @@ -214,7 +218,7 @@ SECTIONS _iend = .; } > IRAM -#if defined(CPU_COLDFIRE) || CONFIG_CPU==PP5020 +#if defined(CPU_COLDFIRE) || defined(CPU_ARM) .stack : { *(.stack) @@ -234,7 +238,7 @@ SECTIONS } > DRAM #endif -#if defined(CPU_COLDFIRE) || CONFIG_CPU==PP5020 +#if defined(CPU_COLDFIRE) || defined(CPU_ARM) .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram): #else .bss : diff --git a/firmware/backlight.c b/firmware/backlight.c index 740acd1d82..b475c61fc0 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -242,6 +242,8 @@ static void __backlight_on(void) /* set port L07 on */ outl(((0x100 | 1) << 7), 0x6000d12c); +#elif CONFIG_BACKLIGHT==BL_IRIVER_IFP7XX + GPIO3_SET = 1; #endif } @@ -279,6 +281,8 @@ static void __backlight_off(void) /* set port L07 off */ outl(((0x100 | 0) << 7), 0x6000d12c); +#elif CONFIG_BACKLIGHT==BL_IRIVER_IFP7XX + GPIO3_CLR = 1; #endif } diff --git a/firmware/crt0.S b/firmware/crt0.S index 0e75195530..1e07e0c029 100644 --- a/firmware/crt0.S +++ b/firmware/crt0.S @@ -37,6 +37,8 @@ start: * */ + msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */ + #ifndef BOOTLOADER #if CONFIG_CPU == PP5002 || CONFIG_CPU == PP5020 b pad_skip @@ -247,8 +249,8 @@ boot_table: /* Set up stack for IRQ mode */ msr cpsr_c, #0xd2 ldr sp, =irq_stack - /* Switch to supervisor mode, enable IRQ and FIQ processing */ - msr cpsr_c, #0x13 + /* Switch to supervisor mode */ + msr cpsr_c, #0xd3 ldr sp, =stackend bl main /* main() should never return */ diff --git a/firmware/drivers/adc.c b/firmware/drivers/adc.c index c9ae2daca8..ad10017d85 100644 --- a/firmware/drivers/adc.c +++ b/firmware/drivers/adc.c @@ -294,4 +294,38 @@ void adc_init(void) } +#elif CONFIG_CPU == PNX0101 + +static unsigned short adcdata[NUM_ADC_CHANNELS]; + +unsigned short adc_read(int channel) +{ + return adcdata[channel]; +} + +static void adc_tick(void) +{ + if (ADCST & 0x10) { + adcdata[0] = ADCCH0 & 0x3ff; + adcdata[1] = ADCCH1 & 0x3ff; + adcdata[2] = ADCCH2 & 0x3ff; + adcdata[3] = ADCCH3 & 0x3ff; + adcdata[4] = ADCCH4 & 0x3ff; + ADCST = 0xa; + } +} + +void adc_init(void) +{ + ADCR24 = 0xaaaaa; + ADCR28 = 0; + ADCST = 2; + ADCST = 0xa; + + while (!(ADCST & 0x10)); + adc_tick(); + + tick_add_task(adc_tick); +} + #endif diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 544cfec32e..0c17fce4c6 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -61,7 +61,7 @@ static bool flipped; /* buttons can be flipped to match the LCD flip */ #define REPEAT_INTERVAL_FINISH 5 /* the power-off button and number of repeated keys before shutting off */ -#if CONFIG_KEYPAD == IPOD_4G_PAD +#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) #define POWEROFF_BUTTON BUTTON_PLAY #define POWEROFF_COUNT 40 #else @@ -731,6 +731,47 @@ static int button_read(void) if (!remote_hold_button && ((data & 0x40) == 0)) btn |= BUTTON_RC_ON; +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD + + static bool hold_button = false; + + /* light handling */ + if (hold_button && !button_hold()) + { + backlight_on(); + } + hold_button = button_hold(); + + /* normal buttons */ + if (!button_hold()) + { + data = adc_read(ADC_BUTTONS); + + if (data < 0x151) + if (data < 0xc7) + if (data < 0x41) + btn = BUTTON_LEFT; + else + btn = BUTTON_RIGHT; + else + btn = BUTTON_SELECT; + else + if (data < 0x268) + if (data < 0x1d7) + btn = BUTTON_UP; + else + btn = BUTTON_DOWN; + else + if (data < 0x2f9) + btn = BUTTON_EQ; + else + if (data < 0x35c) + btn = BUTTON_MODE; + } + + if (!button_hold() && (adc_read(ADC_BUTTON_PLAY) < 0x64)) + btn |= BUTTON_PLAY; + #elif CONFIG_KEYPAD == RECORDER_PAD #ifdef HAVE_FMADC @@ -877,6 +918,13 @@ bool remote_button_hold(void) } #endif +#if CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +bool button_hold(void) +{ + return (GPIO5_READ & 4) ? false : true; +} +#endif + int button_status(void) { return lastbtn; diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 081a7a5267..523e8a1c09 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c @@ -135,6 +135,24 @@ void lcd_write_data( const unsigned char* data, int count ) { P2 |= 0x20; } } + +#elif CONFIG_CPU == PNX0101 + +void lcd_write_command(int cmd) +{ + while ((LCDSTAT & 3) != 3); + LCDCMD = cmd; +} + +void lcd_write_data( const unsigned char* data, int count ) +{ + int i; + for (i=0; i < count; i++) { + while ((LCDSTAT & 3) != 3); + LCDDATA = data[i]; + } +} + #endif /*** hardware configuration ***/ @@ -145,6 +163,8 @@ int lcd_default_contrast(void) return 30; #elif CONFIG_LCD == LCD_GMINI100 return 31; +#elif CONFIG_LCD == LCD_IFP7XX + return 45; #else return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49; #endif @@ -197,7 +217,11 @@ void lcd_set_flip(bool yesno) { lcd_write_command(LCD_SET_SEGMENT_REMAP | 0x01); lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION | 0x08); +#if CONFIG_LCD == LCD_IFP7XX + xoffset = 4; +#else xoffset = 0; +#endif } #endif } @@ -236,6 +260,9 @@ void lcd_init(void) P2CONL |= 0x5a; P2CONL &= 0x5b; P2CONH |= 1; +#elif CONFIG_CPU == PNX0101 + LCDREG10 = 0xf; + LCDREG04 = 0x4084; #else /* Initialize PB0-3 as output pins */ PBCR2 &= 0xff00; /* MD = 00 */ @@ -245,7 +272,11 @@ void lcd_init(void) /* inits like the original firmware */ lcd_write_command(LCD_SOFTWARE_RESET); lcd_write_command(LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4); +#if CONFIG_LCD == LCD_IFP7XX + lcd_write_command(LCD_SET_LCD_BIAS); +#else lcd_write_command(LCD_SET_1OVER4_BIAS_RATIO + 0); /* force 1/4 bias: 0 */ +#endif lcd_write_command(LCD_SET_POWER_CONTROL_REGISTER + 7); /* power control register: op-amp=1, regulator=1, booster=1 */ lcd_write_command(LCD_SET_DISPLAY_ON); diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index 141d985ee6..da97233e57 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c @@ -182,6 +182,8 @@ void ide_power_enable(bool on) P1 |= 0x08; else P1 &= ~0x08; +#elif CONFIG_CPU == PNX0101 + /* no ide controller */ #else /* SH1 based archos */ bool touched = false; #ifdef NEEDS_ATA_POWER_ON @@ -266,6 +268,9 @@ void power_off(void) /* We don't turn off the ipod, we put it in a deep sleep */ pcf50605_standby_mode(); #endif +#elif CONFIG_CPU == PNX0101 + GPIO1_CLR = 1 << 16; + GPIO2_SET = 1; #elif defined(GMINI_ARCH) P1 &= ~1; P1CON &= ~1; diff --git a/firmware/drivers/serial.c b/firmware/drivers/serial.c index 4c5c5a8172..27061c299b 100644 --- a/firmware/drivers/serial.c +++ b/firmware/drivers/serial.c @@ -27,8 +27,9 @@ #include "lcd.h" #include "serial.h" -#if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) && (CONFIG_CPU != PP5020) +#if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) && (CONFIG_CPU != PP5020) && (CONFIG_CPU != PNX0101) /* FIX: this doesn't work on iRiver or Gmini or iPod yet */ +/* iFP7xx has no remote */ #ifndef HAVE_MMC /* MMC takes serial port 1, so don't mess with it */ diff --git a/firmware/export/adc.h b/firmware/export/adc.h index 3ae9dae215..8364cdb012 100644 --- a/firmware/export/adc.h +++ b/firmware/export/adc.h @@ -29,6 +29,15 @@ #define ADC_BATTERY 2 #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ +#elif defined(IRIVER_IFP7XX) + +#define NUM_ADC_CHANNELS 5 + +#define ADC_BUTTONS 0 +#define ADC_BATTERY 1 +#define ADC_BUTTON_PLAY 2 +#define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ + #else #define NUM_ADC_CHANNELS 8 diff --git a/firmware/export/button.h b/firmware/export/button.h index 47912ef1df..7f50b1013c 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h @@ -45,6 +45,10 @@ bool button_hold(void); bool remote_button_hold(void); #endif +#if CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +bool button_hold(void); +#endif + #define BUTTON_NONE 0x0000 /* Shared button codes */ @@ -159,6 +163,15 @@ bool remote_button_hold(void); #define BUTTON_SCROLL_FWD 0x0010 #define BUTTON_SCROLL_BACK 0x0020 +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD + +#define BUTTON_PLAY 0x0001 +#define BUTTON_EQ 0x0002 +#define BUTTON_MODE 0x0004 +#define BUTTON_UP 0x0010 +#define BUTTON_DOWN 0x0020 +#define BUTTON_SELECT 0x0100 + #endif /* RECORDER/PLAYER/ONDIO/GMINI KEYPAD */ #endif /* _BUTTON_H_ */ diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h new file mode 100644 index 0000000000..086b455235 --- /dev/null +++ b/firmware/export/config-ifp7xx.h @@ -0,0 +1,96 @@ +/* + * This config file is for iriver iFP-799 + */ +#define IRIVER_IFP7XX_SERIES 1 + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 6 + +/* define this if you have recording possibility */ +/*#define HAVE_RECORDING 1*/ + +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP 1 + +/* define this if you have a colour LCD */ +/* #define HAVE_LCD_COLOR 1 */ + +/* LCD dimensions */ +#define LCD_WIDTH 128 +#define LCD_HEIGHT 64 +#define LCD_DEPTH 1 + +#define CONFIG_KEYPAD IRIVER_IFP7XX_PAD + +#define CONFIG_FLASH FLASH_IFP7XX + +#define HAVE_FAT16SUPPORT + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x30000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x20000 + +/* Define this if you have the WM8975 audio codec */ +/* #define HAVE_WM8975 */ + +#define HAVE_FLASH_DISK + +#ifndef SIMULATOR + +/* Define this if you have a Philips PNX0101 */ +#define CONFIG_CPU PNX0101 + +/* Define this if you want to use the PNX0101 i2c interface */ +#define CONFIG_I2C I2C_PNX0101 + +/* Type of mobile power */ +//#define CONFIG_BATTERY BATT_LIPOL1300 + +#define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */ + +/* Define this if the platform can charge batteries */ +//#define HAVE_CHARGING 1 + +/* define this if the hardware can be powered off while charging */ +//#define HAVE_POWEROFF_WHILE_CHARGING + +/* The start address index for ROM builds */ +#define ROM_START 0x00000000 + +/* Define this for LCD backlight available */ +#define CONFIG_BACKLIGHT BL_IRIVER_IFP7XX /* port controlled */ + +/* Define this to the CPU frequency */ +#define CPU_FREQ 30000000 + +#define CONFIG_LCD LCD_IFP7XX + +/* Offset ( in the firmware file's header ) to the file length */ +#define FIRMWARE_OFFSET_FILE_LENGTH 0 + +/* 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 USB_ISP1582 + +/* Virtual LED (icon) */ +#define CONFIG_LED LED_VIRTUAL + +/* Define this if you have adjustable CPU frequency */ +//#define HAVE_ADJUSTABLE_CPU_FREQ + +#define BOOTFILE_EXT "iriver" +#define BOOTFILE "rockbox." BOOTFILE_EXT + +#endif diff --git a/firmware/export/config.h b/firmware/export/config.h index 3f563ca9df..5e3bbeb645 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -41,6 +41,7 @@ #define TCC730 730 /* lacking a proper abbrivation */ #define PP5002 5002 #define PP5020 5020 +#define PNX0101 101 /* CONFIG_KEYPAD */ #define PLAYER_PAD 0 @@ -51,6 +52,7 @@ #define IRIVER_H300_PAD 5 #define IAUDIO_X5_PAD 6 #define IPOD_4G_PAD 7 +#define IRIVER_IFP7XX_PAD 8 /* CONFIG_REMOTE_KEYPAD */ #define H100_REMOTE 1 @@ -75,6 +77,7 @@ #define LCD_IPODCOLOR 6 /* as used by iPod Color/Photo */ #define LCD_IPODNANO 7 /* as used by iPod Nano */ #define LCD_IPODVIDEO 8 /* as used by iPod Video */ +#define LCD_IFP7XX 9 /* as used by iRiver iFP 7xx/8xx */ /* LCD_PIXELFORMAT */ #define RGB565 565 @@ -89,6 +92,7 @@ #define BL_IPOD4G 5 /* Apple iPod 4G */ #define BL_IPODNANO 6 /* Apple iPod Nano and iPod Video*/ #define BL_IRIVER_H300 7 /* IRiver PWM */ +#define BL_IRIVER_IFP7XX 8 /* IRiver GPIO */ /* CONFIG_I2C */ #define I2C_PLAYREC 0 /* Archos Player/Recorder style */ @@ -96,11 +100,15 @@ #define I2C_GMINI 2 /* Gmini style */ #define I2C_COLDFIRE 3 /* Coldfire style */ #define I2C_PP5020 4 /* PP5020 style */ +#define I2C_PNX0101 5 /* PNX0101 style */ /* CONFIG_LED */ #define LED_REAL 1 /* SW controlled LED (Archos recorders, player, Gmini) */ #define LED_VIRTUAL 2 /* Virtual LED (icon) (Archos Ondio) */ +/* CONFIG_FLASH */ +#define FLASH_IFP7XX 1 + /* CONFIG_RTC */ #define RTC_M41ST84W 1 /* Archos Recorder */ #define RTC_PCF50605 2 /* iPod 4G */ @@ -139,6 +147,8 @@ #include "config-ipodnano.h" #elif defined(IPOD_VIDEO) #include "config-ipodvideo.h" +#elif defined(IRIVER_IFP7XX) +#include "config-ifp7xx.h" #else /* no known platform */ #endif @@ -156,7 +166,7 @@ #endif /* define for all cpus from ARM family */ -#if (CONFIG_CPU == PP5020) +#if (CONFIG_CPU == PP5020) || (CONFIG_CPU == PNX0101) #define CPU_ARM #endif diff --git a/firmware/export/cpu.h b/firmware/export/cpu.h index a65786c69f..1ced9fce5e 100644 --- a/firmware/export/cpu.h +++ b/firmware/export/cpu.h @@ -33,3 +33,6 @@ #if CONFIG_CPU == PP5020 #include "pp5020.h" #endif +#if CONFIG_CPU == PNX0101 +#include "pnx0101.h" +#endif diff --git a/firmware/export/pnx0101.h b/firmware/export/pnx0101.h new file mode 100644 index 0000000000..4408c0aa5b --- /dev/null +++ b/firmware/export/pnx0101.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2005 by Tomasz Malesinski + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __PNX0101_H__ +#define __PNX0101_H__ + +#define GPIO0_READ (*(volatile unsigned long *)0x80003000) +#define GPIO0_SET (*(volatile unsigned long *)0x80003014) +#define GPIO0_CLR (*(volatile unsigned long *)0x80003018) +#define GPIO1_READ (*(volatile unsigned long *)0x80003040) +#define GPIO1_SET (*(volatile unsigned long *)0x80003054) +#define GPIO1_CLR (*(volatile unsigned long *)0x80003058) +#define GPIO2_READ (*(volatile unsigned long *)0x80003080) +#define GPIO2_SET (*(volatile unsigned long *)0x80003094) +#define GPIO2_CLR (*(volatile unsigned long *)0x80003098) +#define GPIO3_READ (*(volatile unsigned long *)0x800030c0) +#define GPIO3_SET (*(volatile unsigned long *)0x800030d4) +#define GPIO3_CLR (*(volatile unsigned long *)0x800030d8) +#define GPIO4_READ (*(volatile unsigned long *)0x80003100) +#define GPIO4_SET (*(volatile unsigned long *)0x80003114) +#define GPIO4_CLR (*(volatile unsigned long *)0x80003118) +#define GPIO5_READ (*(volatile unsigned long *)0x80003140) +#define GPIO5_SET (*(volatile unsigned long *)0x80003154) +#define GPIO5_CLR (*(volatile unsigned long *)0x80003158) +#define GPIO6_READ (*(volatile unsigned long *)0x80003180) +#define GPIO6_SET (*(volatile unsigned long *)0x80003194) +#define GPIO6_CLR (*(volatile unsigned long *)0x80003198) +#define GPIO7_READ (*(volatile unsigned long *)0x800031c0) +#define GPIO7_SET (*(volatile unsigned long *)0x800031d4) +#define GPIO7_CLR (*(volatile unsigned long *)0x800031d8) + +#define LCDREG04 (*(volatile unsigned long *)0x80104004) +#define LCDSTAT (*(volatile unsigned long *)0x80104008) +#define LCDREG10 (*(volatile unsigned long *)0x80104010) +#define LCDCMD (*(volatile unsigned long *)0x80104020) +#define LCDDATA (*(volatile unsigned long *)0x80104030) + +#define TIMERR00 (*(volatile unsigned long *)0x80020000) +#define TIMERR08 (*(volatile unsigned long *)0x80020008) +#define TIMERR0C (*(volatile unsigned long *)0x8002000c) + +#define ADCCH0 (*(volatile unsigned long *)0x80002400) +#define ADCCH1 (*(volatile unsigned long *)0x80002404) +#define ADCCH2 (*(volatile unsigned long *)0x80002408) +#define ADCCH3 (*(volatile unsigned long *)0x8000240c) +#define ADCCH4 (*(volatile unsigned long *)0x80002410) +#define ADCST (*(volatile unsigned long *)0x80002420) +#define ADCR24 (*(volatile unsigned long *)0x80002424) +#define ADCR28 (*(volatile unsigned long *)0x80002428) + +#endif diff --git a/firmware/export/system.h b/firmware/export/system.h index d197b06547..50cbaee686 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h @@ -299,7 +299,7 @@ static inline void invalidate_icache(void) #define CPUFREQ_MAX_MULT 11 #define CPUFREQ_MAX (CPUFREQ_MAX_MULT * CPU_FREQ) -#elif CONFIG_CPU == PP5020 +#elif defined(CPU_ARM) /* TODO: Implement set_irq_level and check CPU frequencies */ @@ -330,14 +330,26 @@ static inline unsigned long swap32(unsigned long value) } #define HIGHEST_IRQ_LEVEL (1) + static inline int set_irq_level(int level) { - int result=level; - return result; + unsigned long cpsr; + /* Read the old level and set the new one */ + asm volatile ("mrs %0,cpsr" : "=r" (cpsr)); + asm volatile ("msr cpsr_c,%0" + : : "r" ((cpsr & ~0x80) | (level << 7))); + return (cpsr >> 7) & 1; } #define invalidate_icache() +#if CONFIG_CPU == PNX0101 +typedef void (*interrupt_handler_t)(void); + +void irq_set_int_handler(int n, interrupt_handler_t handler); +void irq_enable_int(int n); +#endif + #elif CONFIG_CPU == TCC730 extern int smsc_version(void); diff --git a/firmware/kernel.c b/firmware/kernel.c index a353c4bdc9..b30a3bb12b 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c @@ -358,6 +358,41 @@ void tick_start(unsigned int interval_in_ms) #endif } +#elif CONFIG_CPU == PNX0101 + +void timer_handler(void) +{ + int i; + + /* Run through the list of tick tasks */ + for(i = 0;i < MAX_NUM_TICK_TASKS;i++) + { + if(tick_funcs[i]) + tick_funcs[i](); + } + + current_tick++; + wake_up_thread(); + + TIMERR0C = 1; +} + +void tick_start(unsigned int interval_in_ms) +{ + TIMERR08 &= ~0x80; + TIMERR0C = 1; + TIMERR08 &= ~0x80; + TIMERR08 |= 0x40; + TIMERR00 = 3000000 * interval_in_ms / 1000; + TIMERR08 &= ~0xc; + TIMERR0C = 1; + + irq_set_int_handler(4, timer_handler); + irq_enable_int(4); + + TIMERR08 |= 0x80; +} + #endif int tick_add_task(void (*f)(void)) diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c index 5e16353b85..62a48b5855 100644 --- a/firmware/pcm_playback.c +++ b/firmware/pcm_playback.c @@ -487,4 +487,55 @@ long pcm_get_bytes_waiting(void) return 0; } +#elif CONFIG_CPU == PNX0101 + +/* TODO: Implement for iFP7xx + For now, just implement some dummy functions. +*/ + +void pcm_init(void) +{ + +} + +void pcm_set_frequency(unsigned int frequency) +{ + (void)frequency; +} + +void pcm_play_data(void (*get_more)(unsigned char** start, long* size)) +{ + (void)get_more; +} + +void pcm_play_stop(void) +{ +} + +void pcm_play_pause(bool play) +{ + (void)play; +} + +bool pcm_is_paused(void) +{ + return false; +} + +bool pcm_is_playing(void) +{ + return false; +} + +void pcm_calculate_peaks(int *left, int *right) +{ + (void)left; + (void)right; +} + +long pcm_get_bytes_waiting(void) +{ + return 0; +} + #endif diff --git a/firmware/system.c b/firmware/system.c index 7afa3f720e..da15ee1122 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -1191,5 +1191,86 @@ int system_memory_guard(int newmode) return 0; } +#elif CONFIG_CPU==PNX0101 + +interrupt_handler_t interrupt_vector[0x1d] __attribute__ ((section(".idata"))); + +#define IRQ_REG(reg) (*(volatile unsigned long *)(0x80300000 + (reg))) + +static inline unsigned long irq_read(int reg) +{ + unsigned long v, v2; + do + { + v = IRQ_REG(reg); + v2 = IRQ_REG(reg); + } while (v != v2); + return v; +} + +#define IRQ_WRITE_WAIT(reg, val, cond) \ + do { unsigned long v, v2; \ + do { \ + IRQ_REG(reg) = (val); \ + v = IRQ_REG(reg); \ + v2 = IRQ_REG(reg); \ + } while ((v != v2) || !(cond)); \ + } while (0); + +static void UIE(void) {} + +void irq(void) +{ + int n = irq_read(0x100) >> 3; + (*(interrupt_vector[n]))(); +} + +void irq_enable_int(int n) +{ + IRQ_WRITE_WAIT(0x404 + n * 4, 0x4010000, v & 0x10000); +} + +void irq_set_int_handler(int n, interrupt_handler_t handler) +{ + interrupt_vector[n + 1] = handler; +} + +void system_init(void) +{ + int i; + + /* turn off watchdog */ + (*(volatile unsigned long *)0x80002804) = 0; + + /* + IRQ_WRITE_WAIT(0x100, 0, v == 0); + IRQ_WRITE_WAIT(0x104, 0, v == 0); + IRQ_WRITE_WAIT(0, 0, v == 0); + IRQ_WRITE_WAIT(4, 0, v == 0); + */ + + for (i = 0; i < 0x1c; i++) + { + IRQ_WRITE_WAIT(0x404 + i * 4, 0x1e000001, (v & 0x3010f) == 1); + IRQ_WRITE_WAIT(0x404 + i * 4, 0x4000000, (v & 0x10000) == 0); + IRQ_WRITE_WAIT(0x404 + i * 4, 0x10000001, (v & 0xf) == 1); + interrupt_vector[i + 1] = UIE; + } + interrupt_vector[0] = UIE; +} + + +void system_reboot(void) +{ + (*(volatile unsigned long *)0x80002804) = 1; + while (1); +} + +int system_memory_guard(int newmode) +{ + (void)newmode; + return 0; +} + #endif /* CONFIG_CPU */ diff --git a/firmware/thread.c b/firmware/thread.c index 13577e8efb..281801418f 100644 --- a/firmware/thread.c +++ b/firmware/thread.c @@ -326,7 +326,7 @@ int create_thread(void (*function)(void), void* stack, int stack_size, thread_stack[num_threads] = stack; thread_stack_size[num_threads] = stack_size; regs = &thread_contexts[num_threads]; -#if defined(CPU_COLDFIRE) || (CONFIG_CPU == SH7034) || (CONFIG_CPU == PP5020) +#if defined(CPU_COLDFIRE) || (CONFIG_CPU == SH7034) || defined(CPU_ARM) /* Align stack to an even 32 bit boundary */ regs->sp = (void*)(((unsigned int)stack + stack_size) & ~3); #elif CONFIG_CPU == TCC730 diff --git a/firmware/usb.c b/firmware/usb.c index 98f224f781..bd2fde3ab8 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -180,6 +180,9 @@ void usb_enable(bool on) outl(1, 0x40017F10); outl(inl(0x60006004) | 0x4, 0x60006004); } +#elif defined(USB_ISP1582) + /* TODO: Implement USB_ISP1582 */ + (void) on; #else #ifdef HAVE_LCD_BITMAP if(read_hw_mask() & USB_ACTIVE_HIGH) @@ -403,6 +406,10 @@ bool usb_detect(void) return false; } current_status = (USB_STATUS & 0x800)?true:false; +#endif +#ifdef USB_ISP1582 + /* TODO: Implement USB_ISP1582 */ + current_status = false; #endif return current_status; } diff --git a/tools/configure b/tools/configure index 68d2481922..f8fea6e76c 100755 --- a/tools/configure +++ b/tools/configure @@ -425,6 +425,7 @@ appsdir='\$(ROOTDIR)/apps' echo "13 - iPod Color/Photo" echo "14 - iPod Nano" echo "15 - iPod Video" + echo "16 - iriver iFP-790" getit=`input`; @@ -691,6 +692,20 @@ appsdir='\$(ROOTDIR)/apps' toolset=$ipodbitmaptools ;; + 16) + archos="ifp7xx" + target="-DIRIVER_IFP7XX" + memory=1 + arm7tdmicc + tool="cp" + output="rockbox.wma" + appextra="recorder:gui" + archosrom="" + flash="" + plugins="yes" + codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a" + ;; + *) echo "Please select an actual target platform!" exit diff --git a/tools/scramble.c b/tools/scramble.c index d19ef89173..44a1902424 100644 --- a/tools/scramble.c +++ b/tools/scramble.c @@ -171,6 +171,8 @@ int main (int argc, char** argv) modelnum = 4; else if(!strcmp(&argv[1][5], "ipvd")) modelnum = 5; + else if(!strcmp(&argv[1][5], "fp7x")) + modelnum = 6; else { fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); return 2;