Index: firmware/export/config-iaudio7.h =================================================================== --- firmware/export/config-iaudio7.h (revision 0) +++ firmware/export/config-iaudio7.h (revision 0) @@ -0,0 +1,136 @@ +/* + * This config file is for the Iaudio7 series + */ +#define TARGET_TREE /* this target is using the target tree system */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 30 + +/* define this if you have recording possibility */ +//#define HAVE_RECORDING + +/* Define bitmask of input sources - recordable bitmask can be defined + explicitly if different */ +//#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_SPDIF) + +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP + +/* define this if you have a colour LCD */ +#define HAVE_LCD_COLOR + +/* define this if you can flip your LCD */ +//#define HAVE_LCD_FLIP + +/* define this if you can invert the colours on your LCD */ +//#define HAVE_LCD_INVERT + +/* define this if you have access to the quickscreen */ +//#define HAVE_QUICKSCREEN + +/* define this if you have access to the pitchscreen */ +//#define HAVE_PITCHSCREEN + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + +#define HAVE_FAT16SUPPORT + +#if 0 /* not done yet */ +#define HAVE_USBSTACK +#define USE_HIGH_SPEED +#define USB_VENDOR_ID 0x6666 +#define USB_PRODUCT_ID 0x1234 + +#define USB_STORAGE +#define USB_SERIAL +#endif + +/* define this if you have a flash memory storage */ +#define HAVE_FLASH_STORAGE + +/* LCD dimensions */ +#define LCD_WIDTH 160 +#define LCD_HEIGHT 128 +/* 16bits for now... */ +#define LCD_DEPTH 16 /* 65536 colours */ +#define LCD_PIXELFORMAT RGB565 /*rgb565*/ + +/*#define LCD_PIXELFORMAT VERTICAL_PACKING*/ + +/* define this to indicate your device's keypad */ +#define CONFIG_KEYPAD PLAYER_PAD + +/* #define HAVE_BUTTON_DATA */ + +/* define this if you have a real-time clock */ +#define CONFIG_RTC RTC_TCC77X + +/* define this if you have RTC RAM available for settings */ +//#define HAVE_RTC_RAM + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x8000 + +#define AB_REPEAT_ENABLE 1 + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +/* Define this if you have the TLV320 audio codec */ +//#define HAVE_TLV320 + +/* TLV320 has no tone controls, so we use the software ones */ +//#define HAVE_SW_TONE_CONTROLS + +/* Define this for LCD backlight available */ +#define HAVE_BACKLIGHT + +#define CONFIG_I2C I2C_TCC77X + +#define BATTERY_CAPACITY_DEFAULT 540 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 540 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 540 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ + +/* define this if the unit should not shut down on low battery. */ +#define NO_LOW_BATTERY_SHUTDOWN + +#ifndef SIMULATOR + +/* Define this if you have a TCC770 */ +#define CONFIG_CPU TCC770 + +/* Define this if you have ATA power-off control */ +#define HAVE_ATA_POWER_OFF + +/* Define this to the CPU frequency */ +#define CPU_FREQ 120000000 + +/* 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 4 + +/* Offset ( in the firmware file's header ) to the real data */ +#define FIRMWARE_OFFSET_FILE_DATA 6 + +/* The start address index for ROM builds */ +/* #define ROM_START 0x11010 for behind original Archos */ +#define ROM_START 0x7010 /* for behind BootBox */ + +/* Software controlled LED */ +#define CONFIG_LED LED_VIRTUAL + +#define CONFIG_LCD LCD_IAUDIO7 + +#define BOOTFILE_EXT "i7" +#define BOOTFILE "rockbox." BOOTFILE_EXT +#define BOOTDIR "/" + +#endif /* SIMULATOR */ Index: firmware/export/tcc77x.h =================================================================== --- firmware/export/tcc77x.h (revision 18199) +++ firmware/export/tcc77x.h (working copy) @@ -59,8 +59,12 @@ #define PCLKCFG5 (*(volatile unsigned long *)0x80000430) #define PCLKCFG6 (*(volatile unsigned long *)0x80000434) +#define PCLK_DAI PCLKCFG6 + /* Device bits for SWRESET & BCLKCTR */ +#define DEV_DAI (1<<0) +#define DEV_USBD (1<<4) #define DEV_NAND (1<<16) /* ADC */ @@ -86,10 +90,29 @@ /* IRQ Controller */ - +#define EXT0_IRQ_MASK (1<<0) +#define EXT1_IRQ_MASK (1<<1) +#define EXT2_IRQ_MASK (1<<2) +#define EXT3_IRQ_MASK (1<<3) +#define I2SR_IRQ_MASK (1<<4) +#define I2ST_IRQ_MASK (1<<5) +/* ... */ #define TIMER0_IRQ_MASK (1<<6) -#define ADC_IRQ_MASK (1<<16) +/* ... */ +#define USBD_IRQ_MASK (1<<8) /* USB 2.0 device */ +/* ... */ +#define USBH_IRQ_MASK (1<<10) /* USB 1.1 host */ +/* ... */ +#define ADC_IRQ_MASK (1<<16) +/* ... */ +#define USB_DMA_IRQ_MASK (1<<26) /* USB DMA */ +#define DAI_RX_IRQ_MASK I2SR_IRQ_MASK +#define DAI_TX_IRQ_MASK I2ST_IRQ_MASK + + +#define USB_DMA_IRQ_MASK (1<<26) /* USB DMA */ + #define IEN (*(volatile unsigned long *)0x80000100) #define CREQ (*(volatile unsigned long *)0x80000104) #define IREQ (*(volatile unsigned long *)0x80000108) @@ -160,4 +183,32 @@ #define NFC_IREQ (*(volatile unsigned long *)0x90000060) #define NFC_RST (*(volatile unsigned long *)0x90000064) +/* Digital Audio Interface */ +#define DADI_L0 (*(volatile unsigned long *)0x80000000) +#define DADI_R0 (*(volatile unsigned long *)0x80000004) +#define DADI_L1 (*(volatile unsigned long *)0x80000008) +#define DADI_R1 (*(volatile unsigned long *)0x8000000C) +#define DADI_L2 (*(volatile unsigned long *)0x80000010) +#define DADI_R2 (*(volatile unsigned long *)0x80000014) +#define DADI_L3 (*(volatile unsigned long *)0x80000018) +#define DADI_R3 (*(volatile unsigned long *)0x8000001c) + +#define DADO_L0 (*(volatile unsigned long *)0x80000020) +#define DADO_R0 (*(volatile unsigned long *)0x80000024) +#define DADO_L1 (*(volatile unsigned long *)0x80000028) +#define DADO_R1 (*(volatile unsigned long *)0x8000002C) +#define DADO_L2 (*(volatile unsigned long *)0x80000030) +#define DADO_R2 (*(volatile unsigned long *)0x80000034) +#define DADO_L3 (*(volatile unsigned long *)0x80000038) +#define DADO_R3 (*(volatile unsigned long *)0x8000003c) + +#define DAMR (*(volatile unsigned long *)0x80000040) +#define DAVC (*(volatile unsigned long *)0x80000040) + +/* */ +#define DADI_L(x) (*(volatile unsigned long *)(0x80000000 + (x) * 8)) +#define DADI_R(x) (*(volatile unsigned long *)(0x80000004 + (x) * 8)) +#define DADO_L(x) (*(volatile unsigned long *)(0x80000020 + (x) * 8)) +#define DADO_R(x) (*(volatile unsigned long *)(0x80000024 + (x) * 8)) + #endif Index: firmware/export/hd66789r.h =================================================================== --- firmware/export/hd66789r.h (revision 0) +++ firmware/export/hd66789r.h (revision 0) @@ -0,0 +1,50 @@ +#ifndef _HD66789R_H_ +#define _HD66789R_H_ + +/* HD66789R registers */ +#define R_START_OSC 0x00 +#define R_DRV_OUTPUT_CONTROL 0x01 +#define R_DRV_WAVEFORM_CONTROL 0x02 +#define R_ENTRY_MODE 0x03 +#define R_COMPARE_REG1 0x04 +#define R_COMPARE_REG2 0x05 + +#define R_DISP_CONTROL1 0x07 +#define R_DISP_CONTROL2 0x08 +#define R_DISP_CONTROL3 0x09 + +#define R_FRAME_CYCLE_CONTROL 0x0b +#define R_EXT_DISP_IF_CONTROL 0x0c + +#define R_POWER_CONTROL1 0x10 +#define R_POWER_CONTROL2 0x11 +#define R_POWER_CONTROL3 0x12 +#define R_POWER_CONTROL4 0x13 + +#define R_RAM_ADDR_SET 0x21 +#define R_WRITE_DATA_2_GRAM 0x22 + +#define R_GAMMA_FINE_ADJ_POS1 0x30 +#define R_GAMMA_FINE_ADJ_POS2 0x31 +#define R_GAMMA_FINE_ADJ_POS3 0x32 +#define R_GAMMA_GRAD_ADJ_POS 0x33 + +#define R_GAMMA_FINE_ADJ_NEG1 0x34 +#define R_GAMMA_FINE_ADJ_NEG2 0x35 +#define R_GAMMA_FINE_ADJ_NEG3 0x36 +#define R_GAMMA_GRAD_ADJ_NEG 0x37 + +#define R_GAMMA_AMP_ADJ_RES_POS 0x38 +#define R_GAMMA_AMP_AVG_ADJ_RES_NEG 0x39 + +#define R_GATE_SCAN_POS 0x40 +#define R_VERT_SCROLL_CONTROL 0x41 +#define R_1ST_SCR_DRV_POS 0x42 +#define R_2ND_SCR_DRV_POS 0x43 +#define R_HORIZ_RAM_ADDR_POS 0x44 +#define R_VERT_RAM_ADDR_POS 0x45 + +#define R_ENTRY_MODE_HORZ 0x7030 +#define R_ENTRY_MODE_VERT 0x7038 + +#endif /* _HD66789R_H_ */ Index: firmware/SOURCES =================================================================== --- firmware/SOURCES (revision 18199) +++ firmware/SOURCES (working copy) @@ -1036,11 +1036,19 @@ #ifdef IAUDIO_7 #ifndef SIMULATOR drivers/nand_id.c +drivers/pcf50606.c target/arm/ata-nand-telechips.c +target/arm/tcc77x/system-tcc77x.c +target/arm/tcc77x/kernel-tcc77x.c +target/arm/tcc77x/timer-tcc77x.c target/arm/tcc77x/adc-tcc77x.c -target/arm/tcc77x/system-tcc77x.c +target/arm/tcc77x/pcm-tcc77x.c +target/arm/tcc77x/powermgmt-tcc77x.c +target/arm/tcc77x/usb-tcc77x.c +target/arm/tcc77x/debug-tcc77x.c target/arm/tcc77x/iaudio7/lcd-iaudio7.c target/arm/tcc77x/iaudio7/power-iaudio7.c +target/arm/tcc77x/iaudio7/button-iaudio7.c #endif /* SIMULATOR */ #endif /* IAUDIO_7 */ Index: firmware/target/arm/tcc77x/system-tcc77x.c =================================================================== --- firmware/target/arm/tcc77x/system-tcc77x.c (revision 18199) +++ firmware/target/arm/tcc77x/system-tcc77x.c (working copy) @@ -94,7 +94,7 @@ GPIOC = 0; GPIOD = 0x180; GPIOE = 0; - GPIOA_DIR = 0x84b0 + GPIOA_DIR = 0x84b0; GPIOB_DIR = 0x80800; GPIOC_DIR = 0x2000000; GPIOD_DIR = 0x3e3; Index: firmware/target/arm/tcc77x/iaudio7/adc-target.h =================================================================== --- firmware/target/arm/tcc77x/iaudio7/adc-target.h (revision 0) +++ firmware/target/arm/tcc77x/iaudio7/adc-target.h (revision 0) @@ -0,0 +1,28 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: adc-target.h 17847 2008-06-28 18:10:04Z bagder $ + * + * Copyright (C) 2007 Dave Chapman + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _ADC_TARGET_H_ +#define _ADC_TARGET_H_ + +#define NUM_ADC_CHANNELS 8 + +#define ADC_BUTTONS 0 + +#endif /* _ADC_TARGET_H_ */ Index: firmware/target/arm/tcc77x/iaudio7/backlight-target.h =================================================================== --- firmware/target/arm/tcc77x/iaudio7/backlight-target.h (revision 0) +++ firmware/target/arm/tcc77x/iaudio7/backlight-target.h (revision 0) @@ -0,0 +1,23 @@ +#ifndef BACKLIGHT_TARGET_H +#define BACKLIGHT_TARGET_H + +#include +#include "tcc77x.h" + +/* TODO: is GPIOD_2 really backlight control? */ +static inline bool _backlight_init(void) +{ + GPIOD_DIR |= 0x2; + return true; +} + +static inline void _backlight_on(void) +{ + GPIOD |= 0x2; +} + +static inline void _backlight_off(void) +{ + GPIOD &= ~0x2; +} +#endif Index: firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c =================================================================== --- firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c (revision 0) +++ firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c (revision 0) @@ -0,0 +1,247 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2008 by Vitja Makarov + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +/* + Thanks TMM for initial work. + Mostly based on lcd-h300.c + */ +#include + +#include +#include +#include +#include + +/* TODO: move register definition to header and share + it with h300 */ +#include "hd66789r.h" + +static bool display_on = false; /* is the display turned on? */ + +static inline void lcd_write_reg(int reg, int data) +{ + GPIOA &= ~0x400; + outw(0, 0x50010000); + outw(reg << 1, 0x50010000); + GPIOA |= 0x400; + + outw((data & 0xff00) >> 7, 0x50010008); + outw((data << 24) >> 23, 0x50010008); +} + +static void lcd_write_cmd(int reg) +{ + GPIOA &= ~0x400; + outw(0, 0x50010000); + outw(reg << 1, 0x50010000); + GPIOA |= 0x400; +} + +/* Do what OF do */ +static void lcd_delay(int x) +{ + int i; + + x *= 0xc35; + for (i = 0; i < x*8; i++) {} +} + + +static void _display_on(void) +{ + /* lcd init 1 */ + lcd_write_reg(0x0, 0x1); + lcd_delay(0xf); + lcd_write_reg(0x7, 0x0); + lcd_delay(0xa); + lcd_write_reg(0x11, 0x2); + lcd_write_reg(0x12, 0xa); + lcd_write_reg(0x13, 0xc5a); + lcd_write_reg(0x10, 0x4); + lcd_write_reg(0x10, 0x134); + lcd_write_reg(0x11, 0x111); + lcd_write_reg(0x12, 0x1c); + lcd_delay(0x28); + lcd_write_reg(0x13, 0x2c40); + lcd_write_reg(0x10, 0x510); + lcd_delay(0x3c); + + /* lcd init 2 */ + lcd_write_reg(0x1, 0x113); + lcd_write_reg(0x2, 0x700); + lcd_write_reg(0x3, 0x1038); + lcd_write_reg(0x8, 0x508); // 0x3c8, TMM + lcd_write_reg(0x9, 0x0); + lcd_write_reg(0xb, 0x3); + lcd_write_reg(0x21, 0x0); + lcd_write_reg(0x30, 0x406); + lcd_write_reg(0x31, 0x303); + lcd_write_reg(0x32, 0x0); + lcd_write_reg(0x33, 0x305); + lcd_write_reg(0x34, 0x404); + lcd_write_reg(0x35, 0x0); + lcd_write_reg(0x36, 0x0); + lcd_write_reg(0x37, 0x503); + lcd_write_reg(0x38, 0x1d05); + lcd_write_reg(0x39, 0x1d05); + lcd_write_reg(0x41, 0x0); + lcd_write_reg(0x42, 0x9f00); + lcd_write_reg(0x43, 0x9f00); + lcd_write_reg(0x44, 0x7f00); + lcd_write_reg(0x45, 0x9f00); + + /* lcd init 3 */ + lcd_write_reg(0x10, 0x4510); + lcd_write_reg(0x7, 0x5); + lcd_delay(0x28); + lcd_write_reg(0x7, 0x25); + lcd_write_reg(0x7, 0x27); + lcd_delay(0x28); + lcd_write_reg(0x7, 0x37); + + display_on = true; +} + +void lcd_init_device(void) +{ + /* Configure external memory banks */ + CSCFG1 = 0x3d500023; + + /* may be reset */ + GPIOA |= 0x8000; + + _display_on(); +} + +void lcd_enable(bool on) +{ + if(display_on == on) + return ; + + if(on) { + _display_on(); + lcd_call_enable_hook(); + } else { + /** Off sequence according to datasheet, p. 130 **/ + lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x0002); /* EQ=0, 18 clks/line */ + lcd_write_reg(R_DISP_CONTROL1, 0x0036); /* GON=1, DTE=1, REV=1, D1-0=10 */ + sleep(2); + + lcd_write_reg(R_DISP_CONTROL1, 0x0026); /* GON=1, DTE=0, REV=1, D1-0=10 */ + sleep(2); + + lcd_write_reg(R_DISP_CONTROL1, 0x0000); /* GON=0, DTE=0, D1-0=00 */ + + lcd_write_reg(R_POWER_CONTROL1, 0x0000); /* SAP2-0=000, AP2-0=000 */ + lcd_write_reg(R_POWER_CONTROL3, 0x0000); /* PON=0 */ + lcd_write_reg(R_POWER_CONTROL4, 0x0000); /* VCOMG=0 */ + + /* datasheet p. 131 */ + lcd_write_reg(R_POWER_CONTROL1, 0x0001); /* STB=1: standby mode */ + + display_on=false; + } +} + +bool lcd_enabled(void) +{ + return display_on; +} + + +#define RGB(r,g,b) ((((r)&0x3f) << 12)|(((g)&0x3f) << 6)|(((b)&0x3f))) + + +void lcd_update(void) +{ + lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); +} + +/* todo: need tests */ +void lcd_update_rect(int sx, int sy, int width, int height) +{ + int x, y; + + if (!display_on) + return ; + + if(width <= 0 || height <= 0) /* nothing to do */ + return; + + width += sx; + height += sy; + + if(width > LCD_WIDTH) + width = LCD_WIDTH; + if(height > LCD_HEIGHT) + height = LCD_HEIGHT; + + lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VERT & ~(1<<4)); + /* set update window */ + lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (LCD_HEIGHT - 1) << 8); + lcd_write_reg(R_VERT_RAM_ADDR_POS,((width - 1) << 8) | sx); + lcd_write_reg(R_RAM_ADDR_SET, (sx << 8) | (LCD_HEIGHT - sy - 1)); + lcd_write_cmd(R_WRITE_DATA_2_GRAM); + + for (y = sy; y < height; y++) { + for (x = sx; x < width; x++) { + fb_data c; + int color; + + c = lcd_framebuffer[y][x]; + color = c; + + /* TODO: our color is 18-bit */ + outw((color>>9)&0x1ff, 0x50010008); + outw((color) & 0x1ff, 0x50010008); + } + } +} + + +void lcd_set_contrast(int val) +{ + (void) val; +} + +void lcd_set_invert_display(bool yesno) +{ + (void) yesno; +} + +void lcd_set_flip(bool yesno) +{ + (void) yesno; +} + +/* todo: implement me */ +void lcd_blit_yuv(unsigned char * const src[3], + int src_x, int src_y, int stride, + int x, int y, int width, int height) +{ + if (!display_on) + return; + + width &= ~1; /* stay on the safe side */ + height &= ~1; + + + panicf("%s", __func__); +} Index: firmware/target/arm/tcc77x/iaudio7/button-target.h =================================================================== --- firmware/target/arm/tcc77x/iaudio7/button-target.h (revision 0) +++ firmware/target/arm/tcc77x/iaudio7/button-target.h (revision 0) @@ -0,0 +1,39 @@ +#ifndef _IAUDIO7_BUTTON_TARGET_H_ +#define _IAUDIO7_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); + +/* Main unit's buttons */ +#define BUTTON_POWER 0x00000001 +#define BUTTON_PLUS 0x00000002 +#define BUTTON_MINUS 0x00000004 +#define BUTTON_MENU 0x00000008 + +#define BUTTON_LEFT 0x00000010 +#define BUTTON_RIGHT 0x00000020 +#define BUTTON_UP 0x00000040 +#define BUTTON_DOWN 0x00000080 + + +#define BUTTON_PLAY 0x00000100 +#define BUTTON_STOP 0x00000200 + +#define BUTTON_SELECT 0x00400000 + + +#define BUTTON_ON BUTTON_POWER +/* No remote */ +#define BUTTON_REMOTE 0 + +/* Software power-off */ +#define POWEROFF_BUTTON BUTTON_POWER +#define POWEROFF_COUNT 10 + +#endif /* _IAUDIO7_BUTTON_TARGET_H_ */ Index: firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c =================================================================== --- firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c (revision 0) +++ firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c (revision 0) @@ -0,0 +1,57 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2008 by Vitja Makarov + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * 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 "button.h" +#include "adc.h" + +#include "button-target.h" + +void button_init_device(void) +{ +} + +/* TODO: handle sensor */ +int button_read_device(void) +{ + int btn = BUTTON_NONE; + int adc; + + adc = adc_read(0); + + if (0 == (GPIOA & 4)) + btn |= BUTTON_POWER; + + /* seems they can't be hold together */ + if (adc < 0x120) { + btn |= BUTTON_PLUS; + } else if (adc < 0x270) { + btn |= BUTTON_MINUS; + } else if (adc < 0x300) { + btn |= BUTTON_MENU; + } + + return btn; +} + +bool button_hold(void) +{ + return !(GPIOA & 0x2); +} Index: firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c =================================================================== --- firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c (revision 0) +++ firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c (revision 0) @@ -0,0 +1,59 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2008 by Vitja Makarov + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * 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 "kernel.h" +#include "system.h" +#include "power.h" + +#include "pcf50606.h" + +void power_init(void) +{ + /* simply OF values */ + pcf50606_write(PCF5060X_DCDEC1, 0xe7); + pcf50606_write(PCF5060X_IOREGC, 0xe9); + pcf50606_write(PCF5060X_D1REGC1, 0xf8); + pcf50606_write(PCF5060X_D2REGC1, 0xf2); + pcf50606_write(PCF5060X_D3REGC1, 0xf5); + pcf50606_write(PCF5060X_DCUDC1, 0xe6); + pcf50606_write(PCF5060X_LPREGC1, 0x00); + pcf50606_write(PCF5060X_LPREGC2, 0x02); +} + +void ide_power_enable(bool on) +{ +} + +bool ide_powered(void) +{ + return true; +} + +void power_off(void) +{ +} + +bool charger_inserted(void) +{ + return (GPIOA & 0x1) ? false:true; +} Index: firmware/target/arm/tcc77x/crt0.S =================================================================== --- firmware/target/arm/tcc77x/crt0.S (revision 18199) +++ firmware/target/arm/tcc77x/crt0.S (working copy) @@ -82,12 +82,15 @@ #ifdef TCCBOOT mov r0, #0x80000000 -#ifdef LOGIK_DAX +#if defined(LOGIK_DAX) ldr r0, [r0, #0x300] /* Hold button is GPIO A, pin 0x2 */ tst r0, #0x2 #elif defined(SANSA_M200) ldr r0, [r0, #0x310] /* Hold button is GPIO B, pin 0x200 */ tst r0, #0x200 +#elif defined(IAUDIO_7) + ldr r0, [r0, #0x300] /* Hold button is !GPIO A, pin 0x2 */ + tstne r0, #0x2 #else #error No bootup key detection implemented for this target #endif