summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-05-20 20:26:36 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-05-20 20:26:36 +0000
commit8f659ae8d3845b40ff93ebfa3692f7b2302e6c7e (patch)
treea54381487762ec69bdec99f69dd24b148d3400b9 /firmware/export
parent731d7a16c3f606d586237fc8b4086ee54a0d0704 (diff)
downloadrockbox-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
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/audio.h47
-rw-r--r--firmware/export/config-e200.h3
-rw-r--r--firmware/export/config-fmrecorder.h7
-rw-r--r--firmware/export/config-h10.h3
-rw-r--r--firmware/export/config-h100.h6
-rw-r--r--firmware/export/config-h10_5gb.h3
-rw-r--r--firmware/export/config-h120.h11
-rw-r--r--firmware/export/config-h300.h4
-rw-r--r--firmware/export/config-iaudiom5.h4
-rw-r--r--firmware/export/config-iaudiox5.h4
-rw-r--r--firmware/export/config-ipod4g.h4
-rw-r--r--firmware/export/config-ipodcolor.h4
-rw-r--r--firmware/export/config-ipodnano.h4
-rw-r--r--firmware/export/config-ipodvideo.h4
-rw-r--r--firmware/export/config-ondiofm.h4
-rw-r--r--firmware/export/config-recorder.h7
-rw-r--r--firmware/export/config-recorderv2.h7
-rw-r--r--firmware/export/config.h3
-rw-r--r--firmware/export/config_caps.h107
-rw-r--r--firmware/export/pcm_record.h2
20 files changed, 199 insertions, 39 deletions
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 */
131enum audio_sources 130enum 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. */
148enum 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