Index: bootloader/telechips.c =================================================================== --- bootloader/telechips.c (revision 18199) +++ bootloader/telechips.c (working copy) @@ -177,8 +177,8 @@ unsigned char* loadbuffer = (unsigned char*)LOAD_ADDRESS; #endif + system_init(); power_init(); - system_init(); #ifndef COWON_D2 /* The D2 doesn't enable threading or interrupts */ kernel_init(); Index: tools/configure =================================================================== --- tools/configure (revision 18199) +++ tools/configure (working copy) @@ -1290,7 +1290,7 @@ target="-DIAUDIO_7" memory=16 # always arm946cc - tool="$rootdir/tools/scramble -add i7" + tool="$rootdir/tools/scramble -tcc=crc" boottool="$rootdir/tools/scramble -tcc=crc" bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 5" Index: apps/plugins/plugin.lds =================================================================== --- apps/plugins/plugin.lds (revision 18199) +++ apps/plugins/plugin.lds (working copy) @@ -80,7 +80,7 @@ #define IRAMORIG DRAMORIG #define IRAMSIZE 0x4000 #define IRAM DRAM -#elif defined(CPU_TCC780X) +#elif defined(CPU_TCC780X) || defined(CPU_TCC77X) #define DRAMORIG 0x20000000 /*#define IRAMORIG 0x1000c000 #define IRAMSIZE 0xc000*/ Index: firmware/export/config-iaudio7.h =================================================================== --- firmware/export/config-iaudio7.h (revision 0) +++ firmware/export/config-iaudio7.h (revision 0) @@ -0,0 +1,146 @@ +/* + * 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 555 + +/* 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 have LCD enable function */ +#define HAVE_LCD_ENABLE + + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + + + +#define HAVE_FAT16SUPPORT + +/* Hehe */ +#if 0 +#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 SANSA_M200_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 + +/* The D2 uses a WM8985 codec */ +#define HAVE_WM8731 +#define CODEC_SLAVE + +/* 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 + +/* Software controlled LED */ +#define CONFIG_LED LED_VIRTUAL + +#define CONFIG_LCD LCD_IAUDIO67 + +#define BOOTFILE_EXT "i7" +#define BOOTFILE "rockbox." BOOTFILE_EXT +#define BOOTDIR "/" + +#define THREAD_EXTRA_CHECKS + +#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) @@ -988,7 +988,7 @@ target/arm/tcc77x/logikdax/power-logikdax.c #ifndef BOOTLOADER target/arm/tcc77x/debug-tcc77x.c -target/arm/tcc77x/pcm-tcc77x.c +target/arm/pcm-tcc7xx.c #endif /* BOOTLOADER */ #endif /* SIMULATOR */ #endif /* LOGIK_DAX */ @@ -1008,7 +1008,7 @@ target/arm/tcc77x/m200/power-m200.c #ifndef BOOTLOADER target/arm/tcc77x/debug-tcc77x.c -target/arm/tcc77x/pcm-tcc77x.c +target/arm/pcm-tcc7xx.c #endif /* BOOTLOADER */ #endif /* SIMULATOR */ #endif /* SANSA_M200 */ @@ -1028,7 +1028,7 @@ target/arm/tcc77x/c100/power-c100.c #ifndef BOOTLOADER target/arm/tcc77x/debug-tcc77x.c -target/arm/tcc77x/pcm-tcc77x.c +target/arm/pcm-tcc7xx.c #endif /* BOOTLOADER */ #endif /* SIMULATOR */ #endif /* SANSA_C100 */ @@ -1036,11 +1036,22 @@ #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/powermgmt-tcc77x.c +target/arm/tcc77x/usb-tcc77x.c target/arm/tcc77x/iaudio7/lcd-iaudio7.c target/arm/tcc77x/iaudio7/power-iaudio7.c +target/arm/tcc77x/iaudio7/button-iaudio7.c +#ifndef BOOTLOADER +target/arm/wmcodec-telechips.c +target/arm/pcm-tcc7xx.c +target/arm/tcc77x/debug-tcc77x.c +#endif /* BOOTLOADER */ #endif /* SIMULATOR */ #endif /* IAUDIO_7 */ @@ -1063,7 +1074,7 @@ target/arm/tcc780x/timer-tcc780x.c target/arm/wmcodec-telechips.c target/arm/tcc780x/debug-tcc780x.c -target/arm/tcc780x/pcm-tcc780x.c +target/arm/pcm-tcc7xx.c target/arm/tcc780x/cowond2/audio-cowond2.c #endif /* BOOTLOADER */ #endif /* SIMULATOR */ Index: firmware/target/arm/tcc780x/pcm-tcc780x.c =================================================================== --- firmware/target/arm/tcc780x/pcm-tcc780x.c (revision 18199) +++ firmware/target/arm/tcc780x/pcm-tcc780x.c (working copy) @@ -1,314 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2006 by Michael Sevakis - * Copyright (C) 2008 by Rob Purchase - * - * 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 "system.h" -#include "kernel.h" -#include "logf.h" -#include "audio.h" -#include "sound.h" -#include "pcm.h" - -struct dma_data -{ -/* NOTE: The order of size and p is important if you use assembler - optimised fiq handler, so don't change it. */ - uint16_t *p; - size_t size; -#if NUM_CORES > 1 - unsigned core; -#endif - int locked; - int state; -}; - -/**************************************************************************** - ** Playback DMA transfer - **/ -struct dma_data dma_play_data SHAREDBSS_ATTR = -{ - /* Initialize to a locked, stopped state */ - .p = NULL, - .size = 0, -#if NUM_CORES > 1 - .core = 0x00, -#endif - .locked = 0, - .state = 0 -}; - -static unsigned long pcm_freq SHAREDDATA_ATTR = HW_SAMPR_DEFAULT; /* 44.1 is default */ - -void pcm_postinit(void) -{ - /*audiohw_postinit();*/ - pcm_apply_settings(); -} - -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - unsigned long addr = (unsigned long)dma_play_data.p; - size_t cnt = dma_play_data.size; - *count = cnt >> 2; - return (void *)((addr + 2) & ~3); -} - -void pcm_play_dma_init(void) -{ - /* Set DAI clock divided from PLL0 (192MHz). - The best approximation of 256*44.1kHz is 11.291MHz. */ - BCLKCTR &= ~DEV_DAI; - PCLK_DAI = (1<<28) | 61682; /* DCO mode */ - BCLKCTR |= DEV_DAI; - - /* Enable DAI block in Master mode, 256fs->32fs, 16bit LSB */ - DAMR = 0x3c8e80; - DAVC = 0x0; /* Digital Volume = max */ - - /* Set DAI interrupts as FIQs */ - IRQSEL = ~(DAI_RX_IRQ_MASK | DAI_TX_IRQ_MASK); - - pcm_set_frequency(SAMPR_44); - - /* Initialize default register values. */ - audiohw_init(); - - /* Power on */ - audiohw_enable_output(true); - - /* Unmute the master channel (DAC should be at zero point now). */ - audiohw_mute(false); - - dma_play_data.size = 0; -#if NUM_CORES > 1 - dma_play_data.core = 0; /* no core in control */ -#endif -} - -void pcm_apply_settings(void) -{ - pcm_curr_sampr = pcm_freq; -} - -void pcm_set_frequency(unsigned int frequency) -{ - (void) frequency; - pcm_freq = HW_SAMPR_DEFAULT; -} - -static void play_start_pcm(void) -{ - pcm_apply_settings(); - - DAMR &= ~(1<<14); /* disable tx */ - dma_play_data.state = 1; - - if (dma_play_data.size >= 16) - { - DADO_L(0) = *dma_play_data.p++; - DADO_R(0) = *dma_play_data.p++; - DADO_L(1) = *dma_play_data.p++; - DADO_R(1) = *dma_play_data.p++; - DADO_L(2) = *dma_play_data.p++; - DADO_R(2) = *dma_play_data.p++; - DADO_L(3) = *dma_play_data.p++; - DADO_R(3) = *dma_play_data.p++; - dma_play_data.size -= 16; - } - - DAMR |= (1<<14); /* enable tx */ -} - -static void play_stop_pcm(void) -{ - DAMR &= ~(1<<14); /* disable tx */ - dma_play_data.state = 0; -} - -void pcm_play_dma_start(const void *addr, size_t size) -{ - dma_play_data.p = (void *)(((uintptr_t)addr + 2) & ~3); - dma_play_data.size = (size & ~3); - -#if NUM_CORES > 1 - /* This will become more important later - and different ! */ - dma_play_data.core = processor_id(); /* save initiating core */ -#endif - - IEN |= DAI_TX_IRQ_MASK; - - play_start_pcm(); -} - -void pcm_play_dma_stop(void) -{ - play_stop_pcm(); - dma_play_data.size = 0; -#if NUM_CORES > 1 - dma_play_data.core = 0; /* no core in control */ -#endif -} - -void pcm_play_lock(void) -{ - int status = disable_fiq_save(); - - if (++dma_play_data.locked == 1) - { - IEN &= ~DAI_TX_IRQ_MASK; - } - - restore_fiq(status); -} - -void pcm_play_unlock(void) -{ - int status = disable_fiq_save(); - - if (--dma_play_data.locked == 0 && dma_play_data.state != 0) - { - IEN |= DAI_TX_IRQ_MASK; - } - - restore_fiq(status); -} - -void pcm_play_dma_pause(bool pause) -{ - (void) pause; -} - -size_t pcm_get_bytes_waiting(void) -{ - return dma_play_data.size & ~3; -} - -#if 1 -void fiq_handler(void) ICODE_ATTR __attribute__((naked)); -void fiq_handler(void) -{ - /* r10 contains DADO_L0 base address (set in crt0.S to minimise code in the - * FIQ handler. r11 contains address of p (also set in crt0.S). Most other - * addresses we need are generated by using offsets with these two. - * r8 and r9 contains local copies of p and size respectively. - * r0-r3 and r12 is a working register. - */ - asm volatile ( - "mov r8, #0xc000 \n" /* DAI_TX_IRQ_MASK | DAI_RX_IRQ_MASK */ - "ldr r9, =0xf3001004 \n" /* CREQ */ - "str r8, [r9] \n" /* clear DAI IRQs */ - - "ldmia r11, { r8-r9 } \n" /* r8 = p, r9 = size */ - "cmp r9, #0x10 \n" /* is size <16? */ - "blt .more_data \n" /* if so, ask pcmbuf for more data */ - - ".fill_fifo: \n" - "ldr r12, [r8], #4 \n" /* load two samples */ - "str r12, [r10, #0x0] \n" /* write top sample to DADO_L0 */ - "mov r12, r12, lsr #16 \n" /* put right sample at the bottom */ - "str r12, [r10, #0x4] \n" /* write low sample to DADO_R0*/ - "ldr r12, [r8], #4 \n" /* load two samples */ - "str r12, [r10, #0x8] \n" /* write top sample to DADO_L1 */ - "mov r12, r12, lsr #16 \n" /* put right sample at the bottom */ - "str r12, [r10, #0xc] \n" /* write low sample to DADO_R1*/ - "ldr r12, [r8], #4 \n" /* load two samples */ - "str r12, [r10, #0x10] \n" /* write top sample to DADO_L2 */ - "mov r12, r12, lsr #16 \n" /* put right sample at the bottom */ - "str r12, [r10, #0x14] \n" /* write low sample to DADO_R2*/ - "ldr r12, [r8], #4 \n" /* load two samples */ - "str r12, [r10, #0x18] \n" /* write top sample to DADO_L3 */ - "mov r12, r12, lsr #16 \n" /* put right sample at the bottom */ - "str r12, [r10, #0x1c] \n" /* write low sample to DADO_R3*/ - "sub r9, r9, #0x10 \n" /* 4 words written */ - "stmia r11, { r8-r9 } \n" /* save p and size */ - - ".exit: \n" - "subs pc, lr, #4 \n" /* FIQ specific return sequence */ - - ".more_data: \n" - "stmfd sp!, { r0-r3, lr } \n" /* stack scratch regs and lr */ - "ldr r2, =pcm_callback_for_more \n" - "ldr r2, [r2] \n" /* get callback address */ - "cmp r2, #0 \n" /* check for null pointer */ - "movne r0, r11 \n" /* r0 = &p */ - "addne r1, r11, #4 \n" /* r1 = &size */ - "blxne r2 \n" /* call pcm_callback_for_more */ - "ldmia r11, { r8-r9 } \n" /* reload p and size */ - "cmp r9, #0x10 \n" /* did we actually get more data? */ - "ldmgefd sp!, { r0-r3, lr } \n" - "bge .fill_fifo \n" /* yes: fill the fifo */ - "ldr r12, =pcm_play_dma_stop \n" - "blx r12 \n" /* no: stop playback */ - "ldr r12, =pcm_play_dma_stopped_callback \n" - "blx r12 \n" - "ldmfd sp!, { r0-r3, lr } \n" - "b .exit \n" - ".ltorg \n" - ); -} -#else /* C version for reference */ -void fiq_handler(void) ICODE_ATTR __attribute__((naked)); -void fiq_handler(void) -{ - asm volatile( "stmfd sp!, {r0-r7, ip, lr} \n" /* Store context */ - "sub sp, sp, #8 \n"); /* Reserve stack */ - - register pcm_more_callback_type get_more; - - if (dma_play_data.size < 16) - { - /* p is empty, get some more data */ - get_more = pcm_callback_for_more; - if (get_more) - { - get_more((unsigned char**)&dma_play_data.p, - &dma_play_data.size); - } - } - - if (dma_play_data.size >= 16) - { - DADO_L(0) = *dma_play_data.p++; - DADO_R(0) = *dma_play_data.p++; - DADO_L(1) = *dma_play_data.p++; - DADO_R(1) = *dma_play_data.p++; - DADO_L(2) = *dma_play_data.p++; - DADO_R(2) = *dma_play_data.p++; - DADO_L(3) = *dma_play_data.p++; - DADO_R(3) = *dma_play_data.p++; - - dma_play_data.size -= 16; - } - else - { - /* No more data, so disable the FIFO/interrupt */ - pcm_play_dma_stop(); - pcm_play_dma_stopped_callback(); - } - - /* Clear FIQ status */ - CREQ = DAI_TX_IRQ_MASK | DAI_RX_IRQ_MASK; - - asm volatile( "add sp, sp, #8 \n" /* Cleanup stack */ - "ldmfd sp!, {r0-r7, ip, lr} \n" /* Restore context */ - "subs pc, lr, #4 \n"); /* Return from FIQ */ -} -#endif Index: firmware/target/arm/pcm-tcc7xx.c =================================================================== --- firmware/target/arm/pcm-tcc7xx.c (revision 18199) +++ firmware/target/arm/pcm-tcc7xx.c (working copy) @@ -73,6 +73,7 @@ void pcm_play_dma_init(void) { +#ifdef COWON_D2 /* Set DAI clock divided from PLL0 (192MHz). The best approximation of 256*44.1kHz is 11.291MHz. */ BCLKCTR &= ~DEV_DAI; @@ -82,7 +83,17 @@ /* Enable DAI block in Master mode, 256fs->32fs, 16bit LSB */ DAMR = 0x3c8e80; DAVC = 0x0; /* Digital Volume = max */ - +#elif defined(IAUDIO_7) + BCLKCTR &= ~DEV_DAI; + PCLK_DAI = 0x88044004; + BCLKCTR |= DEV_DAI; + + /* somewhy DAVC should be written first, HW bug? */ + DAVC = 0x0; /* Digital Volume = max */ + DAMR = 0x3cce20; +#else +# error "Target isn't supported" +#endif /* Set DAI interrupts as FIQs */ IRQSEL = ~(DAI_RX_IRQ_MASK | DAI_TX_IRQ_MASK); @@ -312,3 +323,8 @@ "subs pc, lr, #4 \n"); /* Return from FIQ */ } #endif + +/* required by wm8531 codec */ +void i2s_reset(void) +{ +} 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) @@ -40,10 +40,14 @@ panicf("Unhandled IRQ 0x%08X", irq); } +void fiq_handler(void) __attribute__((interrupt ("FIQ"), naked)); + +#ifdef BOOTLOADER void fiq_handler(void) { /* TODO */ } +#endif void system_reboot(void) { @@ -94,7 +98,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/boot.lds =================================================================== --- firmware/target/arm/tcc77x/boot.lds (revision 18199) +++ firmware/target/arm/tcc77x/boot.lds (working copy) @@ -14,7 +14,11 @@ MEMORY { +#ifdef TCCBOOT DRAM : ORIGIN = DRAMORIG + DRAMSIZE - 0x100000, LENGTH = 0x100000 +#else + DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE +#endif IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE } @@ -34,6 +38,7 @@ *(.idata) *(.data*) *(.rodata.*) + *(.rodata) . = ALIGN(0x4); _dataend = . ; } > DRAM Index: firmware/target/arm/tcc77x/app.lds =================================================================== --- firmware/target/arm/tcc77x/app.lds (revision 18199) +++ firmware/target/arm/tcc77x/app.lds (working copy) @@ -1,144 +1,106 @@ #include "config.h" ENTRY(start) - OUTPUT_FORMAT(elf32-littlearm) OUTPUT_ARCH(arm) STARTUP(target/arm/tcc77x/crt0.o) -#define PLUGINSIZE PLUGIN_BUFFER_SIZE -#define CODECSIZE CODEC_SIZE +#define PLUGINSIZE PLUGIN_BUFFER_SIZE +#define CODECSIZE CODEC_SIZE + +#ifdef DEBUG +#define STUBOFFSET 0x10000 +#else +#define STUBOFFSET 0 +#endif + +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE -#include "imx31l.h" - -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - CODECSIZE - #define DRAMORIG 0x20000000 #define IRAMORIG 0x00000000 -#define IRAMSIZE IRAM_SIZE +#define IRAMSIZE 64K -/* End of the audio buffer, where the codec buffer starts */ -#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE) -/* Where the codec buffer ends, and the plugin buffer starts */ -#define ENDADDR (ENDAUDIOADDR + CODECSIZE) +/* End of the audio buffer, where the codec buffer starts */ +#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE) + +/* Where the codec buffer ends, and the plugin buffer starts */ +#define ENDADDR (ENDAUDIOADDR + CODECSIZE) + MEMORY { - DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE - IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE +#ifdef TCCBOOT + DRAM : ORIGIN = DRAMORIG + DRAMSIZE - 0x100000, LENGTH = 0x100000 +#else + DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE +#endif + IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE } SECTIONS { - .text : - { - loadaddress = .; - _loadaddress = .; - . = ALIGN(0x200); + .text : { + loadaddress = .; + _loadaddress = .; + . = ALIGN(0x200); *(.init.text) + *(.text) *(.text*) *(.glue_7) *(.glue_7t) - . = ALIGN(0x4); - } > DRAM + } > DRAM - .rodata : - { - *(.rodata) /* problems without this, dunno why */ - *(.rodata*) - *(.rodata.str1.1) - *(.rodata.str1.4) - . = ALIGN(0x4); - - /* Pseudo-allocate the copies of the data sections */ - _datacopy = .; - } > DRAM - - /* TRICK ALERT! For RAM execution, we put the .data section at the - same load address as the copy. Thus, we don't waste extra RAM - when we don't actually need the copy. */ - .data : AT ( _datacopy ) - { - _datastart = .; - *(.data*) - . = ALIGN(0x4); - _dataend = .; - } > DRAM - - /DISCARD/ : - { - *(.eh_frame) - } - - .vectors 0x0 : - { - _vectorsstart = .; - *(.vectors); - _vectorsend = .; - } AT> DRAM - - _vectorscopy = LOADADDR(.vectors); - - .iram : - { - _iramstart = .; + .data : { *(.icode) *(.irodata) *(.idata) + *(.data*) + *(.rodata.*) + *(.rodata) . = ALIGN(0x4); - _iramend = .; + _dataend = . ; } > DRAM - _iramcopy = LOADADDR(.iram); - - .ibss (NOLOAD) : - { - _iedata = .; - *(.ibss) - . = ALIGN(0x4); - _iend = .; - } > DRAM - .stack : { - *(.stack) - stackbegin = .; - . += 0x2000; - stackend = .; + *(.stack) + _stackbegin = .; + stackbegin = .; + . += 0x2000; + _stackend = .; + stackend = .; } > DRAM - .bss : - { - _edata = .; - *(.bss*) - *(COMMON) - . = ALIGN(0x4); - _end = .; - } > DRAM + .bss : { + _edata = .; + *(.bss*); + *(.ibss); + *(COMMON) + _end = .; + } > DRAM + .audiobuf ALIGN(4) : + { + _audiobuffer = .; + audiobuffer = .; + } > DRAM + + .audiobufend ENDAUDIOADDR: + { + audiobufend = .; + _audiobufend = .; + } > DRAM + + .codec ENDAUDIOADDR: + { + codecbuf = .; + _codecbuf = .; + } + + .plugin ENDADDR: + { + _pluginbuf = .; + pluginbuf = .; + } - .audiobuf ALIGN(4) : - { - _audiobuffer = .; - audiobuffer = .; - } > DRAM - - .audiobufend ENDAUDIOADDR: - { - audiobufend = .; - _audiobufend = .; - } > DRAM - - .codec ENDAUDIOADDR: - { - codecbuf = .; - _codecbuf = .; - } - - .plugin ENDADDR: - { - _pluginbuf = .; - pluginbuf = .; - } } - 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,251 @@ +/*************************************************************************** + * __________ __ ___. + * 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) +{ + GPIOA_DIR |= 0x8000 | 0x400; + GPIOA |= 0x8000; + + /* 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 & 0x1f) << 1) | ((c & 0x7e0) << 1) | ((c & 0xf800) << 2); + + /* 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,43 @@ +#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_VOLUP 0x00000002 +#define BUTTON_VOLDOWN 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 + + +#define BUTTON_PLUS BUTTON_VOLUP +#define BUTTON_MINUS BUTTON_VOLDOWN + +#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 true; //!(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,85 @@ +/*************************************************************************** + * __________ __ ___. + * 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) +{ + pcf50606_write(PCF5060X_DCDC1, 0x90); + pcf50606_write(PCF5060X_DCDC2, 0x48); + pcf50606_write(PCF5060X_DCDC3, 0xfc); + pcf50606_write(PCF5060X_DCDC4, 0xb1); + + pcf50606_write(PCF5060X_IOREGC, 0xe9); + pcf50606_write(PCF5060X_D1REGC1, 0xf8); + pcf50606_write(PCF5060X_D2REGC1, 0xf2); + pcf50606_write(PCF5060X_D3REGC1, 0xf5); + + pcf50606_write(PCF5060X_LPREGC1, 0x00); + pcf50606_write(PCF5060X_LPREGC2, 0x02); + + pcf50606_write(PCF5060X_DCUDC1, 0xe6); + pcf50606_write(PCF5060X_DCUDC2, 0x30); + + pcf50606_write(PCF5060X_DCDEC1, 0xe7); + pcf50606_write(PCF5060X_DCDEC2, 0x02); + + pcf50606_write(PCF5060X_INT1M, 0x5b); + pcf50606_write(PCF5060X_INT1M, 0xaf); + pcf50606_write(PCF5060X_INT1M, 0x8f); + + pcf50606_write(PCF5060X_OOCC1, 0x40); + pcf50606_write(PCF5060X_OOCC2, 0x05); + + pcf50606_write(PCF5060X_MBCC3, 0x3a); + pcf50606_write(PCF5060X_GPOC1, 0x00); //0x77);//0xf8 & ~0x80); + pcf50606_write(PCF5060X_BBCC, 0xf8); +} + +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; + return false; +} + +void audiohw_enable_output(void) +{ + GPIOD |= 0x1; +} 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 Index: firmware/target/arm/tcc77x/pcm-tcc77x.c =================================================================== --- firmware/target/arm/tcc77x/pcm-tcc77x.c (revision 18199) +++ firmware/target/arm/tcc77x/pcm-tcc77x.c (working copy) @@ -1,77 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 by [whoever fills in these functions] - * - * 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 "system.h" -#include "kernel.h" -#include "logf.h" -#include "audio.h" -#include "sound.h" -#include "file.h" - -void pcm_postinit(void) -{ -} - -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - (void)count; - return 0; -} - -void pcm_play_dma_init(void) -{ -} - -void pcm_apply_settings(void) -{ -} - -void pcm_set_frequency(unsigned int frequency) -{ - (void)frequency; -} - -void pcm_play_dma_start(const void *addr, size_t size) -{ - (void)addr; - (void)size; -} - -void pcm_play_dma_stop(void) -{ -} - -void pcm_play_lock(void) -{ -} - -void pcm_play_unlock(void) -{ -} - -void pcm_play_dma_pause(bool pause) -{ - (void)pause; -} - -size_t pcm_get_bytes_waiting(void) -{ - return 0; -} Index: firmware/target/arm/wmcodec-telechips.c =================================================================== --- firmware/target/arm/wmcodec-telechips.c (revision 18199) +++ firmware/target/arm/wmcodec-telechips.c (working copy) @@ -34,6 +34,8 @@ #if defined(COWON_D2) /* The D2's audio codec uses an I2C address of 0x34 */ #define I2C_AUDIO_ADDRESS 0x34 +#elif defined (IAUDIO_7) +#define I2C_AUDIO_ADDRESS 0x34 #else #error wmcodec not implemented for this target! #endif Index: firmware/target/arm/ata-nand-telechips.c =================================================================== --- firmware/target/arm/ata-nand-telechips.c (revision 18199) +++ firmware/target/arm/ata-nand-telechips.c (working copy) @@ -117,7 +117,7 @@ /* Write Caches */ -#define MAX_WRITE_CACHES 8 +#define MAX_WRITE_CACHES 64 struct write_cache { Index: firmware/drivers/audio/wm8731.c =================================================================== --- firmware/drivers/audio/wm8731.c (revision 18199) +++ firmware/drivers/audio/wm8731.c (working copy) @@ -167,7 +167,11 @@ /* 3) Set required values in all other registers except 12h (Active). */ wmcodec_write(AINTFCE, AINTFCE_FORMAT_I2S | AINTFCE_IWL_16BIT | +#ifdef CODEC_SLAVE + 0); +#else AINTFCE_MS); +#endif wm8731_write(AAPCTRL, wm8731_regs[AAPCTRL]); wm8731_write(DAPCTRL, wm8731_regs[DAPCTRL]); wmcodec_write(SAMPCTRL, WM8731_USB24_44100HZ);