diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-05-20 20:26:36 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-05-20 20:26:36 +0000 |
commit | 8f659ae8d3845b40ff93ebfa3692f7b2302e6c7e (patch) | |
tree | a54381487762ec69bdec99f69dd24b148d3400b9 | |
parent | 731d7a16c3f606d586237fc8b4086ee54a0d0704 (diff) | |
download | rockbox-8f659ae8d3845b40ff93ebfa3692f7b2302e6c7e.tar.gz rockbox-8f659ae8d3845b40ff93ebfa3692f7b2302e6c7e.zip |
Use bitmasks to define which inputs are available. Makes it easier to remove old assumptions of which are available. Inspired by e200 being unique in having FM Radio and Mic but no Line. Doesn't remove the assumption that Mic is available or that one of Mic and/or Line is available just to avoid excessive #ifdef'ing until needed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13448 a1c6a512-1295-4272-9138-f99709370657
28 files changed, 282 insertions, 126 deletions
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index e082063a6f..9eb766f054 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -680,7 +680,7 @@ static void gui_statusbar_write_samplerate_info(struct screen * display) | |||
680 | #ifdef SIMULATOR | 680 | #ifdef SIMULATOR |
681 | samprk = 44100; | 681 | samprk = 44100; |
682 | #else | 682 | #else |
683 | #ifdef HAVE_SPDIF_IN | 683 | #ifdef HAVE_SPDIF_REC |
684 | if (global_settings.rec_source == AUDIO_SRC_SPDIF) | 684 | if (global_settings.rec_source == AUDIO_SRC_SPDIF) |
685 | /* Use rate in use, not current measured rate if it changed */ | 685 | /* Use rate in use, not current measured rate if it changed */ |
686 | samprk = pcm_rec_sample_rate(); | 686 | samprk = pcm_rec_sample_rate(); |
@@ -731,7 +731,7 @@ static void gui_statusbar_icon_recording_info(struct screen * display) | |||
731 | gui_statusbar_write_samplerate_info(display); | 731 | gui_statusbar_write_samplerate_info(display); |
732 | #else /* !SWCODEC */ | 732 | #else /* !SWCODEC */ |
733 | /* hwcodec targets have sysfont characters */ | 733 | /* hwcodec targets have sysfont characters */ |
734 | #ifdef HAVE_SPDIF_IN | 734 | #ifdef HAVE_SPDIF_REC |
735 | if (global_settings.rec_source == AUDIO_SRC_SPDIF) | 735 | if (global_settings.rec_source == AUDIO_SRC_SPDIF) |
736 | { | 736 | { |
737 | /* Can't measure S/PDIF sample rate on Archos/Sim yet */ | 737 | /* Can't measure S/PDIF sample rate on Archos/Sim yet */ |
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c index 1bc84e90d2..62af2f94fe 100644 --- a/apps/menus/recording_menu.c +++ b/apps/menus/recording_menu.c | |||
@@ -67,21 +67,21 @@ int recmenu_callback(int action,const struct menu_item_ex *this_item); | |||
67 | 67 | ||
68 | static int recsource_func(void) | 68 | static int recsource_func(void) |
69 | { | 69 | { |
70 | int n_opts = AUDIO_NUM_SOURCES; | 70 | int n_opts = REC_NUM_SOURCES; |
71 | 71 | ||
72 | static const struct opt_items names[AUDIO_NUM_SOURCES] = { | 72 | static const struct opt_items names[AUDIO_NUM_SOURCES] = { |
73 | [AUDIO_SRC_MIC] = { STR(LANG_RECORDING_SRC_MIC) }, | 73 | HAVE_MIC_REC_([AUDIO_SRC_MIC] |
74 | [AUDIO_SRC_LINEIN] = { STR(LANG_RECORDING_SRC_LINE) }, | 74 | = { STR(LANG_RECORDING_SRC_MIC) },) |
75 | #ifdef HAVE_SPDIF_IN | 75 | HAVE_LINE_REC_([AUDIO_SRC_LINEIN] |
76 | [AUDIO_SRC_SPDIF] = { STR(LANG_RECORDING_SRC_DIGITAL) }, | 76 | = { STR(LANG_RECORDING_SRC_LINE) },) |
77 | #endif | 77 | HAVE_SPDIF_REC_([AUDIO_SRC_SPDIF] |
78 | #ifdef HAVE_FMRADIO_IN | 78 | = { STR(LANG_RECORDING_SRC_DIGITAL) },) |
79 | [AUDIO_SRC_FMRADIO] = { STR(LANG_FM_RADIO) } | 79 | HAVE_FMRADIO_REC_([AUDIO_SRC_FMRADIO] |
80 | #endif | 80 | = { STR(LANG_FM_RADIO) },) |
81 | }; | 81 | }; |
82 | 82 | ||
83 | /* caveat: assumes it's the last item! */ | 83 | /* caveat: assumes it's the last item! */ |
84 | #ifdef HAVE_FMRADIO_IN | 84 | #ifdef HAVE_FMRADIO_REC |
85 | if (!radio_hardware_present()) | 85 | if (!radio_hardware_present()) |
86 | n_opts--; | 86 | n_opts--; |
87 | #endif | 87 | #endif |
@@ -145,15 +145,15 @@ static int recfrequency_func(void) | |||
145 | int rec_frequency; | 145 | int rec_frequency; |
146 | bool ret; | 146 | bool ret; |
147 | 147 | ||
148 | #ifdef HAVE_SPDIF_IN | 148 | #ifdef HAVE_SPDIF_REC |
149 | if (global_settings.rec_source == AUDIO_SRC_SPDIF) | 149 | if (global_settings.rec_source == REC_SRC_SPDIF) |
150 | { | 150 | { |
151 | /* Inform user that frequency follows the source's frequency */ | 151 | /* Inform user that frequency follows the source's frequency */ |
152 | opts[0].string = ID2P(LANG_SOURCE_FREQUENCY); | 152 | opts[0].string = ID2P(LANG_SOURCE_FREQUENCY); |
153 | opts[0].voice_id = LANG_SOURCE_FREQUENCY; | 153 | opts[0].voice_id = LANG_SOURCE_FREQUENCY; |
154 | n_opts = 1; | 154 | n_opts = 1; |
155 | rec_frequency = 0; | 155 | rec_frequency = 0; |
156 | } | 156 | } |
157 | else | 157 | else |
158 | #endif | 158 | #endif |
159 | { | 159 | { |
@@ -189,9 +189,7 @@ static int recfrequency_func(void) | |||
189 | &rec_frequency, INT, opts, n_opts, NULL ); | 189 | &rec_frequency, INT, opts, n_opts, NULL ); |
190 | 190 | ||
191 | if (!ret | 191 | if (!ret |
192 | #ifdef HAVE_SPDIF_IN | 192 | HAVE_SPDIF_REC_( && global_settings.rec_source != REC_SRC_SPDIF) |
193 | && global_settings.rec_source != AUDIO_SRC_SPDIF | ||
194 | #endif | ||
195 | ) | 193 | ) |
196 | { | 194 | { |
197 | /* Translate back to full index */ | 195 | /* Translate back to full index */ |
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index ae534aca61..79febc9039 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -1429,7 +1429,7 @@ static int scan_presets(void) | |||
1429 | 1429 | ||
1430 | #ifdef HAVE_RECORDING | 1430 | #ifdef HAVE_RECORDING |
1431 | 1431 | ||
1432 | #if defined(HAVE_FMRADIO_IN) && CONFIG_CODEC == SWCODEC | 1432 | #if defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC |
1433 | #define FM_RECORDING_SCREEN | 1433 | #define FM_RECORDING_SCREEN |
1434 | static int fm_recording_screen(void) | 1434 | static int fm_recording_screen(void) |
1435 | { | 1435 | { |
@@ -1450,9 +1450,9 @@ static int fm_recording_screen(void) | |||
1450 | return ret; | 1450 | return ret; |
1451 | } | 1451 | } |
1452 | 1452 | ||
1453 | #endif /* defined(HAVE_FMRADIO_IN) && CONFIG_CODEC == SWCODEC */ | 1453 | #endif /* defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC */ |
1454 | 1454 | ||
1455 | #if defined(HAVE_FMRADIO_IN) || CONFIG_CODEC != SWCODEC | 1455 | #if defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC |
1456 | #define FM_RECORDING_SETTINGS | 1456 | #define FM_RECORDING_SETTINGS |
1457 | static int fm_recording_settings(void) | 1457 | static int fm_recording_settings(void) |
1458 | { | 1458 | { |
@@ -1471,7 +1471,7 @@ static int fm_recording_settings(void) | |||
1471 | return ret; | 1471 | return ret; |
1472 | } | 1472 | } |
1473 | 1473 | ||
1474 | #endif /* defined(HAVE_FMRADIO_IN) || CONFIG_CODEC != SWCODEC */ | 1474 | #endif /* defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC */ |
1475 | #endif /* HAVE_RECORDING */ | 1475 | #endif /* HAVE_RECORDING */ |
1476 | 1476 | ||
1477 | #ifdef FM_RECORDING_SCREEN | 1477 | #ifdef FM_RECORDING_SCREEN |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 0981cb8811..0323ae12ff 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -183,7 +183,7 @@ static void set_gain(void) | |||
183 | } | 183 | } |
184 | else | 184 | else |
185 | { | 185 | { |
186 | /* AUDIO_SRC_LINEIN, AUDIO_SRC_SPDIF, AUDIO_SRC_FMRADIO */ | 186 | /* AUDIO_SRC_LINEIN, AUDIO_SRC_FMRADIO, AUDIO_SRC_SPDIF */ |
187 | audio_set_recording_gain(global_settings.rec_left_gain, | 187 | audio_set_recording_gain(global_settings.rec_left_gain, |
188 | global_settings.rec_right_gain, | 188 | global_settings.rec_right_gain, |
189 | AUDIO_GAIN_LINEIN); | 189 | AUDIO_GAIN_LINEIN); |
@@ -235,13 +235,12 @@ static bool agc_gain_is_max(bool left, bool right) | |||
235 | 235 | ||
236 | switch (global_settings.rec_source) | 236 | switch (global_settings.rec_source) |
237 | { | 237 | { |
238 | case AUDIO_SRC_LINEIN: | 238 | HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:) |
239 | #ifdef HAVE_FMRADIO_IN | 239 | HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:) |
240 | case AUDIO_SRC_FMRADIO: | ||
241 | #endif | ||
242 | gain_current_l = global_settings.rec_left_gain; | 240 | gain_current_l = global_settings.rec_left_gain; |
243 | gain_current_r = global_settings.rec_right_gain; | 241 | gain_current_r = global_settings.rec_right_gain; |
244 | break; | 242 | break; |
243 | case AUDIO_SRC_MIC: | ||
245 | default: | 244 | default: |
246 | gain_current_l = global_settings.rec_mic_gain; | 245 | gain_current_l = global_settings.rec_mic_gain; |
247 | gain_current_r = global_settings.rec_mic_gain; | 246 | gain_current_r = global_settings.rec_mic_gain; |
@@ -257,14 +256,12 @@ static void change_recording_gain(bool increment, bool left, bool right) | |||
257 | 256 | ||
258 | switch (global_settings.rec_source) | 257 | switch (global_settings.rec_source) |
259 | { | 258 | { |
260 | case AUDIO_SRC_LINEIN: | 259 | HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:) |
261 | #ifdef HAVE_FMRADIO_IN | 260 | HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:) |
262 | case AUDIO_SRC_FMRADIO: | 261 | if (left) global_settings.rec_left_gain += factor; |
263 | #endif | ||
264 | if(left) global_settings.rec_left_gain += factor; | ||
265 | if (right) global_settings.rec_right_gain += factor; | 262 | if (right) global_settings.rec_right_gain += factor; |
266 | break; | 263 | break; |
267 | default: | 264 | case AUDIO_SRC_MIC: |
268 | global_settings.rec_mic_gain += factor; | 265 | global_settings.rec_mic_gain += factor; |
269 | } | 266 | } |
270 | } | 267 | } |
@@ -469,31 +466,27 @@ static void adjust_cursor(void) | |||
469 | #ifdef HAVE_AGC | 466 | #ifdef HAVE_AGC |
470 | switch(global_settings.rec_source) | 467 | switch(global_settings.rec_source) |
471 | { | 468 | { |
472 | case AUDIO_SRC_MIC: | 469 | case REC_SRC_MIC: |
473 | if(cursor == 2) | 470 | if(cursor == 2) |
474 | cursor = 4; | 471 | cursor = 4; |
475 | else if(cursor == 3) | 472 | else if(cursor == 3) |
476 | cursor = 1; | 473 | cursor = 1; |
477 | case AUDIO_SRC_LINEIN: | 474 | HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:) |
478 | #ifdef HAVE_FMRADIO_IN | 475 | HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:) |
479 | case AUDIO_SRC_FMRADIO: | ||
480 | #endif | ||
481 | max_cursor = 5; | 476 | max_cursor = 5; |
482 | break; | 477 | break; |
483 | default: | 478 | default: |
484 | max_cursor = 0; | 479 | max_cursor = 0; |
485 | break; | 480 | break; |
486 | } | 481 | } |
487 | #else | 482 | #else /* !HAVE_AGC */ |
488 | switch(global_settings.rec_source) | 483 | switch(global_settings.rec_source) |
489 | { | 484 | { |
490 | case AUDIO_SRC_MIC: | 485 | case AUDIO_SRC_MIC: |
491 | max_cursor = 1; | 486 | max_cursor = 1; |
492 | break; | 487 | break; |
493 | case AUDIO_SRC_LINEIN: | 488 | HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:) |
494 | #ifdef HAVE_FMRADIO_IN | 489 | HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:) |
495 | case AUDIO_SRC_FMRADIO: | ||
496 | #endif | ||
497 | max_cursor = 3; | 490 | max_cursor = 3; |
498 | break; | 491 | break; |
499 | default: | 492 | default: |
@@ -556,7 +549,7 @@ int rec_create_directory(void) | |||
556 | 549 | ||
557 | #if CONFIG_CODEC == SWCODEC && !defined(SIMULATOR) | 550 | #if CONFIG_CODEC == SWCODEC && !defined(SIMULATOR) |
558 | 551 | ||
559 | # ifdef HAVE_SPDIF_IN | 552 | # ifdef HAVE_SPDIF_REC |
560 | # ifdef HAVE_ADJUSTABLE_CPU_FREQ | 553 | # ifdef HAVE_ADJUSTABLE_CPU_FREQ |
561 | static void rec_boost(bool state) | 554 | static void rec_boost(bool state) |
562 | { | 555 | { |
@@ -588,7 +581,7 @@ void rec_set_source(int source, unsigned flags) | |||
588 | /** Do power up/down of associated device(s) **/ | 581 | /** Do power up/down of associated device(s) **/ |
589 | 582 | ||
590 | /** SPDIF **/ | 583 | /** SPDIF **/ |
591 | #ifdef HAVE_SPDIF_IN | 584 | #ifdef HAVE_SPDIF_REC |
592 | /* Always boost for SPDIF */ | 585 | /* Always boost for SPDIF */ |
593 | rec_boost(source == AUDIO_SRC_SPDIF); | 586 | rec_boost(source == AUDIO_SRC_SPDIF); |
594 | #endif /* HAVE_SPDIF_IN */ | 587 | #endif /* HAVE_SPDIF_IN */ |
@@ -766,7 +759,7 @@ bool recording_screen(bool no_source) | |||
766 | int warning_counter = 0; | 759 | int warning_counter = 0; |
767 | #define WARNING_PERIOD 7 | 760 | #define WARNING_PERIOD 7 |
768 | #endif | 761 | #endif |
769 | #ifdef HAVE_FMRADIO_IN | 762 | #ifdef HAVE_FMRADIO_REC |
770 | /* Radio is left on if: | 763 | /* Radio is left on if: |
771 | * 1) Is was on at the start and the initial source is FM Radio | 764 | * 1) Is was on at the start and the initial source is FM Radio |
772 | * 2) 1) and the source was never changed to something else | 765 | * 2) 1) and the source was never changed to something else |
@@ -849,7 +842,7 @@ bool recording_screen(bool no_source) | |||
849 | agc_preset = global_settings.rec_agc_preset_line; | 842 | agc_preset = global_settings.rec_agc_preset_line; |
850 | agc_maxgain = global_settings.rec_agc_maxgain_line; | 843 | agc_maxgain = global_settings.rec_agc_maxgain_line; |
851 | } | 844 | } |
852 | #endif | 845 | #endif /* HAVE_AGC */ |
853 | 846 | ||
854 | FOR_NB_SCREENS(i) | 847 | FOR_NB_SCREENS(i) |
855 | { | 848 | { |
@@ -1117,7 +1110,7 @@ bool recording_screen(bool no_source) | |||
1117 | global_settings.rec_agc_maxgain_line = agc_maxgain; | 1110 | global_settings.rec_agc_maxgain_line = agc_maxgain; |
1118 | } | 1111 | } |
1119 | break; | 1112 | break; |
1120 | #endif | 1113 | #endif /* HAVE_AGC */ |
1121 | } | 1114 | } |
1122 | set_gain(); | 1115 | set_gain(); |
1123 | update_countdown = 1; /* Update immediately */ | 1116 | update_countdown = 1; /* Update immediately */ |
@@ -1185,7 +1178,7 @@ bool recording_screen(bool no_source) | |||
1185 | global_settings.rec_agc_maxgain_line = agc_maxgain; | 1178 | global_settings.rec_agc_maxgain_line = agc_maxgain; |
1186 | } | 1179 | } |
1187 | break; | 1180 | break; |
1188 | #endif | 1181 | #endif /* HAVE_AGC */ |
1189 | } | 1182 | } |
1190 | set_gain(); | 1183 | set_gain(); |
1191 | update_countdown = 1; /* Update immediately */ | 1184 | update_countdown = 1; /* Update immediately */ |
@@ -1194,7 +1187,7 @@ bool recording_screen(bool no_source) | |||
1194 | case ACTION_STD_MENU: | 1187 | case ACTION_STD_MENU: |
1195 | if(audio_stat != AUDIO_STATUS_RECORD) | 1188 | if(audio_stat != AUDIO_STATUS_RECORD) |
1196 | { | 1189 | { |
1197 | #ifdef HAVE_FMRADIO_IN | 1190 | #ifdef HAVE_FMRADIO_REC |
1198 | const int prev_rec_source = global_settings.rec_source; | 1191 | const int prev_rec_source = global_settings.rec_source; |
1199 | #endif | 1192 | #endif |
1200 | 1193 | ||
@@ -1206,13 +1199,13 @@ bool recording_screen(bool no_source) | |||
1206 | { | 1199 | { |
1207 | done = true; | 1200 | done = true; |
1208 | been_in_usb_mode = true; | 1201 | been_in_usb_mode = true; |
1209 | #ifdef HAVE_FMRADIO_IN | 1202 | #ifdef HAVE_FMRADIO_REC |
1210 | radio_status = FMRADIO_OFF; | 1203 | radio_status = FMRADIO_OFF; |
1211 | #endif | 1204 | #endif |
1212 | } | 1205 | } |
1213 | else | 1206 | else |
1214 | { | 1207 | { |
1215 | #ifdef HAVE_FMRADIO_IN | 1208 | #ifdef HAVE_FMRADIO_REC |
1216 | /* If input changes away from FM Radio, radio will | 1209 | /* If input changes away from FM Radio, radio will |
1217 | remain off when recording screen closes. */ | 1210 | remain off when recording screen closes. */ |
1218 | if (global_settings.rec_source != prev_rec_source | 1211 | if (global_settings.rec_source != prev_rec_source |
@@ -1306,7 +1299,7 @@ bool recording_screen(bool no_source) | |||
1306 | default_event_handler(SYS_USB_CONNECTED); | 1299 | default_event_handler(SYS_USB_CONNECTED); |
1307 | done = true; | 1300 | done = true; |
1308 | been_in_usb_mode = true; | 1301 | been_in_usb_mode = true; |
1309 | #ifdef HAVE_FMRADIO_IN | 1302 | #ifdef HAVE_FMRADIO_REC |
1310 | radio_status = FMRADIO_OFF; | 1303 | radio_status = FMRADIO_OFF; |
1311 | #endif | 1304 | #endif |
1312 | } | 1305 | } |
@@ -1493,11 +1486,10 @@ bool recording_screen(bool no_source) | |||
1493 | PM_HEIGHT + 3, buf); | 1486 | PM_HEIGHT + 3, buf); |
1494 | } | 1487 | } |
1495 | } | 1488 | } |
1496 | else if(global_settings.rec_source == AUDIO_SRC_LINEIN | 1489 | else if(0 |
1497 | #ifdef HAVE_FMRADIO_IN | 1490 | HAVE_LINE_REC_( || global_settings.rec_source == AUDIO_SRC_LINEIN) |
1498 | || global_settings.rec_source == AUDIO_SRC_FMRADIO | 1491 | HAVE_FMRADIO_REC_( || global_settings.rec_source == AUDIO_SRC_FMRADIO) |
1499 | #endif | 1492 | ) |
1500 | ) | ||
1501 | { | 1493 | { |
1502 | /* Draw LINE or FMRADIO recording gain */ | 1494 | /* Draw LINE or FMRADIO recording gain */ |
1503 | snprintf(buf, sizeof(buf), "%s:%s", | 1495 | snprintf(buf, sizeof(buf), "%s:%s", |
@@ -1541,16 +1533,14 @@ bool recording_screen(bool no_source) | |||
1541 | { | 1533 | { |
1542 | switch (global_settings.rec_source) | 1534 | switch (global_settings.rec_source) |
1543 | { | 1535 | { |
1544 | case AUDIO_SRC_LINEIN: | 1536 | HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:) |
1545 | #ifdef HAVE_FMRADIO_IN | 1537 | HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:) |
1546 | case AUDIO_SRC_FMRADIO: | ||
1547 | #endif | ||
1548 | line[i] = 5; | 1538 | line[i] = 5; |
1549 | break; | 1539 | break; |
1550 | case AUDIO_SRC_MIC: | 1540 | case AUDIO_SRC_MIC: |
1551 | line[i] = 4; | 1541 | line[i] = 4; |
1552 | break; | 1542 | break; |
1553 | #ifdef HAVE_SPDIF_IN | 1543 | #ifdef HAVE_SPDIF_REC |
1554 | case AUDIO_SRC_SPDIF: | 1544 | case AUDIO_SRC_SPDIF: |
1555 | line[i] = 3; | 1545 | line[i] = 3; |
1556 | break; | 1546 | break; |
@@ -1615,12 +1605,11 @@ bool recording_screen(bool no_source) | |||
1615 | screens[i].puts_style_offset(0, filename_offset[i] + | 1605 | screens[i].puts_style_offset(0, filename_offset[i] + |
1616 | PM_HEIGHT + line[i], buf, STYLE_INVERT,0); | 1606 | PM_HEIGHT + line[i], buf, STYLE_INVERT,0); |
1617 | } | 1607 | } |
1618 | else if (global_settings.rec_source == AUDIO_SRC_MIC | 1608 | else if ( |
1619 | || global_settings.rec_source == AUDIO_SRC_LINEIN | 1609 | global_settings.rec_source == AUDIO_SRC_MIC |
1620 | #ifdef HAVE_FMRADIO_IN | 1610 | HAVE_LINE_REC_(|| global_settings.rec_source == AUDIO_SRC_LINEIN) |
1621 | || global_settings.rec_source == AUDIO_SRC_FMRADIO | 1611 | HAVE_FMRADIO_REC_(|| global_settings.rec_source == AUDIO_SRC_FMRADIO) |
1622 | #endif | 1612 | ) |
1623 | ) | ||
1624 | { | 1613 | { |
1625 | for(i = 0; i < screen_update; i++) { | 1614 | for(i = 0; i < screen_update; i++) { |
1626 | if (display_agc[i]) { | 1615 | if (display_agc[i]) { |
@@ -1629,7 +1618,7 @@ bool recording_screen(bool no_source) | |||
1629 | } | 1618 | } |
1630 | } | 1619 | } |
1631 | } | 1620 | } |
1632 | 1621 | ||
1633 | if (global_settings.rec_source == AUDIO_SRC_MIC) | 1622 | if (global_settings.rec_source == AUDIO_SRC_MIC) |
1634 | { | 1623 | { |
1635 | if(agc_maxgain < (global_settings.rec_mic_gain)) | 1624 | if(agc_maxgain < (global_settings.rec_mic_gain)) |
@@ -1642,7 +1631,7 @@ bool recording_screen(bool no_source) | |||
1642 | if(agc_maxgain < (global_settings.rec_right_gain)) | 1631 | if(agc_maxgain < (global_settings.rec_right_gain)) |
1643 | change_recording_gain(false, false, true); | 1632 | change_recording_gain(false, false, true); |
1644 | } | 1633 | } |
1645 | #else | 1634 | #else /* !HAVE_AGC */ |
1646 | } | 1635 | } |
1647 | #endif /* HAVE_AGC */ | 1636 | #endif /* HAVE_AGC */ |
1648 | 1637 | ||
@@ -1758,7 +1747,7 @@ bool recording_screen(bool no_source) | |||
1758 | audio_stop_recording(); | 1747 | audio_stop_recording(); |
1759 | audio_close_recording(); | 1748 | audio_close_recording(); |
1760 | 1749 | ||
1761 | #ifdef HAVE_FMRADIO_IN | 1750 | #ifdef HAVE_FMRADIO_REC |
1762 | if (radio_status != FMRADIO_OFF) | 1751 | if (radio_status != FMRADIO_OFF) |
1763 | /* Restore radio playback - radio_status should be unchanged if started | 1752 | /* Restore radio playback - radio_status should be unchanged if started |
1764 | through fm radio screen (barring usb connect) */ | 1753 | through fm radio screen (barring usb connect) */ |
diff --git a/apps/settings_list.c b/apps/settings_list.c index d39779607d..c6adfe884a 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -747,14 +747,12 @@ const struct settings_list settings[] = { | |||
747 | "rec split method", "Time,Filesize", NULL, 2, | 747 | "rec split method", "Time,Filesize", NULL, 2, |
748 | ID2P(LANG_REC_TIME), ID2P(LANG_REC_SIZE)), | 748 | ID2P(LANG_REC_TIME), ID2P(LANG_REC_SIZE)), |
749 | {F_T_INT,&global_settings.rec_source,LANG_RECORDING_SOURCE,INT(0), | 749 | {F_T_INT,&global_settings.rec_source,LANG_RECORDING_SOURCE,INT(0), |
750 | "rec source","mic,line" | 750 | "rec source", |
751 | #ifdef HAVE_SPDIF_IN | 751 | &HAVE_MIC_REC_(",mic") |
752 | ",spdif" | 752 | HAVE_LINE_REC_(",line") |
753 | #endif | 753 | HAVE_SPDIF_REC_(",spdif") |
754 | #ifdef HAVE_FMRADIO_IN | 754 | HAVE_FMRADIO_REC_(",fmradio")[1] |
755 | ",fmradio" | 755 | ,UNUSED}, |
756 | #endif | ||
757 | ,UNUSED}, | ||
758 | INT_SETTING(0, rec_prerecord_time, LANG_RECORD_PRERECORD_TIME, | 756 | INT_SETTING(0, rec_prerecord_time, LANG_RECORD_PRERECORD_TIME, |
759 | 0, "prerecording time", | 757 | 0, "prerecording time", |
760 | UNIT_SEC, 0, 30, 1, rectime_formatter, rectime_getlang, NULL), | 758 | UNIT_SEC, 0, 30, 1, rectime_formatter, rectime_getlang, NULL), |
diff --git a/firmware/export/audio.h b/firmware/export/audio.h index ebcb316cd9..a0da846215 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h | |||
@@ -127,32 +127,37 @@ enum rec_channel_modes | |||
127 | #define CHN_CAP_ALL (CHN_CAP_STEREO | CHN_CAP_MONO) | 127 | #define CHN_CAP_ALL (CHN_CAP_STEREO | CHN_CAP_MONO) |
128 | #endif /* CONFIG_CODEC == SWCODEC */ | 128 | #endif /* CONFIG_CODEC == SWCODEC */ |
129 | 129 | ||
130 | /* audio sources */ | ||
131 | enum audio_sources | 130 | enum audio_sources |
132 | { | 131 | { |
133 | AUDIO_SRC_PLAYBACK = -1, /* for audio playback (default) */ | 132 | AUDIO_SRC_PLAYBACK = -1, /* Virtual source */ |
134 | AUDIO_SRC_MIC, /* monitor mic */ | 133 | HAVE_MIC_IN_(AUDIO_SRC_MIC,) |
135 | AUDIO_SRC_LINEIN, /* monitor line in */ | 134 | HAVE_LINE_IN_(AUDIO_SRC_LINEIN,) |
136 | #ifdef HAVE_SPDIF_IN | 135 | HAVE_SPDIF_IN_(AUDIO_SRC_SPDIF,) |
137 | AUDIO_SRC_SPDIF, /* monitor spdif */ | 136 | HAVE_FMRADIO_IN_(AUDIO_SRC_FMRADIO,) |
138 | #endif | 137 | AUDIO_NUM_SOURCES, |
139 | #if defined(HAVE_FMRADIO_IN) || CONFIG_TUNER | 138 | AUDIO_SRC_MAX = AUDIO_NUM_SOURCES-1, |
140 | AUDIO_SRC_FMRADIO, /* monitor fm radio */ | 139 | AUDIO_SRC_DEFAULT = AUDIO_SRC_PLAYBACK |
141 | #endif | ||
142 | /* define new audio sources above this line */ | ||
143 | AUDIO_SOURCE_LIST_END, | ||
144 | /* AUDIO_SRC_FMRADIO must be declared #if CONFIG_TUNER but is not in | ||
145 | the list of recordable sources. HAVE_FMRADIO_IN implies CONFIG_TUNER. */ | ||
146 | #if defined(HAVE_FMRADIO_IN) || (CONFIG_TUNER == 0) | ||
147 | AUDIO_NUM_SOURCES = AUDIO_SOURCE_LIST_END, | ||
148 | #else | ||
149 | AUDIO_NUM_SOURCES = AUDIO_SOURCE_LIST_END-1, | ||
150 | #endif | ||
151 | AUDIO_SRC_MAX = AUDIO_NUM_SOURCES-1 | ||
152 | }; | 140 | }; |
153 | 141 | ||
142 | #ifdef HAVE_RECORDING | ||
143 | /* Recordable source implies it has the input as well */ | ||
144 | |||
145 | /* For now there's no restrictions on any targets with which inputs | ||
146 | are recordable so define them as equivalent - if they do differ, | ||
147 | special handling is needed right now. */ | ||
148 | enum rec_sources | ||
149 | { | ||
150 | __REC_SRC_FIRST = -1, | ||
151 | HAVE_MIC_REC_(REC_SRC_MIC,) | ||
152 | HAVE_LINE_REC_(REC_SRC_LINEIN,) | ||
153 | HAVE_SPDIF_REC_(REC_SRC_SPDIF,) | ||
154 | HAVE_FMRADIO_REC_(REC_SRC_FMRADIO,) | ||
155 | REC_NUM_SOURCES | ||
156 | }; | ||
157 | #endif /* HAVE_RECORDING */ | ||
158 | |||
154 | #if CONFIG_CODEC == SWCODEC | 159 | #if CONFIG_CODEC == SWCODEC |
155 | /* selects an audio source for recording or playback */ | 160 | /* selects a source to monitor for recording or playback */ |
156 | #define SRCF_PLAYBACK 0x0000 /* default */ | 161 | #define SRCF_PLAYBACK 0x0000 /* default */ |
157 | #define SRCF_RECORDING 0x1000 | 162 | #define SRCF_RECORDING 0x1000 |
158 | #if CONFIG_TUNER | 163 | #if CONFIG_TUNER |
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index d477289f01..edb73e80eb 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h | |||
@@ -9,6 +9,9 @@ | |||
9 | 9 | ||
10 | /* define this if you have recording possibility */ | 10 | /* define this if you have recording possibility */ |
11 | /*#define HAVE_RECORDING*/ /* TODO: add support for this */ | 11 | /*#define HAVE_RECORDING*/ /* TODO: add support for this */ |
12 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
13 | explicitly if different */ | ||
14 | /* #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO) */ | ||
12 | 15 | ||
13 | /* define this if you have a bitmap LCD display */ | 16 | /* define this if you have a bitmap LCD display */ |
14 | #define HAVE_LCD_BITMAP | 17 | #define HAVE_LCD_BITMAP |
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index 211dccb183..479815ee2c 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h | |||
@@ -1,6 +1,10 @@ | |||
1 | /* define this if you have recording possibility */ | 1 | /* define this if you have recording possibility */ |
2 | #define HAVE_RECORDING | 2 | #define HAVE_RECORDING |
3 | 3 | ||
4 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
5 | explicitly if different */ | ||
6 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_SPDIF) | ||
7 | |||
4 | /* define this if you have a bitmap LCD display */ | 8 | /* define this if you have a bitmap LCD display */ |
5 | #define HAVE_LCD_BITMAP | 9 | #define HAVE_LCD_BITMAP |
6 | 10 | ||
@@ -48,9 +52,6 @@ | |||
48 | /* Define this if you have a MAS3587F */ | 52 | /* Define this if you have a MAS3587F */ |
49 | #define CONFIG_CODEC MAS3587F | 53 | #define CONFIG_CODEC MAS3587F |
50 | 54 | ||
51 | /* Define this for S/PDIF input available */ | ||
52 | #define HAVE_SPDIF_IN | ||
53 | |||
54 | /* Define this for LCD backlight available */ | 55 | /* Define this for LCD backlight available */ |
55 | #define HAVE_BACKLIGHT | 56 | #define HAVE_BACKLIGHT |
56 | 57 | ||
diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index 4d372143f8..a5d32ebeaa 100644 --- a/firmware/export/config-h10.h +++ b/firmware/export/config-h10.h | |||
@@ -10,6 +10,9 @@ | |||
10 | 10 | ||
11 | /* define this if you have recording possibility */ | 11 | /* define this if you have recording possibility */ |
12 | #define HAVE_RECORDING | 12 | #define HAVE_RECORDING |
13 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
14 | explicitly if different */ | ||
15 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN) | ||
13 | 16 | ||
14 | /* define the bitmask of hardware sample rates */ | 17 | /* define the bitmask of hardware sample rates */ |
15 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) | 18 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) |
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index cc2bfd7178..af51e81f70 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h | |||
@@ -156,8 +156,10 @@ | |||
156 | 156 | ||
157 | #endif /* !SIMULATOR */ | 157 | #endif /* !SIMULATOR */ |
158 | 158 | ||
159 | /* Define this for S/PDIF input available */ | 159 | /* Define bitmask of input sources - recordable bitmask can be defined |
160 | #define HAVE_SPDIF_IN | 160 | explicitly if different */ |
161 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | \ | ||
162 | SRC_CAP_FMRADIO | SRC_CAP_SPDIF) | ||
161 | 163 | ||
162 | /* Define this for S/PDIF output available */ | 164 | /* Define this for S/PDIF output available */ |
163 | #define HAVE_SPDIF_OUT | 165 | #define HAVE_SPDIF_OUT |
diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h index 3b3cebb8fb..48d73173ce 100644 --- a/firmware/export/config-h10_5gb.h +++ b/firmware/export/config-h10_5gb.h | |||
@@ -10,6 +10,9 @@ | |||
10 | 10 | ||
11 | /* define this if you have recording possibility */ | 11 | /* define this if you have recording possibility */ |
12 | #define HAVE_RECORDING | 12 | #define HAVE_RECORDING |
13 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
14 | explicitly if different */ | ||
15 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN) | ||
13 | 16 | ||
14 | /* define the bitmask of hardware sample rates */ | 17 | /* define the bitmask of hardware sample rates */ |
15 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) | 18 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) |
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index a0ad638fa2..7e5a66a3dd 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h | |||
@@ -75,6 +75,11 @@ | |||
75 | /* define this if you have recording possibility */ | 75 | /* define this if you have recording possibility */ |
76 | #define HAVE_RECORDING | 76 | #define HAVE_RECORDING |
77 | 77 | ||
78 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
79 | explicitly if different */ | ||
80 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | \ | ||
81 | SRC_CAP_FMRADIO | SRC_CAP_SPDIF) | ||
82 | |||
78 | /* define hardware samples rate caps mask */ | 83 | /* define hardware samples rate caps mask */ |
79 | #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11) | 84 | #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11) |
80 | 85 | ||
@@ -150,18 +155,12 @@ | |||
150 | 155 | ||
151 | #endif /* !SIMULATOR */ | 156 | #endif /* !SIMULATOR */ |
152 | 157 | ||
153 | /* Define this for S/PDIF input available */ | ||
154 | #define HAVE_SPDIF_IN | ||
155 | |||
156 | /* Define this for S/PDIF output available */ | 158 | /* Define this for S/PDIF output available */ |
157 | #define HAVE_SPDIF_OUT | 159 | #define HAVE_SPDIF_OUT |
158 | 160 | ||
159 | /* Define this if you can control the S/PDIF power */ | 161 | /* Define this if you can control the S/PDIF power */ |
160 | #define HAVE_SPDIF_POWER | 162 | #define HAVE_SPDIF_POWER |
161 | 163 | ||
162 | /* Define this for FM radio input available */ | ||
163 | #define HAVE_FMRADIO_IN | ||
164 | |||
165 | /* Define this if you have a serial port */ | 164 | /* Define this if you have a serial port */ |
166 | /*#define HAVE_SERIAL*/ | 165 | /*#define HAVE_SERIAL*/ |
167 | 166 | ||
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 0b2406bee7..43239e4419 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h | |||
@@ -72,6 +72,10 @@ | |||
72 | /* define this if you have recording possibility */ | 72 | /* define this if you have recording possibility */ |
73 | #define HAVE_RECORDING | 73 | #define HAVE_RECORDING |
74 | 74 | ||
75 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
76 | explicitly if different */ | ||
77 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO) | ||
78 | |||
75 | /* define hardware samples rate caps mask */ | 79 | /* define hardware samples rate caps mask */ |
76 | #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11) | 80 | #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11) |
77 | 81 | ||
diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h index bcc843f125..d4e09dd0ad 100644 --- a/firmware/export/config-iaudiom5.h +++ b/firmware/export/config-iaudiom5.h | |||
@@ -9,6 +9,10 @@ | |||
9 | /* define this if you have recording possibility */ | 9 | /* define this if you have recording possibility */ |
10 | #define HAVE_RECORDING | 10 | #define HAVE_RECORDING |
11 | 11 | ||
12 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
13 | explicitly if different */ | ||
14 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN) | ||
15 | |||
12 | /* define the bitmask of hardware sample rates */ | 16 | /* define the bitmask of hardware sample rates */ |
13 | #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11) | 17 | #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11) |
14 | 18 | ||
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 43c02a0ee5..fbcb69aa61 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h | |||
@@ -9,6 +9,10 @@ | |||
9 | /* define this if you have recording possibility */ | 9 | /* define this if you have recording possibility */ |
10 | #define HAVE_RECORDING | 10 | #define HAVE_RECORDING |
11 | 11 | ||
12 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
13 | explicitly if different */ | ||
14 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO) | ||
15 | |||
12 | /* define the bitmask of hardware sample rates */ | 16 | /* define the bitmask of hardware sample rates */ |
13 | #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11) | 17 | #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11) |
14 | 18 | ||
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 4a8d4f1bf2..14a4e8266d 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h | |||
@@ -11,6 +11,10 @@ | |||
11 | /* define this if you have recording possibility */ | 11 | /* define this if you have recording possibility */ |
12 | #define HAVE_RECORDING | 12 | #define HAVE_RECORDING |
13 | 13 | ||
14 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
15 | explicitly if different */ | ||
16 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN) | ||
17 | |||
14 | /* define the bitmask of hardware sample rates */ | 18 | /* define the bitmask of hardware sample rates */ |
15 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) | 19 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) |
16 | 20 | ||
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 41277041f1..5e4e3b33ab 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h | |||
@@ -11,6 +11,10 @@ | |||
11 | /* define this if you have recording possibility */ | 11 | /* define this if you have recording possibility */ |
12 | #define HAVE_RECORDING | 12 | #define HAVE_RECORDING |
13 | 13 | ||
14 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
15 | explicitly if different */ | ||
16 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN) | ||
17 | |||
14 | /* define the bitmask of hardware sample rates */ | 18 | /* define the bitmask of hardware sample rates */ |
15 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) | 19 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) |
16 | 20 | ||
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index 74bfe34d0f..1d024d8565 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h | |||
@@ -11,6 +11,10 @@ | |||
11 | /* define this if you have recording possibility */ | 11 | /* define this if you have recording possibility */ |
12 | #define HAVE_RECORDING | 12 | #define HAVE_RECORDING |
13 | 13 | ||
14 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
15 | explicitly if different */ | ||
16 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN) | ||
17 | |||
14 | /* define the bitmask of hardware sample rates */ | 18 | /* define the bitmask of hardware sample rates */ |
15 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) | 19 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) |
16 | 20 | ||
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index b5318d755c..b2b4ae9856 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h | |||
@@ -11,6 +11,10 @@ | |||
11 | /* define this if you have recording possibility */ | 11 | /* define this if you have recording possibility */ |
12 | #define HAVE_RECORDING | 12 | #define HAVE_RECORDING |
13 | 13 | ||
14 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
15 | explicitly if different */ | ||
16 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN) | ||
17 | |||
14 | /* define the bitmask of hardware sample rates */ | 18 | /* define the bitmask of hardware sample rates */ |
15 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) | 19 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) |
16 | 20 | ||
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index c168ecf588..ea806a4973 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h | |||
@@ -1,6 +1,10 @@ | |||
1 | /* define this if you have recording possibility */ | 1 | /* define this if you have recording possibility */ |
2 | #define HAVE_RECORDING | 2 | #define HAVE_RECORDING |
3 | 3 | ||
4 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
5 | explicitly if different */ | ||
6 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN) | ||
7 | |||
4 | /* define this if you have a bitmap LCD display */ | 8 | /* define this if you have a bitmap LCD display */ |
5 | #define HAVE_LCD_BITMAP | 9 | #define HAVE_LCD_BITMAP |
6 | 10 | ||
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index 3fe7365d3c..29f187fdd2 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h | |||
@@ -1,6 +1,10 @@ | |||
1 | /* define this if you have recording possibility */ | 1 | /* define this if you have recording possibility */ |
2 | #define HAVE_RECORDING | 2 | #define HAVE_RECORDING |
3 | 3 | ||
4 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
5 | explicitly if different */ | ||
6 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_SPDIF) | ||
7 | |||
4 | /* define this if you have a bitmap LCD display */ | 8 | /* define this if you have a bitmap LCD display */ |
5 | #define HAVE_LCD_BITMAP | 9 | #define HAVE_LCD_BITMAP |
6 | 10 | ||
@@ -42,9 +46,6 @@ | |||
42 | /* Define this if you have a MAS3587F */ | 46 | /* Define this if you have a MAS3587F */ |
43 | #define CONFIG_CODEC MAS3587F | 47 | #define CONFIG_CODEC MAS3587F |
44 | 48 | ||
45 | /* Define this for S/PDIF input available */ | ||
46 | #define HAVE_SPDIF_IN | ||
47 | |||
48 | /* Define this for LCD backlight available */ | 49 | /* Define this for LCD backlight available */ |
49 | #define HAVE_BACKLIGHT | 50 | #define HAVE_BACKLIGHT |
50 | 51 | ||
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index 8211994275..b534be568f 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h | |||
@@ -1,6 +1,10 @@ | |||
1 | /* define this if you have recording possibility */ | 1 | /* define this if you have recording possibility */ |
2 | #define HAVE_RECORDING | 2 | #define HAVE_RECORDING |
3 | 3 | ||
4 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
5 | explicitly if different */ | ||
6 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_SPDIF) | ||
7 | |||
4 | /* define this if you have a bitmap LCD display */ | 8 | /* define this if you have a bitmap LCD display */ |
5 | #define HAVE_LCD_BITMAP | 9 | #define HAVE_LCD_BITMAP |
6 | 10 | ||
@@ -45,9 +49,6 @@ | |||
45 | /* Define this if you have a MAS3587F */ | 49 | /* Define this if you have a MAS3587F */ |
46 | #define CONFIG_CODEC MAS3587F | 50 | #define CONFIG_CODEC MAS3587F |
47 | 51 | ||
48 | /* Define this for S/PDIF input available */ | ||
49 | #define HAVE_SPDIF_IN | ||
50 | |||
51 | /* Define this for LCD backlight available */ | 52 | /* Define this for LCD backlight available */ |
52 | #define HAVE_BACKLIGHT | 53 | #define HAVE_BACKLIGHT |
53 | 54 | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index ceb63cd098..0ad4fabbe1 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -204,6 +204,9 @@ | |||
204 | /* no known platform */ | 204 | /* no known platform */ |
205 | #endif | 205 | #endif |
206 | 206 | ||
207 | /* setup basic macros from capability masks */ | ||
208 | #include "config_caps.h" | ||
209 | |||
207 | /* now set any CONFIG_ defines correctly if they are not used, | 210 | /* now set any CONFIG_ defines correctly if they are not used, |
208 | No need to do this on CONFIG_'s which are compulsary (e.g CONFIG_CODEC ) */ | 211 | No need to do this on CONFIG_'s which are compulsary (e.g CONFIG_CODEC ) */ |
209 | #ifndef CONFIG_TUNER | 212 | #ifndef CONFIG_TUNER |
diff --git a/firmware/export/config_caps.h b/firmware/export/config_caps.h new file mode 100644 index 0000000000..8e3832d3a7 --- /dev/null +++ b/firmware/export/config_caps.h | |||
@@ -0,0 +1,107 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Michael Sevakis | ||
11 | * | ||
12 | * Convert caps masks into HAVE_* defines | ||
13 | * | ||
14 | * All files in this archive are subject to the GNU General Public License. | ||
15 | * See the file COPYING in the source tree root for full license agreement. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | /** INPUTS **/ | ||
23 | |||
24 | /* NOTE: Playback is implied in all this. Make sense? :) */ | ||
25 | #define SRC_MIC 0 | ||
26 | #define SRC_LINEIN 1 | ||
27 | #define SRC_SPDIF 2 | ||
28 | #define SRC_FMRADIO 3 | ||
29 | |||
30 | #define SRC_CAP_MIC (1 << SRC_MIC) | ||
31 | #define SRC_CAP_LINEIN (1 << SRC_LINEIN) | ||
32 | #define SRC_CAP_SPDIF (1 << SRC_SPDIF) | ||
33 | #define SRC_CAP_FMRADIO (1 << SRC_FMRADIO) | ||
34 | |||
35 | /* audio monitor mux sources */ | ||
36 | #ifndef INPUT_SRC_CAPS | ||
37 | #define INPUT_SRC_CAPS 0 /* Nothing but playback */ | ||
38 | #endif | ||
39 | |||
40 | /* Microphone */ | ||
41 | #if (INPUT_SRC_CAPS & SRC_CAP_MIC) | ||
42 | #define HAVE_MIC_IN | ||
43 | #define HAVE_MIC_IN_(...) __VA_ARGS__ | ||
44 | #else | ||
45 | #define HAVE_MIC_IN_(...) | ||
46 | #endif | ||
47 | /* Line In */ | ||
48 | #if (INPUT_SRC_CAPS & SRC_CAP_LINEIN) | ||
49 | #define HAVE_LINE_IN | ||
50 | #define HAVE_LINE_IN_(...) __VA_ARGS__ | ||
51 | #else | ||
52 | #define HAVE_LINE_IN_(...) | ||
53 | #endif | ||
54 | /* S/PDIF */ | ||
55 | #if (INPUT_SRC_CAPS & SRC_CAP_SPDIF) | ||
56 | #define HAVE_SPDIF_IN | ||
57 | #define HAVE_SPDIF_IN_(...) __VA_ARGS__ | ||
58 | #else | ||
59 | #define HAVE_SPDIF_IN_(...) | ||
60 | #endif | ||
61 | /* FM Radio */ | ||
62 | #if (INPUT_SRC_CAPS & SRC_CAP_FMRADIO) | ||
63 | #define HAVE_FMRADIO_IN | ||
64 | #define HAVE_FMRADIO_IN_(...) __VA_ARGS__ | ||
65 | #else | ||
66 | #define HAVE_FMRADIO_IN_(...) | ||
67 | #endif | ||
68 | |||
69 | #ifdef HAVE_RECORDING | ||
70 | /* Recordable source implies it has the input as well */ | ||
71 | |||
72 | /* For now there's no restrictions on any targets with which inputs | ||
73 | are recordable so define them as equivalent - if they do differ, | ||
74 | special handling is needed right now. */ | ||
75 | #ifndef REC_SRC_CAPS | ||
76 | #define REC_SRC_CAPS INPUT_SRC_CAPS | ||
77 | #endif | ||
78 | |||
79 | /* Microphone */ | ||
80 | #if (REC_SRC_CAPS & SRC_CAP_MIC) | ||
81 | #define HAVE_MIC_REC | ||
82 | #define HAVE_MIC_REC_(...) __VA_ARGS__ | ||
83 | #else | ||
84 | #define HAVE_MIC_REC_(...) | ||
85 | #endif | ||
86 | /* Line In */ | ||
87 | #if (REC_SRC_CAPS & SRC_CAP_LINEIN) | ||
88 | #define HAVE_LINE_REC | ||
89 | #define HAVE_LINE_REC_(...) __VA_ARGS__ | ||
90 | #else | ||
91 | #define HAVE_LINE_REC_(...) | ||
92 | #endif | ||
93 | /* S/PDIF */ | ||
94 | #if (REC_SRC_CAPS & SRC_CAP_SPDIF) | ||
95 | #define HAVE_SPDIF_REC | ||
96 | #define HAVE_SPDIF_REC_(...) __VA_ARGS__ | ||
97 | #else | ||
98 | #define HAVE_SPDIF_REC_(...) | ||
99 | #endif | ||
100 | /* FM Radio */ | ||
101 | #if (REC_SRC_CAPS & SRC_CAP_FMRADIO) | ||
102 | #define HAVE_FMRADIO_REC | ||
103 | #define HAVE_FMRADIO_REC_(...) __VA_ARGS__ | ||
104 | #else | ||
105 | #define HAVE_FMRADIO_REC_(...) | ||
106 | #endif | ||
107 | #endif /* HAVE_RECORDING */ | ||
diff --git a/firmware/export/pcm_record.h b/firmware/export/pcm_record.h index 8075b00ffc..dcc473c3f3 100644 --- a/firmware/export/pcm_record.h +++ b/firmware/export/pcm_record.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #define PCM_RECORD_H | 21 | #define PCM_RECORD_H |
22 | 22 | ||
23 | #define DMA_REC_ERROR_DMA (-1) | 23 | #define DMA_REC_ERROR_DMA (-1) |
24 | #ifdef HAVE_SPDIF_IN | 24 | #ifdef HAVE_SPDIF_REC |
25 | #define DMA_REC_ERROR_SPDIF (-2) | 25 | #define DMA_REC_ERROR_SPDIF (-2) |
26 | #endif | 26 | #endif |
27 | 27 | ||
diff --git a/firmware/target/arm/audio-pp.c b/firmware/target/arm/audio-pp.c index 603bbad5fe..82c5545a3f 100644 --- a/firmware/target/arm/audio-pp.c +++ b/firmware/target/arm/audio-pp.c | |||
@@ -40,7 +40,6 @@ void audio_set_source(int source, unsigned flags) | |||
40 | { | 40 | { |
41 | default: /* playback - no recording */ | 41 | default: /* playback - no recording */ |
42 | source = AUDIO_SRC_PLAYBACK; | 42 | source = AUDIO_SRC_PLAYBACK; |
43 | #ifdef HAVE_RECORDING | ||
44 | case AUDIO_SRC_PLAYBACK: | 43 | case AUDIO_SRC_PLAYBACK: |
45 | if (source != last_source) | 44 | if (source != last_source) |
46 | { | 45 | { |
@@ -48,6 +47,7 @@ void audio_set_source(int source, unsigned flags) | |||
48 | audiohw_set_monitor(false); | 47 | audiohw_set_monitor(false); |
49 | } | 48 | } |
50 | break; | 49 | break; |
50 | #ifdef HAVE_MIC_REC | ||
51 | case AUDIO_SRC_MIC: /* recording only */ | 51 | case AUDIO_SRC_MIC: /* recording only */ |
52 | if (source != last_source) | 52 | if (source != last_source) |
53 | { | 53 | { |
@@ -55,7 +55,8 @@ void audio_set_source(int source, unsigned flags) | |||
55 | audiohw_set_monitor(false); | 55 | audiohw_set_monitor(false); |
56 | } | 56 | } |
57 | break; | 57 | break; |
58 | 58 | #endif | |
59 | #ifdef HAVE_LINEIN_REC | ||
59 | case AUDIO_SRC_LINEIN: /* recording only */ | 60 | case AUDIO_SRC_LINEIN: /* recording only */ |
60 | if (source != last_source) | 61 | if (source != last_source) |
61 | { | 62 | { |
@@ -64,7 +65,7 @@ void audio_set_source(int source, unsigned flags) | |||
64 | } | 65 | } |
65 | break; | 66 | break; |
66 | #endif | 67 | #endif |
67 | #if CONFIG_TUNER | 68 | #ifdef HAVE_FMRADIO_REC |
68 | case AUDIO_SRC_FMRADIO: /* recording and playback */ | 69 | case AUDIO_SRC_FMRADIO: /* recording and playback */ |
69 | if (!recording) | 70 | if (!recording) |
70 | audiohw_set_recvol(0, 0, AUDIO_GAIN_LINEIN); | 71 | audiohw_set_recvol(0, 0, AUDIO_GAIN_LINEIN); |
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c index 1f2d27a7b7..0148f3d9de 100644 --- a/firmware/target/arm/system-pp502x.c +++ b/firmware/target/arm/system-pp502x.c | |||
@@ -62,6 +62,11 @@ extern void clickwheel_int(void); | |||
62 | void irq(void) | 62 | void irq(void) |
63 | { | 63 | { |
64 | if(CURRENT_CORE == CPU) { | 64 | if(CURRENT_CORE == CPU) { |
65 | if (CPU_HI_INT_STAT) | ||
66 | { | ||
67 | gui_syncsplash(0, "%08X %08X", inl(0x6000414c), CPU_HI_INT_STAT); | ||
68 | } | ||
69 | |||
65 | if (CPU_INT_STAT & TIMER1_MASK) { | 70 | if (CPU_INT_STAT & TIMER1_MASK) { |
66 | #ifdef SANSA_E200 | 71 | #ifdef SANSA_E200 |
67 | if (GPIOF_INT_STAT & 0xff) | 72 | if (GPIOF_INT_STAT & 0xff) |
@@ -239,6 +244,11 @@ void system_init(void) | |||
239 | CPU_INT_CLR = -1; | 244 | CPU_INT_CLR = -1; |
240 | INT_FORCED_CLR = -1; | 245 | INT_FORCED_CLR = -1; |
241 | 246 | ||
247 | outl(0, 0x6000414c); | ||
248 | outl(0, 0x60004144); | ||
249 | |||
250 | // outl(0x80000, 0x6000414c); | ||
251 | |||
242 | GPIOA_INT_EN = 0; | 252 | GPIOA_INT_EN = 0; |
243 | GPIOB_INT_EN = 0; | 253 | GPIOB_INT_EN = 0; |
244 | GPIOC_INT_EN = 0; | 254 | GPIOC_INT_EN = 0; |
diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c index b52e5e09b5..dc40dacf0e 100644 --- a/firmware/target/coldfire/pcm-coldfire.c +++ b/firmware/target/coldfire/pcm-coldfire.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "logf.h" | 22 | #include "logf.h" |
23 | #include "audio.h" | 23 | #include "audio.h" |
24 | #include "sound.h" | 24 | #include "sound.h" |
25 | #if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT) | 25 | #if defined(HAVE_SPDIF_REC) || defined(HAVE_SPDIF_OUT) |
26 | #include "spdif.h" | 26 | #include "spdif.h" |
27 | #endif | 27 | #endif |
28 | 28 | ||
@@ -276,7 +276,7 @@ void pcm_init(void) | |||
276 | audiohw_set_frequency(freq_ent[FPARM_FSEL]); | 276 | audiohw_set_frequency(freq_ent[FPARM_FSEL]); |
277 | coldfire_set_pllcr_audio_bits(PLLCR_SET_AUDIO_BITS_DEFPARM); | 277 | coldfire_set_pllcr_audio_bits(PLLCR_SET_AUDIO_BITS_DEFPARM); |
278 | 278 | ||
279 | #if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT) | 279 | #if defined(HAVE_SPDIF_REC) || defined(HAVE_SPDIF_OUT) |
280 | spdif_init(); | 280 | spdif_init(); |
281 | #endif | 281 | #endif |
282 | /* Enable interrupt at level 6, priority 0 */ | 282 | /* Enable interrupt at level 6, priority 0 */ |
@@ -365,7 +365,7 @@ void pcm_rec_dma_start(void *addr, size_t size) | |||
365 | _pcm_apply_settings(!is_playback_monitoring()); | 365 | _pcm_apply_settings(!is_playback_monitoring()); |
366 | 366 | ||
367 | /* Start the DMA transfer.. */ | 367 | /* Start the DMA transfer.. */ |
368 | #ifdef HAVE_SPDIF_IN | 368 | #ifdef HAVE_SPDIF_REC |
369 | /* clear: ebu1cnew, valnogood, symbolerr, parityerr */ | 369 | /* clear: ebu1cnew, valnogood, symbolerr, parityerr */ |
370 | INTERRUPTCLEAR = (1 << 25) | (1 << 24) | (1 << 23) | (1 << 22); | 370 | INTERRUPTCLEAR = (1 << 25) | (1 << 24) | (1 << 23) | (1 << 22); |
371 | #endif | 371 | #endif |
@@ -462,7 +462,7 @@ void DMA1(void) | |||
462 | logf(" DCR1: %08x", DCR1); | 462 | logf(" DCR1: %08x", DCR1); |
463 | #endif | 463 | #endif |
464 | } | 464 | } |
465 | #ifdef HAVE_SPDIF_IN | 465 | #ifdef HAVE_SPDIF_REC |
466 | else if (DATAINCONTROL == 0xc038 && | 466 | else if (DATAINCONTROL == 0xc038 && |
467 | (INTERRUPTSTAT & ((1 << 24) | (1 << 23) | (1 << 22)))) | 467 | (INTERRUPTSTAT & ((1 << 24) | (1 << 23) | (1 << 22)))) |
468 | { | 468 | { |