blob: 3f2c88ae6470d0a5151f92c799cd4186cb02ed72 [file] [log] [blame]
Ian Abbott97ce84d2012-06-19 10:17:45 +01001#ifndef _COMEDI_INTERNAL_H
2#define _COMEDI_INTERNAL_H
3
Ian Abbott78cff592015-03-27 15:58:19 +00004#include <linux/compiler.h>
Ian Abbottf2867662012-06-19 10:17:46 +01005#include <linux/types.h>
6
Greg Kroah-Hartman24343582010-05-03 15:38:37 -07007/*
Ian Abbott4d7df822012-04-13 14:12:53 +01008 * various internal comedi stuff
Greg Kroah-Hartman24343582010-05-03 15:38:37 -07009 */
Ian Abbott78cff592015-03-27 15:58:19 +000010
11struct comedi_buf_map;
12struct comedi_devconfig;
13struct comedi_device;
14struct comedi_insn;
15struct comedi_rangeinfo;
16struct comedi_subdevice;
17struct device;
18
Greg Kroah-Hartman3b6b25b2010-05-03 15:50:09 -070019int do_rangeinfo_ioctl(struct comedi_device *dev,
20 struct comedi_rangeinfo __user *arg);
Ian Abbott7638ffc2013-04-04 14:58:50 +010021struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device);
Ian Abbott3346b792013-04-04 14:58:47 +010022void comedi_release_hardware_device(struct device *hardware_device);
Ian Abbottf65cc542013-02-01 10:20:30 +000023int comedi_alloc_subdevice_minor(struct comedi_subdevice *s);
Ian Abbotte9ab1c22013-02-01 10:20:29 +000024void comedi_free_subdevice_minor(struct comedi_subdevice *s);
H Hartley Sweeten61c9fb02013-01-09 13:27:07 -070025
Greg Kroah-Hartman7029a872010-05-03 15:55:45 -070026int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
27 unsigned long new_size);
Ian Abbottfcc18a92014-05-06 13:12:10 +010028void comedi_buf_reset(struct comedi_subdevice *s);
Ian Abbottd4526ab2014-05-06 13:12:11 +010029bool comedi_buf_is_mmapped(struct comedi_subdevice *s);
Ian Abbottaf93da32013-11-08 15:03:43 +000030void comedi_buf_map_get(struct comedi_buf_map *bm);
31int comedi_buf_map_put(struct comedi_buf_map *bm);
Ian Abbottb34aa862014-04-10 19:41:57 +010032struct comedi_buf_map *comedi_buf_map_from_subdev_get(
33 struct comedi_subdevice *s);
Ian Abbott432fbde2015-10-09 12:26:49 +010034unsigned int comedi_buf_write_n_available(struct comedi_subdevice *s);
Ian Abbott0f1f34e2014-05-06 13:12:06 +010035unsigned int comedi_buf_write_n_allocated(struct comedi_subdevice *s);
Ian Abbottd19db512013-11-08 15:03:28 +000036void comedi_device_cancel_all(struct comedi_device *dev);
Ian Abbott8fc369a2015-04-21 13:18:10 +010037bool comedi_can_auto_free_spriv(struct comedi_subdevice *s);
Ian Abbott4d7df822012-04-13 14:12:53 +010038
39extern unsigned int comedi_default_buf_size_kb;
40extern unsigned int comedi_default_buf_maxsize_kb;
H Hartley Sweeten39bd5e592013-01-30 15:25:06 -070041
42/* drivers.c */
43
Ian Abbottf2867662012-06-19 10:17:46 +010044extern struct comedi_driver *comedi_drivers;
Ian Abbottc383e2d2013-06-27 14:50:58 +010045extern struct mutex comedi_drivers_list_lock;
Ian Abbott97ce84d2012-06-19 10:17:45 +010046
H Hartley Sweeten39bd5e592013-01-30 15:25:06 -070047int insn_inval(struct comedi_device *, struct comedi_subdevice *,
48 struct comedi_insn *, unsigned int *);
49
50void comedi_device_detach(struct comedi_device *);
51int comedi_device_attach(struct comedi_device *, struct comedi_devconfig *);
52
H Hartley Sweeten085494a2013-01-30 15:25:31 -070053#ifdef CONFIG_PROC_FS
54
55/* proc.c */
56
57void comedi_proc_init(void);
58void comedi_proc_cleanup(void);
59#else
60static inline void comedi_proc_init(void)
61{
62}
H Hartley Sweeten663dfc02014-07-18 14:28:12 -070063
H Hartley Sweeten085494a2013-01-30 15:25:31 -070064static inline void comedi_proc_cleanup(void)
65{
66}
67#endif
68
Ian Abbott97ce84d2012-06-19 10:17:45 +010069#endif /* _COMEDI_INTERNAL_H */