From 9558c4956d3d603c4d132af88633767810f3ba62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Tue, 14 Oct 2008 11:12:20 +0000 Subject: [PATCH] Moved pcm_record from firmware to apps. Cleaned up some. Now all code using struct mp3entry is in apps. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18807 a1c6a512-1295-4272-9138-f99709370657 --- apps/SOURCES | 3 +++ {firmware/export => apps}/id3.h | 0 apps/mpeg.c | 25 +++++++------------ {firmware/export => apps}/mpeg.h | 0 {firmware => apps/recorder}/pcm_record.c | 1 + .../export => apps/recorder}/pcm_record.h | 0 apps/recorder/recording.c | 1 + {firmware/export => apps}/replaygain.h | 0 firmware/SOURCES | 3 --- firmware/drivers/mas.c | 17 +++++++++++++ firmware/drivers/tuner/s1a0903x01.c | 3 +-- firmware/export/audio.h | 2 -- firmware/export/mas.h | 6 +++++ firmware/mp3_playback.c | 5 +++- firmware/powermgmt.c | 3 --- 15 files changed, 42 insertions(+), 27 deletions(-) rename {firmware/export => apps}/id3.h (100%) rename {firmware/export => apps}/mpeg.h (100%) rename {firmware => apps/recorder}/pcm_record.c (99%) rename {firmware/export => apps/recorder}/pcm_record.h (100%) rename {firmware/export => apps}/replaygain.h (100%) diff --git a/apps/SOURCES b/apps/SOURCES index 7622b416f7..3fce356092 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -116,6 +116,9 @@ codecs.c dsp.c #ifdef HAVE_RECORDING enc_config.c +#ifndef SIMULATOR +recorder/pcm_record.c +#endif /* SIMULATOR */ #endif eq.c #if defined(CPU_COLDFIRE) diff --git a/firmware/export/id3.h b/apps/id3.h similarity index 100% rename from firmware/export/id3.h rename to apps/id3.h diff --git a/apps/mpeg.c b/apps/mpeg.c index 2c65e46060..b570f41b28 100644 --- a/apps/mpeg.c +++ b/apps/mpeg.c @@ -2432,6 +2432,15 @@ void audio_set_recording_options(struct audio_recording_options *options) DEBUGF("mas_writemem(MAS_BANK_D0, ENCODER_CONTROL, %x)\n", shadow_encoder_control); +#if CONFIG_TUNER & S1A0903X01 + /* Store the (unpitched) MAS PLL frequency. Used for avoiding FM + interference with the Samsung tuner. */ + if (rec_frequency_index) + mas_store_pllfreq(24576000); + else + mas_store_pllfreq(22579000); +#endif + shadow_soft_mute = options->rec_editable?4:0; mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute,1); @@ -2484,22 +2493,6 @@ void audio_set_recording_gain(int left, int right, int type) mas_codec_writereg(0x0, shadow_codec_reg0); } -#if CONFIG_TUNER & S1A0903X01 -/* Get the (unpitched) MAS PLL frequency, for avoiding FM interference with the - * Samsung tuner. Zero means unknown. Currently handles recording from analog - * input only. */ -int mpeg_get_mas_pllfreq(void) -{ - if (mpeg_mode != MPEG_ENCODER) - return 0; - - if (rec_frequency_index == 0) /* 44.1 kHz / 22.05 kHz */ - return 22579000; - else - return 24576000; -} -#endif /* CONFIG_TUNER & S1A0903X01 */ - /* try to make some kind of beep, also in recording mode */ void audio_beep(int duration) { diff --git a/firmware/export/mpeg.h b/apps/mpeg.h similarity index 100% rename from firmware/export/mpeg.h rename to apps/mpeg.h diff --git a/firmware/pcm_record.c b/apps/recorder/pcm_record.c similarity index 99% rename from firmware/pcm_record.c rename to apps/recorder/pcm_record.c index 0e0102af97..b1ea535470 100644 --- a/firmware/pcm_record.c +++ b/apps/recorder/pcm_record.c @@ -18,6 +18,7 @@ * KIND, either express or implied. * ****************************************************************************/ +#include "pcm_record.h" #include "system.h" #include "kernel.h" #include "logf.h" diff --git a/firmware/export/pcm_record.h b/apps/recorder/pcm_record.h similarity index 100% rename from firmware/export/pcm_record.h rename to apps/recorder/pcm_record.h diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 6f5c7df09a..d29db390c7 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -40,6 +40,7 @@ #include "spdif.h" #endif #endif /* CONFIG_CODEC == SWCODEC */ +#include "pcm_record.h" #include "recording.h" #include "mp3_playback.h" #include "mas.h" diff --git a/firmware/export/replaygain.h b/apps/replaygain.h similarity index 100% rename from firmware/export/replaygain.h rename to apps/replaygain.h diff --git a/firmware/SOURCES b/firmware/SOURCES index 9f7007245d..2cd1ba131c 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -191,9 +191,6 @@ pcm_sampr.c pcm.c #ifdef HAVE_RECORDING enc_base.c -#ifndef SIMULATOR -pcm_record.c -#endif /* SIMULATOR */ #endif /* HAVE_RECORDING */ #endif /* BOOTLOADER */ diff --git a/firmware/drivers/mas.c b/firmware/drivers/mas.c index 9d1761b419..4f384d3b98 100644 --- a/firmware/drivers/mas.c +++ b/firmware/drivers/mas.c @@ -466,3 +466,20 @@ unsigned long mas_readver(void) } #endif + +#if CONFIG_TUNER & S1A0903X01 +static int pllfreq; + +void mas_store_pllfreq(int freq) +{ + pllfreq = freq; +} + +int mas_get_pllfreq(void) +{ + return pllfreq; +} +#endif + + + diff --git a/firmware/drivers/tuner/s1a0903x01.c b/firmware/drivers/tuner/s1a0903x01.c index 517d41984d..f6442b269f 100644 --- a/firmware/drivers/tuner/s1a0903x01.c +++ b/firmware/drivers/tuner/s1a0903x01.c @@ -26,7 +26,6 @@ #include "kernel.h" #include "tuner.h" /* tuner abstraction interface */ #include "fmradio.h" /* physical interface driver */ -#include "mpeg.h" #include "sound.h" #define DEFAULT_IN1 0x100003 /* Mute */ @@ -64,7 +63,7 @@ int s1a0903x01_set(int setting, int value) int pitch = 1000; /* 4th harmonic falls in the FM frequency range */ - int if_freq = 4 * mpeg_get_mas_pllfreq(); + int if_freq = 4 * mas_get_pllfreq(); /* shift the mas harmonic >= 300 kHz away using the direction * which needs less shifting. */ diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 9530082050..661247df2f 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h @@ -30,8 +30,6 @@ #include "pcm_sampr.h" #include "pcm.h" #ifdef HAVE_RECORDING -#include "pcm_record.h" -#include "id3.h" #include "enc_base.h" #endif /* HAVE_RECORDING */ #endif /* CONFIG_CODEC == SWCODEC */ diff --git a/firmware/export/mas.h b/firmware/export/mas.h index ab6135cbfa..493ed6a63c 100644 --- a/firmware/export/mas.h +++ b/firmware/export/mas.h @@ -163,3 +163,9 @@ int mas_codec_readreg(int reg); unsigned long mas_readver(void); #endif + +#if CONFIG_TUNER & S1A0903X01 +void mas_store_pllfreq(int freq); +int mas_get_pllfreq(void); +#endif + diff --git a/firmware/mp3_playback.c b/firmware/mp3_playback.c index 66ea3159e3..2bbd08d789 100644 --- a/firmware/mp3_playback.c +++ b/firmware/mp3_playback.c @@ -26,7 +26,6 @@ #include "debug.h" #include "panic.h" #include -#include "mpeg.h" /* ToDo: remove crosslinks */ #include "mp3_playback.h" #include "sound.h" #ifndef SIMULATOR @@ -76,6 +75,10 @@ bool audio_is_initialized = false; /* FIX: this code pretty much assumes a MAS */ +/* dirty calls to mpeg.c */ +extern void playback_tick(void); +extern void rec_tick(void); + #ifndef SIMULATOR unsigned long mas_version_code; diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index f0fbd7df92..86fadff2a2 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -46,9 +46,6 @@ #ifdef HAVE_LCD_BITMAP #include "font.h" #endif -#if defined(HAVE_RECORDING) && (CONFIG_CODEC == SWCODEC) -#include "pcm_record.h" -#endif #include "logf.h" #include "lcd-remote.h" #ifdef SIMULATOR