summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-10-31 00:16:42 +0000
committerDave Chapman <dave@dchapman.com>2008-10-31 00:16:42 +0000
commit42f77d4eb027afed4f4ef80f10c16112c2b7fe2b (patch)
tree2da09bcab257322dce48ddccc4a71d915318aa3a
parent324816f0190dec308f3496a288820a47926b1c17 (diff)
downloadrockbox-42f77d4eb027afed4f4ef80f10c16112c2b7fe2b.tar.gz
rockbox-42f77d4eb027afed4f4ef80f10c16112c2b7fe2b.zip
Abstract the PortalPlayer AS3514 handling with an "ascodec" API - inspired by the wmcodec API used with the Wolfson codecs. The intention is to implement this API for the AS3525 and then share code with the Sansa V2 ports.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18940 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c6
-rw-r--r--firmware/SOURCES3
-rw-r--r--firmware/drivers/audio/as3514.c38
-rw-r--r--firmware/drivers/rtc/rtc_as3514.c5
-rw-r--r--firmware/export/as3514.h4
-rw-r--r--firmware/export/ascodec.h27
-rw-r--r--firmware/target/arm/adc-as3514.c10
-rw-r--r--firmware/target/arm/ascodec-pp.c66
-rw-r--r--firmware/target/arm/ascodec-target.h69
-rw-r--r--firmware/target/arm/i2c-pp.c3
-rw-r--r--firmware/target/arm/philips/sa9200/backlight-sa9200.c6
-rw-r--r--firmware/target/arm/philips/sa9200/power-sa9200.c4
-rw-r--r--firmware/target/arm/sandisk/backlight-c200_e200.c6
-rw-r--r--firmware/target/arm/sandisk/power-c200_e200.c6
-rw-r--r--firmware/usbstack/usb_core.c4
15 files changed, 196 insertions, 61 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index ad19c3a7b2..8c4622828d 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -103,7 +103,7 @@
103#endif 103#endif
104 104
105#if defined(SANSA_E200) || defined(PHILIPS_SA9200) 105#if defined(SANSA_E200) || defined(PHILIPS_SA9200)
106#include "i2c-pp.h" 106#include "ascodec.h"
107#include "as3514.h" 107#include "as3514.h"
108#endif 108#endif
109 109
@@ -1228,7 +1228,9 @@ bool dbg_ports(void)
1228 lcd_puts(0, line++, buf); 1228 lcd_puts(0, line++, buf);
1229 snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT)); 1229 snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT));
1230 lcd_puts(0, line++, buf); 1230 lcd_puts(0, line++, buf);
1231 snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X", i2c_readbyte(AS3514_I2C_ADDR, AS3514_CHARGER), i2c_readbyte(AS3514_I2C_ADDR, AS3514_IRQ_ENRD0)); 1231 snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X",
1232 ascodec_read(AS3514_CHARGER),
1233 ascodec_read(AS3514_IRQ_ENRD0));
1232 lcd_puts(0, line++, buf); 1234 lcd_puts(0, line++, buf);
1233#endif 1235#endif
1234#endif 1236#endif
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 400074a0e9..e73e94b453 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -460,6 +460,7 @@ target/arm/lcd-as-memframe.S
460target/arm/ata-sd-pp.c 460target/arm/ata-sd-pp.c
461target/arm/sandisk/sansa-e200/lcd-e200.c 461target/arm/sandisk/sansa-e200/lcd-e200.c
462target/arm/adc-as3514.c 462target/arm/adc-as3514.c
463target/arm/ascodec-pp.c
463target/arm/sandisk/backlight-c200_e200.c 464target/arm/sandisk/backlight-c200_e200.c
464target/arm/usb-fw-pp502x.c 465target/arm/usb-fw-pp502x.c
465target/arm/sandisk/sansa-e200/button-e200.c 466target/arm/sandisk/sansa-e200/button-e200.c
@@ -478,6 +479,7 @@ target/arm/ata-sd-pp.c
478target/arm/sandisk/sansa-c200/lcd-c200.c 479target/arm/sandisk/sansa-c200/lcd-c200.c
479target/arm/sandisk/sansa-c200/lcd-as-c200.S 480target/arm/sandisk/sansa-c200/lcd-as-c200.S
480target/arm/adc-as3514.c 481target/arm/adc-as3514.c
482target/arm/ascodec-pp.c
481target/arm/sandisk/backlight-c200_e200.c 483target/arm/sandisk/backlight-c200_e200.c
482target/arm/usb-fw-pp502x.c 484target/arm/usb-fw-pp502x.c
483target/arm/sandisk/sansa-c200/button-c200.c 485target/arm/sandisk/sansa-c200/button-c200.c
@@ -495,6 +497,7 @@ target/arm/sandisk/audio-c200_e200.c
495target/arm/ata-sd-pp.c 497target/arm/ata-sd-pp.c
496target/arm/philips/sa9200/lcd-sa9200.c 498target/arm/philips/sa9200/lcd-sa9200.c
497target/arm/adc-as3514.c 499target/arm/adc-as3514.c
500target/arm/ascodec-pp.c
498target/arm/philips/sa9200/backlight-sa9200.c 501target/arm/philips/sa9200/backlight-sa9200.c
499target/arm/usb-fw-pp502x.c 502target/arm/usb-fw-pp502x.c
500target/arm/philips/sa9200/button-sa9200.c 503target/arm/philips/sa9200/button-sa9200.c
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c
index 97117e48c3..db4cb0699f 100644
--- a/firmware/drivers/audio/as3514.c
+++ b/firmware/drivers/audio/as3514.c
@@ -29,7 +29,7 @@
29 29
30#include "audiohw.h" 30#include "audiohw.h"
31#include "i2s.h" 31#include "i2s.h"
32#include "i2c-pp.h" 32#include "ascodec.h"
33 33
34const struct sound_settings_info audiohw_settings[] = { 34const struct sound_settings_info audiohw_settings[] = {
35 [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, 35 [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25},
@@ -71,7 +71,7 @@ static unsigned int source = SOURCE_DAC;
71 */ 71 */
72static void as3514_write(unsigned int reg, unsigned int value) 72static void as3514_write(unsigned int reg, unsigned int value)
73{ 73{
74 if (pp_i2c_send(AS3514_I2C_ADDR, reg, value) != 2) 74 if (ascodec_write(reg, value) != 2)
75 { 75 {
76 DEBUGF("as3514 error reg=0x%02x", reg); 76 DEBUGF("as3514 error reg=0x%02x", reg);
77 } 77 }
@@ -135,36 +135,10 @@ int sound_val2phys(int setting, int value)
135/* 135/*
136 * Initialise the PP I2C and I2S. 136 * Initialise the PP I2C and I2S.
137 */ 137 */
138void audiohw_init(void) 138void audiohw_preinit(void)
139{ 139{
140 unsigned int i; 140 unsigned int i;
141 141
142 /* normal outputs for CDI and I2S pin groups */
143 DEV_INIT2 &= ~0x300;
144
145 /*mini2?*/
146 DEV_INIT1 &=~0x3000000;
147 /*mini2?*/
148
149 /* device reset */
150 DEV_RS |= DEV_I2S;
151 DEV_RS &=~DEV_I2S;
152
153 /* I2S device reset */
154 DEV_RS |= DEV_I2S;
155 DEV_RS &=~DEV_I2S;
156
157 /* I2S device enable */
158 DEV_EN |= DEV_I2S;
159
160 /* enable external dev clock clocks */
161 DEV_EN |= DEV_EXTCLOCKS;
162
163 /* external dev clock to 24MHz */
164 outl(inl(0x70000018) & ~0xc, 0x70000018);
165
166 i2s_reset();
167
168 /* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */ 142 /* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */
169 143
170 /* Turn on SUM, DAC */ 144 /* Turn on SUM, DAC */
@@ -199,14 +173,10 @@ void audiohw_init(void)
199 /* read all reg values */ 173 /* read all reg values */
200 for (i = 0; i < ARRAYLEN(as3514.regs); i++) 174 for (i = 0; i < ARRAYLEN(as3514.regs); i++)
201 { 175 {
202 as3514.regs[i] = i2c_readbyte(AS3514_I2C_ADDR, i); 176 as3514.regs[i] = ascodec_read(i);
203 } 177 }
204} 178}
205 179
206void audiohw_postinit(void)
207{
208}
209
210/* Silently enable / disable audio output */ 180/* Silently enable / disable audio output */
211void audiohw_enable_output(bool enable) 181void audiohw_enable_output(bool enable)
212{ 182{
diff --git a/firmware/drivers/rtc/rtc_as3514.c b/firmware/drivers/rtc/rtc_as3514.c
index 65d8359e08..878f204a4e 100644
--- a/firmware/drivers/rtc/rtc_as3514.c
+++ b/firmware/drivers/rtc/rtc_as3514.c
@@ -22,6 +22,7 @@
22#include "rtc.h" 22#include "rtc.h"
23#include "i2c-pp.h" 23#include "i2c-pp.h"
24#include "as3514.h" 24#include "as3514.h"
25#include "ascodec.h"
25 26
26#define MINUTE_SECONDS 60 27#define MINUTE_SECONDS 60
27#define HOUR_SECONDS 3600 28#define HOUR_SECONDS 3600
@@ -57,7 +58,7 @@ int rtc_read_datetime(unsigned char* buf)
57 58
58 /* RTC_AS3514's slave address is 0x46*/ 59 /* RTC_AS3514's slave address is 0x46*/
59 for (i=0;i<4;i++){ 60 for (i=0;i<4;i++){
60 tmp[i] = i2c_readbyte(AS3514_I2C_ADDR, AS3514_RTC_0 + i); 61 tmp[i] = ascodec_read(AS3514_RTC_0 + i);
61 } 62 }
62 seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24); 63 seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24);
63 64
@@ -162,7 +163,7 @@ int rtc_write_datetime(unsigned char* buf)
162 163
163 /* Send data to RTC */ 164 /* Send data to RTC */
164 for (i=0;i<4;i++){ 165 for (i=0;i<4;i++){
165 pp_i2c_send(AS3514_I2C_ADDR, AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff)); 166 ascodec_write(AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff));
166 } 167 }
167 return 1; 168 return 1;
168} 169}
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h
index aa9847c6a1..9585f5e0ef 100644
--- a/firmware/export/as3514.h
+++ b/firmware/export/as3514.h
@@ -79,8 +79,4 @@ extern void audiohw_set_sample_rate(int sampling_control);
79#define VOLUME_MIN -735 79#define VOLUME_MIN -735
80#define VOLUME_MAX 60 80#define VOLUME_MAX 60
81 81
82#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
83#define AS3514_I2C_ADDR 0x46
84#endif
85
86#endif /* _AS3514_H */ 82#endif /* _AS3514_H */
diff --git a/firmware/export/ascodec.h b/firmware/export/ascodec.h
new file mode 100644
index 0000000000..b8bab8a640
--- /dev/null
+++ b/firmware/export/ascodec.h
@@ -0,0 +1,27 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Dave Chapman
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#ifndef _ASCODEC_H
23#define _ASCODEC_H
24
25#include "ascodec-target.h"
26
27#endif
diff --git a/firmware/target/arm/adc-as3514.c b/firmware/target/arm/adc-as3514.c
index 26cdc76f0d..9c2a421441 100644
--- a/firmware/target/arm/adc-as3514.c
+++ b/firmware/target/arm/adc-as3514.c
@@ -20,7 +20,7 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "adc.h" 21#include "adc.h"
22#include "kernel.h" 22#include "kernel.h"
23#include "i2c-pp.h" 23#include "ascodec.h"
24#include "as3514.h" 24#include "as3514.h"
25 25
26/* Read 10-bit channel data */ 26/* Read 10-bit channel data */
@@ -30,21 +30,21 @@ unsigned short adc_read(int channel)
30 30
31 if ((unsigned)channel < NUM_ADC_CHANNELS) 31 if ((unsigned)channel < NUM_ADC_CHANNELS)
32 { 32 {
33 i2c_lock(); 33 ascodec_lock();
34 34
35 /* Select channel */ 35 /* Select channel */
36 if (pp_i2c_send( AS3514_I2C_ADDR, AS3514_ADC_0, (channel << 4)) >= 0) 36 if (ascodec_write(AS3514_ADC_0, (channel << 4)) >= 0)
37 { 37 {
38 unsigned char buf[2]; 38 unsigned char buf[2];
39 39
40 /* Read data */ 40 /* Read data */
41 if (i2c_readbytes( AS3514_I2C_ADDR, AS3514_ADC_0, 2, buf) >= 0) 41 if (ascodec_readbytes(AS3514_ADC_0, 2, buf) >= 0)
42 { 42 {
43 data = (((buf[0] & 0x3) << 8) | buf[1]); 43 data = (((buf[0] & 0x3) << 8) | buf[1]);
44 } 44 }
45 } 45 }
46 46
47 i2c_unlock(); 47 ascodec_unlock();
48 } 48 }
49 49
50 return data; 50 return data;
diff --git a/firmware/target/arm/ascodec-pp.c b/firmware/target/arm/ascodec-pp.c
new file mode 100644
index 0000000000..30b6b1f8de
--- /dev/null
+++ b/firmware/target/arm/ascodec-pp.c
@@ -0,0 +1,66 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Driver for AS3514 audio codec
11 *
12 * Copyright (c) 2007 Daniel Ankers
13 * Copyright (c) 2007 Christian Gmeiner
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ****************************************************************************/
24#include "cpu.h"
25#include "system.h"
26
27#include "audiohw.h"
28#include "i2s.h"
29
30/*
31 * Initialise the PP I2C and I2S.
32 */
33void audiohw_init(void)
34{
35 /* normal outputs for CDI and I2S pin groups */
36 DEV_INIT2 &= ~0x300;
37
38 /*mini2?*/
39 DEV_INIT1 &=~0x3000000;
40 /*mini2?*/
41
42 /* device reset */
43 DEV_RS |= DEV_I2S;
44 DEV_RS &=~DEV_I2S;
45
46 /* I2S device reset */
47 DEV_RS |= DEV_I2S;
48 DEV_RS &=~DEV_I2S;
49
50 /* I2S device enable */
51 DEV_EN |= DEV_I2S;
52
53 /* enable external dev clock clocks */
54 DEV_EN |= DEV_EXTCLOCKS;
55
56 /* external dev clock to 24MHz */
57 outl(inl(0x70000018) & ~0xc, 0x70000018);
58
59 i2s_reset();
60
61 audiohw_preinit();
62}
63
64void audiohw_postinit(void)
65{
66}
diff --git a/firmware/target/arm/ascodec-target.h b/firmware/target/arm/ascodec-target.h
new file mode 100644
index 0000000000..19b1644541
--- /dev/null
+++ b/firmware/target/arm/ascodec-target.h
@@ -0,0 +1,69 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Driver for AS3514 audio codec
11 *
12 * Copyright (c) 2007 Daniel Ankers
13 * Copyright (c) 2007 Christian Gmeiner
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ****************************************************************************/
24
25#ifndef _ASCODEC_TARGET_H
26#define _ASCODEC_TARGET_H
27
28#include "config.h"
29
30#ifdef CPU_PP
31/* TODO: This header is actually portalplayer specific, and should be
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
38#else
39#error Unknown target!
40#endif
41
42static inline int ascodec_write(unsigned int reg, unsigned int value)
43{
44 return pp_i2c_send(AS3514_I2C_ADDR, reg, value);
45}
46
47static inline int ascodec_read(unsigned int reg)
48{
49 return i2c_readbyte(AS3514_I2C_ADDR, reg);
50}
51
52static inline int ascodec_readbytes(int addr, int len, unsigned char *data)
53{
54 return i2c_readbytes(AS3514_I2C_ADDR, addr, len, data);
55}
56
57static inline void ascodec_lock(void)
58{
59 i2c_lock();
60}
61
62static inline void ascodec_unlock(void)
63{
64 i2c_unlock();
65}
66
67#endif /* CPU_PP */
68
69#endif /* !_ASCODEC_TARGET_H */
diff --git a/firmware/target/arm/i2c-pp.c b/firmware/target/arm/i2c-pp.c
index 4d83208d91..3db25c027c 100644
--- a/firmware/target/arm/i2c-pp.c
+++ b/firmware/target/arm/i2c-pp.c
@@ -32,6 +32,7 @@
32#include "logf.h" 32#include "logf.h"
33#include "system.h" 33#include "system.h"
34#include "i2c-pp.h" 34#include "i2c-pp.h"
35#include "ascodec.h"
35#include "as3514.h" 36#include "as3514.h"
36 37
37/* Local functions definitions */ 38/* Local functions definitions */
@@ -230,7 +231,7 @@ void i2c_init(void)
230 outl(0, 0x600060a4); 231 outl(0, 0x600060a4);
231 outl(0x1e, 0x600060a4); 232 outl(0x1e, 0x600060a4);
232 233
233 pp_i2c_send(AS3514_I2C_ADDR, AS3514_SUPERVISOR, 5); 234 ascodec_write(AS3514_SUPERVISOR, 5);
234#endif 235#endif
235#endif 236#endif
236 237
diff --git a/firmware/target/arm/philips/sa9200/backlight-sa9200.c b/firmware/target/arm/philips/sa9200/backlight-sa9200.c
index 33342d19f1..b3984ca9ad 100644
--- a/firmware/target/arm/philips/sa9200/backlight-sa9200.c
+++ b/firmware/target/arm/philips/sa9200/backlight-sa9200.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 "i2c-pp.h" 26#include "ascodec.h"
27#include "as3514.h" 27#include "as3514.h"
28 28
29static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING; 29static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
@@ -46,12 +46,12 @@ void _backlight_on(void)
46#ifdef HAVE_LCD_ENABLE 46#ifdef HAVE_LCD_ENABLE
47 lcd_enable(true); /* power on lcd + visible display */ 47 lcd_enable(true); /* power on lcd + visible display */
48#endif 48#endif
49 pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, backlight_brightness); 49 ascodec_write(AS3514_DCDC15, backlight_brightness);
50} 50}
51 51
52void _backlight_off(void) 52void _backlight_off(void)
53{ 53{
54 pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, 0x0); 54 ascodec_write(AS3514_DCDC15, 0x0);
55#ifdef HAVE_LCD_ENABLE 55#ifdef HAVE_LCD_ENABLE
56 lcd_enable(false); /* power off visible display */ 56 lcd_enable(false); /* power off visible display */
57#endif 57#endif
diff --git a/firmware/target/arm/philips/sa9200/power-sa9200.c b/firmware/target/arm/philips/sa9200/power-sa9200.c
index a559f65ec4..b005a86651 100644
--- a/firmware/target/arm/philips/sa9200/power-sa9200.c
+++ b/firmware/target/arm/philips/sa9200/power-sa9200.c
@@ -36,9 +36,9 @@ void power_off(void)
36 char byte; 36 char byte;
37 37
38 /* Send shutdown command to PMU */ 38 /* Send shutdown command to PMU */
39 byte = i2c_readbyte(AS3514_I2C_ADDR, AS3514_SYSTEM); 39 byte = ascodec_read(AS3514_SYSTEM);
40 byte &= ~0x1; 40 byte &= ~0x1;
41 pp_i2c_send(AS3514_I2C_ADDR, AS3514_SYSTEM, byte); 41 ascodec_write(AS3514_SYSTEM, byte);
42 42
43 /* Stop interrupts on both cores */ 43 /* Stop interrupts on both cores */
44 disable_interrupt(IRQ_FIQ_STATUS); 44 disable_interrupt(IRQ_FIQ_STATUS);
diff --git a/firmware/target/arm/sandisk/backlight-c200_e200.c b/firmware/target/arm/sandisk/backlight-c200_e200.c
index 33342d19f1..b3984ca9ad 100644
--- a/firmware/target/arm/sandisk/backlight-c200_e200.c
+++ b/firmware/target/arm/sandisk/backlight-c200_e200.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 "i2c-pp.h" 26#include "ascodec.h"
27#include "as3514.h" 27#include "as3514.h"
28 28
29static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING; 29static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
@@ -46,12 +46,12 @@ void _backlight_on(void)
46#ifdef HAVE_LCD_ENABLE 46#ifdef HAVE_LCD_ENABLE
47 lcd_enable(true); /* power on lcd + visible display */ 47 lcd_enable(true); /* power on lcd + visible display */
48#endif 48#endif
49 pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, backlight_brightness); 49 ascodec_write(AS3514_DCDC15, backlight_brightness);
50} 50}
51 51
52void _backlight_off(void) 52void _backlight_off(void)
53{ 53{
54 pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, 0x0); 54 ascodec_write(AS3514_DCDC15, 0x0);
55#ifdef HAVE_LCD_ENABLE 55#ifdef HAVE_LCD_ENABLE
56 lcd_enable(false); /* power off visible display */ 56 lcd_enable(false); /* power off visible display */
57#endif 57#endif
diff --git a/firmware/target/arm/sandisk/power-c200_e200.c b/firmware/target/arm/sandisk/power-c200_e200.c
index a559f65ec4..d6319f44bb 100644
--- a/firmware/target/arm/sandisk/power-c200_e200.c
+++ b/firmware/target/arm/sandisk/power-c200_e200.c
@@ -22,7 +22,7 @@
22#include <stdbool.h> 22#include <stdbool.h>
23#include "system.h" 23#include "system.h"
24#include "cpu.h" 24#include "cpu.h"
25#include "i2c-pp.h" 25#include "ascodec.h"
26#include "tuner.h" 26#include "tuner.h"
27#include "as3514.h" 27#include "as3514.h"
28#include "power.h" 28#include "power.h"
@@ -36,9 +36,9 @@ void power_off(void)
36 char byte; 36 char byte;
37 37
38 /* Send shutdown command to PMU */ 38 /* Send shutdown command to PMU */
39 byte = i2c_readbyte(AS3514_I2C_ADDR, AS3514_SYSTEM); 39 byte = ascodec_read(AS3514_SYSTEM);
40 byte &= ~0x1; 40 byte &= ~0x1;
41 pp_i2c_send(AS3514_I2C_ADDR, AS3514_SYSTEM, byte); 41 ascodec_write(AS3514_SYSTEM, byte);
42 42
43 /* Stop interrupts on both cores */ 43 /* Stop interrupts on both cores */
44 disable_interrupt(IRQ_FIQ_STATUS); 44 disable_interrupt(IRQ_FIQ_STATUS);
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c
index d5e33f1b6b..fa0ff5ea04 100644
--- a/firmware/usbstack/usb_core.c
+++ b/firmware/usbstack/usb_core.c
@@ -46,7 +46,7 @@
46/* TODO: Move target-specific stuff somewhere else (serial number reading) */ 46/* TODO: Move target-specific stuff somewhere else (serial number reading) */
47 47
48#ifdef HAVE_AS3514 48#ifdef HAVE_AS3514
49#include "i2c-pp.h" 49#include "ascodec.h"
50#include "as3514.h" 50#include "as3514.h"
51#endif 51#endif
52 52
@@ -274,7 +274,7 @@ static void set_serial_descriptor(void)
274 short* p = &usb_string_iSerial.wString[1]; 274 short* p = &usb_string_iSerial.wString[1];
275 int i; 275 int i;
276 276
277 i2c_readbytes(AS3514_I2C_ADDR, AS3514_UID_0, 0x10, serial); 277 ascodec_readbytes(AS3514_UID_0, 0x10, serial);
278 for (i = 0; i < 16; i++) { 278 for (i = 0; i < 16; i++) {
279 *p++ = hex[(serial[i] >> 4) & 0xF]; 279 *p++ = hex[(serial[i] >> 4) & 0xF];
280 *p++ = hex[(serial[i] >> 0) & 0xF]; 280 *p++ = hex[(serial[i] >> 0) & 0xF];