From 338e2bbb0c6673452c64378ef9e609d5c19c7558 Mon Sep 17 00:00:00 2001 From: Marcoen Hirschberg Date: Fri, 24 Feb 2006 15:42:52 +0000 Subject: first gigabeat commit git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8831 a1c6a512-1295-4272-9138-f99709370657 --- firmware/app.lds | 4 ++ firmware/boot.lds | 6 +++ firmware/drivers/ata.c | 40 +++++++++++++++++ firmware/drivers/power.c | 8 ++++ firmware/export/button.h | 14 ++++++ firmware/export/config-gigabeat.h | 94 +++++++++++++++++++++++++++++++++++++++ firmware/export/config.h | 11 ++++- firmware/export/cpu.h | 3 ++ 8 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 firmware/export/config-gigabeat.h (limited to 'firmware') diff --git a/firmware/app.lds b/firmware/app.lds index 74cca5a96a..5309311ee1 100644 --- a/firmware/app.lds +++ b/firmware/app.lds @@ -130,6 +130,10 @@ _pluginbuf = 0; #define DRAMORIG 0xc00000 + STUBOFFSET #define IRAMORIG 0x400000 #define IRAMSIZE 0x8000 +#elif CONFIG_CPU==S3C2440 +#define DRAMORIG 0x30000000 + STUBOFFSET +#define IRAMORIG 0x40000000 +#define IRAMSIZE 4K #else #define DRAMORIG 0x09000000 + STUBOFFSET #define IRAMORIG 0x0f000000 diff --git a/firmware/boot.lds b/firmware/boot.lds index 779b7b3b85..0b49917edd 100644 --- a/firmware/boot.lds +++ b/firmware/boot.lds @@ -38,6 +38,12 @@ INPUT(crt0.o) #define IRAMSIZE 0x18000 #define FLASHORIG 0x001f0000 #define FLASHSIZE 2M +#elif CONFIG_CPU == S3C2440 +#define DRAMORIG 0x30000000 +#define IRAMORIG 0x40000000 +#define IRAMSIZE 4K +#define FLASHORIG 0x0000000 +#define FLASHSIZE 1M #elif CONFIG_CPU == PP5002 #define DRAMORIG 0x28000000 #define IRAMORIG 0x40000000 diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index e4600e171a..8b3e54da44 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -246,6 +246,43 @@ int ide_read_register(int reg) { return ide_reg_temp; } +#elif defined(TOSHIBA_GIGABEAT_F) + +/* don't use sh7034 assembler routines */ +#define PREFER_C_READING +#define PREFER_C_WRITING + +#define ATA_IOBASE 0x20000000 +#define ATA_DATA (*((volatile unsigned short*)(ATA_IOBASE))) +#define ATA_ERROR (*((volatile unsigned char*)(ATA_IOBASE + 0x02))) +#define ATA_NSECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x04))) +#define ATA_SECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x06))) +#define ATA_LCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x08))) +#define ATA_HCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x10))) +#define ATA_SELECT (*((volatile unsigned char*)(ATA_IOBASE + 0x12))) +#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x14))) +#define ATA_CONTROL (*((volatile unsigned char*)(0x21000000 + 0x1c))) + +#define STATUS_BSY 0x80 +#define STATUS_RDY 0x40 +#define STATUS_DF 0x20 +#define STATUS_DRQ 0x08 +#define STATUS_ERR 0x01 +#define ERROR_ABRT 0x04 + +#define WRITE_PATTERN1 0xa5 +#define WRITE_PATTERN2 0x5a +#define WRITE_PATTERN3 0xaa +#define WRITE_PATTERN4 0x55 + +#define READ_PATTERN1 0xa5 +#define READ_PATTERN2 0x5a +#define READ_PATTERN3 0xaa +#define READ_PATTERN4 0x55 + +#define SET_REG(reg,val) reg = (val) +#define SET_16BITREG(reg,val) reg = (val) + #endif #define ATA_FEATURE ATA_ERROR @@ -1429,6 +1466,9 @@ int ata_init(void) #elif (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020) bool coldstart = false; /* TODO: Implement coldstart variable */ +#elif defined(TOSHIBA_GIGABEAT_F) + /* TODO */ + bool coldstart = true; #else bool coldstart = (PACR2 & 0x4000) != 0; #endif diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index d7750a33b2..b62121298d 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c @@ -122,6 +122,8 @@ bool charger_inserted(void) /* FM or V2, can also charge from the USB port */ return (adc_read(ADC_CHARGE_REGULATOR) < 0x1FF) || (adc_read(ADC_USB_POWER) < 0x1FF); +#elif defined(TOSHIBA_GIGABEAT_F) + return false; #else /* Player */ return (PADR & 1) == 0; @@ -189,6 +191,8 @@ void ide_power_enable(bool on) P1 &= ~0x08; #elif CONFIG_CPU == PNX0101 /* no ide controller */ +#elif defined(TOSHIBA_GIGABEAT_F) + /* Gigabeat TODO */ #else /* SH1 based archos */ bool touched = false; #ifdef NEEDS_ATA_POWER_ON @@ -241,6 +245,8 @@ bool ide_powered(void) return true; #elif defined(GMINI_ARCH) return (P1 & 0x08?true:false); +#elif defined(TOSHIBA_GIGABEAT_F) + return false; #else /* SH1 based archos */ #if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF) #ifdef ATA_POWER_PLAYERSTYLE @@ -283,6 +289,8 @@ void power_off(void) #elif defined(GMINI_ARCH) P1 &= ~1; P1CON &= ~1; +#elif defined(TOSHIBA_GIGABEAT_F) + /* FIXME: Can we turn the device off, or only enter sleep mode? */ #else #ifdef HAVE_POWEROFF_ON_PBDR and_b(~0x10, &PBDRL); diff --git a/firmware/export/button.h b/firmware/export/button.h index 484698e492..3ae1d37d52 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h @@ -197,6 +197,20 @@ bool button_hold(void); #define BUTTON_RC_REC (BUTTON_REMOTE | 0x00400000) +#elif CONFIG_KEYPAD == GIGABEAT_PAD + +/* TODO: These codes should relate to the hardware */ + +#define BUTTON_POWER 0x0001 +#define BUTTON_MENU 0x0002 +#define BUTTON_VOL_UP 0x0008 +#define BUTTON_VOL_DOWN 0x0010 +#define BUTTON_A 0x0020 +#define BUTTON_UP 0x0100 +#define BUTTON_DOWN 0x0200 +#define BUTTON_SELECT 0x0400 + + #endif /* RECORDER/PLAYER/ONDIO/GMINI KEYPAD */ #endif /* _BUTTON_H_ */ diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h new file mode 100644 index 0000000000..db99bf5d57 --- /dev/null +++ b/firmware/export/config-gigabeat.h @@ -0,0 +1,94 @@ +/* + * This config file is for toshiba Gigabeat F + */ +#define TOSHIBA_GIGABEAT_F 1 + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 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 240 +#define LCD_HEIGHT 320 +#define LCD_DEPTH 16 /* 65k colours */ +#define LCD_PIXELFORMAT RGB565 /* rgb565 */ + + +#define CONFIG_KEYPAD GIGABEAT_PAD + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +/* define this if you have a real-time clock */ +//#define CONFIG_RTC RTC_PCF50606 + +/* Define this for LCD backlight available */ +#define CONFIG_BACKLIGHT BL_GIGABEAT /* port controlled PWM */ + +/* 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 WM8975 audio codec */ +#define HAVE_WM8751 + +#ifndef SIMULATOR + +/* Define this if you have a Motorola SCF5249 */ +#define CONFIG_CPU S3C2440 + +/* Define this if you want to use coldfire's i2c interface */ +#define CONFIG_I2C I2C_S3C2440 + +/* Type of mobile power */ +#define CONFIG_BATTERY BATT_LIPOL1300 + +#define BATTERY_SCALE_FACTOR 23437 /* 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 size of the flash ROM */ +#define FLASH_SIZE 0x400000 + +/* Define this to the CPU frequency */ +#define CPU_FREQ 16934400 + +/* Define this if you have ATA power-off control */ +#define HAVE_ATA_POWER_OFF + +/* Virtual LED (icon) */ +#define CONFIG_LED LED_VIRTUAL + +#define CONFIG_LCD LCD_GIGABEAT + +/* 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_IRIVERSTYLE + +/* Define this if you have adjustable CPU frequency */ +#define HAVE_ADJUSTABLE_CPU_FREQ + +#define BOOTFILE_EXT "gigabeat" +#define BOOTFILE "rockbox." BOOTFILE_EXT + +#define HAVE_BACKLIGHT_BRIGHTNESS + +#endif diff --git a/firmware/export/config.h b/firmware/export/config.h index 0e673cb988..1557accde5 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -42,6 +42,7 @@ #define PP5002 5002 #define PP5020 5020 #define PNX0101 101 +#define S3C2440 2440 /* CONFIG_KEYPAD */ #define PLAYER_PAD 0 @@ -54,6 +55,7 @@ #define IPOD_4G_PAD 7 #define IPOD_3G_PAD 8 #define IRIVER_IFP7XX_PAD 9 +#define GIGABEAT_PAD 10 /* CONFIG_REMOTE_KEYPAD */ #define H100_REMOTE 1 @@ -80,6 +82,7 @@ #define LCD_IPODVIDEO 8 /* as used by iPod Video */ #define LCD_IPOD2BPP 9 /* as used by all greyscale iPods */ #define LCD_IFP7XX 10 /* as used by iRiver iFP 7xx/8xx */ +#define LCD_GIGABEAT 11 /* LCD_PIXELFORMAT */ #define HORIZONTAL_PACKING 1 @@ -99,6 +102,7 @@ #define BL_IRIVER_H300 8 /* IRiver PWM */ #define BL_IRIVER_IFP7XX 9 /* IRiver GPIO */ #define BL_IPODMINI 10 /* Apple iPod Mini */ +#define BL_GIGABEAT 11 /* Toshiba Gigabeat */ /* CONFIG_I2C */ #define I2C_PLAYREC 0 /* Archos Player/Recorder style */ @@ -108,6 +112,7 @@ #define I2C_PP5002 4 /* PP5002 style */ #define I2C_PP5020 5 /* PP5020 style */ #define I2C_PNX0101 6 /* PNX0101 style */ +#define I2C_S3C2440 7 /* CONFIG_LED */ #define LED_REAL 1 /* SW controlled LED (Archos recorders, player, Gmini) */ @@ -120,6 +125,7 @@ #define RTC_M41ST84W 1 /* Archos Recorder */ #define RTC_PCF50605 2 /* iPod 3G and 4G*/ #define RTC_PCF50606 3 /* iriver H300 */ +#define RTC_S3C2440 4 /* else HW controlled LED (iRiver H1x0) */ @@ -160,6 +166,8 @@ #include "config-ipod4g.h" #elif defined(IRIVER_IFP7XX) #include "config-ifp7xx.h" +#elif defined(GIGABEAT_F) +#include "config-gigabeat.h" #elif defined(IPOD_MINI) #include "config-ipodmini.h" #else @@ -185,7 +193,8 @@ #endif /* define for all cpus from ARM family */ -#if (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020) || (CONFIG_CPU == PNX0101) +#if (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020) || (CONFIG_CPU == PNX0101) || (CONFIG_CPU == S3C2440) + #define CPU_ARM #endif diff --git a/firmware/export/cpu.h b/firmware/export/cpu.h index d0b953ef6f..4c33ac96f4 100644 --- a/firmware/export/cpu.h +++ b/firmware/export/cpu.h @@ -39,3 +39,6 @@ #if CONFIG_CPU == PNX0101 #include "pnx0101.h" #endif +#if CONFIG_CPU == S3C2440 +#include "s3c2440.h" +#endif -- cgit v1.2.3