ascodec-target.h: remove

move prototypes to ascodec.h
move code to ascodec*.c

YPR0: use adc-as3514.c instead of duplicating it

TODO: merge as3514.h and ascodec.h ?

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31626 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2012-01-08 01:43:16 +00:00
parent 2737a66471
commit 8552824284
25 changed files with 181 additions and 338 deletions

View file

@ -44,7 +44,7 @@
interrupt bit 7 is raised and DACNT is not decremented after the transfer.
*/
#include "ascodec-target.h"
#include "ascodec.h"
#include "clock-target.h"
#include "kernel.h"
#include "system.h"
@ -534,6 +534,29 @@ bool ascodec_chg_status(void)
{
return ascodec_enrd0_shadow & CHG_STATUS;
}
void ascodec_monitor_endofch(void)
{
/* already enabled */
}
void ascodec_write_charger(int value)
{
#if CONFIG_CPU == AS3525
ascodec_write(AS3514_CHARGER, value);
#else
ascodec_write_pmu(AS3543_CHARGER, 1, value);
#endif
}
int ascodec_read_charger(void)
{
#if CONFIG_CPU == AS3525
return ascodec_read(AS3514_CHARGER);
#else
return ascodec_read_pmu(AS3543_CHARGER, 1);
#endif
}
#endif /* CONFIG_CHARGING */
/*

View file

@ -1,96 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Driver for AS3514 audio codec
*
* Copyright (c) 2007 Daniel Ankers
* Copyright (c) 2007 Christian Gmeiner
*
* 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.
*
****************************************************************************/
#ifndef _ASCODEC_TARGET_H
#define _ASCODEC_TARGET_H
#ifndef SIMULATOR
#include "config.h"
#include "as3514.h"
#include "kernel.h" /* for struct semaphore */
#include "clock-target.h" /* for AS3525_I2C_PRESCALER */
#include "system-arm.h"
/* Charge Pump and Power management Settings */
#define AS314_CP_DCDC3_SETTING \
((0<<7) | /* CP_SW Auto-Switch Margin 0=200/300 1=150/255 */ \
(0<<6) | /* CP_on 0=Normal op 1=Chg Pump Always On */ \
(0<<5) | /* LREG_CPnot Always write 0 */ \
(0<<3) | /* DCDC3p BVDD setting 3.6/3.2/3.1/3.0 */ \
(1<<2) | /* LREG_off 1=Auto mode switching 0=Length Reg only*/\
(0<<0) ) /* CVDDp Core Voltage Setting 1.2/1.15/1.10/1.05*/
#define CVDD_1_20 0
#define CVDD_1_15 1
#define CVDD_1_10 2
#define CVDD_1_05 3
void ascodec_init(void) INIT_ATTR;
int ascodec_write(unsigned int index, unsigned int value);
int ascodec_read(unsigned int index);
int ascodec_readbytes(unsigned int index, unsigned int len, unsigned char *data);
void ascodec_lock(void);
void ascodec_unlock(void);
void ascodec_wait_adc_finished(void);
static inline void ascodec_monitor_endofch(void) {} /* already enabled */
bool ascodec_endofch(void);
bool ascodec_chg_status(void);
#if CONFIG_CPU == AS3525v2
void ascodec_write_pmu(unsigned int index, unsigned int subreg,
unsigned int value);
int ascodec_read_pmu(unsigned int index, unsigned int subreg);
#endif /* CONFIG_CPU == AS3525v2 */
static inline void ascodec_write_charger(int value)
{
#if CONFIG_CPU == AS3525
ascodec_write(AS3514_CHARGER, value);
#else
ascodec_write_pmu(AS3543_CHARGER, 1, value);
#endif
}
static inline int ascodec_read_charger(void)
{
#if CONFIG_CPU == AS3525
return ascodec_read(AS3514_CHARGER);
#else
return ascodec_read_pmu(AS3543_CHARGER, 1);
#endif
}
#endif /* !SIMULATOR */
#endif /* !_ASCODEC_TARGET_H */

View file

@ -23,7 +23,7 @@
#include "system.h"
#include "lcd.h"
#include "backlight.h"
#include "ascodec-target.h"
#include "ascodec.h"
#include "as3514.h"
int buttonlight_is_on = 0;

View file

@ -26,7 +26,7 @@
#include "system.h"
#include "cpu.h"
#include "pl180.h"
#include "ascodec-target.h"
#include "ascodec.h"
#include "adc.h"
#include "storage.h"

View file

@ -20,7 +20,7 @@
****************************************************************************/
#include <stdbool.h>
#include "config.h"
#include "ascodec-target.h"
#include "ascodec.h"
#include "as3514.h"
#include "power.h"

View file

@ -23,7 +23,7 @@
#include "system.h"
#include "lcd.h"
#include "backlight.h"
#include "ascodec-target.h"
#include "ascodec.h"
#include "as3514.h"
int buttonlight_is_on = 0;

View file

@ -22,7 +22,7 @@
#include "backlight-target.h"
#include "lcd.h"
#include "as3525v2.h"
#include "ascodec-target.h"
#include "ascodec.h"
void _backlight_on(void)
{

View file

@ -22,7 +22,7 @@
#include "backlight-target.h"
#include "lcd.h"
#include "as3525v2.h"
#include "ascodec-target.h"
#include "ascodec.h"
void _backlight_on(void)
{

View file

@ -24,7 +24,7 @@
#include "backlight-target.h"
#include "lcd.h"
#include "as3525v2.h"
#include "ascodec-target.h"
#include "ascodec.h"
#include "lcd-target.h"
bool _backlight_init()

View file

@ -23,7 +23,7 @@
#include "system.h"
#include "lcd.h"
#include "backlight.h"
#include "ascodec-target.h"
#include "ascodec.h"
#include "as3514.h"
void _backlight_set_brightness(int brightness)

View file

@ -24,7 +24,7 @@
#include "kernel.h"
#include "system.h"
#include "panic.h"
#include "ascodec-target.h"
#include "ascodec.h"
#include "adc.h"
#include "dma-target.h"
#include "clock-target.h"
@ -33,6 +33,20 @@
#include "backlight-target.h"
#include "lcd.h"
/* Charge Pump and Power management Settings */
#define AS314_CP_DCDC3_SETTING \
((0<<7) | /* CP_SW Auto-Switch Margin 0=200/300 1=150/255 */ \
(0<<6) | /* CP_on 0=Normal op 1=Chg Pump Always On */ \
(0<<5) | /* LREG_CPnot Always write 0 */ \
(0<<3) | /* DCDC3p BVDD setting 3.6/3.2/3.1/3.0 */ \
(1<<2) | /* LREG_off 1=Auto mode switching 0=Length Reg only*/\
(0<<0) ) /* CVDDp Core Voltage Setting 1.2/1.15/1.10/1.05*/
#define CVDD_1_20 0
#define CVDD_1_15 1
#define CVDD_1_10 2
#define CVDD_1_05 3
#define default_interrupt(name) \
extern __attribute__((weak,alias("UIRQ"))) void name (void)