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