diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h index 9585f5e0ef..2bbdc2ed66 100644 --- a/firmware/export/as3514.h +++ b/firmware/export/as3514.h @@ -52,6 +52,7 @@ extern void audiohw_set_sample_rate(int sampling_control); #define AS3514_AUDIOSET1 0x14 #define AS3514_AUDIOSET2 0x15 #define AS3514_AUDIOSET3 0x16 +#define AS3514_USB_UTIL 0x17 /* Only in AS3525 ? */ #define AS3514_PLLMODE 0x1d #define AS3514_SYSTEM 0x20 diff --git a/firmware/target/arm/as3525/as3525-codec.c b/firmware/target/arm/as3525/as3525-codec.c index 76e5071197..4d8598eaf1 100644 --- a/firmware/target/arm/as3525/as3525-codec.c +++ b/firmware/target/arm/as3525/as3525-codec.c @@ -37,11 +37,9 @@ interrupt bit 7 is raised and DACNT is not decremented after the transfer. */ -#include "as3525-codec.h" +#include "ascodec-target.h" #include "as3525.h" -#define AUDIO_I2C_ADDR 0x46 - #define I2C2_DATA *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x00)) #define I2C2_SLAD0 *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x04)) #define I2C2_CNTRL *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x0C)) @@ -72,7 +70,7 @@ void ascodec_init(void) I2C2_CPSR1 = 0; /* MSB */ /* set i2c slave address of codec part */ - I2C2_SLAD0 = AUDIO_I2C_ADDR << 1; + I2C2_SLAD0 = AS3514_I2C_ADDR << 1; I2C2_CNTRL = 0x51; } diff --git a/firmware/target/arm/as3525/as3525-codec.h b/firmware/target/arm/as3525/as3525-codec.h deleted file mode 100644 index 6e6145bb77..0000000000 --- a/firmware/target/arm/as3525/as3525-codec.h +++ /dev/null @@ -1,27 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 by Bertrik Sikken - * - * 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. - * - ****************************************************************************/ - -void ascodec_init(void); - -int ascodec_write(int index, int value); -int ascodec_read(int index); - - diff --git a/firmware/target/arm/as3525/backlight-e200v2-fuze.c b/firmware/target/arm/as3525/backlight-e200v2-fuze.c index 9bc78a4118..2b724b34a3 100644 --- a/firmware/target/arm/as3525/backlight-e200v2-fuze.c +++ b/firmware/target/arm/as3525/backlight-e200v2-fuze.c @@ -23,7 +23,7 @@ #include "system.h" #include "lcd.h" #include "backlight.h" -#include "as3525-codec.h" +#include "ascodec-target.h" #include "as3514.h" static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING; diff --git a/firmware/target/arm/as3525/power-as3525.c b/firmware/target/arm/as3525/power-as3525.c index 53b95e354d..13330aa465 100644 --- a/firmware/target/arm/as3525/power-as3525.c +++ b/firmware/target/arm/as3525/power-as3525.c @@ -20,13 +20,14 @@ ****************************************************************************/ #include "config.h" -#include "as3525-codec.h" +#include "ascodec-target.h" +#include "as3514.h" #include void power_off(void) { /* clear bit 0 of system register */ - ascodec_write(0x20, ascodec_read(0x20) & ~1); + ascodec_write(AS3514_SYSTEM, ascodec_read(AS3514_SYSTEM) & ~1); /* TODO : turn off peripherals properly ? */ @@ -40,7 +41,7 @@ void power_init(void) #if CONFIG_CHARGING bool charger_inserted(void) { - if(ascodec_read(0x25) & (1<<5)) + if(ascodec_read(AS3514_IRQ_ENRD0) & (1<<5)) return true; else return false; diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index 07832f1a49..7653985d19 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c @@ -23,7 +23,7 @@ #include "kernel.h" #include "system.h" #include "panic.h" -#include "as3525-codec.h" +#include "ascodec-target.h" #define default_interrupt(name) \ extern __attribute__((weak,alias("UIRQ"))) void name (void) diff --git a/firmware/target/arm/ascodec-target.h b/firmware/target/arm/ascodec-target.h index 19b1644541..afd19fff63 100644 --- a/firmware/target/arm/ascodec-target.h +++ b/firmware/target/arm/ascodec-target.h @@ -27,18 +27,16 @@ #include "config.h" -#ifdef CPU_PP -/* TODO: This header is actually portalplayer specific, and should be - * moved into an appropriate subdir */ - -#include "i2c-pp.h" - -#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) +#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) || \ + CONFIG_CPU==AS3525 #define AS3514_I2C_ADDR 0x46 #else #error Unknown target! #endif +#ifdef CPU_PP +#include "i2c-pp.h" + static inline int ascodec_write(unsigned int reg, unsigned int value) { return pp_i2c_send(AS3514_I2C_ADDR, reg, value); @@ -63,7 +61,12 @@ static inline void ascodec_unlock(void) { i2c_unlock(); } +#elif CONFIG_CPU==AS3525 +void ascodec_init(void); -#endif /* CPU_PP */ +int ascodec_write(int index, int value); + +int ascodec_read(int index); +#endif #endif /* !_ASCODEC_TARGET_H */