1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef _DVBDEV_H_
24#define _DVBDEV_H_
25
26#include <linux/types.h>
27#include <linux/poll.h>
28#include <linux/fs.h>
29#include <linux/list.h>
30
31#define DVB_MAJOR 212
32
33#if defined(CONFIG_DVB_MAX_ADAPTERS) && CONFIG_DVB_MAX_ADAPTERS > 0
34 #define DVB_MAX_ADAPTERS CONFIG_DVB_MAX_ADAPTERS
35#else
36 #define DVB_MAX_ADAPTERS 8
37#endif
38
39#define DVB_UNSET (-1)
40
41#define DVB_DEVICE_VIDEO 0
42#define DVB_DEVICE_AUDIO 1
43#define DVB_DEVICE_SEC 2
44#define DVB_DEVICE_FRONTEND 3
45#define DVB_DEVICE_DEMUX 4
46#define DVB_DEVICE_DVR 5
47#define DVB_DEVICE_CA 6
48#define DVB_DEVICE_NET 7
49#define DVB_DEVICE_OSD 8
50
51#define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
52 static short adapter_nr[] = \
53 {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
54 module_param_array(adapter_nr, short, NULL, 0444); \
55 MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
56
57struct dvb_adapter {
58 int num;
59 struct list_head list_head;
60 struct list_head device_list;
61 const char *name;
62 u8 proposed_mac [6];
63 void* priv;
64
65 struct device *device;
66
67 struct module *module;
68
69 int mfe_shared;
70 struct dvb_device *mfe_dvbdev;
71 struct mutex mfe_lock;
72};
73
74
75struct dvb_device {
76 struct list_head list_head;
77 const struct file_operations *fops;
78 struct dvb_adapter *adapter;
79 int type;
80 int minor;
81 u32 id;
82
83
84
85 int readers;
86 int writers;
87 int users;
88
89 wait_queue_head_t wait_queue;
90
91 int (*kernel_ioctl)(struct inode *inode, struct file *file,
92 unsigned int cmd, void *arg);
93
94 void *priv;
95};
96
97
98extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
99 struct module *module, struct device *device,
100 short *adapter_nums);
101extern int dvb_unregister_adapter (struct dvb_adapter *adap);
102
103extern int dvb_register_device (struct dvb_adapter *adap,
104 struct dvb_device **pdvbdev,
105 const struct dvb_device *template,
106 void *priv,
107 int type);
108
109extern void dvb_unregister_device (struct dvb_device *dvbdev);
110
111extern int dvb_generic_open (struct inode *inode, struct file *file);
112extern int dvb_generic_release (struct inode *inode, struct file *file);
113extern int dvb_generic_ioctl (struct inode *inode, struct file *file,
114 unsigned int cmd, unsigned long arg);
115
116
117
118
119
120extern int dvb_usercopy(struct inode *inode, struct file *file,
121 unsigned int cmd, unsigned long arg,
122 int (*func)(struct inode *inode, struct file *file,
123 unsigned int cmd, void *arg));
124
125
126#ifdef CONFIG_MEDIA_ATTACH
127#define dvb_attach(FUNCTION, ARGS...) ({ \
128 void *__r = NULL; \
129 typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
130 if (__a) { \
131 __r = (void *) __a(ARGS); \
132 if (__r == NULL) \
133 symbol_put(FUNCTION); \
134 } else { \
135 printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \
136 } \
137 __r; \
138})
139
140#else
141#define dvb_attach(FUNCTION, ARGS...) ({ \
142 FUNCTION(ARGS); \
143})
144
145#endif
146
147#endif
148