1
0
Fork 0
forked from len0rd/rockbox

More iPod 3G changes from Seven Le Mesle, and some unification of the iPod code from me

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8581 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2006-02-05 16:52:22 +00:00
parent e8048cefed
commit d16a8b8845
10 changed files with 335 additions and 26 deletions

View file

@ -163,6 +163,17 @@ bool button_hold(void);
#define BUTTON_SCROLL_FWD 0x0010
#define BUTTON_SCROLL_BACK 0x0020
#elif CONFIG_KEYPAD == IPOD_3G_PAD
/* TODO: These codes should relate to the hardware */
#define BUTTON_MENU 0x0002
#define BUTTON_PLAY 0x0004
#define BUTTON_SELECT 0x0008
#define BUTTON_SCROLL_FWD 0x0010
#define BUTTON_SCROLL_BACK 0x0020
#define BUTTON_HOLD 0x0100
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
#define BUTTON_PLAY 0x0001

View file

@ -0,0 +1,95 @@
/*
* This config file is for the Apple iPod 3g
*/
#define APPLE_IPOD3G 1
/* For Rolo and boot loader */
#define MODEL_NUMBER 7
/* 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
/* LCD dimensions */
#define LCD_WIDTH 160
#define LCD_HEIGHT 128
#define LCD_DEPTH 2 /* 4 colours - 2bpp */
#define CONFIG_KEYPAD IPOD_3G_PAD
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
/* define this if you have a real-time clock */
#ifndef BOOTLOADER
#define CONFIG_RTC RTC_PCF50605
#endif
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
/* The number of bytes reserved for loadable codecs */
#define CODEC_SIZE 0x80000
/* The number of bytes reserved for loadable plugins */
#define PLUGIN_BUFFER_SIZE 0x80000
/* Define this if you have the WM8731L audio codec */
#define HAVE_WM8731L
/* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_IPOD3G /* port controlled */
#ifndef SIMULATOR
/* Define this if you have a PortalPlayer PP5002 */
#define CONFIG_CPU PP5002
/* Define this if you want to use the PP5002 i2c interface */
#define CONFIG_I2C I2C_PP5002
/* 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 to the CPU frequency */
#define CPU_FREQ 11289600
#define CONFIG_LCD LCD_IPOD2BPP
/* 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_IPODSTYLE
/* define this if the unit can be powered or charged via USB */
#define HAVE_USB_POWER
/* Virtual LED (icon) */
#define CONFIG_LED LED_VIRTUAL
/* Define this if you have adjustable CPU frequency */
//#define HAVE_ADJUSTABLE_CPU_FREQ
#define BOOTFILE_EXT "ipod"
#define BOOTFILE "rockbox." BOOTFILE_EXT
#endif

View file

@ -52,7 +52,8 @@
#define IRIVER_H300_PAD 5
#define IAUDIO_X5_PAD 6
#define IPOD_4G_PAD 7
#define IRIVER_IFP7XX_PAD 8
#define IPOD_3G_PAD 8
#define IRIVER_IFP7XX_PAD 9
/* CONFIG_REMOTE_KEYPAD */
#define H100_REMOTE 1
@ -77,7 +78,8 @@
#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 */
#define LCD_IPOD2BPP 9 /* as used by all greyscale iPods */
#define LCD_IFP7XX 10 /* as used by iRiver iFP 7xx/8xx */
/* LCD_PIXELFORMAT */
#define RGB565 565
@ -91,16 +93,18 @@
#define BL_GMINI 4 /* Archos GMini */
#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 */
#define BL_IPOD3G 7 /* Apple iPod 3g with dock */
#define BL_IRIVER_H300 8 /* IRiver PWM */
#define BL_IRIVER_IFP7XX 9 /* IRiver GPIO */
/* CONFIG_I2C */
#define I2C_PLAYREC 0 /* Archos Player/Recorder style */
#define I2C_ONDIO 1 /* Ondio style */
#define I2C_GMINI 2 /* Gmini style */
#define I2C_COLDFIRE 3 /* Coldfire style */
#define I2C_PP5020 4 /* PP5020 style */
#define I2C_PNX0101 5 /* PNX0101 style */
#define I2C_PP5002 4 /* PP5002 style */
#define I2C_PP5020 5 /* PP5020 style */
#define I2C_PNX0101 6 /* PNX0101 style */
/* CONFIG_LED */
#define LED_REAL 1 /* SW controlled LED (Archos recorders, player, Gmini) */
@ -111,7 +115,7 @@
/* CONFIG_RTC */
#define RTC_M41ST84W 1 /* Archos Recorder */
#define RTC_PCF50605 2 /* iPod 4G */
#define RTC_PCF50605 2 /* iPod 3G and 4G*/
#define RTC_PCF50606 3 /* iriver H300 */
/* else HW controlled LED (iRiver H1x0) */
@ -147,6 +151,8 @@
#include "config-ipodnano.h"
#elif defined(IPOD_VIDEO)
#include "config-ipodvideo.h"
#elif defined(IPOD_3G)
#include "config-ipod3g.h"
#elif defined(IRIVER_IFP7XX)
#include "config-ifp7xx.h"
#else
@ -172,7 +178,7 @@
#endif
/* define for all cpus from ARM family */
#if (CONFIG_CPU == PP5020) || (CONFIG_CPU == PNX0101)
#if (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020) || (CONFIG_CPU == PNX0101)
#define CPU_ARM
#endif
@ -193,6 +199,7 @@
(((CONFIG_CPU == SH7034) && !defined(PLUGIN)) || /* SH1 archos: core only */ \
(CONFIG_CPU == MCF5249) || /* Coldfire: core, plugins, codecs */ \
(CONFIG_CPU == PP5020) || /* iPod: core, plugins, codecs */ \
(CONFIG_CPU == PP5002) || /* iPod: core, plugins, codecs */ \
(CONFIG_CPU == TCC730)) /* CalmRISC16: core, (plugins, codecs) */
#define ICODE_ATTR __attribute__ ((section(".icode")))
#define ICONST_ATTR __attribute__ ((section(".irodata")))

View file

@ -33,6 +33,9 @@
#if CONFIG_CPU == PP5020
#include "pp5020.h"
#endif
#if CONFIG_CPU == PP5002
#include "pp5002.h"
#endif
#if CONFIG_CPU == PNX0101
#include "pnx0101.h"
#endif

View file

@ -0,0 +1,34 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Linus Nielsen Feltzing
*
* 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.
*
****************************************************************************/
/*
* PP5002 i2c driver
*
*/
#ifndef _I2C_PP5002_H
#define _I2C_PP5002_H
/* TODO: Fully implement i2c driver */
void i2c_init(void);
int i2c_readbyte(unsigned int dev_addr, int addr);
int ipod_i2c_send(unsigned int addr, int data0, int data1);
#endif

View file

@ -66,10 +66,10 @@ struct mutex
};
/* global tick variable */
#if (CONFIG_CPU == PP5020) && defined(BOOTLOADER)
#if ((CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020)) && defined(BOOTLOADER)
/* We don't enable interrupts in the iPod bootloader, so we need to fake
the current_tick variable */
#define current_tick ((*((volatile long*)0x60005010))/10000)
#define current_tick (USEC_TIMER/10000)
#else
extern long current_tick;
#endif

View file

@ -192,6 +192,8 @@ typedef void lcd_fastpixelfunc_type(fb_data *address);
/* Memory copy of display bitmap */
#if LCD_DEPTH == 1
extern fb_data lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH];
#elif CONFIG_LCD == LCD_IPOD2BPP
extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH/4];
#elif LCD_DEPTH == 2
extern fb_data lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH];
#elif LCD_DEPTH == 16
@ -200,7 +202,7 @@ extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH];
extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH];
#endif
#if CONFIG_BACKLIGHT==BL_IRIVER_H300
#if (CONFIG_BACKLIGHT==BL_IRIVER_H300) || (CONFIG_BACKLIGHT==BL_IPOD3G)
extern void lcd_enable(bool on);
#endif

103
firmware/export/pp5002.h Normal file
View file

@ -0,0 +1,103 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2004 by Thom Johansen
*
* 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 __PP5002_H__
#define __PP5002_H__
/* All info gleaned and/or copied from the iPodLinux project. */
#define GPIOA_ENABLE (*(volatile unsigned long *)(0xcf000000))
#define GPIOB_ENABLE (*(volatile unsigned long *)(0xcf000004))
#define GPIOC_ENABLE (*(volatile unsigned long *)(0xcf000008))
#define GPIOD_ENABLE (*(volatile unsigned long *)(0xcf00000c))
#define GPIOA_OUTPUT_EN (*(volatile unsigned long *)(0xcf000010))
#define GPIOB_OUTPUT_EN (*(volatile unsigned long *)(0xcf000014))
#define GPIOC_OUTPUT_EN (*(volatile unsigned long *)(0xcf000018))
#define GPIOD_OUTPUT_EN (*(volatile unsigned long *)(0xcf00001c))
#define GPIOA_OUTPUT_VAL (*(volatile unsigned long *)(0xcf000020))
#define GPIOB_OUTPUT_VAL (*(volatile unsigned long *)(0xcf000024))
#define GPIOC_OUTPUT_VAL (*(volatile unsigned long *)(0xcf000028))
#define GPIOD_OUTPUT_VAL (*(volatile unsigned long *)(0xcf00002c))
#define GPIOA_INPUT_VAL (*(volatile unsigned long *)(0xcf000030))
#define GPIOB_INPUT_VAL (*(volatile unsigned long *)(0xcf000034))
#define GPIOC_INPUT_VAL (*(volatile unsigned long *)(0xcf000038))
#define GPIOD_INPUT_VAL (*(volatile unsigned long *)(0xcf00003c))
#define GPIOA_INT_STAT (*(volatile unsigned long *)(0xcf000040))
#define GPIOB_INT_STAT (*(volatile unsigned long *)(0xcf000044))
#define GPIOC_INT_STAT (*(volatile unsigned long *)(0xcf000048))
#define GPIOD_INT_STAT (*(volatile unsigned long *)(0xcf00004c))
#define GPIOA_INT_EN (*(volatile unsigned long *)(0xcf000050))
#define GPIOB_INT_EN (*(volatile unsigned long *)(0xcf000054))
#define GPIOC_INT_EN (*(volatile unsigned long *)(0xcf000058))
#define GPIOD_INT_EN (*(volatile unsigned long *)(0xcf00005c))
#define GPIOA_INT_LEV (*(volatile unsigned long *)(0xcf000060))
#define GPIOB_INT_LEV (*(volatile unsigned long *)(0xcf000064))
#define GPIOC_INT_LEV (*(volatile unsigned long *)(0xcf000068))
#define GPIOD_INT_LEV (*(volatile unsigned long *)(0xcf00006c))
#define GPIOA_INT_CLR (*(volatile unsigned long *)(0xcf000070))
#define GPIOB_INT_CLR (*(volatile unsigned long *)(0xcf000074))
#define GPIOC_INT_CLR (*(volatile unsigned long *)(0xcf000078))
#define GPIOD_INT_CLR (*(volatile unsigned long *)(0xcf00007c))
#define DEV_RS (*(volatile unsigned long *)( 0xcf005030))
#define DEV_EN (*(volatile unsigned long *)( 0xcf005000))
#define CPU_INT_STAT (*(volatile unsigned long*)(0xcf001000))
#define CPU_INT_EN (*(volatile unsigned long*)(0xcf001024))
#define CPU_INT_CLR (*(volatile unsigned long*)(0xcf001028))
#define USB2D_IDENT (*(volatile unsigned long*)(0xc5000000))
#define USB_STATUS (*(volatile unsigned long*)(0xc50001a4))
#define IISCONFIG (*(volatile unsigned long*)(0xc0002500))
#define IISFIFO_CFG (*(volatile unsigned long*)(0xc000251c))
#define IISFIFO_WR (*(volatile unsigned long*)(0xc0002540))
#define IISFIFO_RD (*(volatile unsigned long*)(0xc0002580))
/* PP5002 registers */
#define PP5002_TIMER1 0xcf001100
#define PP5002_TIMER1_ACK 0xcf001104
#define PP5002_TIMER2 0xcf001108
#define PP5002_TIMER2_ACK 0xcf00110c
#define PP5002_TIMER_STATUS 0xcf001110
#define IDE_IRQ 1
#define SER0_IRQ 4
#define I2S_IRQ 5
#define SER1_IRQ 7
#define TIMER1_IRQ 11
#define GPIO_IRQ 14
#define DMA_OUT_IRQ 30
#define DMA_IN_IRQ 31
#define TIMER1_MASK (1 << TIMER1_IRQ)
#define I2S_MASK (1 << I2S_IRQ)
#define IDE_MASK (1 << IDE_IRQ)
#define GPIO_MASK (1 << GPIO_IRQ)
#define SER0_MASK (1 << SER0_IRQ)
#define SER1_MASK (1 << SER1_IRQ)
#define TIMER1_VAL (*(volatile unsigned long *)(0xcf001104))
#define TIMER1_CFG (*(volatile unsigned long *)(0xcf001100))
#define USEC_TIMER (*(volatile unsigned long *)(0xcf001110))
#endif

View file

@ -29,7 +29,7 @@ extern void system_init(void);
extern long cpu_frequency;
#if CONFIG_CPU==PP5020
#if (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020)
#define inl(a) (*(volatile unsigned long *) (a))
#define outl(a,b) (*(volatile unsigned long *) (b) = (a))
#define inb(a) (*(volatile unsigned char *) (a))
@ -40,8 +40,8 @@ extern unsigned int ipod_hw_rev;
static inline void udelay(unsigned usecs)
{
unsigned start = inl(0x60005010);
while ((inl(0x60005010) - start) < usecs);
unsigned start = USEC_TIMER;
while ((USEC_TIMER - start) < usecs);
}
#endif

54
firmware/export/wm8731l.h Normal file
View file

@ -0,0 +1,54 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2005 by Dave Chapman
*
* 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 _WM8731L_H
#define _WM8731L_H
extern void wm8731l_reset(void);
extern int wm8731l_init(void);
extern void wm8731l_enable_output(bool enable);
extern int wm8731l_set_master_vol(int vol_l, int vol_r);
extern int wm8731l_set_mixer_vol(int channel1, int channel2);
extern void wm8731l_set_bass(int value);
extern void wm8731l_set_treble(int value);
extern int wm8731l_mute(int mute);
extern void wm8731l_close(void);
extern void wm8731l_set_nsorder(int order);
extern void wm8731l_set_sample_rate(int sampling_control);
extern void wm8731l_enable_recording(bool source_mic);
extern void wm8731l_disable_recording(void);
extern void wm8731l_set_recvol(int left, int right, int type);
extern void wm8731l_set_monitor(int enable);
/* Register settings for the supported samplerates: */
#define WM8731L_8000HZ 0x4d
/*
IpodLinux don't seem to support those sampling rate with the wm8731L chip
#define WM8975_16000HZ 0x55
#define WM8975_22050HZ 0x77
#define WM8975_24000HZ 0x79
*/
#define WM8731L_32000HZ 0x59
#define WM8731L_44100HZ 0x63
#define WM8731L_48000HZ 0x41
#define WM8731L_88200HZ 0x7f
#define WM8731L_96000HZ 0x5d
#endif /* _WM8975_H */