summaryrefslogtreecommitdiff
path: root/apps/recorder/radio.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-06-06 19:23:48 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-06-06 19:23:48 +0000
commit21a4a87ca2553834b3f7b0c8f95f1b0889d8cb2c (patch)
treeb3c7693a1c1b2e24d5aeee3e3316bbcc404f7dbc /apps/recorder/radio.c
parentaf4cd0a84cc8ead0e3b9c32684c55235c792fb12 (diff)
downloadrockbox-21a4a87ca2553834b3f7b0c8f95f1b0889d8cb2c.tar.gz
rockbox-21a4a87ca2553834b3f7b0c8f95f1b0889d8cb2c.zip
Accept FS#7178 - Sansa e200 FM tuner support by Ivan Zupan. Do the needed integration work into recording and the AS3514 audio driver. Do a little AS3514 fiq_record tweak to have it all work nicely from the start.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13573 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/radio.c')
-rw-r--r--apps/recorder/radio.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index a0e6c81e3a..9f3228be1f 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -90,6 +90,13 @@
90#elif CONFIG_KEYPAD == ONDIO_PAD 90#elif CONFIG_KEYPAD == ONDIO_PAD
91#define FM_RECORD_DBLPRE 91#define FM_RECORD_DBLPRE
92#define FM_RECORD 92#define FM_RECORD
93#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
94#define FM_MENU
95#define FM_PRESET
96#define FM_STOP
97#define FM_MODE
98#define FM_EXIT
99#define FM_PLAY
93#endif 100#endif
94 101
95#define RADIO_SCAN_MODE 0 102#define RADIO_SCAN_MODE 0
@@ -97,10 +104,14 @@
97 104
98static const struct fm_region_setting fm_region[] = { 105static const struct fm_region_setting fm_region[] = {
99 /* Note: Desriptive strings are just for display atm and are not compiled. */ 106 /* Note: Desriptive strings are just for display atm and are not compiled. */
100 FM_REGION_ENTRY("Europe", 87500000, 108000000, 50000, 0, 0), 107 [REGION_EUROPE] =
101 FM_REGION_ENTRY("US/Canada", 87900000, 107900000, 200000, 1, 0), 108 FM_REGION_ENTRY("Europe", 87500000, 108000000, 50000, 0, 0),
102 FM_REGION_ENTRY("Japan", 76000000, 90000000, 100000, 0, 1), 109 [REGION_US_CANADA] =
103 FM_REGION_ENTRY("Korea", 87500000, 108000000, 100000, 0, 0), 110 FM_REGION_ENTRY("US/Canada", 87900000, 107900000, 200000, 1, 0),
111 [REGION_JAPAN] =
112 FM_REGION_ENTRY("Japan", 76000000, 90000000, 100000, 0, 1),
113 [REGION_KOREA] =
114 FM_REGION_ENTRY("Korea", 87500000, 108000000, 100000, 0, 0),
104 }; 115 };
105 116
106static int curr_preset = -1; 117static int curr_preset = -1;
@@ -158,13 +169,18 @@ bool in_radio_screen(void)
158 return in_screen; 169 return in_screen;
159} 170}
160 171
172/* TODO: Move some more of the control functionality to an HAL and clean up the
173 mess */
174
161/* secret flag for starting paused - prevents unmute */ 175/* secret flag for starting paused - prevents unmute */
162#define FMRADIO_START_PAUSED 0x8000 176#define FMRADIO_START_PAUSED 0x8000
163void radio_start(void) 177void radio_start(void)
164{ 178{
165 const struct fm_region_setting *fmr; 179 const struct fm_region_setting *fmr;
166 bool start_paused; 180 bool start_paused;
181#if CONFIG_TUNER != LV24020LP
167 int mute_timeout; 182 int mute_timeout;
183#endif
168 184
169 if(radio_status == FMRADIO_PLAYING) 185 if(radio_status == FMRADIO_PLAYING)
170 return; 186 return;
@@ -182,8 +198,14 @@ void radio_start(void)
182 * fmr->freq_step + fmr->freq_min; 198 * fmr->freq_step + fmr->freq_min;
183 199
184 radio_set(RADIO_SLEEP, 0); /* wake up the tuner */ 200 radio_set(RADIO_SLEEP, 0); /* wake up the tuner */
201#if (CONFIG_TUNER & LV24020LP)
202 radio_set(RADIO_REGION, global_settings.fm_region);
203 radio_set(RADIO_FORCE_MONO, global_settings.fm_force_mono);
204#endif
185 radio_set(RADIO_FREQUENCY, curr_freq); 205 radio_set(RADIO_FREQUENCY, curr_freq);
186 206
207#if CONFIG_TUNER != LV24020LP
208
187 if(radio_status == FMRADIO_OFF) 209 if(radio_status == FMRADIO_OFF)
188 { 210 {
189#if (CONFIG_TUNER & S1A0903X01) 211#if (CONFIG_TUNER & S1A0903X01)
@@ -209,6 +231,7 @@ void radio_start(void)
209 break; 231 break;
210 yield(); 232 yield();
211 } 233 }
234#endif /* CONFIG_TUNER != LV24020LP */
212 235
213 /* keep radio from sounding initially */ 236 /* keep radio from sounding initially */
214 if(!start_paused) 237 if(!start_paused)
@@ -1311,6 +1334,9 @@ void toggle_mono_mode(bool mono)
1311 1334
1312void set_radio_region(int region) 1335void set_radio_region(int region)
1313{ 1336{
1337#if (CONFIG_TUNER & LV24020LP)
1338 radio_set(RADIO_REGION, global_settings.fm_region);
1339#endif
1314#if (CONFIG_TUNER & TEA5767) 1340#if (CONFIG_TUNER & TEA5767)
1315 radio_set(RADIO_SET_DEEMPHASIS, 1341 radio_set(RADIO_SET_DEEMPHASIS,
1316 fm_region[region].deemphasis); 1342 fm_region[region].deemphasis);