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_frontend;
58
59struct dvb_adapter {
60 int num;
61 struct list_head list_head;
62 struct list_head device_list;
63 const char *name;
64 u8 proposed_mac [6];
65 void* priv;
66
67 struct device *device;
68
69 struct module *module;
70
71 int mfe_shared;
72 struct dvb_device *mfe_dvbdev;
73 struct mutex mfe_lock;
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95#define DVB_FE_IOCTL_PRE 0
96#define DVB_FE_IOCTL_POST 1
97 int (*fe_ioctl_override)(struct dvb_frontend *fe,
98 unsigned int cmd, void *parg,
99 unsigned int stage);
100};
101
102
103struct dvb_device {
104 struct list_head list_head;
105 const struct file_operations *fops;
106 struct dvb_adapter *adapter;
107 int type;
108 int minor;
109 u32 id;
110
111
112
113 int readers;
114 int writers;
115 int users;
116
117 wait_queue_head_t wait_queue;
118
119 int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg);
120
121 void *priv;
122};
123
124
125extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
126 struct module *module, struct device *device,
127 short *adapter_nums);
128extern int dvb_unregister_adapter (struct dvb_adapter *adap);
129
130extern int dvb_register_device (struct dvb_adapter *adap,
131 struct dvb_device **pdvbdev,
132 const struct dvb_device *template,
133 void *priv,
134 int type);
135
136extern void dvb_unregister_device (struct dvb_device *dvbdev);
137
138extern int dvb_generic_open (struct inode *inode, struct file *file);
139extern int dvb_generic_release (struct inode *inode, struct file *file);
140extern long dvb_generic_ioctl (struct file *file,
141 unsigned int cmd, unsigned long arg);
142
143
144
145
146
147extern int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
148 int (*func)(struct file *file, unsigned int cmd, void *arg));
149
150
151#ifdef CONFIG_MEDIA_ATTACH
152#define dvb_attach(FUNCTION, ARGS...) ({ \
153 void *__r = NULL; \
154 typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
155 if (__a) { \
156 __r = (void *) __a(ARGS); \
157 if (__r == NULL) \
158 symbol_put(FUNCTION); \
159 } else { \
160 printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \
161 } \
162 __r; \
163})
164
165#else
166#define dvb_attach(FUNCTION, ARGS...) ({ \
167 FUNCTION(ARGS); \
168})
169
170#endif
171
172#endif
173