summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/config.h5
-rw-r--r--firmware/export/hwcompat.h7
-rw-r--r--firmware/export/lv24020lp.h51
-rw-r--r--firmware/export/power.h4
-rw-r--r--firmware/export/s1a0903x01.h40
-rw-r--r--firmware/export/tea5767.h50
-rw-r--r--firmware/export/tuner.h173
7 files changed, 247 insertions, 83 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 86e27d0031..056b9857bc 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -245,6 +245,11 @@
245#define CONFIG_REMOTE_DEFAULT_ICON_WIDTH 6 245#define CONFIG_REMOTE_DEFAULT_ICON_WIDTH 6
246#endif 246#endif
247 247
248#if (CONFIG_TUNER & (CONFIG_TUNER - 1)) != 0
249/* Multiple possible tuners */
250#define CONFIG_TUNER_MULTI
251#endif
252
248/* Enable the directory cache and tagcache in RAM if we have 253/* Enable the directory cache and tagcache in RAM if we have
249 * plenty of RAM. Both features can be enabled independently. */ 254 * plenty of RAM. Both features can be enabled independently. */
250#if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \ 255#if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \
diff --git a/firmware/export/hwcompat.h b/firmware/export/hwcompat.h
index bffb76e3ef..bebca68a6c 100644
--- a/firmware/export/hwcompat.h
+++ b/firmware/export/hwcompat.h
@@ -46,4 +46,11 @@
46bool is_new_player(void); 46bool is_new_player(void);
47#endif 47#endif
48 48
49#ifdef CONFIG_TUNER_MULTI
50static inline int tuner_detect_type(void)
51{
52 return (HW_MASK & TUNER_MODEL) ? TEA5767 : S1A0903X01;
53}
54#endif
55
49#endif /* HWCOMPAT_H */ 56#endif /* HWCOMPAT_H */
diff --git a/firmware/export/lv24020lp.h b/firmware/export/lv24020lp.h
new file mode 100644
index 0000000000..0fc39b18df
--- /dev/null
+++ b/firmware/export/lv24020lp.h
@@ -0,0 +1,51 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 * Tuner header for the Sanyo LV24020LP
10 *
11 * Copyright (C) 2007 Michael Sevakis
12 *
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.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#ifndef _LV24020LP_H_
22#define _LV24020LP_H_
23
24/* Define additional tuner messages here */
25#define HAVE_RADIO_REGION
26
27#define LV24020LP_CTRL_STAT (RADIO_GET_CHIP_FIRST+0)
28#define LV24020LP_REG_STAT (RADIO_GET_CHIP_FIRST+1)
29#define LV24020LP_MSS_FM (RADIO_GET_CHIP_FIRST+2)
30#define LV24020LP_MSS_IF (RADIO_GET_CHIP_FIRST+3)
31#define LV24020LP_MSS_SD (RADIO_GET_CHIP_FIRST+4)
32#define LV24020LP_IF_SET (RADIO_GET_CHIP_FIRST+5)
33#define LV24020LP_SD_SET (RADIO_GET_CHIP_FIRST+6)
34
35struct lv24020lp_region_data
36{
37 unsigned char deemphasis;
38} __attribute__((packed));
39
40const unsigned char lv24020lp_region_data[TUNER_NUM_REGIONS];
41
42int lv24020lp_set(int setting, int value);
43int lv24020lp_get(int setting);
44void lv24020lp_power(bool status);
45
46#ifndef CONFIG_TUNER_MULTI
47#define tuner_set lv24020lp_set
48#define tuner_get lv24020lp_get
49#endif
50
51#endif /* _LV24020LP_H_ */
diff --git a/firmware/export/power.h b/firmware/export/power.h
index cafd6f87c8..8ecff6c51e 100644
--- a/firmware/export/power.h
+++ b/firmware/export/power.h
@@ -48,8 +48,8 @@ bool spdif_powered(void);
48#endif 48#endif
49 49
50#if CONFIG_TUNER 50#if CONFIG_TUNER
51extern bool radio_power(bool status); 51extern bool tuner_power(bool status);
52extern bool radio_powered(void); 52extern bool tuner_powered(void);
53#endif 53#endif
54 54
55#endif 55#endif
diff --git a/firmware/export/s1a0903x01.h b/firmware/export/s1a0903x01.h
new file mode 100644
index 0000000000..bf497628b7
--- /dev/null
+++ b/firmware/export/s1a0903x01.h
@@ -0,0 +1,40 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 * Tuner header for the Samsung S1A0903X01
10 *
11 * Copyright (C) 2007 Michael Sevakis
12 *
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.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#ifndef _S1A0903X01_H_
22#define _S1A0903X01_H_
23
24/* Define additional tuner messages here */
25#define HAVE_RADIO_MUTE_TIMEOUT
26
27#if 0
28#define S1A0903X01_IF_MEASUREMENT (RADIO_SET_CHIP_FIRST+0)
29#define S1A0903X01_SENSITIVITY (RADIO_SET_CHIP_FIRST+1)
30#endif
31
32int s1a0903x01_set(int setting, int value);
33int s1a0903x01_get(int setting);
34
35#ifndef CONFIG_TUNER_MULTI
36#define tuner_set s1a0903x01_get
37#define tuner_get s1a0903x01_set
38#endif
39
40#endif /* _S1A0903X01_H_ */
diff --git a/firmware/export/tea5767.h b/firmware/export/tea5767.h
new file mode 100644
index 0000000000..dfa6149f20
--- /dev/null
+++ b/firmware/export/tea5767.h
@@ -0,0 +1,50 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 * Tuner header for the Philips TEA5767
10 *
11 * Copyright (C) 2007 Michael Sevakis
12 *
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.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#ifndef _TEA5767_H_
22#define _TEA5767_H_
23
24#define HAVE_RADIO_REGION
25#define HAVE_RADIO_MUTE_TIMEOUT
26
27struct tea5767_region_data
28{
29 unsigned char deemphasis; /* 0: 50us, 1: 75us */
30 unsigned char band; /* 0: europe, 1: japan (BL in TEA spec)*/
31} __attribute__((packed));
32
33const struct tea5767_region_data tea5767_region_data[TUNER_NUM_REGIONS];
34
35struct tea5767_dbg_info
36{
37 unsigned char read_regs[5];
38 unsigned char write_regs[5];
39};
40
41int tea5767_set(int setting, int value);
42int tea5767_get(int setting);
43void tea5767_dbg_info(struct tea5767_dbg_info *info);
44
45#ifndef CONFIG_TUNER_MULTI
46#define tuner_set tea5767_set
47#define tuner_get tea5767_get
48#endif
49
50#endif /* _TEA5767_H_ */
diff --git a/firmware/export/tuner.h b/firmware/export/tuner.h
index 9f6d29f697..cf18102744 100644
--- a/firmware/export/tuner.h
+++ b/firmware/export/tuner.h
@@ -22,101 +22,112 @@
22 22
23#include "hwcompat.h" 23#include "hwcompat.h"
24 24
25/* settings to the tuner layer */ 25/** Settings to the tuner layer **/
26#define RADIO_ALL -1 /* debug */ 26enum
27#define RADIO_SLEEP 0 27{
28#define RADIO_FREQUENCY 1 28 RADIO_ALL = -1, /* debug */
29#define RADIO_MUTE 2 29 RADIO_SLEEP,
30#define RADIO_IF_MEASUREMENT 3 30 RADIO_FREQUENCY,
31#define RADIO_SENSITIVITY 4 31 RADIO_MUTE,
32#define RADIO_FORCE_MONO 5 32 RADIO_FORCE_MONO,
33#define RADIO_SCAN_FREQUENCY 6 33 RADIO_SCAN_FREQUENCY,
34#if (CONFIG_TUNER & TEA5767) 34
35#define RADIO_SET_DEEMPHASIS 7 35 /* Put new general-purpose settings above this line */
36#define RADIO_SET_BAND 8 36 __RADIO_SET_STANDARD_LAST
37#endif 37};
38#if (CONFIG_TUNER & LV24020LP) 38
39#define RADIO_REGION 9 /* to be used for all tuners */ 39/** Readback from the tuner layer **/
40#define RADIO_REG_STAT 100 40enum
41#define RADIO_MSS_FM 101 41{
42#define RADIO_MSS_IF 102 42 RADIO_PRESENT = 0,
43#define RADIO_MSS_SD 103 43 RADIO_TUNED,
44#define RADIO_IF_SET 104 44 RADIO_STEREO,
45#define RADIO_SD_SET 105 45
46#endif 46 /* Put new general-purpose readback values above this line */
47/* readback from the tuner layer */ 47 __RADIO_GET_STANDARD_LAST
48#define RADIO_PRESENT 0 48};
49#define RADIO_TUNED 1 49
50#define RADIO_STEREO 2 50/** Tuner regions **/
51
52/* Basic region information */
53enum
54{
55 REGION_EUROPE = 0,
56 REGION_US_CANADA,
57 REGION_JAPAN,
58 REGION_KOREA,
59
60 /* Add new regions above this line */
61 TUNER_NUM_REGIONS
62};
51 63
52#define REGION_EUROPE 0 64struct fm_region_data
53#define REGION_US_CANADA 1 65{
54#define REGION_JAPAN 2 66 int freq_min;
55#define REGION_KOREA 3 67 int freq_max;
68 int freq_step;
69};
70
71extern const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS];
56 72
57#if CONFIG_TUNER 73#if CONFIG_TUNER
58 74
59#ifdef SIMULATOR 75#ifdef SIMULATOR
60int radio_set(int setting, int value); 76int tuner_set(int setting, int value);
61int radio_get(int setting); 77int tuner_get(int setting);
62#else 78#else
63#if CONFIG_TUNER == S1A0903X01 /* FM recorder */
64#define radio_set samsung_set
65#define radio_get samsung_get
66#elif CONFIG_TUNER == LV24020LP /* Sansa */
67#define radio_set sanyo_set
68#define radio_get sanyo_get
69#elif CONFIG_TUNER == TEA5767 /* iRiver, iAudio */
70#define radio_set philips_set
71#define radio_get philips_get
72#elif CONFIG_TUNER == (S1A0903X01 | TEA5767) /* OndioFM */
73#define radio_set _radio_set
74#define radio_get _radio_get
75int (*_radio_set)(int setting, int value);
76int (*_radio_get)(int setting);
77#endif /* CONFIG_TUNER == */
78#endif /* SIMULATOR */
79 79
80#if (CONFIG_TUNER & S1A0903X01) 80#ifdef CONFIG_TUNER_MULTI
81int samsung_set(int setting, int value); 81extern int (*tuner_set)(int setting, int value);
82int samsung_get(int setting); 82extern int (*tuner_get)(int setting);
83#endif /* CONFIG_TUNER & S1A0903X01 */ 83#endif /* CONFIG_TUNER_MULTI */
84 84
85/** Sanyo LV24020LP **/
85#if (CONFIG_TUNER & LV24020LP) 86#if (CONFIG_TUNER & LV24020LP)
86int sanyo_set(int setting, int value); 87/* Sansa e200 Series */
87int sanyo_get(int setting); 88#include "lv24020lp.h"
88#endif /* CONFIG_TUNER & LV24020LP */ 89#endif
90
91/** Samsung S1A0903X01 **/
92#if (CONFIG_TUNER & S1A0903X01)
93/* Ondio FM, FM Recorder */
94#include "s1a0903x01.h"
95#endif
89 96
97/** Philips TEA5767 **/
90#if (CONFIG_TUNER & TEA5767) 98#if (CONFIG_TUNER & TEA5767)
91struct philips_dbg_info 99/* Ondio FM, FM Recorder, Recorder V2, iRiver h100/h300, iAudio x5 */
100#include "tea5767.h"
101#endif
102
103#endif /* SIMULATOR */
104
105/* Additional messages that get enumerated after tuner driver headers */
106
107/* for tuner_set */
108enum
92{ 109{
93 unsigned char read_regs[5]; 110 __RADIO_SET_ADDITIONAL_START = __RADIO_SET_STANDARD_LAST-1,
94 unsigned char write_regs[5]; 111#ifdef HAVE_RADIO_REGION
112 RADIO_REGION,
113#endif
114
115 RADIO_SET_CHIP_FIRST
95}; 116};
96int philips_set(int setting, int value); 117
97int philips_get(int setting); 118/* for tuner_get */
98void philips_dbg_info(struct philips_dbg_info *info); 119enum
99#endif /* CONFIG_TUNER & TEA5767 */
100
101/* Just inline here since only radio screen needs this atm and
102 there's no tuner.c. */
103static inline void tuner_init(void)
104{ 120{
105#ifndef SIMULATOR 121 __RADIO_GET_ADDITIONAL_START = __RADIO_SET_STANDARD_LAST-1,
106#if CONFIG_TUNER == (S1A0903X01 | TEA5767) 122
107 if (HW_MASK & TUNER_MODEL) 123 RADIO_GET_CHIP_FIRST
108 { 124};
109 _radio_set = philips_set; 125
110 _radio_get = philips_get; 126/** **/
111 } 127
112 else 128void tuner_init(void);
113 { 129bool tuner_power(bool power);
114 _radio_set = samsung_set; 130bool tuner_powered(void);
115 _radio_get = samsung_get;
116 }
117#endif
118#endif
119}
120 131
121#endif /* #if CONFIG_TUNER */ 132#endif /* #if CONFIG_TUNER */
122 133