From d83e929f3fc369a5981e1e40e1c5307169a46cfc Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Thu, 12 Jan 2006 00:35:50 +0000 Subject: 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 --- 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 ++++++-- 7 files changed, 214 insertions(+), 4 deletions(-) create mode 100644 firmware/export/config-ifp7xx.h create mode 100644 firmware/export/pnx0101.h (limited to 'firmware/export') 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); -- cgit v1.2.3