diff options
author | Rob Purchase <shotofadds@rockbox.org> | 2009-03-21 00:13:20 +0000 |
---|---|---|
committer | Rob Purchase <shotofadds@rockbox.org> | 2009-03-21 00:13:20 +0000 |
commit | 1a6bcfa2c1545fc66aac40c88dba3a6f804d6227 (patch) | |
tree | 11069b2e03848d5e928fa98d7201fb64f75ef389 | |
parent | d63a8fcb7b0f4835a5acdb6c0dcb0783b6d3bba7 (diff) | |
download | rockbox-1a6bcfa2c1545fc66aac40c88dba3a6f804d6227.tar.gz rockbox-1a6bcfa2c1545fc66aac40c88dba3a6f804d6227.zip |
D2: Enable FM radio (based on FS#10035 by Michael Burtin with some changes by myself). Also updates the LV24020 driver to add optional logf debugging.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20420 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/keymaps/keymap-cowond2.c | 9 | ||||
-rw-r--r-- | apps/keymaps/keymap-touchscreen.c | 15 | ||||
-rw-r--r-- | apps/recorder/radio.c | 8 | ||||
-rw-r--r-- | firmware/drivers/audio/wm8985.c | 7 | ||||
-rw-r--r-- | firmware/drivers/tuner/lv24020lp.c | 17 | ||||
-rw-r--r-- | firmware/export/config-cowond2.h | 5 | ||||
-rw-r--r-- | firmware/export/wm8985.h | 1 | ||||
-rw-r--r-- | firmware/target/arm/tcc780x/cowond2/audio-cowond2.c | 2 |
8 files changed, 57 insertions, 7 deletions
diff --git a/apps/keymaps/keymap-cowond2.c b/apps/keymaps/keymap-cowond2.c index 7ba2d8b02b..61fade99ed 100644 --- a/apps/keymaps/keymap-cowond2.c +++ b/apps/keymaps/keymap-cowond2.c | |||
@@ -146,6 +146,13 @@ static const struct button_mapping button_context_keyboard[] = { | |||
146 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | 146 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) |
147 | }; /* button_context_keyboard */ | 147 | }; /* button_context_keyboard */ |
148 | 148 | ||
149 | static const struct button_mapping button_context_radio[] = { | ||
150 | { ACTION_FM_MENU, BUTTON_MENU, BUTTON_NONE }, | ||
151 | { ACTION_FM_STOP, BUTTON_POWER, BUTTON_NONE }, | ||
152 | |||
153 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) | ||
154 | }; /* button_context_radio */ | ||
155 | |||
149 | const struct button_mapping* target_get_context_mapping(int context) | 156 | const struct button_mapping* target_get_context_mapping(int context) |
150 | { | 157 | { |
151 | switch (context) | 158 | switch (context) |
@@ -182,6 +189,8 @@ const struct button_mapping* target_get_context_mapping(int context) | |||
182 | 189 | ||
183 | case CONTEXT_YESNOSCREEN: | 190 | case CONTEXT_YESNOSCREEN: |
184 | return button_context_yesno; | 191 | return button_context_yesno; |
192 | case CONTEXT_FM: | ||
193 | return button_context_radio; | ||
185 | case CONTEXT_BOOKMARKSCREEN: | 194 | case CONTEXT_BOOKMARKSCREEN: |
186 | return button_context_bmark; | 195 | return button_context_bmark; |
187 | case CONTEXT_QUICKSCREEN: | 196 | case CONTEXT_QUICKSCREEN: |
diff --git a/apps/keymaps/keymap-touchscreen.c b/apps/keymaps/keymap-touchscreen.c index 37d36a25fc..ce5d01c9dc 100644 --- a/apps/keymaps/keymap-touchscreen.c +++ b/apps/keymaps/keymap-touchscreen.c | |||
@@ -232,6 +232,19 @@ static const struct button_mapping button_context_keyboard[] = { | |||
232 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_KEYBOARD) | 232 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_KEYBOARD) |
233 | }; /* button_context_keyboard */ | 233 | }; /* button_context_keyboard */ |
234 | 234 | ||
235 | static const struct button_mapping button_context_radio[] = { | ||
236 | { ACTION_STD_PREV, BUTTON_MIDLEFT, BUTTON_NONE }, | ||
237 | { ACTION_STD_PREVREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
238 | { ACTION_STD_NEXT, BUTTON_MIDRIGHT, BUTTON_NONE }, | ||
239 | { ACTION_STD_NEXTREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
240 | { ACTION_FM_MENU, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER }, | ||
241 | { ACTION_FM_PRESET, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE }, | ||
242 | { ACTION_FM_EXIT, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_NONE }, | ||
243 | { ACTION_FM_MODE, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_NONE }, | ||
244 | { ACTION_FM_PLAY, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_NONE }, | ||
245 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_FM) | ||
246 | }; /* button_context_radio */ | ||
247 | |||
235 | const struct button_mapping* get_context_mapping(int context) | 248 | const struct button_mapping* get_context_mapping(int context) |
236 | { | 249 | { |
237 | if (context & CONTEXT_CUSTOM2 | 250 | if (context & CONTEXT_CUSTOM2 |
@@ -274,6 +287,8 @@ const struct button_mapping* get_context_mapping(int context) | |||
274 | 287 | ||
275 | case CONTEXT_YESNOSCREEN: | 288 | case CONTEXT_YESNOSCREEN: |
276 | return button_context_yesno; | 289 | return button_context_yesno; |
290 | case CONTEXT_FM: | ||
291 | return button_context_radio; | ||
277 | case CONTEXT_BOOKMARKSCREEN: | 292 | case CONTEXT_BOOKMARKSCREEN: |
278 | return button_context_bmark; | 293 | return button_context_bmark; |
279 | case CONTEXT_QUICKSCREEN: | 294 | case CONTEXT_QUICKSCREEN: |
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index f3270d1f5d..fe6f277fcb 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -109,6 +109,14 @@ | |||
109 | #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) | 109 | #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) |
110 | #define FM_PRESET | 110 | #define FM_PRESET |
111 | #define FM_MODE | 111 | #define FM_MODE |
112 | |||
113 | #elif (CONFIG_KEYPAD == COWOND2_PAD) | ||
114 | #define FM_MENU | ||
115 | #define FM_PRESET | ||
116 | #define FM_STOP | ||
117 | #define FM_MODE | ||
118 | #define FM_EXIT | ||
119 | #define FM_PLAY | ||
112 | #endif | 120 | #endif |
113 | 121 | ||
114 | #define RADIO_SCAN_MODE 0 | 122 | #define RADIO_SCAN_MODE 0 |
diff --git a/firmware/drivers/audio/wm8985.c b/firmware/drivers/audio/wm8985.c index f7b2e510ae..d59d2d3230 100644 --- a/firmware/drivers/audio/wm8985.c +++ b/firmware/drivers/audio/wm8985.c | |||
@@ -186,6 +186,13 @@ void audiohw_set_lineout_vol(int vol_l, int vol_r) | |||
186 | wmcodec_write(ROUT2VOL, 0x100 | vol_r); | 186 | wmcodec_write(ROUT2VOL, 0x100 | vol_r); |
187 | } | 187 | } |
188 | 188 | ||
189 | void audiohw_set_aux_vol(int vol_l, int vol_r) | ||
190 | { | ||
191 | /* OUTMIX */ | ||
192 | wmcodec_write(LOUTMIX, 0x111 | (vol_l << 5) ); | ||
193 | wmcodec_write(ROUTMIX, 0x111 | (vol_r << 5) ); | ||
194 | } | ||
195 | |||
189 | void audiohw_set_bass(int value) | 196 | void audiohw_set_bass(int value) |
190 | { | 197 | { |
191 | eq1_reg = (eq1_reg & ~EQ_GAIN_MASK) | EQ_GAIN_VALUE(value); | 198 | eq1_reg = (eq1_reg & ~EQ_GAIN_MASK) | EQ_GAIN_VALUE(value); |
diff --git a/firmware/drivers/tuner/lv24020lp.c b/firmware/drivers/tuner/lv24020lp.c index 769be8ac77..c6d396aca4 100644 --- a/firmware/drivers/tuner/lv24020lp.c +++ b/firmware/drivers/tuner/lv24020lp.c | |||
@@ -29,19 +29,17 @@ | |||
29 | #include "power.h" | 29 | #include "power.h" |
30 | #include "fmradio.h" /* physical interface driver */ | 30 | #include "fmradio.h" /* physical interface driver */ |
31 | #include "sound.h" | 31 | #include "sound.h" |
32 | #include "pp5024.h" | ||
33 | #include "system.h" | 32 | #include "system.h" |
34 | 33 | ||
35 | #ifndef BOOTLOADER | 34 | #ifndef BOOTLOADER |
36 | 35 | ||
37 | static struct mutex tuner_mtx; | 36 | static struct mutex tuner_mtx; |
38 | 37 | ||
39 | #if 0 | ||
40 | /* define to enable tuner logging */ | 38 | /* define to enable tuner logging */ |
41 | #define SANYO_TUNER_LOG | 39 | #undef SANYO_TUNER_LOG_FILE |
42 | #endif | 40 | #undef SANYO_TUNER_LOGF |
43 | 41 | ||
44 | #ifdef SANYO_TUNER_LOG | 42 | #ifdef SANYO_TUNER_LOG_FILE |
45 | #include "sprintf.h" | 43 | #include "sprintf.h" |
46 | #include "file.h" | 44 | #include "file.h" |
47 | 45 | ||
@@ -52,6 +50,15 @@ static int fd_log = -1; | |||
52 | /* syncing required because close() is never called */ | 50 | /* syncing required because close() is never called */ |
53 | #define TUNER_LOG_SYNC() fsync(fd_log) | 51 | #define TUNER_LOG_SYNC() fsync(fd_log) |
54 | #define TUNER_LOG(s...) fdprintf(fd_log, s) | 52 | #define TUNER_LOG(s...) fdprintf(fd_log, s) |
53 | |||
54 | #elif defined(SANYO_TUNER_LOGF) | ||
55 | #define LOGF_ENABLE | ||
56 | #include "logf.h" | ||
57 | |||
58 | #define TUNER_LOG_OPEN() | ||
59 | #define TUNER_LOG_SYNC() | ||
60 | #define TUNER_LOG(s...) logf(s) | ||
61 | |||
55 | #else | 62 | #else |
56 | #define TUNER_LOG_OPEN() | 63 | #define TUNER_LOG_OPEN() |
57 | #define TUNER_LOG_SYNC() | 64 | #define TUNER_LOG_SYNC() |
diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h index 2b3b09cb09..85e46f9b30 100644 --- a/firmware/export/config-cowond2.h +++ b/firmware/export/config-cowond2.h | |||
@@ -49,9 +49,10 @@ | |||
49 | /* define this if you would like tagcache to build on this target */ | 49 | /* define this if you would like tagcache to build on this target */ |
50 | //#define HAVE_TAGCACHE | 50 | //#define HAVE_TAGCACHE |
51 | 51 | ||
52 | /* FM Tuner | 52 | /* FM Tuner */ |
53 | #define CONFIG_TUNER LV24020LP | 53 | #define CONFIG_TUNER LV24020LP |
54 | #define HAVE_TUNER_PWR_CTRL*/ | 54 | #define HAVE_TUNER_PWR_CTRL |
55 | #define HAVE_RADIO_REGION | ||
55 | 56 | ||
56 | /* define this if you have a flash memory storage */ | 57 | /* define this if you have a flash memory storage */ |
57 | #define HAVE_FLASH_STORAGE | 58 | #define HAVE_FLASH_STORAGE |
diff --git a/firmware/export/wm8985.h b/firmware/export/wm8985.h index 0827d4388f..5d036a672f 100644 --- a/firmware/export/wm8985.h +++ b/firmware/export/wm8985.h | |||
@@ -32,5 +32,6 @@ extern int tenthdb2master(int db); | |||
32 | 32 | ||
33 | extern void audiohw_set_headphone_vol(int vol_l, int vol_r); | 33 | extern void audiohw_set_headphone_vol(int vol_l, int vol_r); |
34 | extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | 34 | extern void audiohw_set_lineout_vol(int vol_l, int vol_r); |
35 | extern void audiohw_set_aux_vol(int vol_l, int vol_r); | ||
35 | 36 | ||
36 | #endif /* _WM8985_H */ | 37 | #endif /* _WM8985_H */ |
diff --git a/firmware/target/arm/tcc780x/cowond2/audio-cowond2.c b/firmware/target/arm/tcc780x/cowond2/audio-cowond2.c index cd7ea74df2..a6cace3d7d 100644 --- a/firmware/target/arm/tcc780x/cowond2/audio-cowond2.c +++ b/firmware/target/arm/tcc780x/cowond2/audio-cowond2.c | |||
@@ -57,6 +57,7 @@ void audio_input_mux(int source, unsigned flags) | |||
57 | { | 57 | { |
58 | /*audiohw_set_monitor(false); | 58 | /*audiohw_set_monitor(false); |
59 | audiohw_disable_recording();*/ | 59 | audiohw_disable_recording();*/ |
60 | audiohw_set_aux_vol(0,0); | ||
60 | } | 61 | } |
61 | break; | 62 | break; |
62 | 63 | ||
@@ -86,6 +87,7 @@ void audio_input_mux(int source, unsigned flags) | |||
86 | { | 87 | { |
87 | /*audiohw_disable_recording(); | 88 | /*audiohw_disable_recording(); |
88 | audiohw_set_monitor(true); /. line 1 analog audio path */ | 89 | audiohw_set_monitor(true); /. line 1 analog audio path */ |
90 | audiohw_set_aux_vol(7,7); | ||
89 | } | 91 | } |
90 | break; | 92 | break; |
91 | } /* end switch */ | 93 | } /* end switch */ |