summaryrefslogtreecommitdiffstats
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire')
-rw-r--r--firmware/target/coldfire/pcm-coldfire.c63
1 files changed, 21 insertions, 42 deletions
diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c
index f9c0764d64..06f17d1170 100644
--- a/firmware/target/coldfire/pcm-coldfire.c
+++ b/firmware/target/coldfire/pcm-coldfire.c
@@ -288,13 +288,14 @@ 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 */
if (res & 0x70)
{
- /* Stop on error */
logf("DMA0 err: %02x", res);
#if 0
logf(" SAR0: %08x", SAR0);
@@ -303,32 +304,17 @@ void DMA0(void)
logf(" DCR0: %08x", DCR0);
#endif
}
- else
+
+ /* Force stop on error */
+ pcm_play_get_more_callback((res & 0x70) ? NULL : &start, &size);
+
+ if (size != 0)
{
- pcm_more_callback_type get_more = pcm_callback_for_more;
- unsigned char *start;
- size_t size = 0;
-
- if (get_more)
- get_more(&start, &size);
-
- start = (unsigned char *)(((long)start + 3) & ~3);
- size &= ~3;
-
- if (size > 0)
- {
- SAR0 = (unsigned long)start; /* Source address */
- BCR0 = size; /* Bytes to transfer */
- or_l(DMA_EEXT | DMA_INT, &DCR0); /* per request and int ON */
- return;
- }
- /* Finished playing */
+ SAR0 = (unsigned long)start; /* Source address */
+ BCR0 = size; /* Bytes to transfer */
+ or_l(DMA_EEXT | DMA_INT, &DCR0); /* per request and int ON */
}
-
- /* Stop interrupt and futher transfers */
- pcm_play_dma_stop();
- /* Inform PCM that we're done */
- pcm_play_dma_stopped_callback();
+ /* else inished playing */
} /* DMA0 */
const void * pcm_play_dma_get_peak_buffer(int *count)
@@ -436,7 +422,8 @@ void DMA1(void)
{
unsigned long res = DSR1;
int status = 0;
- pcm_more_callback_type2 more_ready;
+ void *start;
+ size_t size;
and_l(~(DMA_EEXT | DMA_INT), &DCR1); /* per request and int OFF */
DSR1 = 1; /* Clear interrupt and errors */
@@ -465,25 +452,17 @@ void DMA1(void)
}
#endif
- more_ready = pcm_callback_more_ready;
-
- if (more_ready != NULL && more_ready(status) >= 0)
- return;
+ /* Inform PCM we have more data (or error) */
+ pcm_rec_more_ready_callback(status, &start, &size);
- /* Finished recording */
- pcm_rec_dma_stop();
- /* Inform PCM that we're done */
- pcm_rec_dma_stopped_callback();
+ if (size != 0)
+ {
+ DAR1 = (unsigned long)start; /* Destination address */
+ BCR1 = (unsigned long)size; /* Bytes to transfer */
+ or_l(DMA_EEXT | DMA_INT, &DCR1); /* per request and int ON */
+ }
} /* DMA1 */
-/* Continue transferring data in - call from interrupt callback */
-void pcm_rec_dma_record_more(void *start, size_t size)
-{
- DAR1 = (unsigned long)start; /* Destination address */
- BCR1 = (unsigned long)size; /* Bytes to transfer */
- or_l(DMA_EEXT | DMA_INT, &DCR1); /* per request and int ON */
-} /* pcm_record_more */
-
const void * pcm_rec_dma_get_peak_buffer(void)
{
return (void *)(DAR1 & ~3);