1COMEDI_GET_SUBDEVICE(3) Comedi reference COMEDI_GET_SUBDEVICE(3)
2
3
4
6 comedi_get_subdevice_flags - properties of subdevice
7
9 #include <comedilib.h>
10
11 int comedi_get_subdevice_flags(comedi_t * device,
12 unsigned int subdevice);
13
15 The function comedi_get_subdevice_flags returns a bitfield describing
16 the capabilities of the specified subdevice subdevice of the Comedi
17 device device. If there is an error, -1 is returned, and the Comedilib
18 error value is set.
19
20 ┌──────────────────────┬───────────────┬───────────────────────────────┐
21 │ Subdevice Flag │ Value (hex) │ Description │
22 ├──────────────────────┼───────────────┼───────────────────────────────┤
23 │ SDF_BUSY │ 0x00000001 │ The subdevice is │
24 │ │ │ busy performing an │
25 │ │ │ asynchronous │
26 │ │ │ command. A │
27 │ │ │ subdevice being │
28 │ │ │ “busy” is slightly │
29 │ │ │ different from the │
30 │ │ │ “running” state │
31 │ │ │ flagged by │
32 │ │ │ SDF_RUNNING. A │
33 │ │ │ “running” subdevice │
34 │ │ │ is always “busy”, │
35 │ │ │ but a “busy” │
36 │ │ │ subdevice is not │
37 │ │ │ necessarily │
38 │ │ │ “running”. For │
39 │ │ │ example, suppose an │
40 │ │ │ analog input │
41 │ │ │ command has been │
42 │ │ │ completed by the │
43 │ │ │ hardware, but there │
44 │ │ │ are still samples │
45 │ │ │ in Comedi's buffer │
46 │ │ │ waiting to be read │
47 │ │ │ out. In this case, │
48 │ │ │ the subdevice is │
49 │ │ │ not “running”, but │
50 │ │ │ is still “busy” │
51 │ │ │ until all the │
52 │ │ │ samples are read │
53 │ │ │ out or │
54 │ │ │ comedi_cancel is │
55 │ │ │ called. │
56 ├──────────────────────┼───────────────┼───────────────────────────────┤
57 │ SDF_BUSY_OWNER │ 0x00000002 │ The subdevice is │
58 │ │ │ “busy”, and the │
59 │ │ │ command it is │
60 │ │ │ running was started │
61 │ │ │ by the current │
62 │ │ │ process. │
63 ├──────────────────────┼───────────────┼───────────────────────────────┤
64 │ SDF_LOCKED │ 0x00000004 │ The subdevice has │
65 │ │ │ been locked by │
66 │ │ │ comedi_lock. │
67 ├──────────────────────┼───────────────┼───────────────────────────────┤
68 │ SDF_LOCK_OWNER │ 0x00000008 │ The subdevice is │
69 │ │ │ locked, and was │
70 │ │ │ locked by the │
71 │ │ │ current process. │
72 ├──────────────────────┼───────────────┼───────────────────────────────┤
73 │ SDF_MAXDATA │ 0x00000010 │ The maximum data │
74 │ │ │ value for the │
75 │ │ │ subdevice depends │
76 │ │ │ on the channel. │
77 ├──────────────────────┼───────────────┼───────────────────────────────┤
78 │ SDF_FLAGS │ 0x00000020 │ The subdevice flags │
79 │ │ │ depend on the │
80 │ │ │ channel │
81 │ │ │ (unfinished/broken │
82 │ │ │ support in │
83 │ │ │ library). │
84 ├──────────────────────┼───────────────┼───────────────────────────────┤
85 │ SDF_RANGETYPE │ 0x00000040 │ The range type │
86 │ │ │ depends on the │
87 │ │ │ channel. │
88 ├──────────────────────┼───────────────┼───────────────────────────────┤
89 │ SDF_CMD │ 0x00001000 │ The subdevice │
90 │ │ │ supports │
91 │ │ │ asynchronous │
92 │ │ │ commands. │
93 ├──────────────────────┼───────────────┼───────────────────────────────┤
94 │ SDF_SOFT_CALIBRATED │ 0x00002000 │ The subdevice │
95 │ │ │ relies on the host │
96 │ │ │ to do calibration │
97 │ │ │ in software. │
98 │ │ │ Software │
99 │ │ │ calibration │
100 │ │ │ coefficients are │
101 │ │ │ determined by the │
102 │ │ │ comedi_soft_calibrate │
103 │ │ │ utility. See the │
104 │ │ │ description of the │
105 │ │ │ comedi_get_softcal_converter │
106 │ │ │ function for more │
107 │ │ │ information. │
108 ├──────────────────────┼───────────────┼───────────────────────────────┤
109 │ SDF_READABLE │ 0x00010000 │ The subdevice can be read │
110 │ │ │ (e.g. analog input). │
111 ├──────────────────────┼───────────────┼───────────────────────────────┤
112 │ SDF_WRITABLE │ 0x00020000 │ The subdevice can be written │
113 │ │ │ to (e.g. analog output). │
114 ├──────────────────────┼───────────────┼───────────────────────────────┤
115 │ SDF_INTERNAL │ 0x00040000 │ The subdevice does not have │
116 │ │ │ externally visible lines. │
117 ├──────────────────────┼───────────────┼───────────────────────────────┤
118 │ SDF_GROUND │ 0x00100000 │ The subdevice supports │
119 │ │ │ analog reference │
120 │ │ │ AREF_GROUND. │
121 ├──────────────────────┼───────────────┼───────────────────────────────┤
122 │ SDF_COMMON │ 0x00200000 │ The subdevice supports │
123 │ │ │ analog reference │
124 │ │ │ AREF_COMMON. │
125 ├──────────────────────┼───────────────┼───────────────────────────────┤
126 │ SDF_DIFF │ 0x00400000 │ The subdevice supports │
127 │ │ │ analog reference AREF_DIFF. │
128 ├──────────────────────┼───────────────┼───────────────────────────────┤
129 │ SDF_OTHER │ 0x00800000 │ The subdevice supports │
130 │ │ │ analog reference AREF_OTHER │
131 ├──────────────────────┼───────────────┼───────────────────────────────┤
132 │ SDF_DITHER │ 0x01000000 │ The subdevice supports │
133 │ │ │ dithering (via the │
134 │ │ │ CR_ALT_FILTER chanspec │
135 │ │ │ flag). │
136 ├──────────────────────┼───────────────┼───────────────────────────────┤
137 │ SDF_DEGLITCH │ 0x02000000 │ The subdevice supports │
138 │ │ │ deglitching (via the │
139 │ │ │ CR_ALT_FILTER chanspec │
140 │ │ │ flag). │
141 ├──────────────────────┼───────────────┼───────────────────────────────┤
142 │ SDF_RUNNING │ 0x08000000 │ An asynchronous command is │
143 │ │ │ running. You can use this │
144 │ │ │ flag to poll for the │
145 │ │ │ completion of an output │
146 │ │ │ command. │
147 ├──────────────────────┼───────────────┼───────────────────────────────┤
148 │ SDF_LSAMPL │ 0x10000000 │ The subdevice uses the │
149 │ │ │ 32-bit lsampl_t type instead │
150 │ │ │ of the 16-bit sampl_t for │
151 │ │ │ asynchronous command data. │
152 ├──────────────────────┼───────────────┼───────────────────────────────┤
153 │ SDF_PACKED │ 0x20000000 │ The subdevice uses bitfield │
154 │ │ │ samples for asynchronous │
155 │ │ │ command data, one bit per │
156 │ │ │ channel (otherwise it uses │
157 │ │ │ one sampl_t or lsampl_t per │
158 │ │ │ channel). Commonly used for │
159 │ │ │ digital subdevices. │
160 └──────────────────────┴───────────────┴───────────────────────────────┘
161
163 David Schleef <ds@schleef.org>
164 Author.
165
166 Frank Mori Hess <fmhess@users.sourceforge.net>
167 Author.
168
169 Herman Bruyninckx <Herman.Bruyninckx@mech.kuleuven.ac.be>
170 Author.
171
172 Bernd Porr <tech@linux-usb-daq.co.uk>
173 Author.
174
175 Ian Abbott <abbotti@mev.co.uk>
176 Author.
177
178 Éric Piel <piel@delmic.com>
179 Author.
180
182 Copyright © 1998-2003 David Schleef
183 Copyright © 2001-2003, 2005, 2008 Frank Mori Hess
184 Copyright © 2002-2003 Herman Bruyninckx
185 Copyright © 2012 Bernd Porr
186 Copyright © 2012 Ian Abbott
187 Copyright © 2012, 2015 Éric Piel
188
189 This document is part of Comedilib. In the context of this document,
190 the term "source code" as defined by the license is interpreted as the
191 XML source.
192
193 This library is free software; you can redistribute it and/or modify it
194 under the terms of the GNU Lesser General Public License as published
195 by the Free Software Foundation, version 2.1 of the License.
196
197 This library is distributed in the hope that it will be useful, but
198 WITHOUT ANY WARRANTY; without even the implied warranty of
199 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
200 General Public License for more details.
201
202 You should have received a copy of the GNU Lesser General Public
203 License along with this library; if not, write to the Free Software
204 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
205 USA.
206
207
208
209
210Comedi 05/11/2017 COMEDI_GET_SUBDEVICE(3)