summaryrefslogtreecommitdiffstats
path: root/firmware/tuner.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-07-14 11:25:02 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-07-14 11:25:02 +0000
commit338aa0b2f6c5ec11fd9652607ba676facf9ddfb4 (patch)
tree5005388926167a119173733e53838e6c8362a2b9 /firmware/tuner.c
parent7d759f6b9ca96a4a64c71ac301eb59cb9702e74c (diff)
downloadrockbox-338aa0b2f6c5ec11fd9652607ba676facf9ddfb4.tar.gz
rockbox-338aa0b2f6c5ec11fd9652607ba676facf9ddfb4.tar.bz2
rockbox-338aa0b2f6c5ec11fd9652607ba676facf9ddfb4.zip
Oops. Forgot to add a file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13881 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/tuner.c')
-rw-r--r--firmware/tuner.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/firmware/tuner.c b/firmware/tuner.c
new file mode 100644
index 0000000000..85f56b8976
--- /dev/null
+++ b/firmware/tuner.c
@@ -0,0 +1,99 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ * General tuner functions
+ *
+ * Copyright (C) 2007 by Michael Sevakis
+ *
+ * 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.
+ *
+ ****************************************************************************/
+#include <stdlib.h>
+#include "config.h"
+#include "kernel.h"
+#include "tuner.h"
+#include "fmradio.h"
+
+#ifdef CONFIG_TUNER_MULTI
+int (*tuner_set)(int setting, int value);
+int (*tuner_get)(int setting);
+
+#define TUNER_TYPE_CASE(type, set, get, region_data) \
+ case type: \
+ tuner_set = set; \
+ tuner_get = get; \
+ break;
+
+#else
+
+#define TUNER_TYPE_CASE(type, set, get, region_data)
+
+#endif /* CONFIG_TUNER_MULTI */
+
+/* General region information */
+const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS] =
+{
+ [REGION_EUROPE] = { 87500000, 108000000, 50000 },
+ [REGION_US_CANADA] = { 87900000, 107900000, 200000 },
+ [REGION_JAPAN] = { 76000000, 90000000, 100000 },
+ [REGION_KOREA] = { 87500000, 108000000, 100000 }
+};
+
+/* Tuner-specific region information */
+
+#if (CONFIG_TUNER & LV24020LP)
+/* deemphasis setting for region */
+const unsigned char lv24020lp_region_data[TUNER_NUM_REGIONS] =
+{
+ [REGION_EUROPE] = 0, /* 50uS */
+ [REGION_US_CANADA] = 1, /* 75uS */
+ [REGION_JAPAN] = 0, /* 50uS */
+ [REGION_KOREA] = 0, /* 50uS */
+};
+#endif /* (CONFIG_TUNER & LV24020LP) */
+
+#if (CONFIG_TUNER & TEA5767)
+const struct tea5767_region_data tea5767_region_data[TUNER_NUM_REGIONS] =
+{
+ [REGION_EUROPE] = { 0, 0 }, /* 50uS, US/Europe band */
+ [REGION_US_CANADA] = { 1, 0 }, /* 75uS, US/Europe band */
+ [REGION_JAPAN] = { 0, 1 }, /* 50uS, Japanese band */
+ [REGION_KOREA] = { 0, 0 }, /* 50uS, US/Europe band */
+};
+#endif /* (CONFIG_TUNER & TEA5767) */
+
+void tuner_init(void)
+{
+#ifdef CONFIG_TUNER_MULTI
+ switch (tuner_detect_type())
+#endif
+ {
+ #if (CONFIG_TUNER & LV24020LP)
+ TUNER_TYPE_CASE(LV24020LP,
+ lv24020lp_set,
+ lv24020lp_get,
+ lv24020lp_region_data)
+ #endif
+ #if (CONFIG_TUNER & TEA5767)
+ TUNER_TYPE_CASE(TEA5767,
+ tea5767_set,
+ tea5767_get,
+ tea5767_region_data)
+ #endif
+ #if (CONFIG_TUNER & S1A0903X01)
+ TUNER_TYPE_CASE(S1A0903X01,
+ s1a0903x01_set,
+ s1a0903x01_get,
+ NULL)
+ #endif
+ }
+}