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 /firmware/export/config_caps.h | |
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
Diffstat (limited to 'firmware/export/config_caps.h')
-rw-r--r-- | firmware/export/config_caps.h | 107 |
1 files changed, 107 insertions, 0 deletions
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 */ | ||