Limit AUDIO_IRQ handling to AS3525, since it doesn't work on the newer SoC in SANSA_CLIPPLUS yet.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25305 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f5988d4fbd
commit
c4e4ffb541
4 changed files with 49 additions and 12 deletions
|
@ -96,7 +96,9 @@ static unsigned char *req_data_ptr = NULL;
|
|||
static struct ascodec_request *req_head = NULL;
|
||||
static struct ascodec_request *req_tail = NULL;
|
||||
|
||||
#if CONFIG_CPU == AS3525
|
||||
static struct wakeup adc_wkup;
|
||||
static struct ascodec_request as_audio_req;
|
||||
|
||||
#ifdef DEBUG
|
||||
static int int_audio_ctr = 0;
|
||||
|
@ -107,15 +109,16 @@ static int int_usb_insert = 0;
|
|||
static int int_usb_remove = 0;
|
||||
static int int_rtc = 0;
|
||||
static int int_adc = 0;
|
||||
#endif
|
||||
#endif /* DEBUG */
|
||||
|
||||
static struct ascodec_request as_audio_req;
|
||||
static void ascodec_read_cb(unsigned const char *data, unsigned int len);
|
||||
#endif /* CONFIG_CPU == AS3525 */
|
||||
|
||||
static void ascodec_start_req(struct ascodec_request *req);
|
||||
static int ascodec_continue_req(struct ascodec_request *req, int irq_status);
|
||||
static void ascodec_finish_req(struct ascodec_request *req);
|
||||
static void ascodec_read_cb(unsigned const char *data, unsigned int len);
|
||||
|
||||
#if CONFIG_CPU == AS3525
|
||||
void INT_AUDIO(void)
|
||||
{
|
||||
VIC_INT_EN_CLEAR = INTERRUPT_AUDIO;
|
||||
|
@ -123,6 +126,7 @@ void INT_AUDIO(void)
|
|||
|
||||
ascodec_async_read(AS3514_IRQ_ENRD0, 3, &as_audio_req, ascodec_read_cb);
|
||||
}
|
||||
#endif /* CONFIG_CPU == AS3525 */
|
||||
|
||||
void INT_I2C_AUDIO(void)
|
||||
{
|
||||
|
@ -162,7 +166,9 @@ void ascodec_init(void)
|
|||
int prescaler;
|
||||
|
||||
mutex_init(&as_mtx);
|
||||
#if CONFIG_CPU == AS3525
|
||||
wakeup_init(&adc_wkup);
|
||||
#endif
|
||||
|
||||
/* enable clock */
|
||||
CGU_PERI |= CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE;
|
||||
|
@ -423,6 +429,7 @@ int ascodec_readbytes(unsigned int index, unsigned int len, unsigned char *data)
|
|||
return i;
|
||||
}
|
||||
|
||||
#if CONFIG_CPU == AS3525
|
||||
static void ascodec_read_cb(unsigned const char *data, unsigned int len)
|
||||
{
|
||||
if (len != 3) /* some error happened? */
|
||||
|
@ -465,6 +472,7 @@ void ascodec_wait_adc_finished(void)
|
|||
{
|
||||
wakeup_wait(&adc_wkup, TIMEOUT_BLOCK);
|
||||
}
|
||||
#endif /* CONFIG_CPU == AS3525 */
|
||||
|
||||
|
||||
void ascodec_enable_endofch_irq(void)
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
#ifndef SIMULATOR
|
||||
|
||||
#include "as3514.h"
|
||||
#include "kernel.h" /* for struct wakeup */
|
||||
#include "kernel.h" /* for struct wakeup */
|
||||
#include "clock-target.h" /* for AS3525_I2C_PRESCALER */
|
||||
|
||||
/* Charge Pump and Power management Settings */
|
||||
#define AS314_CP_DCDC3_SETTING \
|
||||
|
@ -70,8 +71,6 @@ struct ascodec_request {
|
|||
|
||||
void ascodec_init(void);
|
||||
|
||||
void ascodec_init_late(void);
|
||||
|
||||
int ascodec_write(unsigned int index, unsigned int value);
|
||||
|
||||
int ascodec_read(unsigned int index);
|
||||
|
@ -106,7 +105,14 @@ void ascodec_lock(void);
|
|||
|
||||
void ascodec_unlock(void);
|
||||
|
||||
#if CONFIG_CPU == AS3525
|
||||
void ascodec_wait_adc_finished(void);
|
||||
#else
|
||||
static inline void ascodec_wait_adc_finished(void)
|
||||
{
|
||||
/* FIXME: Doesn't work yet on AS3525v2 */
|
||||
}
|
||||
#endif
|
||||
|
||||
void ascodec_enable_endofch_irq(void);
|
||||
|
||||
|
|
|
@ -29,7 +29,13 @@
|
|||
#include "power.h"
|
||||
#include "as3525.h"
|
||||
|
||||
#if defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_FUZEV2)
|
||||
#warning USB_DETECT_PIN not defined for your target
|
||||
#endif
|
||||
|
||||
#if CONFIG_CPU == AS3525
|
||||
static int usb_status = USB_EXTRACTED;
|
||||
#endif
|
||||
|
||||
void usb_enable(bool on)
|
||||
{
|
||||
|
@ -43,6 +49,14 @@ void usb_enable(bool on)
|
|||
#endif
|
||||
}
|
||||
|
||||
void usb_init_device(void)
|
||||
{
|
||||
#ifdef USB_DETECT_PIN
|
||||
GPIOA_DIR &= ~(1 << USB_DETECT_PIN); /* set as input */
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_CPU == AS3525
|
||||
void usb_insert_int(void)
|
||||
{
|
||||
usb_status = USB_INSERTED;
|
||||
|
@ -53,11 +67,18 @@ void usb_remove_int(void)
|
|||
usb_status = USB_EXTRACTED;
|
||||
}
|
||||
|
||||
void usb_init_device(void)
|
||||
{
|
||||
}
|
||||
|
||||
int usb_detect(void)
|
||||
{
|
||||
return usb_status;
|
||||
}
|
||||
#else
|
||||
int usb_detect(void)
|
||||
{
|
||||
#ifdef USB_DETECT_PIN
|
||||
if (GPIOA_PIN( USB_DETECT_PIN ))
|
||||
return USB_INSERTED;
|
||||
else
|
||||
#endif
|
||||
return USB_EXTRACTED;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
#define USB_TARGET_H
|
||||
|
||||
void usb_init_device(void);
|
||||
int usb_detect(void);
|
||||
#if CONFIG_CPU == AS3525
|
||||
void usb_insert_int(void);
|
||||
void usb_remove_int(void);
|
||||
int usb_detect(void);
|
||||
#endif /* CONFIG_CPU == AS3525 */
|
||||
|
||||
#endif
|
||||
#endif /* USB_TARGET_H */
|
||||
|
|
Loading…
Reference in a new issue