1*8ffdff6aSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2*8ffdff6aSGreg Kroah-Hartman #ifndef _COMEDI_INTERNAL_H
3*8ffdff6aSGreg Kroah-Hartman #define _COMEDI_INTERNAL_H
4*8ffdff6aSGreg Kroah-Hartman 
5*8ffdff6aSGreg Kroah-Hartman #include <linux/compiler.h>
6*8ffdff6aSGreg Kroah-Hartman #include <linux/types.h>
7*8ffdff6aSGreg Kroah-Hartman 
8*8ffdff6aSGreg Kroah-Hartman /*
9*8ffdff6aSGreg Kroah-Hartman  * various internal comedi stuff
10*8ffdff6aSGreg Kroah-Hartman  */
11*8ffdff6aSGreg Kroah-Hartman 
12*8ffdff6aSGreg Kroah-Hartman struct comedi_buf_map;
13*8ffdff6aSGreg Kroah-Hartman struct comedi_devconfig;
14*8ffdff6aSGreg Kroah-Hartman struct comedi_device;
15*8ffdff6aSGreg Kroah-Hartman struct comedi_insn;
16*8ffdff6aSGreg Kroah-Hartman struct comedi_rangeinfo;
17*8ffdff6aSGreg Kroah-Hartman struct comedi_subdevice;
18*8ffdff6aSGreg Kroah-Hartman struct device;
19*8ffdff6aSGreg Kroah-Hartman 
20*8ffdff6aSGreg Kroah-Hartman int do_rangeinfo_ioctl(struct comedi_device *dev,
21*8ffdff6aSGreg Kroah-Hartman 		       struct comedi_rangeinfo *it);
22*8ffdff6aSGreg Kroah-Hartman struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device);
23*8ffdff6aSGreg Kroah-Hartman void comedi_release_hardware_device(struct device *hardware_device);
24*8ffdff6aSGreg Kroah-Hartman int comedi_alloc_subdevice_minor(struct comedi_subdevice *s);
25*8ffdff6aSGreg Kroah-Hartman void comedi_free_subdevice_minor(struct comedi_subdevice *s);
26*8ffdff6aSGreg Kroah-Hartman 
27*8ffdff6aSGreg Kroah-Hartman int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
28*8ffdff6aSGreg Kroah-Hartman 		     unsigned long new_size);
29*8ffdff6aSGreg Kroah-Hartman void comedi_buf_reset(struct comedi_subdevice *s);
30*8ffdff6aSGreg Kroah-Hartman bool comedi_buf_is_mmapped(struct comedi_subdevice *s);
31*8ffdff6aSGreg Kroah-Hartman void comedi_buf_map_get(struct comedi_buf_map *bm);
32*8ffdff6aSGreg Kroah-Hartman int comedi_buf_map_put(struct comedi_buf_map *bm);
33*8ffdff6aSGreg Kroah-Hartman int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset,
34*8ffdff6aSGreg Kroah-Hartman 			  void *buf, int len, int write);
35*8ffdff6aSGreg Kroah-Hartman struct comedi_buf_map *
36*8ffdff6aSGreg Kroah-Hartman comedi_buf_map_from_subdev_get(struct comedi_subdevice *s);
37*8ffdff6aSGreg Kroah-Hartman unsigned int comedi_buf_write_n_available(struct comedi_subdevice *s);
38*8ffdff6aSGreg Kroah-Hartman unsigned int comedi_buf_write_n_allocated(struct comedi_subdevice *s);
39*8ffdff6aSGreg Kroah-Hartman void comedi_device_cancel_all(struct comedi_device *dev);
40*8ffdff6aSGreg Kroah-Hartman bool comedi_can_auto_free_spriv(struct comedi_subdevice *s);
41*8ffdff6aSGreg Kroah-Hartman 
42*8ffdff6aSGreg Kroah-Hartman extern unsigned int comedi_default_buf_size_kb;
43*8ffdff6aSGreg Kroah-Hartman extern unsigned int comedi_default_buf_maxsize_kb;
44*8ffdff6aSGreg Kroah-Hartman 
45*8ffdff6aSGreg Kroah-Hartman /* drivers.c */
46*8ffdff6aSGreg Kroah-Hartman 
47*8ffdff6aSGreg Kroah-Hartman extern struct comedi_driver *comedi_drivers;
48*8ffdff6aSGreg Kroah-Hartman extern struct mutex comedi_drivers_list_lock;
49*8ffdff6aSGreg Kroah-Hartman 
50*8ffdff6aSGreg Kroah-Hartman int insn_inval(struct comedi_device *dev, struct comedi_subdevice *s,
51*8ffdff6aSGreg Kroah-Hartman 	       struct comedi_insn *insn, unsigned int *data);
52*8ffdff6aSGreg Kroah-Hartman 
53*8ffdff6aSGreg Kroah-Hartman void comedi_device_detach(struct comedi_device *dev);
54*8ffdff6aSGreg Kroah-Hartman int comedi_device_attach(struct comedi_device *dev,
55*8ffdff6aSGreg Kroah-Hartman 			 struct comedi_devconfig *it);
56*8ffdff6aSGreg Kroah-Hartman 
57*8ffdff6aSGreg Kroah-Hartman #ifdef CONFIG_PROC_FS
58*8ffdff6aSGreg Kroah-Hartman 
59*8ffdff6aSGreg Kroah-Hartman /* proc.c */
60*8ffdff6aSGreg Kroah-Hartman 
61*8ffdff6aSGreg Kroah-Hartman void comedi_proc_init(void);
62*8ffdff6aSGreg Kroah-Hartman void comedi_proc_cleanup(void);
63*8ffdff6aSGreg Kroah-Hartman #else
comedi_proc_init(void)64*8ffdff6aSGreg Kroah-Hartman static inline void comedi_proc_init(void)
65*8ffdff6aSGreg Kroah-Hartman {
66*8ffdff6aSGreg Kroah-Hartman }
67*8ffdff6aSGreg Kroah-Hartman 
comedi_proc_cleanup(void)68*8ffdff6aSGreg Kroah-Hartman static inline void comedi_proc_cleanup(void)
69*8ffdff6aSGreg Kroah-Hartman {
70*8ffdff6aSGreg Kroah-Hartman }
71*8ffdff6aSGreg Kroah-Hartman #endif
72*8ffdff6aSGreg Kroah-Hartman 
73*8ffdff6aSGreg Kroah-Hartman #endif /* _COMEDI_INTERNAL_H */
74