Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * dvbdev.h | |
3 | * | |
4 | * Copyright (C) 2000 Ralph Metzler & Marcus Metzler | |
5 | * for convergence integrated media GmbH | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or | |
8 | * modify it under the terms of the GNU General Lesser Public License | |
9 | * as published by the Free Software Foundation; either version 2.1 | |
10 | * of the License, or (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU Lesser General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
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> | |
1da177e4 LT |
30 | |
31 | #define DVB_MAJOR 212 | |
32 | ||
4457ef1d | 33 | #if defined(CONFIG_DVB_MAX_ADAPTERS) && CONFIG_DVB_MAX_ADAPTERS > 0 |
d4c02ef9 | 34 | #define DVB_MAX_ADAPTERS CONFIG_DVB_MAX_ADAPTERS |
4457ef1d | 35 | #else |
d4c02ef9 | 36 | #define DVB_MAX_ADAPTERS 8 |
4457ef1d | 37 | #endif |
78e92006 JG |
38 | |
39 | #define DVB_UNSET (-1) | |
40 | ||
1da177e4 LT |
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 | ||
78e92006 JG |
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") | |
1da177e4 LT |
56 | |
57 | struct 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 | ||
d09dbf92 AQ |
65 | struct device *device; |
66 | ||
1da177e4 | 67 | struct module *module; |
59b1842d DB |
68 | |
69 | int mfe_shared; /* indicates mutually exclusive frontends */ | |
70 | struct dvb_device *mfe_dvbdev; /* frontend device in use */ | |
71 | struct mutex mfe_lock; /* access lock for thread creation */ | |
1da177e4 LT |
72 | }; |
73 | ||
74 | ||
75 | struct dvb_device { | |
76 | struct list_head list_head; | |
784e29d2 | 77 | const struct file_operations *fops; |
1da177e4 LT |
78 | struct dvb_adapter *adapter; |
79 | int type; | |
5dd3f307 | 80 | int minor; |
1da177e4 LT |
81 | u32 id; |
82 | ||
83 | /* in theory, 'users' can vanish now, | |
84 | but I don't want to change too much now... */ | |
85 | int readers; | |
86 | int writers; | |
87 | int users; | |
88 | ||
ca5be9cd | 89 | wait_queue_head_t wait_queue; |
afd1a0c9 MCC |
90 | /* don't really need those !? -- FIXME: use video_usercopy */ |
91 | int (*kernel_ioctl)(struct inode *inode, struct file *file, | |
1da177e4 LT |
92 | unsigned int cmd, void *arg); |
93 | ||
94 | void *priv; | |
95 | }; | |
96 | ||
97 | ||
78e92006 JG |
98 | extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name, |
99 | struct module *module, struct device *device, | |
100 | short *adapter_nums); | |
1da177e4 LT |
101 | extern int dvb_unregister_adapter (struct dvb_adapter *adap); |
102 | ||
103 | extern 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 | ||
109 | extern void dvb_unregister_device (struct dvb_device *dvbdev); | |
110 | ||
111 | extern int dvb_generic_open (struct inode *inode, struct file *file); | |
112 | extern int dvb_generic_release (struct inode *inode, struct file *file); | |
113 | extern int dvb_generic_ioctl (struct inode *inode, struct file *file, | |
114 | unsigned int cmd, unsigned long arg); | |
115 | ||
116 | /* we don't mess with video_usercopy() any more, | |
117 | we simply define out own dvb_usercopy(), which will hopefully become | |
118 | generic_usercopy() someday... */ | |
119 | ||
120 | extern int dvb_usercopy(struct inode *inode, struct file *file, | |
50c25fff | 121 | unsigned int cmd, unsigned long arg, |
1da177e4 LT |
122 | int (*func)(struct inode *inode, struct file *file, |
123 | unsigned int cmd, void *arg)); | |
124 | ||
d9955060 | 125 | /** generic DVB attach function. */ |
149ef72d | 126 | #ifdef CONFIG_MEDIA_ATTACH |
d9955060 AQ |
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 | ||
d9955060 AQ |
140 | #else |
141 | #define dvb_attach(FUNCTION, ARGS...) ({ \ | |
142 | FUNCTION(ARGS); \ | |
143 | }) | |
144 | ||
d9955060 AQ |
145 | #endif |
146 | ||
1da177e4 | 147 | #endif /* #ifndef _DVBDEV_H_ */ |