3
functions to return information about comedi devices
5
COMEDILIB - Linux Control and Measurement Device Interface Library
6
Copyright (C) 1997-2001 David A. Schleef <ds@schleef.org>
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation, version 2.1
13
This library 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 GNU
16
Lesser General Public License for more details.
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27
#include <sys/types.h>
31
#include <sys/ioctl.h>
35
#include "libinternal.h"
38
EXPORT_ALIAS_DEFAULT(_comedi_get_n_subdevices,comedi_get_n_subdevices,0.7.18);
39
int _comedi_get_n_subdevices(comedi_t *it)
44
return it->n_subdevices;
47
EXPORT_ALIAS_DEFAULT(_comedi_get_version_code,comedi_get_version_code,0.7.18);
48
int _comedi_get_version_code(comedi_t *it)
53
return it->devinfo.version_code;
56
EXPORT_ALIAS_DEFAULT(_comedi_get_driver_name,comedi_get_driver_name,0.7.18);
57
char* _comedi_get_driver_name(comedi_t *it)
62
return it->devinfo.driver_name;
65
EXPORT_ALIAS_DEFAULT(_comedi_get_board_name,comedi_get_board_name,0.7.18);
66
char* _comedi_get_board_name(comedi_t *it)
71
return it->devinfo.board_name;
74
EXPORT_ALIAS_DEFAULT(_comedi_get_subdevice_flags,comedi_get_subdevice_flags,0.7.18);
75
int _comedi_get_subdevice_flags(comedi_t *it,unsigned int subd)
80
return it->subdevices[subd].subd_flags;
83
EXPORT_ALIAS_DEFAULT(_comedi_get_subdevice_type,comedi_get_subdevice_type,0.7.18);
84
int _comedi_get_subdevice_type(comedi_t *it,unsigned int subd)
89
return it->subdevices[subd].type;
92
EXPORT_ALIAS_DEFAULT(_comedi_find_subdevice_by_type,comedi_find_subdevice_by_type,0.7.18);
93
int _comedi_find_subdevice_by_type(comedi_t *it,int type,unsigned int subd)
95
if(!valid_subd(it,subd))
98
for(;subd<it->n_subdevices;subd++){
99
if(it->subdevices[subd].type==type)
105
EXPORT_ALIAS_DEFAULT(_comedi_get_read_subdevice,comedi_get_read_subdevice,0.7.19);
106
int _comedi_get_read_subdevice(comedi_t *dev)
111
return dev->devinfo.read_subdevice;
114
EXPORT_ALIAS_DEFAULT(_comedi_get_write_subdevice,comedi_get_write_subdevice,0.7.19);
115
int _comedi_get_write_subdevice(comedi_t *dev)
120
return dev->devinfo.write_subdevice;
123
EXPORT_ALIAS_DEFAULT(_comedi_get_n_channels,comedi_get_n_channels,0.7.18);
124
int _comedi_get_n_channels(comedi_t *it,unsigned int subd)
126
if(!valid_subd(it,subd))
129
return it->subdevices[subd].n_chan;
135
EXPORT_ALIAS_DEFAULT(_comedi_get_maxdata,comedi_get_maxdata,0.7.18);
136
lsampl_t _comedi_get_maxdata(comedi_t *it,unsigned int subdevice,unsigned int chan)
138
if(!valid_chan(it,subdevice,chan))
141
if(it->subdevices[subdevice].maxdata_list)
142
return it->subdevices[subdevice].maxdata_list[chan];
144
return it->subdevices[subdevice].maxdata;
147
EXPORT_ALIAS_DEFAULT(_comedi_maxdata_is_chan_specific,comedi_maxdata_is_chan_specific,0.7.18);
148
int _comedi_maxdata_is_chan_specific(comedi_t *it,unsigned int subdevice)
150
if(it->subdevices[subdevice].maxdata_list)
155
EXPORT_ALIAS_DEFAULT(_comedi_get_rangetype,comedi_get_rangetype,0.7.18);
156
int _comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int chan)
158
if(!valid_chan(it,subdevice,chan))
161
if(it->subdevices[subdevice].range_type_list)
162
return it->subdevices[subdevice].range_type_list[chan];
164
return it->subdevices[subdevice].range_type;
168
EXPORT_ALIAS_DEFAULT(_comedi_get_range,comedi_get_range,0.7.18);
169
comedi_range * _comedi_get_range(comedi_t *it,unsigned int subdevice,unsigned int chan,unsigned int range)
173
if(!valid_chan(it,subdevice,chan))
176
range_type=comedi_get_rangetype(it,subdevice,chan);
178
if(range>=RANGE_LENGTH(range_type))
181
if(it->subdevices[subdevice].rangeinfo_list)
182
return it->subdevices[subdevice].rangeinfo_list[chan]+range;
184
return it->subdevices[subdevice].rangeinfo+range;