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/as3525/pcm-as3525.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'firmware/target/arm/as3525/pcm-as3525.c') diff --git a/firmware/target/arm/as3525/pcm-as3525.c b/firmware/target/arm/as3525/pcm-as3525.c index 0ecc63d018..eb22fc2016 100644 --- a/firmware/target/arm/as3525/pcm-as3525.c +++ b/firmware/target/arm/as3525/pcm-as3525.c @@ -36,9 +36,9 @@ * and the number of 32bits words has to * fit in 11 bits of DMA register */ -static void *dma_start_addr; /* Pointer to callback buffer */ +static const void *dma_start_addr; /* Pointer to callback buffer */ static size_t dma_start_size; /* Size of callback buffer */ -static void *dma_sub_addr; /* Pointer to sub buffer */ +static const void *dma_sub_addr; /* Pointer to sub buffer */ static size_t dma_rem_size; /* Remaining size - in 4*32 bits */ static size_t play_sub_size; /* size of current subtransfer */ static void dma_callback(void); @@ -100,9 +100,8 @@ static void dma_callback(void) if(!dma_rem_size) { - pcm_play_get_more_callback(&dma_start_addr, &dma_start_size); - - if (!dma_start_size) + if(!pcm_play_dma_complete_callback(PCM_DMAST_OK, &dma_start_addr, + &dma_start_size)) return; dma_sub_addr = dma_start_addr; @@ -111,7 +110,7 @@ static void dma_callback(void) /* force writeback */ commit_dcache_range(dma_start_addr, dma_start_size); play_start_pcm(); - pcm_play_dma_started_callback(); + pcm_play_dma_status_callback(PCM_DMAST_STARTED); } else { @@ -123,7 +122,7 @@ void pcm_play_dma_start(const void *addr, size_t size) { is_playing = true; - dma_start_addr = (void*)addr; + dma_start_addr = addr; dma_start_size = size; dma_sub_addr = dma_start_addr; dma_rem_size = size; @@ -368,7 +367,12 @@ void INT_I2SIN(void) } } - pcm_rec_more_ready_callback(0, (void *)&rec_dma_addr, &rec_dma_size); + /* Inform middle layer */ + if (pcm_rec_dma_complete_callback(PCM_DMAST_OK, (void **)&rec_dma_addr, + &rec_dma_size)) + { + pcm_rec_dma_status_callback(PCM_DMAST_STARTED); + } } -- cgit v1.2.3