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 {
17 enum dibx000_i2c_interface selected_interface;
19 // struct i2c_adapter tuner_i2c_adap;
20 struct i2c_adapter gated_tuner_i2c_adap;
22 struct i2c_adapter *i2c_adap;
28 extern int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, struct i2c_adapter *i2c_adap, u8 i2c_addr);
29 extern struct i2c_adapter * dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst, enum dibx000_i2c_interface intf, int gating);
30 extern void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst);
32 #define BAND_LBAND 0x01
35 #define BAND_SBAND 0x08
38 #define BAND_OF_FREQUENCY(freq_kHz) ( (freq_kHz) <= 115000 ? BAND_FM : \
39 (freq_kHz) <= 250000 ? BAND_VHF : \
40 (freq_kHz) <= 863000 ? BAND_UHF : \
41 (freq_kHz) <= 2000000 ? BAND_LBAND : BAND_SBAND )
43 struct dibx000_agc_config {
44 /* defines the capabilities of this AGC-setting - using the BAND_-defines*/
84 u8 perform_agc_softsplit;
94 struct dibx000_bandwidth_config {
116 enum dibx000_adc_states {
117 DIBX000_SLOW_ADC_ON = 0,
118 DIBX000_SLOW_ADC_OFF,
125 #define BW_INDEX_TO_KHZ(v) ( (v) == BANDWIDTH_8_MHZ ? 8000 : \
126 (v) == BANDWIDTH_7_MHZ ? 7000 : \
127 (v) == BANDWIDTH_6_MHZ ? 6000 : 8000 )
129 /* Chip output mode. */
130 #define OUTMODE_HIGH_Z 0
131 #define OUTMODE_MPEG2_PAR_GATED_CLK 1
132 #define OUTMODE_MPEG2_PAR_CONT_CLK 2
133 #define OUTMODE_MPEG2_SERIAL 7
134 #define OUTMODE_DIVERSITY 4
135 #define OUTMODE_MPEG2_FIFO 5
137 /* I hope I can get rid of the following kludge in the near future */
138 struct dibx000_ofdm_channel {
147 s16 vit_code_rate_hp;
148 s16 vit_code_rate_lp;
152 #define FEP2DIB(fep,ch) \
153 (ch)->RF_kHz = (fep)->frequency / 1000; \
154 (ch)->Bw = (fep)->u.ofdm.bandwidth; \
155 (ch)->nfft = (fep)->u.ofdm.transmission_mode == TRANSMISSION_MODE_AUTO ? -1 : (fep)->u.ofdm.transmission_mode; \
156 (ch)->guard = (fep)->u.ofdm.guard_interval == GUARD_INTERVAL_AUTO ? -1 : (fep)->u.ofdm.guard_interval; \
157 (ch)->nqam = (fep)->u.ofdm.constellation == QAM_AUTO ? -1 : (fep)->u.ofdm.constellation == QAM_64 ? 2 : (fep)->u.ofdm.constellation; \
158 (ch)->vit_hrch = 0; /* linux-dvb is not prepared for HIERARCHICAL TRANSMISSION */ \
159 (ch)->vit_select_hp = 1; \
160 (ch)->vit_alpha = 1; \
161 (ch)->vit_code_rate_hp = (fep)->u.ofdm.code_rate_HP == FEC_AUTO ? -1 : (fep)->u.ofdm.code_rate_HP; \
162 (ch)->vit_code_rate_lp = (fep)->u.ofdm.code_rate_LP == FEC_AUTO ? -1 : (fep)->u.ofdm.code_rate_LP; \
163 (ch)->intlv_native = 1;
165 #define INIT_OFDM_CHANNEL(ch) do {\
170 (ch)->vit_hrch = -1; \
171 (ch)->vit_select_hp = -1; \
172 (ch)->vit_alpha = -1; \
173 (ch)->vit_code_rate_hp = -1; \
174 (ch)->vit_code_rate_lp = -1; \