ignore comments containing iTunes 7 gapless data; should solve issues reported in...
[Rockbox.git] / firmware / tuner.c
blob4f3ddc0c73ee820918bef3289b2139917ffbb0a3
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 * General tuner functions
11 * Copyright (C) 2007 by Michael Sevakis
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
19 ****************************************************************************/
20 #include <stdlib.h>
21 #include "config.h"
22 #include "kernel.h"
23 #include "tuner.h"
24 #include "fmradio.h"
26 /* General region information */
27 const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS] =
29 [REGION_EUROPE] = { 87500000, 108000000, 50000 },
30 [REGION_US_CANADA] = { 87900000, 107900000, 200000 },
31 [REGION_JAPAN] = { 76000000, 90000000, 100000 },
32 [REGION_KOREA] = { 87500000, 108000000, 100000 }
35 #ifndef SIMULATOR
37 /* Tuner-specific region information */
39 #if (CONFIG_TUNER & LV24020LP)
40 /* deemphasis setting for region */
41 const unsigned char lv24020lp_region_data[TUNER_NUM_REGIONS] =
43 [REGION_EUROPE] = 0, /* 50uS */
44 [REGION_US_CANADA] = 1, /* 75uS */
45 [REGION_JAPAN] = 0, /* 50uS */
46 [REGION_KOREA] = 0, /* 50uS */
48 #endif /* (CONFIG_TUNER & LV24020LP) */
50 #if (CONFIG_TUNER & TEA5767)
51 const struct tea5767_region_data tea5767_region_data[TUNER_NUM_REGIONS] =
53 [REGION_EUROPE] = { 0, 0 }, /* 50uS, US/Europe band */
54 [REGION_US_CANADA] = { 1, 0 }, /* 75uS, US/Europe band */
55 [REGION_JAPAN] = { 0, 1 }, /* 50uS, Japanese band */
56 [REGION_KOREA] = { 0, 0 }, /* 50uS, US/Europe band */
58 #endif /* (CONFIG_TUNER & TEA5767) */
60 #ifdef CONFIG_TUNER_MULTI
61 int (*tuner_set)(int setting, int value);
62 int (*tuner_get)(int setting);
63 #define TUNER_TYPE_CASE(type, set, get, ...) \
64 case type: \
65 tuner_set = set; \
66 tuner_get = get; \
67 __VA_ARGS__; \
68 break;
69 #else
70 #define TUNER_TYPE_CASE(type, set, get, ...) \
71 __VA_ARGS__;
72 #endif /* CONFIG_TUNER_MULTI */
74 void tuner_init(void)
76 #ifdef CONFIG_TUNER_MULTI
77 switch (tuner_detect_type())
78 #endif
80 #if (CONFIG_TUNER & LV24020LP)
81 TUNER_TYPE_CASE(LV24020LP,
82 lv24020lp_set,
83 lv24020lp_get,
84 lv24020lp_init())
85 #endif
86 #if (CONFIG_TUNER & TEA5767)
87 TUNER_TYPE_CASE(TEA5767,
88 tea5767_set,
89 tea5767_get)
90 #endif
91 #if (CONFIG_TUNER & S1A0903X01)
92 TUNER_TYPE_CASE(S1A0903X01,
93 s1a0903x01_set,
94 s1a0903x01_get)
95 #endif
99 #endif /* SIMULATOR */