summaryrefslogtreecommitdiffstats
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2010-05-24 16:42:32 +0000
committerMichael Sevakis <jethead71@rockbox.org>2010-05-24 16:42:32 +0000
commitd56999890f2aacf197d9ae4383313271499509a9 (patch)
tree76a0177e2cf19bb15a065199b812ef20158422e1 /firmware/target/coldfire
parent6688988ec42aa2254c8e370ec1932033a258b6fa (diff)
downloadrockbox-d56999890f2aacf197d9ae4383313271499509a9.tar.gz
rockbox-d56999890f2aacf197d9ae4383313271499509a9.tar.bz2
rockbox-d56999890f2aacf197d9ae4383313271499509a9.zip
Make PCM->driver interface about as simple as it will get. Registered callback, zero data, alignment and stops are handled entirely inside pcm.c; driver merely calls fixed pcm.c callback. Remove pcm_record_more and do it just like playback; the original reason behind it isn't very practical in general. Everything checks out on supported targets. There wer some compat changes I can't check out on many unsupoorted but if there's a problem it will be a minor oops. Plugins become incompatible due to recording tweak-- full update. Sorted API.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26253 a1c6a512-1295-4272-9138-f99709370657
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);