-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtuner_r820t.h
196 lines (166 loc) · 3.85 KB
/
tuner_r820t.h
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#ifndef _R820T_TUNER_H
#define _R820T_TUNER_H
#define R820T_I2C_ADDR 0x34
#define R820T_CHECK_ADDR 0x00
#define R820T_CHECK_VAL 0x69
#define R820T_IF_FREQ 3570000//4570000//
//***************************************************************
//* INCLUDES.H
//***************************************************************
#define VERSION "R820T_v1.49_ASTRO"
#define VER_NUM 49
#define USE_16M_XTAL FALSE
#define R828_Xtal 28800
#define USE_DIPLEXER FALSE
#define TUNER_CLK_OUT TRUE
#ifndef _UINT_X_
#define _UINT_X_ 1
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
#endif
#define TRUE 1
#define FALSE 0
#define FUNCTION_SUCCESS 0
#define FUNCTION_ERROR -1
typedef enum _R828_ErrCode
{
RT_Success,
RT_Fail
}R828_ErrCode;
typedef enum _Rafael_Chip_Type //Don't modify chip list
{
R828 = 0,
R828D,
R828S,
R820T,
R820C,
R620D,
R620S
}Rafael_Chip_Type;
//----------------------------------------------------------//
// R828 Parameter //
//----------------------------------------------------------//
extern UINT8 R828_ADDRESS;
#define DIP_FREQ 320000
#define IMR_TRIAL 9
#define VCO_pwr_ref 0x02
extern UINT32 R828_IF_khz;
extern UINT32 R828_CAL_LO_khz;
extern UINT8 R828_IMR_point_num;
extern UINT8 R828_IMR_done_flag;
extern UINT8 Rafael_Chip;
typedef enum _R828_Standard_Type //Don't remove standand list!!
{
NTSC_MN = 0,
PAL_I,
PAL_DK,
PAL_B_7M, //no use
PAL_BGH_8M, //for PAL B/G, PAL G/H
SECAM_L,
SECAM_L1_INV, //for SECAM L'
SECAM_L1, //no use
ATV_SIZE,
DVB_T_6M = ATV_SIZE,
DVB_T_7M,
DVB_T_7M_2,
DVB_T_8M,
DVB_T2_6M,
DVB_T2_7M,
DVB_T2_7M_2,
DVB_T2_8M,
DVB_T2_1_7M,
DVB_T2_10M,
DVB_C_8M,
DVB_C_6M,
ISDB_T,
DTMB,
R828_ATSC,
FM,
STD_SIZE
}R828_Standard_Type;
extern UINT8 R828_Fil_Cal_flag[STD_SIZE];
typedef enum _R828_SetFreq_Type
{
FAST_MODE = TRUE,
NORMAL_MODE = FALSE
}R828_SetFreq_Type;
typedef enum _R828_LoopThrough_Type
{
LOOP_THROUGH = TRUE,
SIGLE_IN = FALSE
}R828_LoopThrough_Type;
typedef enum _R828_InputMode_Type
{
AIR_IN = 0,
CABLE_IN_1,
CABLE_IN_2
}R828_InputMode_Type;
typedef enum _R828_IfAgc_Type
{
IF_AGC1 = 0,
IF_AGC2
}R828_IfAgc_Type;
typedef enum _R828_GPIO_Type
{
HI_SIG = TRUE,
LO_SIG = FALSE
}R828_GPIO_Type;
typedef struct _R828_Set_Info
{
UINT32 RF_Hz;
UINT32 RF_KHz;
R828_Standard_Type R828_Standard;
R828_LoopThrough_Type RT_Input;
R828_InputMode_Type RT_InputMode;
R828_IfAgc_Type R828_IfAgc_Select;
}R828_Set_Info;
typedef struct _R828_RF_Gain_Info
{
UINT8 RF_gain1;
UINT8 RF_gain2;
UINT8 RF_gain_comb;
}R828_RF_Gain_Info;
typedef enum _R828_RF_Gain_TYPE
{
RF_AUTO = 0,
RF_MANUAL
}R828_RF_Gain_TYPE;
typedef struct _R828_I2C_LEN_TYPE
{
UINT8 RegAddr;
UINT8 Data[50];
UINT8 Len;
}R828_I2C_LEN_TYPE;
typedef struct _R828_I2C_TYPE
{
UINT8 RegAddr;
UINT8 Data;
}R828_I2C_TYPE;
//----------------------------------------------------------//
// R828 Function //
//----------------------------------------------------------//
R828_ErrCode R828_Init(void *pTuner);
R828_ErrCode R828_Standby(void *pTuner, R828_LoopThrough_Type R828_LoopSwitch);
R828_ErrCode R828_GPIO(void *pTuner, R828_GPIO_Type R828_GPIO_Conrl);
R828_ErrCode R828_SetStandard(void *pTuner, R828_Standard_Type RT_Standard);
R828_ErrCode R828_SetFrequency(void *pTuner, R828_Set_Info R828_INFO, R828_SetFreq_Type R828_SetFreqMode);
R828_ErrCode R828_GetRfGain(void *pTuner, R828_RF_Gain_Info *pR828_rf_gain);
R828_ErrCode R828_SetRfGain(void *pTuner, int gain);
R828_ErrCode R828_RfGainMode(void *pTuner, int manual);
int
r820t_SetRfFreqHz(
void *pTuner,
unsigned long RfFreqHz
);
int
r820t_SetStandardMode(
void *pTuner,
int StandardMode
);
int
r820t_SetStandby(
void *pTuner,
int LoopThroughType
);
#endif /* _R820T_TUNER_H */