]>
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 | 56 | |
9133aee0 MK |
57 | struct dvb_frontend; |
58 | ||
1da177e4 LT |
59 | struct 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 | ||
d09dbf92 AQ |
67 | struct device *device; |
68 | ||
1da177e4 | 69 | struct module *module; |
59b1842d DB |
70 | |
71 | int mfe_shared; /* indicates mutually exclusive frontends */ | |
72 | struct dvb_device *mfe_dvbdev; /* frontend device in use */ | |
73 | struct mutex mfe_lock; /* access lock for thread creation */ | |
1da177e4 LT |
74 | }; |
75 | ||
76 | ||
77 | struct dvb_device { | |
78 | struct list_head list_head; | |
784e29d2 | 79 | const struct file_operations *fops; |
1da177e4 LT |
80 | struct dvb_adapter *adapter; |
81 | int type; | |
5dd3f307 | 82 | int minor; |
1da177e4 LT |
83 | u32 id; |
84 | ||
85 | /* in theory, 'users' can vanish now, | |
86 | but I don't want to change too much now... */ | |
87 | int readers; | |
88 | int writers; | |
89 | int users; | |
90 | ||
ca5be9cd | 91 | wait_queue_head_t wait_queue; |
afd1a0c9 | 92 | /* don't really need those !? -- FIXME: use video_usercopy */ |
16ef8def | 93 | int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg); |
1da177e4 LT |
94 | |
95 | void *priv; | |
96 | }; | |
97 | ||
98 | ||
78e92006 JG |
99 | extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name, |
100 | struct module *module, struct device *device, | |
101 | short *adapter_nums); | |
1da177e4 LT |
102 | extern int dvb_unregister_adapter (struct dvb_adapter *adap); |
103 | ||
104 | extern int dvb_register_device (struct dvb_adapter *adap, | |
105 | struct dvb_device **pdvbdev, | |
106 | const struct dvb_device *template, | |
107 | void *priv, | |
108 | int type); | |
109 | ||
110 | extern void dvb_unregister_device (struct dvb_device *dvbdev); | |
111 | ||
112 | extern int dvb_generic_open (struct inode *inode, struct file *file); | |
113 | extern int dvb_generic_release (struct inode *inode, struct file *file); | |
16ef8def | 114 | extern long dvb_generic_ioctl (struct file *file, |
1da177e4 LT |
115 | unsigned int cmd, unsigned long arg); |
116 | ||
117 | /* we don't mess with video_usercopy() any more, | |
118 | we simply define out own dvb_usercopy(), which will hopefully become | |
119 | generic_usercopy() someday... */ | |
120 | ||
16ef8def AB |
121 | extern int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg, |
122 | int (*func)(struct file *file, unsigned int cmd, void *arg)); | |
1da177e4 | 123 | |
d9955060 | 124 | /** generic DVB attach function. */ |
149ef72d | 125 | #ifdef CONFIG_MEDIA_ATTACH |
d9955060 AQ |
126 | #define dvb_attach(FUNCTION, ARGS...) ({ \ |
127 | void *__r = NULL; \ | |
128 | typeof(&FUNCTION) __a = symbol_request(FUNCTION); \ | |
129 | if (__a) { \ | |
130 | __r = (void *) __a(ARGS); \ | |
131 | if (__r == NULL) \ | |
132 | symbol_put(FUNCTION); \ | |
133 | } else { \ | |
134 | printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \ | |
135 | } \ | |
136 | __r; \ | |
137 | }) | |
138 | ||
d9955060 AQ |
139 | #else |
140 | #define dvb_attach(FUNCTION, ARGS...) ({ \ | |
141 | FUNCTION(ARGS); \ | |
142 | }) | |
143 | ||
d9955060 AQ |
144 | #endif |
145 | ||
1da177e4 | 146 | #endif /* #ifndef _DVBDEV_H_ */ |