summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-02-23 08:14:46 -0500
committerMichael Sevakis <jethead71@rockbox.org>2012-03-03 07:23:38 +0100
commit286a4c5caa1945c8d1cb365a3d90fb09d5700cb2 (patch)
tree4835f46d16ec78d035ec9f49333079fe618384c1 /firmware/target/coldfire
parent3f82f3aca14eb954e55f761721ffdd2684f0e812 (diff)
downloadrockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.tar.gz
rockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.zip
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 <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
Diffstat (limited to 'firmware/target/coldfire')
-rw-r--r--firmware/target/coldfire/pcm-coldfire.c36
1 files changed, 18 insertions, 18 deletions
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")));
294void DMA0(void) 294void DMA0(void)
295{ 295{
296 unsigned long res = DSR0; 296 unsigned long res = DSR0;
297 void *start;
298 size_t size;
299 297
300 and_l(~(DMA_EEXT | DMA_INT), &DCR0); /* per request and int OFF */ 298 and_l(~(DMA_EEXT | DMA_INT), &DCR0); /* per request and int OFF */
301 DSR0 = 1; /* Clear interrupt and errors */ 299 DSR0 = 1; /* Clear interrupt and errors */
@@ -311,17 +309,18 @@ void DMA0(void)
311#endif 309#endif
312 } 310 }
313 311
314 /* Force stop on error */ 312 const void *addr;
315 pcm_play_get_more_callback((res & 0x70) ? NULL : &start, &size); 313 size_t size;
316 314
317 if (size != 0) 315 if (pcm_play_dma_complete_callback((res & 0x70) ?
316 PCM_DMAST_ERR_DMA : PCM_DMAST_OK,
317 &addr, &size))
318 { 318 {
319 SAR0 = (unsigned long)start; /* Source address */ 319 SAR0 = (unsigned long)addr; /* Source address */
320 BCR0 = size; /* Bytes to transfer */ 320 BCR0 = (unsigned long)size; /* Bytes to transfer */
321 or_l(DMA_EEXT | DMA_INT, &DCR0); /* per request and int ON */ 321 or_l(DMA_EEXT | DMA_INT, &DCR0); /* per request and int ON */
322 322
323 /* Call buffer callback */ 323 pcm_play_dma_status_callback(PCM_DMAST_STARTED);
324 pcm_play_dma_started_callback();
325 } 324 }
326 /* else inished playing */ 325 /* else inished playing */
327} /* DMA0 */ 326} /* DMA0 */
@@ -368,7 +367,7 @@ void pcm_rec_unlock(void)
368 367
369void pcm_rec_dma_start(void *addr, size_t size) 368void pcm_rec_dma_start(void *addr, size_t size)
370{ 369{
371 /* stop any DMA in progress */ 370 /* Stop any DMA in progress */
372 pcm_rec_dma_stop(); 371 pcm_rec_dma_stop();
373 372
374 and_l(~PDIR2_FIFO_RESET, &DATAINCONTROL); 373 and_l(~PDIR2_FIFO_RESET, &DATAINCONTROL);
@@ -430,16 +429,14 @@ void DMA1(void) __attribute__ ((interrupt_handler, section(".icode")));
430void DMA1(void) 429void DMA1(void)
431{ 430{
432 unsigned long res = DSR1; 431 unsigned long res = DSR1;
433 int status = 0; 432 enum pcm_dma_status status = PCM_DMAST_OK;
434 void *start;
435 size_t size;
436 433
437 and_l(~(DMA_EEXT | DMA_INT), &DCR1); /* per request and int OFF */ 434 and_l(~(DMA_EEXT | DMA_INT), &DCR1); /* per request and int OFF */
438 DSR1 = 1; /* Clear interrupt and errors */ 435 DSR1 = 1; /* Clear interrupt and errors */
439 436
440 if (res & 0x70) 437 if (res & 0x70)
441 { 438 {
442 status = DMA_REC_ERROR_DMA; 439 status = PCM_DMAST_ERR_DMA;
443 logf("DMA1 err: %02x", res); 440 logf("DMA1 err: %02x", res);
444#if 0 441#if 0
445 logf(" SAR1: %08x", SAR1); 442 logf(" SAR1: %08x", SAR1);
@@ -456,19 +453,22 @@ void DMA1(void)
456 * Ignore valnogood since several sources don't set it properly. */ 453 * Ignore valnogood since several sources don't set it properly. */
457 /* clear: ebu1cnew, symbolerr, parityerr */ 454 /* clear: ebu1cnew, symbolerr, parityerr */
458 INTERRUPTCLEAR = (1 << 25) | (1 << 23) | (1 << 22); 455 INTERRUPTCLEAR = (1 << 25) | (1 << 23) | (1 << 22);
459 status = DMA_REC_ERROR_SPDIF; 456 status = PCM_DMAST_ERR_SPDIF;
460 logf("spdif err"); 457 logf("spdif err");
461 } 458 }
462#endif 459#endif
463 460
464 /* Inform PCM we have more data (or error) */ 461 /* Inform PCM we have more data (or error) */
465 pcm_rec_more_ready_callback(status, &start, &size); 462 void *addr;
463 size_t size;
466 464
467 if (size != 0) 465 if (pcm_rec_dma_complete_callback(status, &addr, &size))
468 { 466 {
469 DAR1 = (unsigned long)start; /* Destination address */ 467 DAR1 = (unsigned long)addr; /* Destination address */
470 BCR1 = (unsigned long)size; /* Bytes to transfer */ 468 BCR1 = (unsigned long)size; /* Bytes to transfer */
471 or_l(DMA_EEXT | DMA_INT, &DCR1); /* per request and int ON */ 469 or_l(DMA_EEXT | DMA_INT, &DCR1); /* per request and int ON */
470
471 pcm_rec_dma_status_callback(PCM_DMAST_STARTED);
472 } 472 }
473} /* DMA1 */ 473} /* DMA1 */
474 474