2 linux/include/comedilib.h
3 header file for kcomedilib
5 COMEDI - Linux Control and Measurement Device Interface
6 Copyright (C) 1998-2001 David A. Schleef <ds@schleef.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef _LINUX_COMEDILIB_H
25 #define _LINUX_COMEDILIB_H
29 /* these functions may not be called at real-time priority */
31 void *comedi_open(const char *path);
32 int comedi_close(void *dev);
34 /* these functions may be called at any priority, but may fail at
37 int comedi_lock(void *dev, unsigned int subdev);
38 int comedi_unlock(void *dev, unsigned int subdev);
40 /* these functions may be called at any priority, but you must hold
41 the lock for the subdevice */
43 int comedi_loglevel(int loglevel);
44 void comedi_perror(const char *s);
45 char *comedi_strerror(int errnum);
46 int comedi_errno(void);
47 int comedi_fileno(void *dev);
49 int comedi_cancel(void *dev, unsigned int subdev);
50 int comedi_register_callback(void *dev, unsigned int subdev,
51 unsigned int mask, int (*cb) (unsigned int,
54 int comedi_command(void *dev, struct comedi_cmd *cmd);
55 int comedi_command_test(void *dev, struct comedi_cmd *cmd);
56 int comedi_trigger(void *dev, unsigned int subdev, struct comedi_trig *it);
57 int __comedi_trigger(void *dev, unsigned int subdev, struct comedi_trig *it);
58 int comedi_data_write(void *dev, unsigned int subdev, unsigned int chan,
59 unsigned int range, unsigned int aref, unsigned int data);
60 int comedi_data_read(void *dev, unsigned int subdev, unsigned int chan,
61 unsigned int range, unsigned int aref, unsigned int *data);
62 int comedi_data_read_hint(void *dev, unsigned int subdev,
63 unsigned int chan, unsigned int range,
65 int comedi_data_read_delayed(void *dev, unsigned int subdev, unsigned int chan,
66 unsigned int range, unsigned int aref,
67 unsigned int *data, unsigned int nano_sec);
68 int comedi_dio_config(void *dev, unsigned int subdev, unsigned int chan,
70 int comedi_dio_read(void *dev, unsigned int subdev, unsigned int chan,
72 int comedi_dio_write(void *dev, unsigned int subdev, unsigned int chan,
74 int comedi_dio_bitfield(void *dev, unsigned int subdev, unsigned int mask,
76 int comedi_get_n_subdevices(void *dev);
77 int comedi_get_version_code(void *dev);
78 const char *comedi_get_driver_name(void *dev);
79 const char *comedi_get_board_name(void *dev);
80 int comedi_get_subdevice_type(void *dev, unsigned int subdevice);
81 int comedi_find_subdevice_by_type(void *dev, int type, unsigned int subd);
82 int comedi_get_n_channels(void *dev, unsigned int subdevice);
83 unsigned int comedi_get_maxdata(void *dev, unsigned int subdevice, unsigned
85 int comedi_get_n_ranges(void *dev, unsigned int subdevice, unsigned int chan);
86 int comedi_do_insn(void *dev, struct comedi_insn *insn);
87 int comedi_poll(void *dev, unsigned int subdev);
89 /* DEPRECATED functions */
90 int comedi_get_rangetype(void *dev, unsigned int subdevice, unsigned int chan);
93 unsigned int comedi_get_subdevice_flags(void *dev, unsigned int subdevice);
94 int comedi_get_len_chanlist(void *dev, unsigned int subdevice);
95 int comedi_get_krange(void *dev, unsigned int subdevice, unsigned int
96 chan, unsigned int range, struct comedi_krange *krange);
97 unsigned int comedi_get_buf_head_pos(void *dev, unsigned int subdevice);
98 int comedi_set_user_int_count(void *dev, unsigned int subdevice,
99 unsigned int buf_user_count);
100 int comedi_map(void *dev, unsigned int subdev, void *ptr);
101 int comedi_unmap(void *dev, unsigned int subdev);
102 int comedi_get_buffer_size(void *dev, unsigned int subdev);
103 int comedi_mark_buffer_read(void *dev, unsigned int subdevice,
104 unsigned int num_bytes);
105 int comedi_mark_buffer_written(void *d, unsigned int subdevice,
106 unsigned int num_bytes);
107 int comedi_get_buffer_contents(void *dev, unsigned int subdevice);
108 int comedi_get_buffer_offset(void *dev, unsigned int subdevice);