summaryrefslogtreecommitdiffstats
path: root/apps/recorder
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 /apps/recorder
parent3f82f3aca14eb954e55f761721ffdd2684f0e812 (diff)
downloadrockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.tar.gz
rockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.tar.bz2
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 'apps/recorder')
-rw-r--r--apps/recorder/pcm_record.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c
index 90a6163b8f..d904be9a4e 100644
--- a/apps/recorder/pcm_record.c
+++ b/apps/recorder/pcm_record.c
@@ -257,20 +257,9 @@ enum
/*******************************************************************/
/* Callback for when more data is ready - called in interrupt context */
-static void pcm_rec_have_more(int status, void **start, size_t *size)
+static void pcm_rec_have_more(void **start, size_t *size)
{
- if (status < 0)
- {
- /* some error condition */
- if (status == DMA_REC_ERROR_DMA)
- {
- /* Flush recorded data to disk and stop recording */
- queue_post(&pcmrec_queue, PCMREC_STOP, 0);
- return;
- }
- /* else try again next transmission - frame is invalid */
- }
- else if (!dma_lock)
+ if (!dma_lock)
{
/* advance write position */
int next_pos = (dma_wr_pos + PCM_CHUNK_SIZE) & PCM_CHUNK_MASK;
@@ -287,6 +276,23 @@ static void pcm_rec_have_more(int status, void **start, size_t *size)
*size = PCM_CHUNK_SIZE;
} /* pcm_rec_have_more */
+static enum pcm_dma_status pcm_rec_status_callback(enum pcm_dma_status status)
+{
+ if (status < PCM_DMAST_OK)
+ {
+ /* some error condition */
+ if (status == PCM_DMAST_ERR_DMA)
+ {
+ /* Flush recorded data to disk and stop recording */
+ queue_post(&pcmrec_queue, PCMREC_STOP, 0);
+ return status;
+ }
+ /* else try again next transmission - frame is invalid */
+ }
+
+ return PCM_DMAST_OK;
+} /* pcm_rec_status_callback */
+
static void reset_hardware(void)
{
/* reset pcm to defaults */
@@ -1239,8 +1245,8 @@ static void pcmrec_set_recording_options(
{
/* start DMA transfer */
dma_lock = pre_record_ticks == 0;
- pcm_record_data(pcm_rec_have_more, GET_PCM_CHUNK(dma_wr_pos),
- PCM_CHUNK_SIZE);
+ pcm_record_data(pcm_rec_have_more, pcm_rec_status_callback,
+ GET_PCM_CHUNK(dma_wr_pos), PCM_CHUNK_SIZE);
}
else
{