3 comedi library routines
5 COMEDI - Linux Control and Measurement Device Interface
6 Copyright (C) 1997-8 David A. Schleef <ds@stm.lbl.gov>
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.
27 #include <sys/types.h>
31 #include <sys/ioctl.h>
36 #include <libinternal.h>
39 int comedi_get_n_subdevices(comedi_t *it)
44 return it->n_subdevices;
47 int comedi_get_version_code(comedi_t *it)
52 return it->devinfo.version_code;
55 char *comedi_get_driver_name(comedi_t *it)
60 return it->devinfo.driver_name;
63 char *comedi_get_board_name(comedi_t *it)
68 return it->devinfo.board_name;
71 int comedi_get_subdevice_flags(comedi_t *it,unsigned int subd)
76 return it->subdevices[subd].subd_flags;
79 int comedi_get_subdevice_type(comedi_t *it,unsigned int subd)
84 return it->subdevices[subd].type;
87 int comedi_find_subdevice_by_type(comedi_t *it,int type,unsigned int subd)
89 if(!valid_subd(it,subd))
92 for(;subd<it->n_subdevices;subd++){
93 if(it->subdevices[subd].type==type)
100 int comedi_get_n_channels(comedi_t *it,unsigned int subd)
102 if(!valid_subd(it,subd))
105 return it->subdevices[subd].n_chan;
111 lsampl_t comedi_get_maxdata(comedi_t *it,unsigned int subdevice,unsigned int chan)
113 if(!valid_chan(it,subdevice,chan))
116 if(it->subdevices[subdevice].maxdata_list)
117 return it->subdevices[subdevice].maxdata_list[chan];
119 return it->subdevices[subdevice].maxdata;
122 int comedi_maxdata_is_chan_specific(comedi_t *it,unsigned int subdevice)
124 if(it->subdevices[subdevice].maxdata_list)
129 int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int chan)
131 if(!valid_chan(it,subdevice,chan))
134 if(it->subdevices[subdevice].range_type_list)
135 return it->subdevices[subdevice].range_type_list[chan];
137 return it->subdevices[subdevice].range_type;
141 comedi_range * comedi_get_range(comedi_t *it,unsigned int subdevice,unsigned int chan,unsigned int range)
145 if(!valid_chan(it,subdevice,chan))
148 range_type=comedi_get_rangetype(it,subdevice,chan);
150 if(range>=RANGE_LENGTH(range_type))
153 if(it->subdevices[subdevice].rangeinfo_list)
154 return it->subdevices[subdevice].rangeinfo_list[chan]+range;
156 return it->subdevices[subdevice].rangeinfo+range;