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 /* Kernel internal stuff. Needed by real-time modules and such. */
32 #error linux/comedilib.h should not be included by non-kernel-space code
35 /* exported functions */
37 #ifndef KCOMEDILIB_DEPRECATED
39 typedef void comedi_t;
41 /* these functions may not be called at real-time priority */
43 comedi_t *comedi_open(const char *path);
44 int comedi_close(comedi_t *dev);
46 /* these functions may be called at any priority, but may fail at
49 int comedi_lock(comedi_t *dev, unsigned int subdev);
50 int comedi_unlock(comedi_t *dev, unsigned int subdev);
52 /* these functions may be called at any priority, but you must hold
53 the lock for the subdevice */
55 int comedi_loglevel(int loglevel);
56 void comedi_perror(const char *s);
57 char *comedi_strerror(int errnum);
58 int comedi_errno(void);
59 int comedi_fileno(comedi_t *dev);
61 int comedi_cancel(comedi_t *dev, unsigned int subdev);
62 int comedi_register_callback(comedi_t *dev, unsigned int subdev,
63 unsigned int mask, int (*cb) (unsigned int, void *), void *arg);
65 int comedi_command(comedi_t *dev, comedi_cmd *cmd);
66 int comedi_command_test(comedi_t *dev, comedi_cmd *cmd);
67 int comedi_trigger(comedi_t *dev, unsigned int subdev, comedi_trig *it);
68 int __comedi_trigger(comedi_t *dev, unsigned int subdev, comedi_trig *it);
69 int comedi_data_write(comedi_t *dev, unsigned int subdev, unsigned int chan,
70 unsigned int range, unsigned int aref, lsampl_t data);
71 int comedi_data_read(comedi_t *dev, unsigned int subdev, unsigned int chan,
72 unsigned int range, unsigned int aref, lsampl_t *data);
73 int comedi_data_read_hint(comedi_t *dev, unsigned int subdev,
74 unsigned int chan, unsigned int range, unsigned int aref);
75 int comedi_data_read_delayed(comedi_t *dev, unsigned int subdev,
76 unsigned int chan, unsigned int range, unsigned int aref,
77 lsampl_t *data, unsigned int nano_sec);
78 int comedi_dio_config(comedi_t *dev, unsigned int subdev, unsigned int chan,
80 int comedi_dio_read(comedi_t *dev, unsigned int subdev, unsigned int chan,
82 int comedi_dio_write(comedi_t *dev, unsigned int subdev, unsigned int chan,
84 int comedi_dio_bitfield(comedi_t *dev, unsigned int subdev, unsigned int mask,
86 int comedi_get_n_subdevices(comedi_t *dev);
87 int comedi_get_version_code(comedi_t *dev);
88 const char *comedi_get_driver_name(comedi_t *dev);
89 const char *comedi_get_board_name(comedi_t *dev);
90 int comedi_get_subdevice_type(comedi_t *dev, unsigned int subdevice);
91 int comedi_find_subdevice_by_type(comedi_t *dev, int type, unsigned int subd);
92 int comedi_get_n_channels(comedi_t *dev, unsigned int subdevice);
93 lsampl_t comedi_get_maxdata(comedi_t *dev, unsigned int subdevice, unsigned
95 int comedi_get_n_ranges(comedi_t *dev, unsigned int subdevice, unsigned int
97 int comedi_do_insn(comedi_t *dev, comedi_insn *insn);
98 int comedi_poll(comedi_t *dev, unsigned int subdev);
100 /* DEPRECATED functions */
101 int comedi_get_rangetype(comedi_t *dev, unsigned int subdevice,
104 /* ALPHA functions */
105 unsigned int comedi_get_subdevice_flags(comedi_t *dev, unsigned int subdevice);
106 int comedi_get_len_chanlist(comedi_t *dev, unsigned int subdevice);
107 int comedi_get_krange(comedi_t *dev, unsigned int subdevice, unsigned int
108 chan, unsigned int range, comedi_krange *krange);
109 unsigned int comedi_get_buf_head_pos(comedi_t *dev, unsigned int subdevice);
110 int comedi_set_user_int_count(comedi_t *dev, unsigned int subdevice,
111 unsigned int buf_user_count);
112 int comedi_map(comedi_t *dev, unsigned int subdev, void *ptr);
113 int comedi_unmap(comedi_t *dev, unsigned int subdev);
114 int comedi_get_buffer_size(comedi_t *dev, unsigned int subdev);
115 int comedi_mark_buffer_read(comedi_t *dev, unsigned int subdevice,
116 unsigned int num_bytes);
117 int comedi_mark_buffer_written(comedi_t *d, unsigned int subdevice,
118 unsigned int num_bytes);
119 int comedi_get_buffer_contents(comedi_t *dev, unsigned int subdevice);
120 int comedi_get_buffer_offset(comedi_t *dev, unsigned int subdevice);
124 /* these functions may not be called at real-time priority */
126 int comedi_open(unsigned int minor);
127 void comedi_close(unsigned int minor);
129 /* these functions may be called at any priority, but may fail at
130 real-time priority */
132 int comedi_lock(unsigned int minor, unsigned int subdev);
133 int comedi_unlock(unsigned int minor, unsigned int subdev);
135 /* these functions may be called at any priority, but you must hold
136 the lock for the subdevice */
138 int comedi_cancel(unsigned int minor, unsigned int subdev);
139 int comedi_register_callback(unsigned int minor, unsigned int subdev,
140 unsigned int mask, int (*cb) (unsigned int, void *), void *arg);
142 int comedi_command(unsigned int minor, comedi_cmd *cmd);
143 int comedi_command_test(unsigned int minor, comedi_cmd *cmd);
144 int comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig *it);
145 int __comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig *it);
146 int comedi_data_write(unsigned int dev, unsigned int subdev, unsigned int chan,
147 unsigned int range, unsigned int aref, lsampl_t data);
148 int comedi_data_read(unsigned int dev, unsigned int subdev, unsigned int chan,
149 unsigned int range, unsigned int aref, lsampl_t *data);
150 int comedi_dio_config(unsigned int dev, unsigned int subdev, unsigned int chan,
152 int comedi_dio_read(unsigned int dev, unsigned int subdev, unsigned int chan,
154 int comedi_dio_write(unsigned int dev, unsigned int subdev, unsigned int chan,
156 int comedi_dio_bitfield(unsigned int dev, unsigned int subdev,
157 unsigned int mask, unsigned int *bits);
158 int comedi_get_n_subdevices(unsigned int dev);
159 int comedi_get_version_code(unsigned int dev);
160 char *comedi_get_driver_name(unsigned int dev);
161 char *comedi_get_board_name(unsigned int minor);
162 int comedi_get_subdevice_type(unsigned int minor, unsigned int subdevice);
163 int comedi_find_subdevice_by_type(unsigned int minor, int type,
165 int comedi_get_n_channels(unsigned int minor, unsigned int subdevice);
166 lsampl_t comedi_get_maxdata(unsigned int minor, unsigned int subdevice, unsigned
168 int comedi_get_n_ranges(unsigned int minor, unsigned int subdevice, unsigned int
170 int comedi_do_insn(unsigned int minor, comedi_insn *insn);
171 int comedi_poll(unsigned int minor, unsigned int subdev);
173 /* DEPRECATED functions */
174 int comedi_get_rangetype(unsigned int minor, unsigned int subdevice,
177 /* ALPHA functions */
178 unsigned int comedi_get_subdevice_flags(unsigned int minor, unsigned int
180 int comedi_get_len_chanlist(unsigned int minor, unsigned int subdevice);
181 int comedi_get_krange(unsigned int minor, unsigned int subdevice, unsigned int
182 chan, unsigned int range, comedi_krange *krange);
183 unsigned int comedi_get_buf_head_pos(unsigned int minor, unsigned int
185 int comedi_set_user_int_count(unsigned int minor, unsigned int subdevice,
186 unsigned int buf_user_count);
187 int comedi_map(unsigned int minor, unsigned int subdev, void **ptr);
188 int comedi_unmap(unsigned int minor, unsigned int subdev);