comedilib.h revision e2a0eab0a121a95be60a81911df07cc21e4ee429
1/*
2    linux/include/comedilib.h
3    header file for kcomedilib
4
5    COMEDI - Linux Control and Measurement Device Interface
6    Copyright (C) 1998-2001 David A. Schleef <ds@schleef.org>
7
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.
12
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.
17
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.
21
22*/
23
24#ifndef _LINUX_COMEDILIB_H
25#define _LINUX_COMEDILIB_H
26
27/* these functions may not be called at real-time priority */
28
29void *comedi_open(const char *path);
30int comedi_close(void *dev);
31
32/* these functions may be called at any priority, but may fail at
33   real-time priority */
34
35int comedi_lock(void *dev, unsigned int subdev);
36int comedi_unlock(void *dev, unsigned int subdev);
37
38/* these functions may be called at any priority, but you must hold
39   the lock for the subdevice */
40
41int comedi_loglevel(int loglevel);
42void comedi_perror(const char *s);
43char *comedi_strerror(int errnum);
44int comedi_errno(void);
45int comedi_fileno(void *dev);
46
47int comedi_cancel(void *dev, unsigned int subdev);
48int comedi_register_callback(void *dev, unsigned int subdev,
49			     unsigned int mask, int (*cb) (unsigned int,
50							   void *), void *arg);
51
52int comedi_command(void *dev, struct comedi_cmd *cmd);
53int comedi_command_test(void *dev, struct comedi_cmd *cmd);
54int comedi_trigger(void *dev, unsigned int subdev, struct comedi_trig *it);
55int __comedi_trigger(void *dev, unsigned int subdev, struct comedi_trig *it);
56int comedi_data_write(void *dev, unsigned int subdev, unsigned int chan,
57		      unsigned int range, unsigned int aref, unsigned int data);
58int comedi_data_read(void *dev, unsigned int subdev, unsigned int chan,
59		     unsigned int range, unsigned int aref, unsigned int *data);
60int comedi_data_read_hint(void *dev, unsigned int subdev,
61			  unsigned int chan, unsigned int range,
62			  unsigned int aref);
63int comedi_data_read_delayed(void *dev, unsigned int subdev, unsigned int chan,
64			     unsigned int range, unsigned int aref,
65			     unsigned int *data, unsigned int nano_sec);
66int comedi_dio_config(void *dev, unsigned int subdev, unsigned int chan,
67		      unsigned int io);
68int comedi_dio_read(void *dev, unsigned int subdev, unsigned int chan,
69		    unsigned int *val);
70int comedi_dio_write(void *dev, unsigned int subdev, unsigned int chan,
71		     unsigned int val);
72int comedi_dio_bitfield(void *dev, unsigned int subdev, unsigned int mask,
73			unsigned int *bits);
74int comedi_get_n_subdevices(void *dev);
75int comedi_get_version_code(void *dev);
76const char *comedi_get_driver_name(void *dev);
77const char *comedi_get_board_name(void *dev);
78int comedi_get_subdevice_type(void *dev, unsigned int subdevice);
79int comedi_find_subdevice_by_type(void *dev, int type, unsigned int subd);
80int comedi_get_n_channels(void *dev, unsigned int subdevice);
81unsigned int comedi_get_maxdata(void *dev, unsigned int subdevice, unsigned
82				int chan);
83int comedi_get_n_ranges(void *dev, unsigned int subdevice, unsigned int chan);
84int comedi_do_insn(void *dev, struct comedi_insn *insn);
85int comedi_poll(void *dev, unsigned int subdev);
86
87/* DEPRECATED functions */
88int comedi_get_rangetype(void *dev, unsigned int subdevice, unsigned int chan);
89
90/* ALPHA functions */
91unsigned int comedi_get_subdevice_flags(void *dev, unsigned int subdevice);
92int comedi_get_len_chanlist(void *dev, unsigned int subdevice);
93int comedi_get_krange(void *dev, unsigned int subdevice, unsigned int
94		      chan, unsigned int range, struct comedi_krange *krange);
95unsigned int comedi_get_buf_head_pos(void *dev, unsigned int subdevice);
96int comedi_set_user_int_count(void *dev, unsigned int subdevice,
97			      unsigned int buf_user_count);
98int comedi_map(void *dev, unsigned int subdev, void *ptr);
99int comedi_unmap(void *dev, unsigned int subdev);
100int comedi_get_buffer_size(void *dev, unsigned int subdev);
101int comedi_mark_buffer_read(void *dev, unsigned int subdevice,
102			    unsigned int num_bytes);
103int comedi_mark_buffer_written(void *d, unsigned int subdevice,
104			       unsigned int num_bytes);
105int comedi_get_buffer_contents(void *dev, unsigned int subdevice);
106int comedi_get_buffer_offset(void *dev, unsigned int subdevice);
107
108
109#endif
110