Commit | Line | Data |
---|---|---|
ed9eccbe DS |
1 | /* |
2 | include/linux/comedidev.h | |
3 | header file for kernel-only structures, variables, and constants | |
4 | ||
5 | COMEDI - Linux Control and Measurement Device Interface | |
6 | Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org> | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | ||
22 | */ | |
23 | ||
24 | #ifndef _COMEDIDEV_H | |
25 | #define _COMEDIDEV_H | |
26 | ||
27 | #include <linux/kernel.h> | |
28 | #include <linux/module.h> | |
ed9eccbe DS |
29 | #include <linux/kdev_t.h> |
30 | #include <linux/slab.h> | |
f9c51375 | 31 | #include <linux/delay.h> |
ed9eccbe DS |
32 | #include <linux/errno.h> |
33 | #include <linux/spinlock.h> | |
34 | #include <linux/mutex.h> | |
35 | #include <linux/wait.h> | |
36 | #include <linux/mm.h> | |
37 | #include <linux/init.h> | |
38 | #include <linux/vmalloc.h> | |
ed9eccbe | 39 | #include <linux/dma-mapping.h> |
e0dcef71 GKH |
40 | #include <linux/uaccess.h> |
41 | #include <linux/io.h> | |
c7a5d707 | 42 | #include <linux/timer.h> |
ed9eccbe DS |
43 | |
44 | #include "comedi.h" | |
45 | ||
e0dcef71 GKH |
46 | #define DPRINTK(format, args...) do { \ |
47 | if (comedi_debug) \ | |
4f870fe6 | 48 | pr_debug("comedi: " format, ## args); \ |
e0dcef71 | 49 | } while (0) |
ed9eccbe | 50 | |
e0dcef71 | 51 | #define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) |
62eeae93 SW |
52 | #define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, \ |
53 | COMEDI_MINORVERSION, COMEDI_MICROVERSION) | |
ed9eccbe DS |
54 | #define COMEDI_RELEASE VERSION |
55 | ||
ed9eccbe | 56 | #define COMEDI_NUM_BOARD_MINORS 0x30 |
ed9eccbe | 57 | |
34c43922 | 58 | struct comedi_subdevice { |
71b5f4f1 | 59 | struct comedi_device *device; |
90a35c15 | 60 | int index; |
ed9eccbe DS |
61 | int type; |
62 | int n_chan; | |
baf22b64 | 63 | int subdev_flags; |
ed9eccbe DS |
64 | int len_chanlist; /* maximum length of channel/gain list */ |
65 | ||
66 | void *private; | |
67 | ||
d163679c | 68 | struct comedi_async *async; |
ed9eccbe DS |
69 | |
70 | void *lock; | |
71 | void *busy; | |
72 | unsigned runflags; | |
73 | spinlock_t spin_lock; | |
74 | ||
d4a7dc85 | 75 | unsigned int io_bits; |
ed9eccbe | 76 | |
790c5541 BP |
77 | unsigned int maxdata; /* if maxdata==0, use list */ |
78 | const unsigned int *maxdata_list; /* list is channel specific */ | |
ed9eccbe DS |
79 | |
80 | unsigned int flags; | |
81 | const unsigned int *flaglist; | |
82 | ||
83 | unsigned int settling_time_0; | |
84 | ||
9ced1de6 BP |
85 | const struct comedi_lrange *range_table; |
86 | const struct comedi_lrange *const *range_table_list; | |
ed9eccbe DS |
87 | |
88 | unsigned int *chanlist; /* driver-owned chanlist (not used) */ | |
89 | ||
0a85b6f0 MT |
90 | int (*insn_read) (struct comedi_device *, struct comedi_subdevice *, |
91 | struct comedi_insn *, unsigned int *); | |
92 | int (*insn_write) (struct comedi_device *, struct comedi_subdevice *, | |
93 | struct comedi_insn *, unsigned int *); | |
94 | int (*insn_bits) (struct comedi_device *, struct comedi_subdevice *, | |
95 | struct comedi_insn *, unsigned int *); | |
96 | int (*insn_config) (struct comedi_device *, struct comedi_subdevice *, | |
97 | struct comedi_insn *, unsigned int *); | |
ed9eccbe | 98 | |
34c43922 | 99 | int (*do_cmd) (struct comedi_device *, struct comedi_subdevice *); |
0a85b6f0 MT |
100 | int (*do_cmdtest) (struct comedi_device *, struct comedi_subdevice *, |
101 | struct comedi_cmd *); | |
34c43922 BP |
102 | int (*poll) (struct comedi_device *, struct comedi_subdevice *); |
103 | int (*cancel) (struct comedi_device *, struct comedi_subdevice *); | |
62eeae93 SW |
104 | /* int (*do_lock)(struct comedi_device *, struct comedi_subdevice *); */ |
105 | /* int (*do_unlock)(struct comedi_device *, \ | |
106 | struct comedi_subdevice *); */ | |
ed9eccbe DS |
107 | |
108 | /* called when the buffer changes */ | |
62eeae93 SW |
109 | int (*buf_change) (struct comedi_device *dev, |
110 | struct comedi_subdevice *s, unsigned long new_size); | |
ed9eccbe | 111 | |
62eeae93 | 112 | void (*munge) (struct comedi_device *dev, struct comedi_subdevice *s, |
0a85b6f0 MT |
113 | void *data, unsigned int num_bytes, |
114 | unsigned int start_chan_index); | |
ed9eccbe DS |
115 | enum dma_data_direction async_dma_dir; |
116 | ||
117 | unsigned int state; | |
118 | ||
0bfbbe8f | 119 | struct device *class_dev; |
ed9eccbe DS |
120 | int minor; |
121 | }; | |
122 | ||
123 | struct comedi_buf_page { | |
124 | void *virt_addr; | |
125 | dma_addr_t dma_addr; | |
126 | }; | |
127 | ||
d163679c | 128 | struct comedi_async { |
34c43922 | 129 | struct comedi_subdevice *subdevice; |
ed9eccbe DS |
130 | |
131 | void *prealloc_buf; /* pre-allocated buffer */ | |
132 | unsigned int prealloc_bufsz; /* buffer size, in bytes */ | |
62eeae93 SW |
133 | /* virtual and dma address of each page */ |
134 | struct comedi_buf_page *buf_page_list; | |
ed9eccbe DS |
135 | unsigned n_buf_pages; /* num elements in buf_page_list */ |
136 | ||
137 | unsigned int max_bufsize; /* maximum buffer size, bytes */ | |
62eeae93 SW |
138 | /* current number of mmaps of prealloc_buf */ |
139 | unsigned int mmap_count; | |
140 | ||
141 | /* byte count for writer (write completed) */ | |
142 | unsigned int buf_write_count; | |
143 | /* byte count for writer (allocated for writing) */ | |
144 | unsigned int buf_write_alloc_count; | |
145 | /* byte count for reader (read completed) */ | |
146 | unsigned int buf_read_count; | |
147 | /* byte count for reader (allocated for reading) */ | |
148 | unsigned int buf_read_alloc_count; | |
ed9eccbe DS |
149 | |
150 | unsigned int buf_write_ptr; /* buffer marker for writer */ | |
151 | unsigned int buf_read_ptr; /* buffer marker for reader */ | |
152 | ||
153 | unsigned int cur_chan; /* useless channel marker for interrupt */ | |
154 | /* number of bytes that have been received for current scan */ | |
155 | unsigned int scan_progress; | |
156 | /* keeps track of where we are in chanlist as for munging */ | |
157 | unsigned int munge_chan; | |
158 | /* number of bytes that have been munged */ | |
159 | unsigned int munge_count; | |
160 | /* buffer marker for munging */ | |
161 | unsigned int munge_ptr; | |
162 | ||
163 | unsigned int events; /* events that have occurred */ | |
164 | ||
ea6d0d4c | 165 | struct comedi_cmd cmd; |
ed9eccbe DS |
166 | |
167 | wait_queue_head_t wait_head; | |
168 | ||
e0dcef71 | 169 | /* callback stuff */ |
ed9eccbe DS |
170 | unsigned int cb_mask; |
171 | int (*cb_func) (unsigned int flags, void *); | |
172 | void *cb_arg; | |
173 | ||
62eeae93 | 174 | int (*inttrig) (struct comedi_device *dev, struct comedi_subdevice *s, |
e0dcef71 | 175 | unsigned int x); |
ed9eccbe DS |
176 | }; |
177 | ||
139dfbdf BP |
178 | struct comedi_driver { |
179 | struct comedi_driver *next; | |
ed9eccbe DS |
180 | |
181 | const char *driver_name; | |
182 | struct module *module; | |
0707bb04 | 183 | int (*attach) (struct comedi_device *, struct comedi_devconfig *); |
484ecc95 | 184 | void (*detach) (struct comedi_device *); |
8ed705af | 185 | int (*auto_attach) (struct comedi_device *, unsigned long); |
ed9eccbe DS |
186 | |
187 | /* number of elements in board_name and board_id arrays */ | |
188 | unsigned int num_names; | |
189 | const char *const *board_name; | |
190 | /* offset in bytes from one board name pointer to the next */ | |
191 | int offset; | |
192 | }; | |
193 | ||
71b5f4f1 | 194 | struct comedi_device { |
ed9eccbe | 195 | int use_count; |
139dfbdf | 196 | struct comedi_driver *driver; |
ed9eccbe DS |
197 | void *private; |
198 | ||
0bfbbe8f | 199 | struct device *class_dev; |
ed9eccbe | 200 | int minor; |
e0dcef71 GKH |
201 | /* hw_dev is passed to dma_alloc_coherent when allocating async buffers |
202 | * for subdevices that have async_dma_dir set to something other than | |
203 | * DMA_NONE */ | |
ed9eccbe DS |
204 | struct device *hw_dev; |
205 | ||
206 | const char *board_name; | |
207 | const void *board_ptr; | |
a7401cdd | 208 | bool attached:1; |
13f12b5a | 209 | bool in_request_module:1; |
00ca6884 | 210 | bool ioenabled:1; |
ed9eccbe DS |
211 | spinlock_t spinlock; |
212 | struct mutex mutex; | |
ed9eccbe DS |
213 | |
214 | int n_subdevices; | |
34c43922 | 215 | struct comedi_subdevice *subdevices; |
ed9eccbe DS |
216 | |
217 | /* dumb */ | |
218 | unsigned long iobase; | |
316f97f1 | 219 | unsigned long iolen; |
ed9eccbe DS |
220 | unsigned int irq; |
221 | ||
34c43922 BP |
222 | struct comedi_subdevice *read_subdev; |
223 | struct comedi_subdevice *write_subdev; | |
ed9eccbe DS |
224 | |
225 | struct fasync_struct *async_queue; | |
226 | ||
3c17ba07 | 227 | int (*open) (struct comedi_device *dev); |
62eeae93 | 228 | void (*close) (struct comedi_device *dev); |
ed9eccbe DS |
229 | }; |
230 | ||
4dba6c02 | 231 | static inline const void *comedi_board(const struct comedi_device *dev) |
37859f88 HS |
232 | { |
233 | return dev->board_ptr; | |
234 | } | |
235 | ||
ed9eccbe DS |
236 | #ifdef CONFIG_COMEDI_DEBUG |
237 | extern int comedi_debug; | |
238 | #else | |
e0dcef71 | 239 | static const int comedi_debug; |
ed9eccbe DS |
240 | #endif |
241 | ||
242 | /* | |
243 | * function prototypes | |
244 | */ | |
245 | ||
34c43922 | 246 | void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s); |
71b5f4f1 | 247 | void comedi_error(const struct comedi_device *dev, const char *s); |
ed9eccbe DS |
248 | |
249 | /* we can expand the number of bits used to encode devices/subdevices into | |
250 | the minor number soon, after more distros support > 8 bit minor numbers | |
251 | (like after Debian Etch gets released) */ | |
252 | enum comedi_minor_bits { | |
253 | COMEDI_DEVICE_MINOR_MASK = 0xf, | |
254 | COMEDI_SUBDEVICE_MINOR_MASK = 0xf0 | |
255 | }; | |
256 | static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4; | |
257 | static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1; | |
258 | ||
85104e9b HS |
259 | struct comedi_device *comedi_dev_from_minor(unsigned minor); |
260 | ||
ed9eccbe DS |
261 | void init_polling(void); |
262 | void cleanup_polling(void); | |
71b5f4f1 BP |
263 | void start_polling(struct comedi_device *); |
264 | void stop_polling(struct comedi_device *); | |
ed9eccbe | 265 | |
ed9eccbe DS |
266 | /* subdevice runflags */ |
267 | enum subdevice_runflags { | |
268 | SRF_USER = 0x00000001, | |
269 | SRF_RT = 0x00000002, | |
e0dcef71 GKH |
270 | /* indicates an COMEDI_CB_ERROR event has occurred since the last |
271 | * command was started */ | |
ed9eccbe DS |
272 | SRF_ERROR = 0x00000004, |
273 | SRF_RUNNING = 0x08000000 | |
274 | }; | |
275 | ||
e0dac318 HS |
276 | bool comedi_is_subdevice_running(struct comedi_subdevice *s); |
277 | ||
5e220112 MR |
278 | int comedi_check_chanlist(struct comedi_subdevice *s, |
279 | int n, | |
280 | unsigned int *chanlist); | |
ed9eccbe DS |
281 | |
282 | /* range stuff */ | |
283 | ||
e0dcef71 GKH |
284 | #define RANGE(a, b) {(a)*1e6, (b)*1e6, 0} |
285 | #define RANGE_ext(a, b) {(a)*1e6, (b)*1e6, RF_EXTERNAL} | |
286 | #define RANGE_mA(a, b) {(a)*1e6, (b)*1e6, UNIT_mA} | |
baf22b64 | 287 | #define RANGE_unitless(a, b) {(a)*1e6, (b)*1e6, 0} |
e0dcef71 GKH |
288 | #define BIP_RANGE(a) {-(a)*1e6, (a)*1e6, 0} |
289 | #define UNI_RANGE(a) {0, (a)*1e6, 0} | |
ed9eccbe | 290 | |
9ced1de6 BP |
291 | extern const struct comedi_lrange range_bipolar10; |
292 | extern const struct comedi_lrange range_bipolar5; | |
293 | extern const struct comedi_lrange range_bipolar2_5; | |
294 | extern const struct comedi_lrange range_unipolar10; | |
295 | extern const struct comedi_lrange range_unipolar5; | |
5f8eb72c | 296 | extern const struct comedi_lrange range_unipolar2_5; |
2c71c4ff HS |
297 | extern const struct comedi_lrange range_0_20mA; |
298 | extern const struct comedi_lrange range_4_20mA; | |
299 | extern const struct comedi_lrange range_0_32mA; | |
9ced1de6 | 300 | extern const struct comedi_lrange range_unknown; |
ed9eccbe DS |
301 | |
302 | #define range_digital range_unipolar5 | |
303 | ||
304 | #if __GNUC__ >= 3 | |
305 | #define GCC_ZERO_LENGTH_ARRAY | |
306 | #else | |
307 | #define GCC_ZERO_LENGTH_ARRAY 0 | |
308 | #endif | |
309 | ||
9ced1de6 | 310 | struct comedi_lrange { |
ed9eccbe | 311 | int length; |
1f6325d6 | 312 | struct comedi_krange range[GCC_ZERO_LENGTH_ARRAY]; |
ed9eccbe DS |
313 | }; |
314 | ||
315 | /* some silly little inline functions */ | |
316 | ||
34c43922 | 317 | static inline unsigned int bytes_per_sample(const struct comedi_subdevice *subd) |
ed9eccbe DS |
318 | { |
319 | if (subd->subdev_flags & SDF_LSAMPL) | |
790c5541 | 320 | return sizeof(unsigned int); |
ed9eccbe | 321 | else |
790c5541 | 322 | return sizeof(short); |
ed9eccbe DS |
323 | } |
324 | ||
bc3954b8 IA |
325 | /* |
326 | * Must set dev->hw_dev if you wish to dma directly into comedi's buffer. | |
327 | * Also useful for retrieving a previously configured hardware device of | |
328 | * known bus type. Set automatically for auto-configured devices. | |
329 | * Automatically set to NULL when detaching hardware device. | |
330 | */ | |
da717511 | 331 | int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev); |
ed9eccbe | 332 | |
8ae560a1 HS |
333 | unsigned int comedi_buf_write_alloc(struct comedi_async *, unsigned int); |
334 | unsigned int comedi_buf_write_free(struct comedi_async *, unsigned int); | |
335 | ||
336 | unsigned int comedi_buf_read_n_available(struct comedi_async *); | |
337 | unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int); | |
338 | unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int); | |
339 | ||
340 | int comedi_buf_put(struct comedi_async *, short); | |
341 | int comedi_buf_get(struct comedi_async *, short *); | |
342 | ||
d163679c | 343 | void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset, |
0a85b6f0 | 344 | const void *source, unsigned int num_bytes); |
d163679c | 345 | void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset, |
0a85b6f0 | 346 | void *destination, unsigned int num_bytes); |
0a85b6f0 | 347 | |
1ae6b20b HS |
348 | /* drivers.c - general comedi driver functions */ |
349 | ||
350 | int comedi_alloc_subdevices(struct comedi_device *, int); | |
351 | ||
2f69915c HS |
352 | void comedi_spriv_free(struct comedi_device *, int subdev_num); |
353 | ||
ca8b2964 HS |
354 | int __comedi_request_region(struct comedi_device *, |
355 | unsigned long start, unsigned long len); | |
f375ac5f HS |
356 | int comedi_request_region(struct comedi_device *, |
357 | unsigned long start, unsigned long len); | |
316f97f1 | 358 | void comedi_legacy_detach(struct comedi_device *); |
f375ac5f | 359 | |
1ae6b20b HS |
360 | int comedi_auto_config(struct device *, struct comedi_driver *, |
361 | unsigned long context); | |
362 | void comedi_auto_unconfig(struct device *); | |
363 | ||
364 | int comedi_driver_register(struct comedi_driver *); | |
365 | int comedi_driver_unregister(struct comedi_driver *); | |
366 | ||
367 | /** | |
368 | * module_comedi_driver() - Helper macro for registering a comedi driver | |
369 | * @__comedi_driver: comedi_driver struct | |
370 | * | |
371 | * Helper macro for comedi drivers which do not do anything special in module | |
372 | * init/exit. This eliminates a lot of boilerplate. Each module may only use | |
373 | * this macro once, and calling it replaces module_init() and module_exit(). | |
374 | */ | |
375 | #define module_comedi_driver(__comedi_driver) \ | |
376 | module_driver(__comedi_driver, comedi_driver_register, \ | |
377 | comedi_driver_unregister) | |
581a7dde | 378 | |
33782dd5 HS |
379 | #ifdef CONFIG_COMEDI_PCI_DRIVERS |
380 | ||
381 | /* comedi_pci.c - comedi PCI driver specific functions */ | |
382 | ||
383 | /* | |
384 | * PCI Vendor IDs not in <linux/pci_ids.h> | |
385 | */ | |
386 | #define PCI_VENDOR_ID_KOLTER 0x1001 | |
387 | #define PCI_VENDOR_ID_ICP 0x104c | |
388 | #define PCI_VENDOR_ID_AMCC 0x10e8 | |
389 | #define PCI_VENDOR_ID_DT 0x1116 | |
390 | #define PCI_VENDOR_ID_IOTECH 0x1616 | |
391 | #define PCI_VENDOR_ID_CONTEC 0x1221 | |
33782dd5 | 392 | #define PCI_VENDOR_ID_RTD 0x1435 |
33782dd5 HS |
393 | |
394 | struct pci_dev; | |
395 | struct pci_driver; | |
396 | ||
397 | struct pci_dev *comedi_to_pci_dev(struct comedi_device *); | |
398 | ||
818f569f | 399 | int comedi_pci_enable(struct comedi_device *); |
7f072f54 | 400 | void comedi_pci_disable(struct comedi_device *); |
33782dd5 | 401 | |
b8f4ac23 HS |
402 | int comedi_pci_auto_config(struct pci_dev *, struct comedi_driver *, |
403 | unsigned long context); | |
33782dd5 HS |
404 | void comedi_pci_auto_unconfig(struct pci_dev *); |
405 | ||
406 | int comedi_pci_driver_register(struct comedi_driver *, struct pci_driver *); | |
407 | void comedi_pci_driver_unregister(struct comedi_driver *, struct pci_driver *); | |
408 | ||
409 | /** | |
410 | * module_comedi_pci_driver() - Helper macro for registering a comedi PCI driver | |
411 | * @__comedi_driver: comedi_driver struct | |
412 | * @__pci_driver: pci_driver struct | |
413 | * | |
414 | * Helper macro for comedi PCI drivers which do not do anything special | |
415 | * in module init/exit. This eliminates a lot of boilerplate. Each | |
416 | * module may only use this macro once, and calling it replaces | |
417 | * module_init() and module_exit() | |
418 | */ | |
419 | #define module_comedi_pci_driver(__comedi_driver, __pci_driver) \ | |
420 | module_driver(__comedi_driver, comedi_pci_driver_register, \ | |
421 | comedi_pci_driver_unregister, &(__pci_driver)) | |
422 | ||
423 | #else | |
424 | ||
425 | /* | |
426 | * Some of the comedi mixed ISA/PCI drivers call the PCI specific | |
427 | * functions. Provide some dummy functions if CONFIG_COMEDI_PCI_DRIVERS | |
428 | * is not enabled. | |
429 | */ | |
430 | ||
431 | static inline struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev) | |
432 | { | |
433 | return NULL; | |
434 | } | |
435 | ||
818f569f | 436 | static inline int comedi_pci_enable(struct comedi_device *dev) |
33782dd5 HS |
437 | { |
438 | return -ENOSYS; | |
439 | } | |
440 | ||
7f072f54 | 441 | static inline void comedi_pci_disable(struct comedi_device *dev) |
581a7dde | 442 | { |
581a7dde IA |
443 | } |
444 | ||
33782dd5 | 445 | #endif /* CONFIG_COMEDI_PCI_DRIVERS */ |
581a7dde | 446 | |
309231d7 HS |
447 | #ifdef CONFIG_COMEDI_PCMCIA_DRIVERS |
448 | ||
449 | /* comedi_pcmcia.c - comedi PCMCIA driver specific functions */ | |
450 | ||
451 | struct pcmcia_driver; | |
1f021e1f HS |
452 | struct pcmcia_device; |
453 | ||
454 | struct pcmcia_device *comedi_to_pcmcia_dev(struct comedi_device *); | |
455 | ||
a3ac9519 HS |
456 | int comedi_pcmcia_enable(struct comedi_device *, |
457 | int (*conf_check)(struct pcmcia_device *, void *)); | |
ddb2d0a0 HS |
458 | void comedi_pcmcia_disable(struct comedi_device *); |
459 | ||
1f021e1f HS |
460 | int comedi_pcmcia_auto_config(struct pcmcia_device *, struct comedi_driver *); |
461 | void comedi_pcmcia_auto_unconfig(struct pcmcia_device *); | |
309231d7 HS |
462 | |
463 | int comedi_pcmcia_driver_register(struct comedi_driver *, | |
464 | struct pcmcia_driver *); | |
465 | void comedi_pcmcia_driver_unregister(struct comedi_driver *, | |
466 | struct pcmcia_driver *); | |
467 | ||
468 | /** | |
469 | * module_comedi_pcmcia_driver() - Helper macro for registering a comedi PCMCIA driver | |
470 | * @__comedi_driver: comedi_driver struct | |
471 | * @__pcmcia_driver: pcmcia_driver struct | |
472 | * | |
473 | * Helper macro for comedi PCMCIA drivers which do not do anything special | |
474 | * in module init/exit. This eliminates a lot of boilerplate. Each | |
475 | * module may only use this macro once, and calling it replaces | |
476 | * module_init() and module_exit() | |
477 | */ | |
478 | #define module_comedi_pcmcia_driver(__comedi_driver, __pcmcia_driver) \ | |
479 | module_driver(__comedi_driver, comedi_pcmcia_driver_register, \ | |
480 | comedi_pcmcia_driver_unregister, &(__pcmcia_driver)) | |
481 | ||
482 | #endif /* CONFIG_COMEDI_PCMCIA_DRIVERS */ | |
483 | ||
abac8b54 | 484 | #ifdef CONFIG_COMEDI_USB_DRIVERS |
581a7dde | 485 | |
abac8b54 HS |
486 | /* comedi_usb.c - comedi USB driver specific functions */ |
487 | ||
488 | struct usb_driver; | |
489 | struct usb_interface; | |
490 | ||
491 | struct usb_interface *comedi_to_usb_interface(struct comedi_device *); | |
492 | ||
55ab4f64 HS |
493 | int comedi_usb_auto_config(struct usb_interface *, struct comedi_driver *, |
494 | unsigned long context); | |
abac8b54 HS |
495 | void comedi_usb_auto_unconfig(struct usb_interface *); |
496 | ||
497 | int comedi_usb_driver_register(struct comedi_driver *, struct usb_driver *); | |
498 | void comedi_usb_driver_unregister(struct comedi_driver *, struct usb_driver *); | |
499 | ||
500 | /** | |
501 | * module_comedi_usb_driver() - Helper macro for registering a comedi USB driver | |
502 | * @__comedi_driver: comedi_driver struct | |
503 | * @__usb_driver: usb_driver struct | |
504 | * | |
505 | * Helper macro for comedi USB drivers which do not do anything special | |
506 | * in module init/exit. This eliminates a lot of boilerplate. Each | |
507 | * module may only use this macro once, and calling it replaces | |
508 | * module_init() and module_exit() | |
509 | */ | |
510 | #define module_comedi_usb_driver(__comedi_driver, __usb_driver) \ | |
511 | module_driver(__comedi_driver, comedi_usb_driver_register, \ | |
512 | comedi_usb_driver_unregister, &(__usb_driver)) | |
513 | ||
514 | #endif /* CONFIG_COMEDI_USB_DRIVERS */ | |
ed9eccbe | 515 | |
ed9eccbe | 516 | #endif /* _COMEDIDEV_H */ |