diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2008-11-10 19:53:12 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2008-11-10 19:53:12 +0000 |
commit | 22c450a7f41ff0c37a274ab14eb5d8cd575266a0 (patch) | |
tree | e4becf3cd7221a18e33fa620521659a30ec0903a /firmware/target | |
parent | 81b2ffb63ea164d41ffb793187c9e1244c6355c9 (diff) | |
download | rockbox-22c450a7f41ff0c37a274ab14eb5d8cd575266a0.tar.gz rockbox-22c450a7f41ff0c37a274ab14eb5d8cd575266a0.zip |
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
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/as3525/as3525-codec.c | 6 | ||||
-rw-r--r-- | firmware/target/arm/as3525/as3525-codec.h | 27 | ||||
-rw-r--r-- | firmware/target/arm/as3525/backlight-e200v2-fuze.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/as3525/power-as3525.c | 7 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/ascodec-target.h | 19 |
6 files changed, 19 insertions, 44 deletions
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 @@ | |||
37 | interrupt bit 7 is raised and DACNT is not decremented after the transfer. | 37 | interrupt bit 7 is raised and DACNT is not decremented after the transfer. |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #include "as3525-codec.h" | 40 | #include "ascodec-target.h" |
41 | #include "as3525.h" | 41 | #include "as3525.h" |
42 | 42 | ||
43 | #define AUDIO_I2C_ADDR 0x46 | ||
44 | |||
45 | #define I2C2_DATA *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x00)) | 43 | #define I2C2_DATA *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x00)) |
46 | #define I2C2_SLAD0 *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x04)) | 44 | #define I2C2_SLAD0 *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x04)) |
47 | #define I2C2_CNTRL *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x0C)) | 45 | #define I2C2_CNTRL *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x0C)) |
@@ -72,7 +70,7 @@ void ascodec_init(void) | |||
72 | I2C2_CPSR1 = 0; /* MSB */ | 70 | I2C2_CPSR1 = 0; /* MSB */ |
73 | 71 | ||
74 | /* set i2c slave address of codec part */ | 72 | /* set i2c slave address of codec part */ |
75 | I2C2_SLAD0 = AUDIO_I2C_ADDR << 1; | 73 | I2C2_SLAD0 = AS3514_I2C_ADDR << 1; |
76 | 74 | ||
77 | I2C2_CNTRL = 0x51; | 75 | I2C2_CNTRL = 0x51; |
78 | } | 76 | } |
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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Bertrik Sikken | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | void ascodec_init(void); | ||
23 | |||
24 | int ascodec_write(int index, int value); | ||
25 | int ascodec_read(int index); | ||
26 | |||
27 | |||
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 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "lcd.h" | 24 | #include "lcd.h" |
25 | #include "backlight.h" | 25 | #include "backlight.h" |
26 | #include "as3525-codec.h" | 26 | #include "ascodec-target.h" |
27 | #include "as3514.h" | 27 | #include "as3514.h" |
28 | 28 | ||
29 | static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING; | 29 | 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 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "as3525-codec.h" | 23 | #include "ascodec-target.h" |
24 | #include "as3514.h" | ||
24 | #include <stdbool.h> | 25 | #include <stdbool.h> |
25 | 26 | ||
26 | void power_off(void) | 27 | void power_off(void) |
27 | { | 28 | { |
28 | /* clear bit 0 of system register */ | 29 | /* clear bit 0 of system register */ |
29 | ascodec_write(0x20, ascodec_read(0x20) & ~1); | 30 | ascodec_write(AS3514_SYSTEM, ascodec_read(AS3514_SYSTEM) & ~1); |
30 | 31 | ||
31 | /* TODO : turn off peripherals properly ? */ | 32 | /* TODO : turn off peripherals properly ? */ |
32 | 33 | ||
@@ -40,7 +41,7 @@ void power_init(void) | |||
40 | #if CONFIG_CHARGING | 41 | #if CONFIG_CHARGING |
41 | bool charger_inserted(void) | 42 | bool charger_inserted(void) |
42 | { | 43 | { |
43 | if(ascodec_read(0x25) & (1<<5)) | 44 | if(ascodec_read(AS3514_IRQ_ENRD0) & (1<<5)) |
44 | return true; | 45 | return true; |
45 | else | 46 | else |
46 | return false; | 47 | 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 @@ | |||
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "panic.h" | 25 | #include "panic.h" |
26 | #include "as3525-codec.h" | 26 | #include "ascodec-target.h" |
27 | 27 | ||
28 | #define default_interrupt(name) \ | 28 | #define default_interrupt(name) \ |
29 | extern __attribute__((weak,alias("UIRQ"))) void name (void) | 29 | 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 @@ | |||
27 | 27 | ||
28 | #include "config.h" | 28 | #include "config.h" |
29 | 29 | ||
30 | #ifdef CPU_PP | 30 | #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) || \ |
31 | /* TODO: This header is actually portalplayer specific, and should be | 31 | CONFIG_CPU==AS3525 |
32 | * moved into an appropriate subdir */ | ||
33 | |||
34 | #include "i2c-pp.h" | ||
35 | |||
36 | #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) | ||
37 | #define AS3514_I2C_ADDR 0x46 | 32 | #define AS3514_I2C_ADDR 0x46 |
38 | #else | 33 | #else |
39 | #error Unknown target! | 34 | #error Unknown target! |
40 | #endif | 35 | #endif |
41 | 36 | ||
37 | #ifdef CPU_PP | ||
38 | #include "i2c-pp.h" | ||
39 | |||
42 | static inline int ascodec_write(unsigned int reg, unsigned int value) | 40 | static inline int ascodec_write(unsigned int reg, unsigned int value) |
43 | { | 41 | { |
44 | return pp_i2c_send(AS3514_I2C_ADDR, reg, value); | 42 | return pp_i2c_send(AS3514_I2C_ADDR, reg, value); |
@@ -63,7 +61,12 @@ static inline void ascodec_unlock(void) | |||
63 | { | 61 | { |
64 | i2c_unlock(); | 62 | i2c_unlock(); |
65 | } | 63 | } |
64 | #elif CONFIG_CPU==AS3525 | ||
65 | void ascodec_init(void); | ||
66 | 66 | ||
67 | #endif /* CPU_PP */ | 67 | int ascodec_write(int index, int value); |
68 | |||
69 | int ascodec_read(int index); | ||
70 | #endif | ||
68 | 71 | ||
69 | #endif /* !_ASCODEC_TARGET_H */ | 72 | #endif /* !_ASCODEC_TARGET_H */ |