1
0
Fork 0
forked from len0rd/rockbox

Gigabeat S: Handle any DMA playback errors reported and stop in that case (none are expected but it's better to handle than ignore).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19983 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2009-02-12 02:04:26 +00:00
parent 911cc69ebd
commit e6bac4c6f4

View file

@ -51,7 +51,7 @@ static struct dma_data dma_play_data =
static void play_dma_callback(void) static void play_dma_callback(void)
{ {
unsigned char *start; unsigned char *start;
size_t size; size_t size = 0;
pcm_more_callback_type get_more = pcm_callback_for_more; pcm_more_callback_type get_more = pcm_callback_for_more;
if (dma_play_data.locked != 0) if (dma_play_data.locked != 0)
@ -61,13 +61,11 @@ static void play_dma_callback(void)
return; return;
} }
if (get_more == NULL || (get_more(&start, &size), size == 0)) if (dma_play_bd.mode.status & BD_RROR)
{ {
/* Callback missing or no more DMA to do */ /* Stop on error */
pcm_play_dma_stop();
pcm_play_dma_stopped_callback();
} }
else else if (get_more != NULL && (get_more(&start, &size), size != 0))
{ {
start = (void*)(((unsigned long)start + 3) & ~3); start = (void*)(((unsigned long)start + 3) & ~3);
size &= ~3; size &= ~3;
@ -79,7 +77,12 @@ static void play_dma_callback(void)
dma_play_bd.mode.command = TRANSFER_16BIT; dma_play_bd.mode.command = TRANSFER_16BIT;
dma_play_bd.mode.status = BD_DONE | BD_WRAP | BD_INTR; dma_play_bd.mode.status = BD_DONE | BD_WRAP | BD_INTR;
sdma_channel_run(DMA_PLAY_CH_NUM); sdma_channel_run(DMA_PLAY_CH_NUM);
return;
} }
/* Error, callback missing or no more DMA to do */
pcm_play_dma_stop();
pcm_play_dma_stopped_callback();
} }
void pcm_play_lock(void) void pcm_play_lock(void)