1 #ifndef DIBX000_COMMON_H
2 #define DIBX000_COMMON_H
4 enum dibx000_i2c_interface
{
5 DIBX000_I2C_INTERFACE_TUNER
= 0,
6 DIBX000_I2C_INTERFACE_GPIO_1_2
= 1,
7 DIBX000_I2C_INTERFACE_GPIO_3_4
= 2
10 struct dibx000_i2c_master
{
18 enum dibx000_i2c_interface selected_interface
;
20 // struct i2c_adapter tuner_i2c_adap;
21 struct i2c_adapter gated_tuner_i2c_adap
;
23 struct i2c_adapter
*i2c_adap
;
29 extern int dibx000_init_i2c_master(struct dibx000_i2c_master
*mst
,
30 u16 device_rev
, struct i2c_adapter
*i2c_adap
,
32 extern struct i2c_adapter
*dibx000_get_i2c_adapter(struct dibx000_i2c_master
34 enum dibx000_i2c_interface
36 extern void dibx000_exit_i2c_master(struct dibx000_i2c_master
*mst
);
37 extern void dibx000_reset_i2c_master(struct dibx000_i2c_master
*mst
);
39 extern u32
systime(void);
41 #define BAND_LBAND 0x01
44 #define BAND_SBAND 0x08
46 #define BAND_CBAND 0x20
48 #define BAND_OF_FREQUENCY(freq_kHz) ((freq_kHz) <= 170000 ? BAND_CBAND : \
49 (freq_kHz) <= 115000 ? BAND_FM : \
50 (freq_kHz) <= 250000 ? BAND_VHF : \
51 (freq_kHz) <= 863000 ? BAND_UHF : \
52 (freq_kHz) <= 2000000 ? BAND_LBAND : BAND_SBAND )
54 struct dibx000_agc_config
{
55 /* defines the capabilities of this AGC-setting - using the BAND_-defines */
95 u8 perform_agc_softsplit
;
105 struct dibx000_bandwidth_config
{
129 enum dibx000_adc_states
{
130 DIBX000_SLOW_ADC_ON
= 0,
131 DIBX000_SLOW_ADC_OFF
,
138 #define BANDWIDTH_TO_KHZ(v) ( (v) == BANDWIDTH_8_MHZ ? 8000 : \
139 (v) == BANDWIDTH_7_MHZ ? 7000 : \
140 (v) == BANDWIDTH_6_MHZ ? 6000 : 8000 )
142 #define BANDWIDTH_TO_INDEX(v) ( \
143 (v) == 8000 ? BANDWIDTH_8_MHZ : \
144 (v) == 7000 ? BANDWIDTH_7_MHZ : \
145 (v) == 6000 ? BANDWIDTH_6_MHZ : BANDWIDTH_8_MHZ )
147 /* Chip output mode. */
148 #define OUTMODE_HIGH_Z 0
149 #define OUTMODE_MPEG2_PAR_GATED_CLK 1
150 #define OUTMODE_MPEG2_PAR_CONT_CLK 2
151 #define OUTMODE_MPEG2_SERIAL 7
152 #define OUTMODE_DIVERSITY 4
153 #define OUTMODE_MPEG2_FIFO 5
154 #define OUTMODE_ANALOG_ADC 6
156 enum frontend_tune_state
{
187 CT_DEMOD_SEARCH_NEXT
= 41,
188 CT_DEMOD_STEP_LOCKED
,
196 struct dvb_frontend_parametersContext
{
197 #define CHANNEL_STATUS_PARAMETERS_UNKNOWN 0x01
198 #define CHANNEL_STATUS_PARAMETERS_SET 0x02
200 u32 tune_time_estimation
[2];
205 #define FE_STATUS_TUNE_FAILED 0
206 #define FE_STATUS_TUNE_TIMED_OUT -1
207 #define FE_STATUS_TUNE_TIME_TOO_SHORT -2
208 #define FE_STATUS_TUNE_PENDING -3
209 #define FE_STATUS_STD_SUCCESS -4
210 #define FE_STATUS_FFT_SUCCESS -5
211 #define FE_STATUS_DEMOD_SUCCESS -6
212 #define FE_STATUS_LOCKED -7
213 #define FE_STATUS_DATA_LOCKED -8
215 #define FE_CALLBACK_TIME_NEVER 0xffffffff
217 #define ABS(x) ((x < 0) ? (-x) : (x))