summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-12-10 14:21:31 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-12-10 14:21:31 +0000
commiteca9f7fd6023a2b7acde89692812d1ecbd8964e6 (patch)
treef434bcc02db8245b27de67fda4977f19a723815f /firmware/export
parent0a8d88228baf68c3bc515ca4a1add44aac7e5617 (diff)
downloadrockbox-eca9f7fd6023a2b7acde89692812d1ecbd8964e6.tar.gz
rockbox-eca9f7fd6023a2b7acde89692812d1ecbd8964e6.zip
Place all recording functionality on pcmrec thread to serialize all recording operations. Button mash problems should be ruled out of pcm_record.c. Add additional lightweight checks by default and display any warnings that occurred during recording in first line of recording screen when they occur by blinking back and forth from warning display to normal line (Warning: <hex bitmask>). Warnings are cleared when beginning a new recording so write the number down if you see it and file a report. Add heavier checks when PCMREC_PARANOID is defined in the player config header (encoders and pcm_record must be aware of the define since it changes the chunk header format). These checks are mainly concerned with things that may cause skipping but also add unwanted overhead for normal operation. Best used with logf enabled.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11705 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/audio.h17
-rw-r--r--firmware/export/enc_base.h8
-rw-r--r--firmware/export/pcm_record.h32
3 files changed, 49 insertions, 8 deletions
diff --git a/firmware/export/audio.h b/firmware/export/audio.h
index 3edbfe155d..6a98d6f4c5 100644
--- a/firmware/export/audio.h
+++ b/firmware/export/audio.h
@@ -39,16 +39,17 @@
39#define audio_play(x) sim_audio_play(x) 39#define audio_play(x) sim_audio_play(x)
40#endif 40#endif
41 41
42#define AUDIO_STATUS_PLAY 1 42#define AUDIO_STATUS_PLAY 0x0001
43#define AUDIO_STATUS_PAUSE 2 43#define AUDIO_STATUS_PAUSE 0x0002
44#define AUDIO_STATUS_RECORD 4 44#define AUDIO_STATUS_RECORD 0x0004
45#define AUDIO_STATUS_PRERECORD 8 45#define AUDIO_STATUS_PRERECORD 0x0008
46#define AUDIO_STATUS_ERROR 16 46#define AUDIO_STATUS_ERROR 0x0010
47#define AUDIO_STATUS_WARNING 0x0020
47 48
48#define AUDIOERR_DISK_FULL 1 49#define AUDIOERR_DISK_FULL 1
49 50
50#define AUDIO_GAIN_LINEIN 0 51#define AUDIO_GAIN_LINEIN 0
51#define AUDIO_GAIN_MIC 1 52#define AUDIO_GAIN_MIC 1
52 53
53 54
54struct audio_debug 55struct audio_debug
diff --git a/firmware/export/enc_base.h b/firmware/export/enc_base.h
index 1be796ec8f..8d1e6fa11e 100644
--- a/firmware/export/enc_base.h
+++ b/firmware/export/enc_base.h
@@ -152,10 +152,18 @@ struct encoder_config
152#define CHUNKF_ERROR 0x80000000 /* An error has occured (passed to/ 152#define CHUNKF_ERROR 0x80000000 /* An error has occured (passed to/
153 from encoder). Use the sign bit to 153 from encoder). Use the sign bit to
154 check (long)flags < 0. */ 154 check (long)flags < 0. */
155#define CHUNKF_ALLFLAGS 0x80000033
155 156
156/* Header at the beginning of every encoder chunk */ 157/* Header at the beginning of every encoder chunk */
158#ifdef PCMREC_PARANOID
159#define ENC_CHUNK_MAGIC H_TO_BE32(('P' << 24) | ('T' << 16) | ('Y' << 8) | 'R')
160#endif
157struct enc_chunk_hdr 161struct enc_chunk_hdr
158{ 162{
163#ifdef PCMREC_PARANOID
164 unsigned long id; /* overflow detection - 'PTYR' - acronym for
165 "PTYR Tells You Right" ;) */
166#endif
159 unsigned long flags; /* in/out: flags used by encoder and file 167 unsigned long flags; /* in/out: flags used by encoder and file
160 writing */ 168 writing */
161 size_t enc_size; /* out: amount of encoder data written to 169 size_t enc_size; /* out: amount of encoder data written to
diff --git a/firmware/export/pcm_record.h b/firmware/export/pcm_record.h
index f6dddb3424..865a37fc70 100644
--- a/firmware/export/pcm_record.h
+++ b/firmware/export/pcm_record.h
@@ -25,6 +25,37 @@
25#define DMA_REC_ERROR_SPDIF (-2) 25#define DMA_REC_ERROR_SPDIF (-2)
26#endif 26#endif
27 27
28/** Warnings **/
29/* pcm (dma) buffer has overflowed */
30#define PCMREC_W_PCM_BUFFER_OVF 0x00000001
31/* encoder output buffer has overflowed */
32#define PCMREC_W_ENC_BUFFER_OVF 0x00000002
33#ifdef PCMREC_PARANOID
34/* dma write position alignment incorrect */
35#define PCMREC_W_DMA_WR_POS_ALIGN 0x00000004
36/* pcm read position changed at some point not under control of recording */
37#define PCMREC_W_PCM_RD_POS_TRASHED 0x00000008
38/* dma write position changed at some point not under control of recording */
39#define PCMREC_W_DMA_WR_POS_TRASHED 0x00000010
40#endif /* PCMREC_PARANOID */
41/** Errors **/
42/* failed to load encoder */
43#define PCMREC_E_LOAD_ENCODER 0x80001000
44/* error originating in encoder */
45#define PCMREC_E_ENCODER 0x80002000
46/* filename queue has desynced from stream markers */
47#define PCMREC_E_FNQ_DESYNC 0x80004000
48#ifdef PCMREC_PARANOID
49/* encoder has written past end of allotted space */
50#define PCMREC_E_CHUNK_OVF 0x80008000
51/* chunk header incorrect */
52#define PCMREC_E_BAD_CHUNK 0x80010000
53/* encoder read position changed outside of recording control */
54#define PCMREC_E_ENC_RD_INDEX_TRASHED 0x80020000
55/* encoder write position changed outside of recording control */
56#define PCMREC_E_ENC_WR_INDEX_TRASHED 0x80040000
57#endif /* PCMREC_PARANOID */
58
28/** 59/**
29 * RAW pcm data recording 60 * RAW pcm data recording
30 * These calls are nescessary only when using the raw pcm apis directly. 61 * These calls are nescessary only when using the raw pcm apis directly.
@@ -54,6 +85,7 @@ void pcm_rec_error_clear(void);
54/* pcm_rec_status is deprecated for general use. audio_status merges the 85/* pcm_rec_status is deprecated for general use. audio_status merges the
55 results for consistency with the hardware codec version */ 86 results for consistency with the hardware codec version */
56unsigned long pcm_rec_status(void); 87unsigned long pcm_rec_status(void);
88unsigned long pcm_rec_get_warnings(void);
57void pcm_rec_init(void); 89void pcm_rec_init(void);
58int pcm_rec_current_bitrate(void); 90int pcm_rec_current_bitrate(void);
59int pcm_rec_encoder_afmt(void); /* AFMT_* value, AFMT_UNKNOWN if none */ 91int pcm_rec_encoder_afmt(void); /* AFMT_* value, AFMT_UNKNOWN if none */