blob: 9b3631a654c895a6b1ae70d93cf69eae6bd469d6 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Ian Abbott97ce84d2012-06-19 10:17:45 +01002#ifndef _COMEDI_INTERNAL_H
3#define _COMEDI_INTERNAL_H
4
Ian Abbott78cff592015-03-27 15:58:19 +00005#include <linux/compiler.h>
Ian Abbottf2867662012-06-19 10:17:46 +01006#include <linux/types.h>
7
Greg Kroah-Hartman24343582010-05-03 15:38:37 -07008/*
Ian Abbott4d7df822012-04-13 14:12:53 +01009 * various internal comedi stuff
Greg Kroah-Hartman24343582010-05-03 15:38:37 -070010 */
Ian Abbott78cff592015-03-27 15:58:19 +000011
12struct comedi_buf_map;
13struct comedi_devconfig;
14struct comedi_device;
15struct comedi_insn;
16struct comedi_rangeinfo;
17struct comedi_subdevice;
18struct device;
19
Greg Kroah-Hartman3b6b25b2010-05-03 15:50:09 -070020int do_rangeinfo_ioctl(struct comedi_device *dev,
Al Viro38813872020-04-25 18:44:30 -040021 struct comedi_rangeinfo *it);
Ian Abbott7638ffc2013-04-04 14:58:50 +010022struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device);
Ian Abbott3346b792013-04-04 14:58:47 +010023void comedi_release_hardware_device(struct device *hardware_device);
Ian Abbottf65cc542013-02-01 10:20:30 +000024int comedi_alloc_subdevice_minor(struct comedi_subdevice *s);
Ian Abbotte9ab1c22013-02-01 10:20:29 +000025void comedi_free_subdevice_minor(struct comedi_subdevice *s);
H Hartley Sweeten61c9fb02013-01-09 13:27:07 -070026
Greg Kroah-Hartman7029a872010-05-03 15:55:45 -070027int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
28 unsigned long new_size);
Ian Abbottfcc18a92014-05-06 13:12:10 +010029void comedi_buf_reset(struct comedi_subdevice *s);
Ian Abbottd4526ab2014-05-06 13:12:11 +010030bool comedi_buf_is_mmapped(struct comedi_subdevice *s);
Ian Abbottaf93da32013-11-08 15:03:43 +000031void comedi_buf_map_get(struct comedi_buf_map *bm);
32int comedi_buf_map_put(struct comedi_buf_map *bm);
Ian Abbott255364f2017-04-20 19:05:14 +010033int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset,
34 void *buf, int len, int write);
John B. Wyatt IV37c25132020-03-29 01:00:31 -070035struct comedi_buf_map *
36comedi_buf_map_from_subdev_get(struct comedi_subdevice *s);
Ian Abbott432fbde2015-10-09 12:26:49 +010037unsigned int comedi_buf_write_n_available(struct comedi_subdevice *s);
Ian Abbott0f1f34e2014-05-06 13:12:06 +010038unsigned int comedi_buf_write_n_allocated(struct comedi_subdevice *s);
Ian Abbottd19db512013-11-08 15:03:28 +000039void comedi_device_cancel_all(struct comedi_device *dev);
Ian Abbott8fc369a2015-04-21 13:18:10 +010040bool comedi_can_auto_free_spriv(struct comedi_subdevice *s);
Ian Abbott4d7df822012-04-13 14:12:53 +010041
42extern unsigned int comedi_default_buf_size_kb;
43extern unsigned int comedi_default_buf_maxsize_kb;
H Hartley Sweeten39bd5e592013-01-30 15:25:06 -070044
45/* drivers.c */
46
Ian Abbottf2867662012-06-19 10:17:46 +010047extern struct comedi_driver *comedi_drivers;
Ian Abbottc383e2d2013-06-27 14:50:58 +010048extern struct mutex comedi_drivers_list_lock;
Ian Abbott97ce84d2012-06-19 10:17:45 +010049
Ian Abbott751922d2016-12-15 13:19:48 +000050int insn_inval(struct comedi_device *dev, struct comedi_subdevice *s,
51 struct comedi_insn *insn, unsigned int *data);
H Hartley Sweeten39bd5e592013-01-30 15:25:06 -070052
Ian Abbott751922d2016-12-15 13:19:48 +000053void comedi_device_detach(struct comedi_device *dev);
54int comedi_device_attach(struct comedi_device *dev,
55 struct comedi_devconfig *it);
H Hartley Sweeten39bd5e592013-01-30 15:25:06 -070056
H Hartley Sweeten085494a2013-01-30 15:25:31 -070057#ifdef CONFIG_PROC_FS
58
59/* proc.c */
60
61void comedi_proc_init(void);
62void comedi_proc_cleanup(void);
63#else
64static inline void comedi_proc_init(void)
65{
66}
H Hartley Sweeten663dfc02014-07-18 14:28:12 -070067
H Hartley Sweeten085494a2013-01-30 15:25:31 -070068static inline void comedi_proc_cleanup(void)
69{
70}
71#endif
72
Ian Abbott97ce84d2012-06-19 10:17:45 +010073#endif /* _COMEDI_INTERNAL_H */