From 22c450a7f41ff0c37a274ab14eb5d8cd575266a0 Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Mon, 10 Nov 2008 19:53:12 +0000 Subject: Merge target/arm/as3525/as3525-codec.h into target/arm/ascodec-target.h The AMS Sansa use the same AS3514 registers (except USB_UTIL which was added) Use the register defines in AMS Sansa code instead of hardcoded values git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19073 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/as3525-codec.c | 6 ++--- firmware/target/arm/as3525/as3525-codec.h | 27 ---------------------- firmware/target/arm/as3525/backlight-e200v2-fuze.c | 2 +- firmware/target/arm/as3525/power-as3525.c | 7 +++--- firmware/target/arm/as3525/system-as3525.c | 2 +- firmware/target/arm/ascodec-target.h | 19 ++++++++------- 6 files changed, 19 insertions(+), 44 deletions(-) delete mode 100644 firmware/target/arm/as3525/as3525-codec.h (limited to 'firmware/target') 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 */ -- cgit v1.2.3