This source file includes following definitions.
- dvb_dummy_fe_read_status
- dvb_dummy_fe_read_ber
- dvb_dummy_fe_read_signal_strength
- dvb_dummy_fe_read_snr
- dvb_dummy_fe_read_ucblocks
- dvb_dummy_fe_get_frontend
- dvb_dummy_fe_set_frontend
- dvb_dummy_fe_sleep
- dvb_dummy_fe_init
- dvb_dummy_fe_set_tone
- dvb_dummy_fe_set_voltage
- dvb_dummy_fe_release
- dvb_dummy_fe_ofdm_attach
- dvb_dummy_fe_qpsk_attach
- dvb_dummy_fe_qam_attach
1
2
3
4
5
6
7
8 #include <linux/module.h>
9 #include <linux/init.h>
10 #include <linux/string.h>
11 #include <linux/slab.h>
12
13 #include <media/dvb_frontend.h>
14 #include "dvb_dummy_fe.h"
15
16
17 struct dvb_dummy_fe_state {
18 struct dvb_frontend frontend;
19 };
20
21
22 static int dvb_dummy_fe_read_status(struct dvb_frontend *fe,
23 enum fe_status *status)
24 {
25 *status = FE_HAS_SIGNAL
26 | FE_HAS_CARRIER
27 | FE_HAS_VITERBI
28 | FE_HAS_SYNC
29 | FE_HAS_LOCK;
30
31 return 0;
32 }
33
34 static int dvb_dummy_fe_read_ber(struct dvb_frontend* fe, u32* ber)
35 {
36 *ber = 0;
37 return 0;
38 }
39
40 static int dvb_dummy_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength)
41 {
42 *strength = 0;
43 return 0;
44 }
45
46 static int dvb_dummy_fe_read_snr(struct dvb_frontend* fe, u16* snr)
47 {
48 *snr = 0;
49 return 0;
50 }
51
52 static int dvb_dummy_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
53 {
54 *ucblocks = 0;
55 return 0;
56 }
57
58
59
60
61
62
63 static int dvb_dummy_fe_get_frontend(struct dvb_frontend *fe,
64 struct dtv_frontend_properties *p)
65 {
66 return 0;
67 }
68
69 static int dvb_dummy_fe_set_frontend(struct dvb_frontend *fe)
70 {
71 if (fe->ops.tuner_ops.set_params) {
72 fe->ops.tuner_ops.set_params(fe);
73 if (fe->ops.i2c_gate_ctrl)
74 fe->ops.i2c_gate_ctrl(fe, 0);
75 }
76
77 return 0;
78 }
79
80 static int dvb_dummy_fe_sleep(struct dvb_frontend* fe)
81 {
82 return 0;
83 }
84
85 static int dvb_dummy_fe_init(struct dvb_frontend* fe)
86 {
87 return 0;
88 }
89
90 static int dvb_dummy_fe_set_tone(struct dvb_frontend *fe,
91 enum fe_sec_tone_mode tone)
92 {
93 return 0;
94 }
95
96 static int dvb_dummy_fe_set_voltage(struct dvb_frontend *fe,
97 enum fe_sec_voltage voltage)
98 {
99 return 0;
100 }
101
102 static void dvb_dummy_fe_release(struct dvb_frontend* fe)
103 {
104 struct dvb_dummy_fe_state* state = fe->demodulator_priv;
105 kfree(state);
106 }
107
108 static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops;
109
110 struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void)
111 {
112 struct dvb_dummy_fe_state* state = NULL;
113
114
115 state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
116 if (!state)
117 return NULL;
118
119
120 memcpy(&state->frontend.ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops));
121 state->frontend.demodulator_priv = state;
122 return &state->frontend;
123 }
124
125 static const struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops;
126
127 struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void)
128 {
129 struct dvb_dummy_fe_state* state = NULL;
130
131
132 state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
133 if (!state)
134 return NULL;
135
136
137 memcpy(&state->frontend.ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops));
138 state->frontend.demodulator_priv = state;
139 return &state->frontend;
140 }
141
142 static const struct dvb_frontend_ops dvb_dummy_fe_qam_ops;
143
144 struct dvb_frontend *dvb_dummy_fe_qam_attach(void)
145 {
146 struct dvb_dummy_fe_state* state = NULL;
147
148
149 state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
150 if (!state)
151 return NULL;
152
153
154 memcpy(&state->frontend.ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops));
155 state->frontend.demodulator_priv = state;
156 return &state->frontend;
157 }
158
159 static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = {
160 .delsys = { SYS_DVBT },
161 .info = {
162 .name = "Dummy DVB-T",
163 .frequency_min_hz = 0,
164 .frequency_max_hz = 863250 * kHz,
165 .frequency_stepsize_hz = 62500,
166 .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
167 FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 |
168 FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO |
169 FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
170 FE_CAN_TRANSMISSION_MODE_AUTO |
171 FE_CAN_GUARD_INTERVAL_AUTO |
172 FE_CAN_HIERARCHY_AUTO,
173 },
174
175 .release = dvb_dummy_fe_release,
176
177 .init = dvb_dummy_fe_init,
178 .sleep = dvb_dummy_fe_sleep,
179
180 .set_frontend = dvb_dummy_fe_set_frontend,
181 .get_frontend = dvb_dummy_fe_get_frontend,
182
183 .read_status = dvb_dummy_fe_read_status,
184 .read_ber = dvb_dummy_fe_read_ber,
185 .read_signal_strength = dvb_dummy_fe_read_signal_strength,
186 .read_snr = dvb_dummy_fe_read_snr,
187 .read_ucblocks = dvb_dummy_fe_read_ucblocks,
188 };
189
190 static const struct dvb_frontend_ops dvb_dummy_fe_qam_ops = {
191 .delsys = { SYS_DVBC_ANNEX_A },
192 .info = {
193 .name = "Dummy DVB-C",
194 .frequency_min_hz = 51 * MHz,
195 .frequency_max_hz = 858 * MHz,
196 .frequency_stepsize_hz = 62500,
197 .symbol_rate_min = (57840000 / 2) / 64,
198 .symbol_rate_max = (57840000 / 2) / 4,
199 .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 |
200 FE_CAN_QAM_128 | FE_CAN_QAM_256 |
201 FE_CAN_FEC_AUTO | FE_CAN_INVERSION_AUTO
202 },
203
204 .release = dvb_dummy_fe_release,
205
206 .init = dvb_dummy_fe_init,
207 .sleep = dvb_dummy_fe_sleep,
208
209 .set_frontend = dvb_dummy_fe_set_frontend,
210 .get_frontend = dvb_dummy_fe_get_frontend,
211
212 .read_status = dvb_dummy_fe_read_status,
213 .read_ber = dvb_dummy_fe_read_ber,
214 .read_signal_strength = dvb_dummy_fe_read_signal_strength,
215 .read_snr = dvb_dummy_fe_read_snr,
216 .read_ucblocks = dvb_dummy_fe_read_ucblocks,
217 };
218
219 static const struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops = {
220 .delsys = { SYS_DVBS },
221 .info = {
222 .name = "Dummy DVB-S",
223 .frequency_min_hz = 950 * MHz,
224 .frequency_max_hz = 2150 * MHz,
225 .frequency_stepsize_hz = 250 * kHz,
226 .frequency_tolerance_hz = 29500 * kHz,
227 .symbol_rate_min = 1000000,
228 .symbol_rate_max = 45000000,
229 .caps = FE_CAN_INVERSION_AUTO |
230 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
231 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
232 FE_CAN_QPSK
233 },
234
235 .release = dvb_dummy_fe_release,
236
237 .init = dvb_dummy_fe_init,
238 .sleep = dvb_dummy_fe_sleep,
239
240 .set_frontend = dvb_dummy_fe_set_frontend,
241 .get_frontend = dvb_dummy_fe_get_frontend,
242
243 .read_status = dvb_dummy_fe_read_status,
244 .read_ber = dvb_dummy_fe_read_ber,
245 .read_signal_strength = dvb_dummy_fe_read_signal_strength,
246 .read_snr = dvb_dummy_fe_read_snr,
247 .read_ucblocks = dvb_dummy_fe_read_ucblocks,
248
249 .set_voltage = dvb_dummy_fe_set_voltage,
250 .set_tone = dvb_dummy_fe_set_tone,
251 };
252
253 MODULE_DESCRIPTION("DVB DUMMY Frontend");
254 MODULE_AUTHOR("Emard");
255 MODULE_LICENSE("GPL");
256
257 EXPORT_SYMBOL(dvb_dummy_fe_ofdm_attach);
258 EXPORT_SYMBOL(dvb_dummy_fe_qam_attach);
259 EXPORT_SYMBOL(dvb_dummy_fe_qpsk_attach);