From 286a4c5caa1945c8d1cb365a3d90fb09d5700cb2 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Thu, 23 Feb 2012 08:14:46 -0500 Subject: Revise the PCM callback system after adding multichannel audio. Additional status callback is added to pcm_play/rec_data instead of using a special function to set it. Status includes DMA error reporting to the status callback. Playback and recording callback become more alike except playback uses "const void **addr" (because the data should not be altered) and recording uses "void **addr". "const" is put in place throughout where appropriate. Most changes are fairly trivial. One that should be checked in particular because it isn't so much is telechips, if anyone cares to bother. PP5002 is not so trivial either but that tested as working. Change-Id: I4928d69b3b3be7fb93e259f81635232df9bd1df2 Reviewed-on: http://gerrit.rockbox.org/166 Reviewed-by: Michael Sevakis Tested-by: Michael Sevakis --- firmware/target/arm/pnx0101/pcm-pnx0101.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'firmware/target/arm/pnx0101') diff --git a/firmware/target/arm/pnx0101/pcm-pnx0101.c b/firmware/target/arm/pnx0101/pcm-pnx0101.c index 89d56af374..bb11ad32fe 100644 --- a/firmware/target/arm/pnx0101/pcm-pnx0101.c +++ b/firmware/target/arm/pnx0101/pcm-pnx0101.c @@ -28,7 +28,7 @@ short __attribute__((section(".dmabuf"))) dma_buf_left[DMA_BUF_SAMPLES]; short __attribute__((section(".dmabuf"))) dma_buf_right[DMA_BUF_SAMPLES]; -unsigned short* p IBSS_ATTR; +const int16_t* p IBSS_ATTR; size_t p_size IBSS_ATTR; void pcm_play_lock(void) @@ -41,7 +41,7 @@ void pcm_play_unlock(void) void pcm_play_dma_start(const void *addr, size_t size) { - p = (unsigned short*)addr; + p = addr; p_size = size; } @@ -69,7 +69,7 @@ static inline void fill_dma_buf(int offset) do { int count; - unsigned short *tmp_p; + const int16_t *tmp_p; count = MIN(p_size / 4, (size_t)(lend - l)); tmp_p = p; p_size -= count * 4; @@ -109,16 +109,14 @@ static inline void fill_dma_buf(int offset) if (new_buffer) { new_buffer = false; - pcm_play_dma_started_callback(); + pcm_play_dma_status_callback(PCM_DMAST_STARTED); } if (l >= lend) return; - pcm_play_get_more_callback((void**)&p, &p_size); - - if (p_size) - new_buffer = true; + new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK, + &p, &p_size); } while (p_size); } -- cgit v1.2.3