diff options
| author | Dave Chapman <dave@dchapman.com> | 2008-10-31 00:16:42 +0000 |
|---|---|---|
| committer | Dave Chapman <dave@dchapman.com> | 2008-10-31 00:16:42 +0000 |
| commit | 42f77d4eb027afed4f4ef80f10c16112c2b7fe2b (patch) | |
| tree | 2da09bcab257322dce48ddccc4a71d915318aa3a /firmware/drivers | |
| parent | 324816f0190dec308f3496a288820a47926b1c17 (diff) | |
| download | rockbox-42f77d4eb027afed4f4ef80f10c16112c2b7fe2b.zip rockbox-42f77d4eb027afed4f4ef80f10c16112c2b7fe2b.tar.gz rockbox-42f77d4eb027afed4f4ef80f10c16112c2b7fe2b.tar.bz2 rockbox-42f77d4eb027afed4f4ef80f10c16112c2b7fe2b.tar.xz | |
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
Diffstat (limited to 'firmware/drivers')
| -rw-r--r-- | firmware/drivers/audio/as3514.c | 38 | ||||
| -rw-r--r-- | firmware/drivers/rtc/rtc_as3514.c | 5 |
2 files changed, 7 insertions, 36 deletions
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c index 97117e4..db4cb06 100644 --- a/firmware/drivers/audio/as3514.c +++ b/firmware/drivers/audio/as3514.c @@ -29,7 +29,7 @@ #include "audiohw.h" #include "i2s.h" -#include "i2c-pp.h" +#include "ascodec.h" const struct sound_settings_info audiohw_settings[] = { [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, @@ -71,7 +71,7 @@ static unsigned int source = SOURCE_DAC; */ static void as3514_write(unsigned int reg, unsigned int value) { - if (pp_i2c_send(AS3514_I2C_ADDR, reg, value) != 2) + if (ascodec_write(reg, value) != 2) { DEBUGF("as3514 error reg=0x%02x", reg); } @@ -135,36 +135,10 @@ int sound_val2phys(int setting, int value) /* * Initialise the PP I2C and I2S. */ -void audiohw_init(void) +void audiohw_preinit(void) { unsigned int i; - /* normal outputs for CDI and I2S pin groups */ - DEV_INIT2 &= ~0x300; - - /*mini2?*/ - DEV_INIT1 &=~0x3000000; - /*mini2?*/ - - /* device reset */ - DEV_RS |= DEV_I2S; - DEV_RS &=~DEV_I2S; - - /* I2S device reset */ - DEV_RS |= DEV_I2S; - DEV_RS &=~DEV_I2S; - - /* I2S device enable */ - DEV_EN |= DEV_I2S; - - /* enable external dev clock clocks */ - DEV_EN |= DEV_EXTCLOCKS; - - /* external dev clock to 24MHz */ - outl(inl(0x70000018) & ~0xc, 0x70000018); - - i2s_reset(); - /* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */ /* Turn on SUM, DAC */ @@ -199,14 +173,10 @@ void audiohw_init(void) /* read all reg values */ for (i = 0; i < ARRAYLEN(as3514.regs); i++) { - as3514.regs[i] = i2c_readbyte(AS3514_I2C_ADDR, i); + as3514.regs[i] = ascodec_read(i); } } -void audiohw_postinit(void) -{ -} - /* Silently enable / disable audio output */ void audiohw_enable_output(bool enable) { diff --git a/firmware/drivers/rtc/rtc_as3514.c b/firmware/drivers/rtc/rtc_as3514.c index 65d8359..878f204 100644 --- a/firmware/drivers/rtc/rtc_as3514.c +++ b/firmware/drivers/rtc/rtc_as3514.c @@ -22,6 +22,7 @@ #include "rtc.h" #include "i2c-pp.h" #include "as3514.h" +#include "ascodec.h" #define MINUTE_SECONDS 60 #define HOUR_SECONDS 3600 @@ -57,7 +58,7 @@ int rtc_read_datetime(unsigned char* buf) /* RTC_AS3514's slave address is 0x46*/ for (i=0;i<4;i++){ - tmp[i] = i2c_readbyte(AS3514_I2C_ADDR, AS3514_RTC_0 + i); + tmp[i] = ascodec_read(AS3514_RTC_0 + i); } seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24); @@ -162,7 +163,7 @@ int rtc_write_datetime(unsigned char* buf) /* Send data to RTC */ for (i=0;i<4;i++){ - pp_i2c_send(AS3514_I2C_ADDR, AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff)); + ascodec_write(AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff)); } return 1; } |