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