summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-08-13 17:35:02 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-08-13 17:35:02 +0000
commit8c7589bc96517c4e04299e99579799ee2e8dd4ad (patch)
treede7f626e5a20460545032bd60b19687f2e342565
parentadec21acbe7d2d7759820ddf927649278a618ee1 (diff)
downloadrockbox-8c7589bc96517c4e04299e99579799ee2e8dd4ad.zip
rockbox-8c7589bc96517c4e04299e99579799ee2e8dd4ad.tar.gz
rockbox-8c7589bc96517c4e04299e99579799ee2e8dd4ad.tar.bz2
rockbox-8c7589bc96517c4e04299e99579799ee2e8dd4ad.tar.xz
Very lame, initial support for FM radio on the iriver
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7318 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/radio.c45
-rw-r--r--firmware/export/config-h100.h3
-rw-r--r--firmware/export/config-h120.h3
3 files changed, 47 insertions, 4 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index 4961212..7554beb 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -55,6 +55,11 @@
#ifdef CONFIG_TUNER
+#if CONFIG_HWCODEC == MASNONE
+#include "uda1380.h"
+#include "pcm_record.h"
+#endif
+
#if CONFIG_KEYPAD == RECORDER_PAD
#define FM_MENU BUTTON_F1
#define FM_PRESET BUTTON_F2
@@ -64,6 +69,10 @@
#define FM_EXIT (BUTTON_ON | BUTTON_REL)
#define FM_PRESET_ADD BUTTON_F1
#define FM_PRESET_ACTION BUTTON_F3
+#elif CONFIG_KEYPAD == IRIVER_H100_PAD
+#define FM_MENU BUTTON_MODE
+#define FM_STOP BUTTON_OFF
+#define FM_EXIT (BUTTON_ON | BUTTON_REL)
#elif CONFIG_KEYPAD == ONDIO_PAD /* restricted keypad */
#define FM_MENU (BUTTON_MENU | BUTTON_REPEAT)
#define FM_RECORD (BUTTON_MENU | BUTTON_REL)
@@ -91,6 +100,7 @@ static int num_presets; /* The number of presets in the preset list */
void radio_load_presets(void);
bool handle_radio_presets(void);
bool radio_menu(void);
+bool radio_add_preset(void);
#if CONFIG_TUNER == S1A0903X01 /* FM recorder */
#define radio_set samsung_set
@@ -163,7 +173,7 @@ bool radio_screen(void)
{
char buf[MAX_PATH];
bool done = false;
- int button;
+ int button, lastbutton = BUTTON_NONE;
int freq;
bool tuned;
bool stereo = false;
@@ -175,7 +185,7 @@ bool radio_screen(void)
int timeout = current_tick + HZ/10;
bool screen_freeze = false;
bool have_recorded = false;
- unsigned int seconds;
+ unsigned int seconds = 0;
unsigned int last_seconds = 0;
int hours, minutes;
bool keep_playing = false;
@@ -195,11 +205,14 @@ bool radio_screen(void)
radio_load_presets();
#ifndef SIMULATOR
+#if CONFIG_HWCODEC != MASNONE
if(rec_create_directory() > 0)
have_recorded = true;
+#endif
audio_stop();
-
+
+#if CONFIG_HWCODEC != MASNONE
mpeg_init_recording();
sound_settings_apply();
@@ -222,6 +235,14 @@ bool radio_screen(void)
mpeg_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
sound_default(SOUND_RIGHT_GAIN), false);
+#else
+ uda1380_enable_recording(false);
+ uda1380_set_recvol(0, 0, 10);
+ uda1380_set_monitor(true);
+
+ /* Set the input multiplexer to FM */
+ pcmrec_set_mux(1);
+#endif
#endif
curr_freq = global_settings.last_frequency * FREQ_STEP + MIN_FREQ;
@@ -434,6 +455,9 @@ bool radio_screen(void)
break;
}
+ if (button != BUTTON_NONE)
+ lastbutton = button;
+
peak_meter_peek();
if(!screen_freeze)
@@ -464,8 +488,10 @@ bool radio_screen(void)
}
#ifndef SIMULATOR
+#if CONFIG_HWCODEC != MASNONE
seconds = mpeg_recorded_time() / HZ;
#endif
+#endif
if(update_screen || seconds > last_seconds)
{
last_seconds = seconds;
@@ -545,21 +571,28 @@ bool radio_screen(void)
}
}
+#if CONFIG_HWCODEC != MASNONE
audio_init_playback();
+#endif
sound_settings_apply();
if(keep_playing)
{
+#if CONFIG_HWCODEC != MASNONE
/* Enable the Left and right A/D Converter */
mpeg_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
sound_default(SOUND_RIGHT_GAIN), false);
mas_codec_writereg(6, 0x4000);
+#endif
radio_set_status(FMRADIO_POWERED); /* leave it powered */
}
else
{
radio_stop();
+#if CONFIG_HWCODEC == MASNONE
+ pcmrec_set_mux(0); /* Line In */
+#endif
}
#endif
@@ -641,7 +674,7 @@ static void rebuild_preset_menu(void)
}
}
-static bool radio_add_preset(void)
+bool radio_add_preset(void)
{
char buf[27];
@@ -840,6 +873,7 @@ bool handle_radio_presets(void)
}
#ifndef SIMULATOR
+#if CONFIG_HWCODEC != MASNONE
static bool fm_recording_settings(void)
{
bool ret;
@@ -860,6 +894,7 @@ static bool fm_recording_settings(void)
return ret;
}
#endif
+#endif
char monomode_menu_string[32];
@@ -922,8 +957,10 @@ bool radio_menu(void)
menu_insert(m, -1, monomode_menu_string, toggle_mono_mode);
menu_insert(m, -1, ID2P(LANG_SOUND_SETTINGS), sound_menu);
#ifndef SIMULATOR
+#if CONFIG_HWCODEC != MASNONE
menu_insert(m, -1, ID2P(LANG_RECORDING_SETTINGS), fm_recording_settings);
#endif
+#endif
result = menu_run(m);
menu_exit(m);
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index 6bd94a2..c45fa5c 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -7,6 +7,9 @@
*/
#define IRIVER_H100_SERIES 1
+#define CONFIG_TUNER TEA5767
+#define CONFIG_TUNER_XTAL 32768000
+
/* For Rolo and boot loader */
#define MODEL_NUMBER 1
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index 2ddf821..7a894ed 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -3,6 +3,9 @@
*/
#define IRIVER_H100_SERIES 1
+#define CONFIG_TUNER TEA5767
+#define CONFIG_TUNER_XTAL 32768000
+
/* For Rolo and boot loader */
#define MODEL_NUMBER 0