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/coldfire/pcm-coldfire.c | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'firmware/target/coldfire') diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c index e95d445337..2e2312f7ae 100644 --- a/firmware/target/coldfire/pcm-coldfire.c +++ b/firmware/target/coldfire/pcm-coldfire.c @@ -294,8 +294,6 @@ void DMA0(void) __attribute__ ((interrupt_handler, section(".icode"))); void DMA0(void) { unsigned long res = DSR0; - void *start; - size_t size; and_l(~(DMA_EEXT | DMA_INT), &DCR0); /* per request and int OFF */ DSR0 = 1; /* Clear interrupt and errors */ @@ -311,17 +309,18 @@ void DMA0(void) #endif } - /* Force stop on error */ - pcm_play_get_more_callback((res & 0x70) ? NULL : &start, &size); + const void *addr; + size_t size; - if (size != 0) + if (pcm_play_dma_complete_callback((res & 0x70) ? + PCM_DMAST_ERR_DMA : PCM_DMAST_OK, + &addr, &size)) { - SAR0 = (unsigned long)start; /* Source address */ - BCR0 = size; /* Bytes to transfer */ + SAR0 = (unsigned long)addr; /* Source address */ + BCR0 = (unsigned long)size; /* Bytes to transfer */ or_l(DMA_EEXT | DMA_INT, &DCR0); /* per request and int ON */ - /* Call buffer callback */ - pcm_play_dma_started_callback(); + pcm_play_dma_status_callback(PCM_DMAST_STARTED); } /* else inished playing */ } /* DMA0 */ @@ -368,7 +367,7 @@ void pcm_rec_unlock(void) void pcm_rec_dma_start(void *addr, size_t size) { - /* stop any DMA in progress */ + /* Stop any DMA in progress */ pcm_rec_dma_stop(); and_l(~PDIR2_FIFO_RESET, &DATAINCONTROL); @@ -430,16 +429,14 @@ void DMA1(void) __attribute__ ((interrupt_handler, section(".icode"))); void DMA1(void) { unsigned long res = DSR1; - int status = 0; - void *start; - size_t size; + enum pcm_dma_status status = PCM_DMAST_OK; and_l(~(DMA_EEXT | DMA_INT), &DCR1); /* per request and int OFF */ DSR1 = 1; /* Clear interrupt and errors */ if (res & 0x70) { - status = DMA_REC_ERROR_DMA; + status = PCM_DMAST_ERR_DMA; logf("DMA1 err: %02x", res); #if 0 logf(" SAR1: %08x", SAR1); @@ -456,19 +453,22 @@ void DMA1(void) * Ignore valnogood since several sources don't set it properly. */ /* clear: ebu1cnew, symbolerr, parityerr */ INTERRUPTCLEAR = (1 << 25) | (1 << 23) | (1 << 22); - status = DMA_REC_ERROR_SPDIF; + status = PCM_DMAST_ERR_SPDIF; logf("spdif err"); } #endif /* Inform PCM we have more data (or error) */ - pcm_rec_more_ready_callback(status, &start, &size); + void *addr; + size_t size; - if (size != 0) + if (pcm_rec_dma_complete_callback(status, &addr, &size)) { - DAR1 = (unsigned long)start; /* Destination address */ + DAR1 = (unsigned long)addr; /* Destination address */ BCR1 = (unsigned long)size; /* Bytes to transfer */ or_l(DMA_EEXT | DMA_INT, &DCR1); /* per request and int ON */ + + pcm_rec_dma_status_callback(PCM_DMAST_STARTED); } } /* DMA1 */ -- cgit