summaryrefslogtreecommitdiffstats
path: root/firmware/export/config_caps.h
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/config_caps.h
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/config_caps.h')
-rw-r--r--firmware/export/config_caps.h107
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 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Michael Sevakis
+ *
+ * Convert caps masks into HAVE_* defines
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/** INPUTS **/
+
+/* NOTE: Playback is implied in all this. Make sense? :) */
+#define SRC_MIC 0
+#define SRC_LINEIN 1
+#define SRC_SPDIF 2
+#define SRC_FMRADIO 3
+
+#define SRC_CAP_MIC (1 << SRC_MIC)
+#define SRC_CAP_LINEIN (1 << SRC_LINEIN)
+#define SRC_CAP_SPDIF (1 << SRC_SPDIF)
+#define SRC_CAP_FMRADIO (1 << SRC_FMRADIO)
+
+/* audio monitor mux sources */
+#ifndef INPUT_SRC_CAPS
+#define INPUT_SRC_CAPS 0 /* Nothing but playback */
+#endif
+
+/* Microphone */
+#if (INPUT_SRC_CAPS & SRC_CAP_MIC)
+ #define HAVE_MIC_IN
+ #define HAVE_MIC_IN_(...) __VA_ARGS__
+#else
+ #define HAVE_MIC_IN_(...)
+#endif
+/* Line In */
+#if (INPUT_SRC_CAPS & SRC_CAP_LINEIN)
+ #define HAVE_LINE_IN
+ #define HAVE_LINE_IN_(...) __VA_ARGS__
+#else
+ #define HAVE_LINE_IN_(...)
+#endif
+/* S/PDIF */
+#if (INPUT_SRC_CAPS & SRC_CAP_SPDIF)
+ #define HAVE_SPDIF_IN
+ #define HAVE_SPDIF_IN_(...) __VA_ARGS__
+#else
+ #define HAVE_SPDIF_IN_(...)
+#endif
+/* FM Radio */
+#if (INPUT_SRC_CAPS & SRC_CAP_FMRADIO)
+ #define HAVE_FMRADIO_IN
+ #define HAVE_FMRADIO_IN_(...) __VA_ARGS__
+#else
+ #define HAVE_FMRADIO_IN_(...)
+#endif
+
+#ifdef HAVE_RECORDING
+/* Recordable source implies it has the input as well */
+
+/* For now there's no restrictions on any targets with which inputs
+ are recordable so define them as equivalent - if they do differ,
+ special handling is needed right now. */
+#ifndef REC_SRC_CAPS
+#define REC_SRC_CAPS INPUT_SRC_CAPS
+#endif
+
+/* Microphone */
+#if (REC_SRC_CAPS & SRC_CAP_MIC)
+ #define HAVE_MIC_REC
+ #define HAVE_MIC_REC_(...) __VA_ARGS__
+#else
+ #define HAVE_MIC_REC_(...)
+#endif
+/* Line In */
+#if (REC_SRC_CAPS & SRC_CAP_LINEIN)
+ #define HAVE_LINE_REC
+ #define HAVE_LINE_REC_(...) __VA_ARGS__
+#else
+ #define HAVE_LINE_REC_(...)
+#endif
+/* S/PDIF */
+#if (REC_SRC_CAPS & SRC_CAP_SPDIF)
+ #define HAVE_SPDIF_REC
+ #define HAVE_SPDIF_REC_(...) __VA_ARGS__
+#else
+ #define HAVE_SPDIF_REC_(...)
+#endif
+/* FM Radio */
+#if (REC_SRC_CAPS & SRC_CAP_FMRADIO)
+ #define HAVE_FMRADIO_REC
+ #define HAVE_FMRADIO_REC_(...) __VA_ARGS__
+#else
+ #define HAVE_FMRADIO_REC_(...)
+#endif
+#endif /* HAVE_RECORDING */