This source file includes following definitions.
- rc5_custom
- rc5_data
- rc5_scan
1
2
3
4
5
6
7
8
9
10
11 #ifndef __DVB_USB_H__
12 #define __DVB_USB_H__
13
14 #include <linux/input.h>
15 #include <linux/usb.h>
16 #include <linux/firmware.h>
17 #include <linux/mutex.h>
18 #include <media/rc-core.h>
19
20 #include <media/dvb_frontend.h>
21 #include <media/dvb_demux.h>
22 #include <media/dvb_net.h>
23 #include <media/dmxdev.h>
24
25 #include "dvb-pll.h"
26
27 #include <media/dvb-usb-ids.h>
28
29
30 #ifdef CONFIG_DVB_USB_DEBUG
31 #define dprintk(var,level,args...) \
32 do { if ((var & level)) { printk(args); } } while (0)
33
34 #define debug_dump(b,l,func) {\
35 int loop_; \
36 for (loop_ = 0; loop_ < l; loop_++) func("%02x ", b[loop_]); \
37 func("\n");\
38 }
39 #define DVB_USB_DEBUG_STATUS
40 #else
41 #define dprintk(args...)
42 #define debug_dump(b,l,func)
43
44 #define DVB_USB_DEBUG_STATUS " (debugging is not enabled)"
45
46 #endif
47
48
49 #ifndef DVB_USB_LOG_PREFIX
50 #define DVB_USB_LOG_PREFIX "dvb-usb (please define a log prefix)"
51 #endif
52
53 #undef err
54 #define err(format, arg...) printk(KERN_ERR DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
55 #undef info
56 #define info(format, arg...) printk(KERN_INFO DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
57 #undef warn
58 #define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
59
60
61
62
63
64
65
66
67
68
69
70
71 struct dvb_usb_device_description {
72 const char *name;
73
74 #define DVB_USB_ID_MAX_NUM 15
75 struct usb_device_id *cold_ids[DVB_USB_ID_MAX_NUM];
76 struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM];
77 };
78
79 static inline u8 rc5_custom(struct rc_map_table *key)
80 {
81 return (key->scancode >> 8) & 0xff;
82 }
83
84 static inline u8 rc5_data(struct rc_map_table *key)
85 {
86 return key->scancode & 0xff;
87 }
88
89 static inline u16 rc5_scan(struct rc_map_table *key)
90 {
91 return key->scancode & 0xffff;
92 }
93
94 struct dvb_usb_device;
95 struct dvb_usb_adapter;
96 struct usb_data_stream;
97
98
99
100
101
102
103 struct usb_data_stream_properties {
104 #define USB_BULK 1
105 #define USB_ISOC 2
106 int type;
107 int count;
108 int endpoint;
109
110 union {
111 struct {
112 int buffersize;
113 } bulk;
114 struct {
115 int framesperurb;
116 int framesize;
117 int interval;
118 } isoc;
119 } u;
120 };
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143 struct dvb_usb_adapter_fe_properties {
144 #define DVB_USB_ADAP_HAS_PID_FILTER 0x01
145 #define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02
146 #define DVB_USB_ADAP_NEED_PID_FILTERING 0x04
147 #define DVB_USB_ADAP_RECEIVES_204_BYTE_TS 0x08
148 #define DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD 0x10
149 int caps;
150 int pid_filter_count;
151
152 int (*streaming_ctrl) (struct dvb_usb_adapter *, int);
153 int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int);
154 int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int);
155
156 int (*frontend_attach) (struct dvb_usb_adapter *);
157 int (*tuner_attach) (struct dvb_usb_adapter *);
158
159 struct usb_data_stream_properties stream;
160
161 int size_of_priv;
162 };
163
164 #define MAX_NO_OF_FE_PER_ADAP 3
165 struct dvb_usb_adapter_properties {
166 int size_of_priv;
167
168 int (*frontend_ctrl) (struct dvb_frontend *, int);
169
170 int num_frontends;
171 struct dvb_usb_adapter_fe_properties fe[MAX_NO_OF_FE_PER_ADAP];
172 };
173
174
175
176
177
178
179
180
181
182 struct dvb_rc_legacy {
183
184 #define REMOTE_NO_KEY_PRESSED 0x00
185 #define REMOTE_KEY_PRESSED 0x01
186 #define REMOTE_KEY_REPEAT 0x02
187 struct rc_map_table *rc_map_table;
188 int rc_map_size;
189 int (*rc_query) (struct dvb_usb_device *, u32 *, int *);
190 int rc_interval;
191 };
192
193
194
195
196
197
198
199
200
201
202
203
204 struct dvb_rc {
205 char *rc_codes;
206 u64 protocol;
207 u64 allowed_protos;
208 enum rc_driver_type driver_type;
209 int (*change_protocol)(struct rc_dev *dev, u64 *rc_proto);
210 char *module_name;
211 int (*rc_query) (struct dvb_usb_device *d);
212 int rc_interval;
213 bool bulk_mode;
214 u32 scancode_mask;
215 };
216
217
218
219
220
221
222
223 enum dvb_usb_mode {
224 DVB_RC_LEGACY,
225 DVB_RC_CORE,
226 };
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270 #define MAX_NO_OF_ADAPTER_PER_DEVICE 2
271 struct dvb_usb_device_properties {
272
273 #define DVB_USB_IS_AN_I2C_ADAPTER 0x01
274 int caps;
275
276 #define DEVICE_SPECIFIC 0
277 #define CYPRESS_AN2135 1
278 #define CYPRESS_AN2235 2
279 #define CYPRESS_FX2 3
280 int usb_ctrl;
281 int (*download_firmware) (struct usb_device *, const struct firmware *);
282 const char *firmware;
283 int no_reconnect;
284
285 int size_of_priv;
286 int (*priv_init)(struct dvb_usb_device *);
287 void (*priv_destroy)(struct dvb_usb_device *);
288
289 int num_adapters;
290 struct dvb_usb_adapter_properties adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
291
292 int (*power_ctrl) (struct dvb_usb_device *, int);
293 int (*read_mac_address) (struct dvb_usb_device *, u8 []);
294 int (*identify_state) (struct usb_device *, struct dvb_usb_device_properties *,
295 struct dvb_usb_device_description **, int *);
296
297 struct {
298 enum dvb_usb_mode mode;
299 struct dvb_rc_legacy legacy;
300 struct dvb_rc core;
301 } rc;
302
303 struct i2c_algorithm *i2c_algo;
304
305 int generic_bulk_ctrl_endpoint;
306 int generic_bulk_ctrl_endpoint_response;
307
308 int num_device_descs;
309 struct dvb_usb_device_description devices[12];
310 };
311
312
313
314
315
316
317
318
319
320
321
322 #define MAX_NO_URBS_FOR_DATA_STREAM 10
323 struct usb_data_stream {
324 struct usb_device *udev;
325 struct usb_data_stream_properties props;
326
327 #define USB_STATE_INIT 0x00
328 #define USB_STATE_URB_BUF 0x01
329 int state;
330
331 void (*complete) (struct usb_data_stream *, u8 *, size_t);
332
333 struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM];
334 int buf_num;
335 unsigned long buf_size;
336 u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM];
337 dma_addr_t dma_addr[MAX_NO_URBS_FOR_DATA_STREAM];
338
339 int urbs_initialized;
340 int urbs_submitted;
341
342 void *user_priv;
343 };
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370 struct dvb_usb_fe_adapter {
371 struct dvb_frontend *fe;
372
373 int (*fe_init) (struct dvb_frontend *);
374 int (*fe_sleep) (struct dvb_frontend *);
375
376 struct usb_data_stream stream;
377
378 int pid_filtering;
379 int max_feed_count;
380
381 void *priv;
382 };
383
384 struct dvb_usb_adapter {
385 struct dvb_usb_device *dev;
386 struct dvb_usb_adapter_properties props;
387
388 #define DVB_USB_ADAP_STATE_INIT 0x000
389 #define DVB_USB_ADAP_STATE_DVB 0x001
390 int state;
391
392 u8 id;
393
394 int feedcount;
395
396
397 struct dvb_adapter dvb_adap;
398 struct dmxdev dmxdev;
399 struct dvb_demux demux;
400 struct dvb_net dvb_net;
401
402 struct dvb_usb_fe_adapter fe_adap[MAX_NO_OF_FE_PER_ADAP];
403 int active_fe;
404 int num_frontends_initialized;
405
406 void *priv;
407 };
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437 struct dvb_usb_device {
438 struct dvb_usb_device_properties props;
439 struct dvb_usb_device_description *desc;
440
441 struct usb_device *udev;
442
443 #define DVB_USB_STATE_INIT 0x000
444 #define DVB_USB_STATE_I2C 0x001
445 #define DVB_USB_STATE_DVB 0x002
446 #define DVB_USB_STATE_REMOTE 0x004
447 int state;
448
449 int powered;
450
451
452 struct mutex data_mutex;
453 struct mutex usb_mutex;
454
455
456 struct mutex i2c_mutex;
457 struct i2c_adapter i2c_adap;
458
459 int num_adapters_initialized;
460 struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
461
462
463 struct rc_dev *rc_dev;
464 struct input_dev *input_dev;
465 char rc_phys[64];
466 struct delayed_work rc_query_work;
467 u32 last_event;
468 int last_state;
469
470 struct module *owner;
471
472 void *priv;
473 };
474
475 extern int dvb_usb_device_init(struct usb_interface *,
476 struct dvb_usb_device_properties *,
477 struct module *, struct dvb_usb_device **,
478 short *adapter_nums);
479 extern void dvb_usb_device_exit(struct usb_interface *);
480
481
482 extern int __must_check
483 dvb_usb_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16, int);
484 extern int __must_check
485 dvb_usb_generic_write(struct dvb_usb_device *, u8 *, u16);
486
487
488 extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *);
489
490
491 struct hexline {
492 u8 len;
493 u32 addr;
494 u8 type;
495 u8 data[255];
496 u8 chk;
497 };
498 extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type);
499 extern int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int *pos);
500
501
502 #endif