mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
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
This commit is contained in:
parent
81b2ffb63e
commit
22c450a7f4
7 changed files with 20 additions and 44 deletions
|
|
@ -52,6 +52,7 @@ extern void audiohw_set_sample_rate(int sampling_control);
|
||||||
#define AS3514_AUDIOSET1 0x14
|
#define AS3514_AUDIOSET1 0x14
|
||||||
#define AS3514_AUDIOSET2 0x15
|
#define AS3514_AUDIOSET2 0x15
|
||||||
#define AS3514_AUDIOSET3 0x16
|
#define AS3514_AUDIOSET3 0x16
|
||||||
|
#define AS3514_USB_UTIL 0x17 /* Only in AS3525 ? */
|
||||||
#define AS3514_PLLMODE 0x1d
|
#define AS3514_PLLMODE 0x1d
|
||||||
|
|
||||||
#define AS3514_SYSTEM 0x20
|
#define AS3514_SYSTEM 0x20
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,9 @@
|
||||||
interrupt bit 7 is raised and DACNT is not decremented after the transfer.
|
interrupt bit 7 is raised and DACNT is not decremented after the transfer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "as3525-codec.h"
|
#include "ascodec-target.h"
|
||||||
#include "as3525.h"
|
#include "as3525.h"
|
||||||
|
|
||||||
#define AUDIO_I2C_ADDR 0x46
|
|
||||||
|
|
||||||
#define I2C2_DATA *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x00))
|
#define I2C2_DATA *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x00))
|
||||||
#define I2C2_SLAD0 *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x04))
|
#define I2C2_SLAD0 *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x04))
|
||||||
#define I2C2_CNTRL *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x0C))
|
#define I2C2_CNTRL *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x0C))
|
||||||
|
|
@ -72,7 +70,7 @@ void ascodec_init(void)
|
||||||
I2C2_CPSR1 = 0; /* MSB */
|
I2C2_CPSR1 = 0; /* MSB */
|
||||||
|
|
||||||
/* set i2c slave address of codec part */
|
/* set i2c slave address of codec part */
|
||||||
I2C2_SLAD0 = AUDIO_I2C_ADDR << 1;
|
I2C2_SLAD0 = AS3514_I2C_ADDR << 1;
|
||||||
|
|
||||||
I2C2_CNTRL = 0x51;
|
I2C2_CNTRL = 0x51;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "as3525-codec.h"
|
#include "ascodec-target.h"
|
||||||
#include "as3514.h"
|
#include "as3514.h"
|
||||||
|
|
||||||
static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
|
static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,14 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "as3525-codec.h"
|
#include "ascodec-target.h"
|
||||||
|
#include "as3514.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
void power_off(void)
|
void power_off(void)
|
||||||
{
|
{
|
||||||
/* clear bit 0 of system register */
|
/* 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 ? */
|
/* TODO : turn off peripherals properly ? */
|
||||||
|
|
||||||
|
|
@ -40,7 +41,7 @@ void power_init(void)
|
||||||
#if CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
bool charger_inserted(void)
|
bool charger_inserted(void)
|
||||||
{
|
{
|
||||||
if(ascodec_read(0x25) & (1<<5))
|
if(ascodec_read(AS3514_IRQ_ENRD0) & (1<<5))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
#include "as3525-codec.h"
|
#include "ascodec-target.h"
|
||||||
|
|
||||||
#define default_interrupt(name) \
|
#define default_interrupt(name) \
|
||||||
extern __attribute__((weak,alias("UIRQ"))) void name (void)
|
extern __attribute__((weak,alias("UIRQ"))) void name (void)
|
||||||
|
|
|
||||||
|
|
@ -27,18 +27,16 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef CPU_PP
|
#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) || \
|
||||||
/* TODO: This header is actually portalplayer specific, and should be
|
CONFIG_CPU==AS3525
|
||||||
* moved into an appropriate subdir */
|
|
||||||
|
|
||||||
#include "i2c-pp.h"
|
|
||||||
|
|
||||||
#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
|
|
||||||
#define AS3514_I2C_ADDR 0x46
|
#define AS3514_I2C_ADDR 0x46
|
||||||
#else
|
#else
|
||||||
#error Unknown target!
|
#error Unknown target!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CPU_PP
|
||||||
|
#include "i2c-pp.h"
|
||||||
|
|
||||||
static inline int ascodec_write(unsigned int reg, unsigned int value)
|
static inline int ascodec_write(unsigned int reg, unsigned int value)
|
||||||
{
|
{
|
||||||
return pp_i2c_send(AS3514_I2C_ADDR, reg, value);
|
return pp_i2c_send(AS3514_I2C_ADDR, reg, value);
|
||||||
|
|
@ -63,7 +61,12 @@ static inline void ascodec_unlock(void)
|
||||||
{
|
{
|
||||||
i2c_unlock();
|
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 */
|
#endif /* !_ASCODEC_TARGET_H */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue