Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Ian Abbott | 97ce84d | 2012-06-19 10:17:45 +0100 | [diff] [blame] | 2 | #ifndef _COMEDI_INTERNAL_H |
| 3 | #define _COMEDI_INTERNAL_H |
| 4 | |
Ian Abbott | 78cff59 | 2015-03-27 15:58:19 +0000 | [diff] [blame] | 5 | #include <linux/compiler.h> |
Ian Abbott | f286766 | 2012-06-19 10:17:46 +0100 | [diff] [blame] | 6 | #include <linux/types.h> |
| 7 | |
Greg Kroah-Hartman | 2434358 | 2010-05-03 15:38:37 -0700 | [diff] [blame] | 8 | /* |
Ian Abbott | 4d7df82 | 2012-04-13 14:12:53 +0100 | [diff] [blame] | 9 | * various internal comedi stuff |
Greg Kroah-Hartman | 2434358 | 2010-05-03 15:38:37 -0700 | [diff] [blame] | 10 | */ |
Ian Abbott | 78cff59 | 2015-03-27 15:58:19 +0000 | [diff] [blame] | 11 | |
| 12 | struct comedi_buf_map; |
| 13 | struct comedi_devconfig; |
| 14 | struct comedi_device; |
| 15 | struct comedi_insn; |
| 16 | struct comedi_rangeinfo; |
| 17 | struct comedi_subdevice; |
| 18 | struct device; |
| 19 | |
Greg Kroah-Hartman | 3b6b25b | 2010-05-03 15:50:09 -0700 | [diff] [blame] | 20 | int do_rangeinfo_ioctl(struct comedi_device *dev, |
Al Viro | 3881387 | 2020-04-25 18:44:30 -0400 | [diff] [blame] | 21 | struct comedi_rangeinfo *it); |
Ian Abbott | 7638ffc | 2013-04-04 14:58:50 +0100 | [diff] [blame] | 22 | struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device); |
Ian Abbott | 3346b79 | 2013-04-04 14:58:47 +0100 | [diff] [blame] | 23 | void comedi_release_hardware_device(struct device *hardware_device); |
Ian Abbott | f65cc54 | 2013-02-01 10:20:30 +0000 | [diff] [blame] | 24 | int comedi_alloc_subdevice_minor(struct comedi_subdevice *s); |
Ian Abbott | e9ab1c2 | 2013-02-01 10:20:29 +0000 | [diff] [blame] | 25 | void comedi_free_subdevice_minor(struct comedi_subdevice *s); |
H Hartley Sweeten | 61c9fb0 | 2013-01-09 13:27:07 -0700 | [diff] [blame] | 26 | |
Greg Kroah-Hartman | 7029a87 | 2010-05-03 15:55:45 -0700 | [diff] [blame] | 27 | int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, |
| 28 | unsigned long new_size); |
Ian Abbott | fcc18a9 | 2014-05-06 13:12:10 +0100 | [diff] [blame] | 29 | void comedi_buf_reset(struct comedi_subdevice *s); |
Ian Abbott | d4526ab | 2014-05-06 13:12:11 +0100 | [diff] [blame] | 30 | bool comedi_buf_is_mmapped(struct comedi_subdevice *s); |
Ian Abbott | af93da3 | 2013-11-08 15:03:43 +0000 | [diff] [blame] | 31 | void comedi_buf_map_get(struct comedi_buf_map *bm); |
| 32 | int comedi_buf_map_put(struct comedi_buf_map *bm); |
Ian Abbott | 255364f | 2017-04-20 19:05:14 +0100 | [diff] [blame] | 33 | int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset, |
| 34 | void *buf, int len, int write); |
John B. Wyatt IV | 37c2513 | 2020-03-29 01:00:31 -0700 | [diff] [blame] | 35 | struct comedi_buf_map * |
| 36 | comedi_buf_map_from_subdev_get(struct comedi_subdevice *s); |
Ian Abbott | 432fbde | 2015-10-09 12:26:49 +0100 | [diff] [blame] | 37 | unsigned int comedi_buf_write_n_available(struct comedi_subdevice *s); |
Ian Abbott | 0f1f34e | 2014-05-06 13:12:06 +0100 | [diff] [blame] | 38 | unsigned int comedi_buf_write_n_allocated(struct comedi_subdevice *s); |
Ian Abbott | d19db51 | 2013-11-08 15:03:28 +0000 | [diff] [blame] | 39 | void comedi_device_cancel_all(struct comedi_device *dev); |
Ian Abbott | 8fc369a | 2015-04-21 13:18:10 +0100 | [diff] [blame] | 40 | bool comedi_can_auto_free_spriv(struct comedi_subdevice *s); |
Ian Abbott | 4d7df82 | 2012-04-13 14:12:53 +0100 | [diff] [blame] | 41 | |
| 42 | extern unsigned int comedi_default_buf_size_kb; |
| 43 | extern unsigned int comedi_default_buf_maxsize_kb; |
H Hartley Sweeten | 39bd5e59 | 2013-01-30 15:25:06 -0700 | [diff] [blame] | 44 | |
| 45 | /* drivers.c */ |
| 46 | |
Ian Abbott | f286766 | 2012-06-19 10:17:46 +0100 | [diff] [blame] | 47 | extern struct comedi_driver *comedi_drivers; |
Ian Abbott | c383e2d | 2013-06-27 14:50:58 +0100 | [diff] [blame] | 48 | extern struct mutex comedi_drivers_list_lock; |
Ian Abbott | 97ce84d | 2012-06-19 10:17:45 +0100 | [diff] [blame] | 49 | |
Ian Abbott | 751922d | 2016-12-15 13:19:48 +0000 | [diff] [blame] | 50 | int insn_inval(struct comedi_device *dev, struct comedi_subdevice *s, |
| 51 | struct comedi_insn *insn, unsigned int *data); |
H Hartley Sweeten | 39bd5e59 | 2013-01-30 15:25:06 -0700 | [diff] [blame] | 52 | |
Ian Abbott | 751922d | 2016-12-15 13:19:48 +0000 | [diff] [blame] | 53 | void comedi_device_detach(struct comedi_device *dev); |
| 54 | int comedi_device_attach(struct comedi_device *dev, |
| 55 | struct comedi_devconfig *it); |
H Hartley Sweeten | 39bd5e59 | 2013-01-30 15:25:06 -0700 | [diff] [blame] | 56 | |
H Hartley Sweeten | 085494a | 2013-01-30 15:25:31 -0700 | [diff] [blame] | 57 | #ifdef CONFIG_PROC_FS |
| 58 | |
| 59 | /* proc.c */ |
| 60 | |
| 61 | void comedi_proc_init(void); |
| 62 | void comedi_proc_cleanup(void); |
| 63 | #else |
| 64 | static inline void comedi_proc_init(void) |
| 65 | { |
| 66 | } |
H Hartley Sweeten | 663dfc0 | 2014-07-18 14:28:12 -0700 | [diff] [blame] | 67 | |
H Hartley Sweeten | 085494a | 2013-01-30 15:25:31 -0700 | [diff] [blame] | 68 | static inline void comedi_proc_cleanup(void) |
| 69 | { |
| 70 | } |
| 71 | #endif |
| 72 | |
Ian Abbott | 97ce84d | 2012-06-19 10:17:45 +0100 | [diff] [blame] | 73 | #endif /* _COMEDI_INTERNAL_H */ |