summaryrefslogtreecommitdiffstats
path: root/firmware/export/tuner.h
blob: b27e660667f86328bec38768f10e47c7952861d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 * Tuner abstraction layer
 *
 * Copyright (C) 2004 Jörg Hohensohn
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/
#ifndef __TUNER_H__
#define __TUNER_H__

#include "hwcompat.h"

/** Settings to the tuner layer **/
enum
{
    RADIO_ALL = -1, /* debug */
    RADIO_SLEEP,
    RADIO_FREQUENCY,
    RADIO_MUTE,
    RADIO_FORCE_MONO,
    RADIO_SCAN_FREQUENCY,

    /* Put new general-purpose settings above this line */
    __RADIO_SET_STANDARD_LAST
};

/** Readback from the tuner layer **/
enum
{
    RADIO_PRESENT = 0,
    RADIO_TUNED,
    RADIO_STEREO,

    /* Put new general-purpose readback values above this line */
    __RADIO_GET_STANDARD_LAST
};

/** Tuner regions **/

/* Basic region information */
enum
{
    REGION_EUROPE = 0,
    REGION_US_CANADA,
    REGION_JAPAN,
    REGION_KOREA,
    REGION_ITALY,
    REGION_OTHER,

    /* Add new regions above this line */
    TUNER_NUM_REGIONS
};

struct fm_region_data
{
    int freq_min;
    int freq_max;
    int freq_step;
};

extern const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS];

#if CONFIG_TUNER

#ifdef SIMULATOR
int tuner_set(int setting, int value);
int tuner_get(int setting);
#else

#ifdef CONFIG_TUNER_MULTI
extern int (*tuner_set)(int setting, int value);
extern int (*tuner_get)(int setting);
#endif /* CONFIG_TUNER_MULTI */

/** Sanyo LV24020LP **/
#if (CONFIG_TUNER & LV24020LP)
/* Sansa c200, e200 */
#include "lv24020lp.h"
#endif

/** Samsung S1A0903X01 **/
#if (CONFIG_TUNER & S1A0903X01)
/* Ondio FM, FM Recorder */
#include "s1a0903x01.h"
#endif

/** Philips TEA5760 **/
#if (CONFIG_TUNER & TEA5760)
#include "tea5760.h"
#endif

/** Philips TEA5767 **/
#if (CONFIG_TUNER & TEA5767)
/* Ondio FM, FM Recorder, Recorder V2, iRiver h100/h300, iAudio x5 */
#include "tea5767.h"
#endif

/* Silicon Labs 4700 */
#if (CONFIG_TUNER & SI4700)
#include "si4700.h"
#endif

#endif /* SIMULATOR */

/* Additional messages that get enumerated after tuner driver headers */

/* for tuner_set */
enum
{
    __RADIO_SET_ADDITIONAL_START = __RADIO_SET_STANDARD_LAST-1,
#ifdef HAVE_RADIO_REGION
    RADIO_REGION,
#endif

    RADIO_SET_CHIP_FIRST
};

/* for tuner_get */
enum
{
    __RADIO_GET_ADDITIONAL_START = __RADIO_GET_STANDARD_LAST-1,

    RADIO_GET_CHIP_FIRST
};

/** **/

void tuner_init(void);

#endif /* #if CONFIG_TUNER */

#endif /* __TUNER_H__ */