From e69d567d9ebf7d236ff9663b11ac396cc71dcd75 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 12 Dec 2008 11:01:07 +0000 Subject: Bring consistency to pcm implementation and samplerate handling. Less low-level duplication. A small test_sampr fix so it works on coldfire again. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19400 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/pcm-pp.c | 56 ++++---------------------------------------- 1 file changed, 4 insertions(+), 52 deletions(-) (limited to 'firmware/target/arm/pcm-pp.c') diff --git a/firmware/target/arm/pcm-pp.c b/firmware/target/arm/pcm-pp.c index deaa20b6be..e00b1d7e75 100644 --- a/firmware/target/arm/pcm-pp.c +++ b/firmware/target/arm/pcm-pp.c @@ -25,10 +25,7 @@ #include "audio.h" #include "sound.h" #include "pcm.h" - -#ifdef HAVE_WM8751 -#define MROBE100_44100HZ (0x40|(0x11 << 1)|1) -#endif +#include "pcm_sampr.h" /** DMA **/ @@ -87,36 +84,9 @@ static struct dma_data dma_play_data SHAREDBSS_ATTR = .state = 0 }; -static unsigned long pcm_freq SHAREDDATA_ATTR = HW_SAMPR_DEFAULT; /* 44.1 is default */ -#ifdef HAVE_WM8751 -/* Samplerate control for audio codec */ -static int sr_ctrl = MROBE100_44100HZ; -#endif - -void pcm_set_frequency(unsigned int frequency) -{ -#if defined(HAVE_WM8731) || defined(HAVE_WM8721) - pcm_freq = frequency; -#else - (void)frequency; - pcm_freq = HW_SAMPR_DEFAULT; -#endif -#ifdef HAVE_WM8751 - sr_ctrl = MROBE100_44100HZ; -#endif -} - -void pcm_apply_settings(void) +void pcm_dma_apply_settings(void) { -#ifdef HAVE_WM8751 - audiohw_set_frequency(sr_ctrl); -#endif - -#if defined(HAVE_WM8711) || defined(HAVE_WM8721) \ - || defined(HAVE_WM8731) - audiohw_set_sample_rate(pcm_freq); -#endif - pcm_curr_sampr = pcm_freq; + audiohw_set_frequency(pcm_fsel); } /* ASM optimised FIQ handler. Checks for the minimum allowed loop cycles by @@ -330,9 +300,7 @@ static void play_stop_pcm(void) IIS_IRQTX_REG &= ~IIS_IRQTX; /* Wait for FIFO to empty */ -#ifdef CPU_PP502x - while (IIS_TX_FREE_COUNT < 16); -#endif + while (!IIS_TX_IS_EMPTY); dma_play_data.state = 0; } @@ -397,8 +365,6 @@ void pcm_play_dma_init(void) : [iiscfg]"r"(iiscfg), [dmapd]"r"(dmapd) : "r2"); - pcm_set_frequency(SAMPR_44); - /* Initialize default register values. */ audiohw_init(); @@ -620,24 +586,10 @@ void pcm_rec_dma_start(void *addr, size_t size) void pcm_rec_dma_close(void) { pcm_rec_dma_stop(); - -#if defined(IPOD_COLOR) || defined (IPOD_4G) - /* The usual magic from IPL - I'm guessing this configures the headphone - socket to be input or output - in this case, output. */ - GPIO_SET_BITWISE(GPIOI_OUTPUT_VAL, 0x40); - GPIO_SET_BITWISE(GPIOA_OUTPUT_VAL, 0x04); -#endif } /* pcm_close_recording */ void pcm_rec_dma_init(void) { -#if defined(IPOD_COLOR) || defined (IPOD_4G) - /* The usual magic from IPL - I'm guessing this configures the headphone - socket to be input or output - in this case, input. */ - GPIO_CLEAR_BITWISE(GPIOI_OUTPUT_VAL, 0x40); - GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_VAL, 0x04); -#endif - pcm_rec_dma_stop(); } /* pcm_init */ -- cgit v1.2.3