diff --git a/firmware/SOURCES b/firmware/SOURCES index a0e4922154..fd83c05982 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -137,6 +137,8 @@ drivers/i2c-pp5020.c drivers/i2c-pp5002.c #elif CONFIG_I2C == I2C_PNX0101 drivers/i2c-pnx0101.c +#elif CONFIG_I2C == I2C_S3C2440 +/* no i2c driver yet */ #else drivers/i2c.c #endif @@ -256,3 +258,14 @@ target/arm/iriver/h10/usb-h10.c target/arm/iriver/h10/lcd-h10.c #endif #endif + +#ifdef GIGABEAT_F +#ifndef SIMULATOR +target/arm/gigabeat/meg-fx/backlight-meg-fx.c +target/arm/gigabeat/meg-fx/button-meg-fx.c +target/arm/gigabeat/meg-fx/ata-meg-fx.c +target/arm/gigabeat/meg-fx/power-meg-fx.c +target/arm/gigabeat/meg-fx/usb-meg-fx.c +target/arm/gigabeat/meg-fx/lcd-meg-fx.c +#endif +#endif diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 9c37a15537..8593eebea1 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -274,48 +274,6 @@ int ide_read_register(int reg) { return ide_reg_temp; } -#elif defined(TOSHIBA_GIGABEAT_F) - -/* Plain C read & write loops */ -#define PREFER_C_READING -#define PREFER_C_WRITING - -#define ATA_IOBASE 0x18000000 -#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*)(0x20000000 + 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 READ_PATTERN1_MASK 0xff -#define READ_PATTERN2_MASK 0xff -#define READ_PATTERN3_MASK 0xff -#define READ_PATTERN4_MASK 0xff - -#define SET_REG(reg,val) reg = (val) -#define SET_16BITREG(reg,val) reg = (val) - #endif #ifndef NOINLINE_ATTR @@ -323,6 +281,7 @@ int ide_read_register(int reg) { #endif #define ATA_FEATURE ATA_ERROR + #define ATA_STATUS ATA_COMMAND #define ATA_ALT_STATUS ATA_CONTROL @@ -348,7 +307,6 @@ int ide_read_register(int reg) { #define READ_TIMEOUT 5*HZ - static struct mutex ata_mtx; char ata_device; /* device 0 (master) or 1 (slave) */ int ata_io_address; /* 0x300 or 0x200, only valid on recorder */ @@ -430,6 +388,7 @@ static int wait_for_start_of_transfer(void) { if (!wait_for_bsy()) return 0; + return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ; } @@ -1402,16 +1361,16 @@ static int check_registers(void) return -1; for (i = 0; i<64; i++) { - SET_REG(ATA_NSECTOR, WRITE_PATTERN1); - SET_REG(ATA_SECTOR, WRITE_PATTERN2); - SET_REG(ATA_LCYL, WRITE_PATTERN3); - SET_REG(ATA_HCYL, WRITE_PATTERN4); - - if (((ATA_NSECTOR & READ_PATTERN1_MASK) == READ_PATTERN1) && - ((ATA_SECTOR & READ_PATTERN2_MASK) == READ_PATTERN2) && - ((ATA_LCYL & READ_PATTERN3_MASK) == READ_PATTERN3) && - ((ATA_HCYL & READ_PATTERN4_MASK) == READ_PATTERN4)) - return 0; + SET_REG(ATA_NSECTOR, WRITE_PATTERN1); + SET_REG(ATA_SECTOR, WRITE_PATTERN2); + SET_REG(ATA_LCYL, WRITE_PATTERN3); + SET_REG(ATA_HCYL, WRITE_PATTERN4); + + if (((ATA_NSECTOR & READ_PATTERN1_MASK) == READ_PATTERN1) && + ((ATA_SECTOR & READ_PATTERN2_MASK) == READ_PATTERN2) && + ((ATA_LCYL & READ_PATTERN3_MASK) == READ_PATTERN3) && + ((ATA_HCYL & READ_PATTERN4_MASK) == READ_PATTERN4)) + return 0; } return -2; #endif @@ -1957,12 +1916,15 @@ int ata_init(void) } rc = identify(); + if (rc) return -40 + rc; + multisectors = identify_info[47] & 0xff; DEBUGF("ata: %d sectors per ata request\n",multisectors); rc = freeze_lock(); + if (rc) return -50 + rc; @@ -1977,7 +1939,6 @@ int ata_init(void) sizeof(ata_stack), ata_thread_name); initialized = true; - } rc = set_multiple_mode(multisectors); if (rc) diff --git a/firmware/drivers/serial.c b/firmware/drivers/serial.c index f1cee96d51..46280bc8cc 100644 --- a/firmware/drivers/serial.c +++ b/firmware/drivers/serial.c @@ -28,10 +28,7 @@ #include "serial.h" -#if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) && \ - (CONFIG_CPU != PP5020) && (CONFIG_CPU != PNX0101) && \ - (CONFIG_CPU != PP5002) && (CONFIG_CPU != MCF5250) && \ - (CONFIG_CPU != PP5024) +#if CONFIG_CPU == SH7034 /* FIX: this doesn't work on iRiver or Gmini or iPod yet */ /* iFP7xx has no remote */ diff --git a/firmware/export/button.h b/firmware/export/button.h index 92c9415372..0e11da9da5 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h @@ -261,31 +261,6 @@ bool remote_button_hold(void); #define BUTTON_REMOTE 0 -#elif CONFIG_KEYPAD == GIGABEAT_PAD -/* Toshiba Gigabeat specific button codes */ - -#define BUTTON_POWER 0x00000001 -#define BUTTON_MENU 0x00000002 - -#define BUTTON_LEFT 0x00000004 -#define BUTTON_RIGHT 0x00000008 -#define BUTTON_UP 0x00000010 -#define BUTTON_DOWN 0x00000020 - -#define BUTTON_VOL_UP 0x00000040 -#define BUTTON_VOL_DOWN 0x00000080 - -#define BUTTON_SELECT 0x00000100 -#define BUTTON_A 0x00000200 - - -#define BUTTON_MAIN (BUTTON_POWER|BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\ - |BUTTON_UP|BUTTON_DOWN|BUTTON_VOL_UP|BUTTON_VOL_DOWN\ - |BUTTON_SELECT|BUTTON_A) - - -#define BUTTON_REMOTE 0 - #elif 0 /* diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 1ebbdbf908..fee2b79b2e 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h @@ -1,6 +1,8 @@ /* * This config file is for toshiba Gigabeat F */ +#define TARGET_TREE /* this target is using the target tree system */ + #define TOSHIBA_GIGABEAT_F 1 /* For Rolo and boot loader */ @@ -25,7 +27,10 @@ #define CONFIG_CODEC SWCODEC /* define this if you have a real-time clock */ -//#define CONFIG_RTC RTC_PCF50606 + +#if 0 /* TODO */ +#define CONFIG_RTC RTC_S3C2440 +#endif /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_GIGABEAT /* port controlled PWM */ @@ -42,7 +47,7 @@ /* Define this if you have the WM8975 audio codec */ #define HAVE_WM8751 -#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ +#define BATTERY_CAPACITY_DEFAULT 830 /* default battery capacity */ #ifndef SIMULATOR @@ -59,7 +64,7 @@ #define BATTERY_CAPACITY_INC 50 /* capacity increment */ #define BATTERY_TYPES_COUNT 1 /* only one type */ -#define BATTERY_SCALE_FACTOR 23437 /* FIX: this value is picked at random */ +#define BATTERY_SCALE_FACTOR 6852 /* FIX: this value is picked at random */ /* Hardware controlled charging? FIXME */ #define CONFIG_CHARGING CHARGING_SIMPLE @@ -74,7 +79,9 @@ #define CPU_FREQ 16934400 /* Define this if you have ATA power-off control */ +#if 0 /* TODO */ #define HAVE_ATA_POWER_OFF +#endif /* Virtual LED (icon) */ #define CONFIG_LED LED_VIRTUAL @@ -87,14 +94,18 @@ /* Offset ( in the firmware file's header ) to the real data */ #define FIRMWARE_OFFSET_FILE_DATA 8 -#define USB_IRIVERSTYLE +#define USB_GIGABEAT_STYLE /* Define this if you have adjustable CPU frequency */ +#if 0 /* TODO */ #define HAVE_ADJUSTABLE_CPU_FREQ +#endif #define BOOTFILE_EXT "gigabeat" #define BOOTFILE "rockbox." BOOTFILE_EXT +#if 0 /* TODO */ #define HAVE_BACKLIGHT_BRIGHTNESS +#endif #endif diff --git a/firmware/export/s3c2440.h b/firmware/export/s3c2440.h index 9b42256a38..799c14eb0e 100644 --- a/firmware/export/s3c2440.h +++ b/firmware/export/s3c2440.h @@ -143,6 +143,9 @@ #define LCDINTMSK (*(volatile int *)0x4D00005C) /* LCD interrupt mask */ #define TCONSEL (*(volatile int *)0x4D000060) /* TCON(LPC3600/LCC3600) control */ +/* The following should be computed but for now, we cheat. */ +#define FRAME ( (volatile short * ) 0x31E00000 ) /* LCD Frame buffer */ + /* NAND Flash */ #define NFCONF (*(volatile int *)0x4E000000) /* NAND flash configuration */ diff --git a/firmware/kernel.c b/firmware/kernel.c index 979dbb4759..7c5c74c662 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c @@ -415,7 +415,31 @@ void tick_start(unsigned int interval_in_ms) TIMERR08 |= 0x80; } +#elif CONFIG_CPU == S3C2440 +void tick_start(unsigned int interval_in_ms) +{ + unsigned long count; + /* period = (n + 1) / 128 , n = tick time count (1~127)*/ + count = interval_in_ms / 1000 * 128 - 1; + + if(count > 127) + { + panicf("Error! The tick interval is too long (%d ms)\n", + interval_in_ms); + return; + } + + /* Disable the tick */ + TICNT &= ~(1<<7); + /* Set the count value */ + TICNT |= count; + /* Start up the ticker */ + TICNT |= (1<<7); + + /* need interrupt handler ??? */ + +} #endif int tick_add_task(void (*f)(void)) diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c index f7a2de52c2..473c49f30d 100644 --- a/firmware/pcm_playback.c +++ b/firmware/pcm_playback.c @@ -55,6 +55,31 @@ static bool pcm_paused; /* the registered callback function to ask for more mp3 data */ static void (*callback_for_more)(unsigned char**, size_t*) IDATA_ATTR = NULL; +#if (CONFIG_CPU == PNX0101 || CONFIG_CPU == S3C2440) + +/* 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_stop(void) +{ +} + +size_t pcm_get_bytes_waiting(void) +{ + return 0; +} +#else #ifdef CPU_COLDFIRE #ifdef HAVE_SPDIF_OUT @@ -501,29 +526,13 @@ void pcm_init(void) dma_stop(); } -#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; -} +#endif void pcm_play_stop(void) { -} - -size_t pcm_get_bytes_waiting(void) -{ - return 0; + if (pcm_playing) { + dma_stop(); + } } #endif @@ -564,13 +573,6 @@ void pcm_mute(bool mute) sleep(HZ/16); } -void pcm_play_stop(void) -{ - if (pcm_playing) { - dma_stop(); - } -} - void pcm_play_pause(bool play) { bool needs_change = pcm_paused == play; @@ -620,11 +622,11 @@ void pcm_play_pause(bool play) IISFIFO_WR = (*(p++))<<16; p_size-=4; } -#elif (CONFIG_CPU == PNX0101) /* End wmcodecs */ +#elif (CONFIG_CPU == PNX0101 || CONFIG_CPU == S3C2440) /* End wmcodecs */ /* nothing yet */ #endif } else { -#if (CONFIG_CPU != PNX0101) +#if (CONFIG_CPU != PNX0101 && CONFIG_CPU != S3C2440) size_t next_size; unsigned char *next_start; void (*get_more)(unsigned char**, size_t*) = callback_for_more; @@ -665,7 +667,7 @@ void pcm_play_pause(bool play) #endif disable_fiq(); -#elif (CONFIG_CPU == PNX0101) /* End wmcodecs */ +#elif (CONFIG_CPU == PNX0101 || CONFIG_CPU == S3C2440) /* End wmcodecs */ /* nothing yet */ #endif } @@ -697,7 +699,7 @@ bool pcm_is_paused(void) { void pcm_calculate_peaks(int *left, int *right) { -#if (CONFIG_CPU == PNX0101) +#if (CONFIG_CPU == PNX0101 || CONFIG_CPU == S3C2440) (void)left; (void)right; #else diff --git a/firmware/system.c b/firmware/system.c index c635254a8a..2767f50edc 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -77,7 +77,15 @@ void cpu_idle_mode(bool on_off) } #endif +#if CONFIG_CPU == S3C2440 +void system_reboot(void) { +} + +void system_init(void) { +} + +#endif #if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR) bool detect_flashed_rockbox(void) { diff --git a/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c new file mode 100644 index 0000000000..58fec1e6a3 --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c @@ -0,0 +1,43 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 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. + * + ****************************************************************************/ +#include "config.h" +#include "cpu.h" +#include +#include "kernel.h" +#include "system.h" +#include "power.h" +#include "pcf50606.h" + +void ata_reset(void) +{ +} + +void ata_enable(bool on) +{ + (void)on; +} + +bool ata_is_coldstart(void) +{ + return true; /* TODO */ +} + +void ata_device_init(void) +{ +} diff --git a/firmware/target/arm/gigabeat/meg-fx/ata-target.h b/firmware/target/arm/gigabeat/meg-fx/ata-target.h new file mode 100644 index 0000000000..95b66ab1bd --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/ata-target.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 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. + * + ****************************************************************************/ +#ifndef ATA_TARGET_H +#define ATA_TARGET_H + +/* Plain C read & write loops */ +#define PREFER_C_READING +#define PREFER_C_WRITING + +#define ATA_IOBASE 0x18000000 +#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 + 0x0A))) +#define ATA_SELECT (*((volatile unsigned char*)(ATA_IOBASE + 0x0C))) +#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x0E))) +#define ATA_CONTROL (*((volatile unsigned char*)(0x20000000 + 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 READ_PATTERN1_MASK 0xff +#define READ_PATTERN2_MASK 0xff +#define READ_PATTERN3_MASK 0xff +#define READ_PATTERN4_MASK 0xff + +#define SET_REG(reg,val) reg = (val) +#define SET_16BITREG(reg,val) reg = (val) + +void ata_reset(void); +void ata_device_init(void); +bool ata_is_coldstart(void); + +#endif diff --git a/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c new file mode 100644 index 0000000000..8f7c30b5d7 --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c @@ -0,0 +1,38 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 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. + * + ****************************************************************************/ +#include "config.h" +#include "cpu.h" +#include "system.h" +#include "backlight.h" +#include "lcd.h" + +void __backlight_on(void) +{ +} + +void __backlight_off(void) +{ +} + +void __backlight_set_brightness(int val) +{ + /* The SC606 LED driver of the gigabeat series + * can set the brightness in 64 steps */ + val &= 0x3F; +} diff --git a/firmware/target/arm/gigabeat/meg-fx/backlight-target.h b/firmware/target/arm/gigabeat/meg-fx/backlight-target.h new file mode 100644 index 0000000000..3204293131 --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/backlight-target.h @@ -0,0 +1,26 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 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. + * + ****************************************************************************/ +#ifndef BACKLIGHT_TARGET_H +#define BACKLIGHT_TARGET_H + +void __backlight_on(void); +void __backlight_off(void); +void __backlight_set_brightness(int val); + +#endif diff --git a/firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c new file mode 100644 index 0000000000..88a1b4de09 --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c @@ -0,0 +1,84 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 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. + * + ****************************************************************************/ + +#include +#include "config.h" +#include "cpu.h" +#include "system.h" +#include "button.h" +#include "kernel.h" +#include "backlight.h" +#include "adc.h" +#include "system.h" + +void button_init_device(void) +{ + /* Power, Remote Play & Hold switch */ +} + +bool button_hold(void) +{ + return (GPGDAT & (1 << 15)); +} + +int button_read_device(void) +{ + int btn = BUTTON_NONE; + int touchpad = GPJDAT; + int buttons = GPGDAT; + + /* Check for hold first */ + if (buttons & (1 << 15)) + return btn; + + /* the side buttons */ + if (buttons & (1 << 0)) + btn |= BUTTON_POWER; + + if (buttons & (1 << 1)) + btn |= BUTTON_MENU; + + if (buttons & (1 << 2)) + btn |= BUTTON_VOL_UP; + + if (buttons & (1 << 3)) + btn |= BUTTON_VOL_DOWN; + + if (buttons & (1 << 4)) + btn |= BUTTON_A; + + /* the touchpad */ + if (touchpad & (1 << 0)) + btn |= BUTTON_UP; + + if (touchpad & (1 << 12)) + btn |= BUTTON_RIGHT; + + if (touchpad & (1 << 6)) + btn |= BUTTON_DOWN; + + if (touchpad & (1 << 7)) + btn |= BUTTON_LEFT; + + if (touchpad & (1 << 3)) + btn |= BUTTON_SELECT; + + return btn; +} + diff --git a/firmware/target/arm/gigabeat/meg-fx/button-target.h b/firmware/target/arm/gigabeat/meg-fx/button-target.h new file mode 100644 index 0000000000..95fb72e601 --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/button-target.h @@ -0,0 +1,58 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 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. + * + ****************************************************************************/ +#ifndef _BUTTON_TARGET_H_ +#define _BUTTON_TARGET_H_ + +#include +#include "config.h" + +#define HAS_BUTTON_HOLD + +bool button_hold(void); +void button_init_device(void); +int button_read_device(void); + +/* Toshiba Gigabeat specific button codes */ + +#define BUTTON_POWER 0x00000001 +#define BUTTON_MENU 0x00000002 + +#define BUTTON_LEFT 0x00000004 +#define BUTTON_RIGHT 0x00000008 +#define BUTTON_UP 0x00000010 +#define BUTTON_DOWN 0x00000020 + +#define BUTTON_VOL_UP 0x00000040 +#define BUTTON_VOL_DOWN 0x00000080 + +#define BUTTON_SELECT 0x00000100 +#define BUTTON_A 0x00000200 + + +#define BUTTON_MAIN (BUTTON_POWER|BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\ + |BUTTON_UP|BUTTON_DOWN|BUTTON_VOL_UP|BUTTON_VOL_DOWN\ + |BUTTON_SELECT|BUTTON_A) + + +#define BUTTON_REMOTE 0 + +#define POWEROFF_BUTTON BUTTON_POWER +#define POWEROFF_COUNT 10 + +#endif /* _BUTTON_TARGET_H_ */ diff --git a/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c new file mode 100644 index 0000000000..5ec62271ad --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c @@ -0,0 +1,31 @@ +#include "config.h" +#include "cpu.h" +#include "lcd.h" +#include "kernel.h" +#include "system.h" + +void lcd_init_device(void); +void lcd_update_rec(int, int, int, int); +void lcd_update(void); + +/* LCD init */ +void lcd_init_device(void) +{ +} + +/* Update a fraction of the display. */ +void lcd_update_rect(int x, int y, int width, int height) +{ + (void)x; + (void)y; + (void)width; + (void)height; + memcpy(FRAME, &lcd_framebuffer, sizeof(lcd_framebuffer)); +} + +/* Update the display. + This must be called after all other LCD functions that change the display. */ +void lcd_update(void) +{ + lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); +} diff --git a/firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c new file mode 100644 index 0000000000..688b44eaa6 --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c @@ -0,0 +1,75 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 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. + * + ****************************************************************************/ +#include "config.h" +#include "cpu.h" +#include +#include "kernel.h" +#include "system.h" +#include "power.h" +#include "pcf50606.h" + +#ifndef SIMULATOR + +void power_init(void) +{ + /* Charger detect */ +} + +bool charger_inserted(void) +{ + return !(GPFDAT & (1 << 4)); +} + +void ide_power_enable(bool on) +{ + (void)on; +} + +bool ide_powered(void) +{ + return true; +} + +void power_off(void) +{ +} + +#else /* SIMULATOR */ + +bool charger_inserted(void) +{ + return false; +} + +void charger_enable(bool on) +{ + (void)on; +} + +void power_off(void) +{ +} + +void ide_power_enable(bool on) +{ + (void)on; +} + +#endif /* SIMULATOR */ + diff --git a/firmware/target/arm/gigabeat/meg-fx/usb-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/usb-meg-fx.c new file mode 100644 index 0000000000..6e0f31e8c7 --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/usb-meg-fx.c @@ -0,0 +1,52 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 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. + * + ****************************************************************************/ +#include "config.h" +#include +#include "cpu.h" +#include "system.h" + +void usb_init_device(void) +{ +} + +bool usb_detect(void) +{ + return (GPFDAT & 1) ? false : true; +} + +void usb_enable(bool on) +{ + if(on) { + int i; + + GPBDAT &= 0x7EF; + GPBCON |= 1<<8; + + GPGDAT &= 0xE7FF; + GPGDAT |= 1<<11; + + for (i = 0; i < 10000000; i++) {continue;} + + GPBCON &= 0x2FFCFF; + GPBDAT |= 1<<5; + GPBDAT |= 1<<6; + } else { + /* TODO how turn USB mode back off again? */ + } +} diff --git a/firmware/target/arm/gigabeat/meg-fx/usb-target.h b/firmware/target/arm/gigabeat/meg-fx/usb-target.h new file mode 100644 index 0000000000..baeb539b38 --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/usb-target.h @@ -0,0 +1,26 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 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. + * + ****************************************************************************/ +#ifndef USB_TARGET_H +#define USB_TARGET_H + +bool usb_init_device(void); +bool usb_detect(void); +void usb_enable(bool on); + +#endif diff --git a/firmware/thread.c b/firmware/thread.c index 7cde9f5e9f..0013d49519 100644 --- a/firmware/thread.c +++ b/firmware/thread.c @@ -279,6 +279,8 @@ void switch_thread(void) 0x1f seems to trigger a reset; 0x0f is the only one other argument used by Archos. */ +#elif CONFIG_CPU == S3C2440 + CLKCON |= 2; #endif } #endif diff --git a/firmware/usb.c b/firmware/usb.c index a8a3e6b3eb..6be5fda093 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -77,6 +77,9 @@ void screen_dump(void); /* Nasty again. Defined in apps/ too */ #elif CONFIG_KEYPAD == IRIVER_H300_PAD #define USBPOWER_BUTTON BUTTON_REC #define USBPOWER_BTN_IGNORE BUTTON_ON +#elif CONFIG_KEYPAD == GIGABEAT_PAD +#define USBPOWER_BUTTON BUTTON_MENU +#define USBPOWER_BTN_IGNORE BUTTON_POWER #endif #endif /* HAVE_USB_POWER */ @@ -191,6 +194,8 @@ void usb_enable(bool on) (void) on; #elif defined(USB_X5STYLE) /* TODO X5 */ +#elif defined(USB_GIGABEAT_STYLE) + /* TODO gigabeat */ #else #ifdef HAVE_LCD_BITMAP if(read_hw_mask() & USB_ACTIVE_HIGH) diff --git a/tools/configure b/tools/configure index 78fb0d7812..449041094a 100755 --- a/tools/configure +++ b/tools/configure @@ -871,6 +871,10 @@ toolsdir='\$(ROOTDIR)/tools' plugins="yes" codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a" toolset=$genericbitmaptools + # architecture, manufacturer and model for the target-tree build + t_cpu="arm" + t_manufacturer="gigabeat" + t_model="meg-fx" ;; 21)