added insn support
[comedilib.git] / lib / ioctl.c
1 /*
2     lib/ioctl.c
3     comedi library routines
4
5     COMEDI - Linux Control and Measurement Device Interface
6     Copyright (C) 1997-8 David A. Schleef <ds@stm.lbl.gov>
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 #include <stdio.h>
25 #include <math.h>
26 #include <stdlib.h>
27 #include <sys/types.h>
28 #include <sys/stat.h>
29 #include <fcntl.h>
30 #include <unistd.h>
31 #include <sys/ioctl.h>
32 #include <errno.h>
33 #include <comedi.h>
34 #include <string.h>
35
36 #include <libinternal.h>
37
38
39 /* ioctl wrappers */
40
41 int ioctl_devinfo(int fd,comedi_devinfo *it)
42 {
43         return ioctl(fd,COMEDI_DEVINFO,it);
44 }
45
46 int ioctl_subdinfo(int fd,comedi_subdinfo *it)
47 {
48         return ioctl(fd,COMEDI_SUBDINFO,it);
49 }
50
51 int ioctl_chaninfo(int fd,unsigned int subdev,lsampl_t *maxdata_list,unsigned int *flaglist,unsigned int *rangelist)
52 {
53         comedi_chaninfo ci;
54
55         ci.subdev=subdev;
56         ci.flaglist=flaglist;
57         ci.rangelist=rangelist;
58         ci.maxdata_list=maxdata_list;
59
60         return ioctl(fd,COMEDI_CHANINFO,&ci);
61 }
62
63 int ioctl_trigger(int fd,comedi_trig *it)
64 {
65         return ioctl(fd,COMEDI_TRIG,it);
66 }
67
68 #ifdef HAVE_COMEDI_CMD
69 int ioctl_cmd(int fd,comedi_cmd *it)
70 {
71         return ioctl(fd,COMEDI_CMD,it);
72 }
73 #endif
74
75 int ioctl_lock(int fd,int subdevice)
76 {
77         return ioctl(fd,COMEDI_LOCK,subdevice);
78 }
79
80 int ioctl_unlock(int fd,int subdevice)
81 {
82         return ioctl(fd,COMEDI_UNLOCK,subdevice);
83 }
84
85 int ioctl_cancel(int fd,int subdevice)
86 {
87         return ioctl(fd,COMEDI_CANCEL,subdevice);
88 }
89
90 int ioctl_rangeinfo(int fd,int range_type,comedi_krange *range_ptr)
91 {
92         comedi_rangeinfo it;
93
94         it.range_type=range_type;
95         it.range_ptr=range_ptr;
96
97         return ioctl(fd,COMEDI_RANGEINFO,&it);
98 }
99
100