diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/mpeg.h | 1 | ||||
-rw-r--r-- | firmware/mpeg.c | 30 |
2 files changed, 24 insertions, 7 deletions
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h index f24664edc9..d61789c26e 100644 --- a/firmware/export/mpeg.h +++ b/firmware/export/mpeg.h | |||
@@ -99,6 +99,7 @@ unsigned int mpeg_error(void); | |||
99 | void mpeg_error_clear(void); | 99 | void mpeg_error_clear(void); |
100 | int mpeg_get_file_pos(void); | 100 | int mpeg_get_file_pos(void); |
101 | unsigned long mpeg_get_last_header(void); | 101 | unsigned long mpeg_get_last_header(void); |
102 | void mpeg_beep(int freq, int duration); | ||
102 | 103 | ||
103 | /* in order to keep the recording here, I have to expose this */ | 104 | /* in order to keep the recording here, I have to expose this */ |
104 | void rec_tick(void); | 105 | void rec_tick(void); |
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 5a199a4169..26bfbc0dc3 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -53,6 +53,7 @@ static void stop_recording(void); | |||
53 | static int get_unsaved_space(void); | 53 | static int get_unsaved_space(void); |
54 | static void pause_recording(void); | 54 | static void pause_recording(void); |
55 | static void resume_recording(void); | 55 | static void resume_recording(void); |
56 | static int shadow_codec_reg0; | ||
56 | #endif /* #if CONFIG_HWCODEC == MAS3587F */ | 57 | #endif /* #if CONFIG_HWCODEC == MAS3587F */ |
57 | 58 | ||
58 | #ifndef SIMULATOR | 59 | #ifndef SIMULATOR |
@@ -2090,7 +2091,8 @@ static void init_recording(void) | |||
2090 | } | 2091 | } |
2091 | 2092 | ||
2092 | /* Enable A/D Converters */ | 2093 | /* Enable A/D Converters */ |
2093 | mas_codec_writereg(0x0, 0xcccd); | 2094 | shadow_codec_reg0 = 0xcccd; |
2095 | mas_codec_writereg(0x0, shadow_codec_reg0); | ||
2094 | 2096 | ||
2095 | /* Copy left channel to right (mono mode) */ | 2097 | /* Copy left channel to right (mono mode) */ |
2096 | mas_codec_writereg(8, 0x8000); | 2098 | mas_codec_writereg(8, 0x8000); |
@@ -2366,12 +2368,26 @@ void mpeg_set_recording_options(int frequency, int quality, | |||
2366 | void mpeg_set_recording_gain(int left, int right, bool use_mic) | 2368 | void mpeg_set_recording_gain(int left, int right, bool use_mic) |
2367 | { | 2369 | { |
2368 | /* Enable both left and right A/D */ | 2370 | /* Enable both left and right A/D */ |
2369 | mas_codec_writereg(0x0, | 2371 | shadow_codec_reg0 = (left << 12) | |
2370 | (left << 12) | | 2372 | (right << 8) | |
2371 | (right << 8) | | 2373 | (left << 4) | |
2372 | (left << 4) | | 2374 | (use_mic?0x0008:0) | /* Connect left A/D to mic */ |
2373 | (use_mic?0x0008:0) | /* Connect left A/D to mic */ | 2375 | 0x0007; |
2374 | 0x0007); | 2376 | mas_codec_writereg(0x0, shadow_codec_reg0); |
2377 | } | ||
2378 | |||
2379 | /* try to make some kind of beep, also in recording mode */ | ||
2380 | void mpeg_beep(int freq, int duration) | ||
2381 | { | ||
2382 | (void)freq; /* not used yet */ | ||
2383 | long starttick = current_tick; | ||
2384 | do | ||
2385 | { | ||
2386 | mas_codec_writereg(0, 0); /* some little-understood sequence, */ | ||
2387 | mas_codec_writereg(0, 1); /* there may be better ways */ | ||
2388 | } | ||
2389 | while (current_tick - starttick < duration); | ||
2390 | mas_codec_writereg(0, shadow_codec_reg0); /* restore it */ | ||
2375 | } | 2391 | } |
2376 | 2392 | ||
2377 | void mpeg_new_file(const char *filename) | 2393 | void mpeg_new_file(const char *filename) |