Xenomai API  2.6.5
channel_range.h
Go to the documentation of this file.
1 
23 #ifndef __ANALOGY_CHANNEL_RANGE__
24 #define __ANALOGY_CHANNEL_RANGE__
25 
26 #if __GNUC__ >= 3
27 #define GCC_ZERO_LENGTH_ARRAY
28 #else
29 #define GCC_ZERO_LENGTH_ARRAY 0
30 #endif
31 
128 /* --- Channel section --- */
129 
139 #define A4L_CHAN_AREF_GROUND 0x1
140 
143 #define A4L_CHAN_AREF_COMMON 0x2
144 
147 #define A4L_CHAN_AREF_DIFF 0x4
148 
151 #define A4L_CHAN_AREF_OTHER 0x8
152 
158 #define A4L_CHAN_GLOBAL 0x10
159 
164 struct a4l_channel {
165  unsigned long flags;
166  unsigned long nb_bits;
167 };
168 typedef struct a4l_channel a4l_chan_t;
169 
181 #define A4L_CHAN_GLOBAL_CHANDESC 0
182 
185 #define A4L_CHAN_PERCHAN_CHANDESC 1
186 
194  unsigned long mode;
195  unsigned long length;
196  a4l_chan_t chans[GCC_ZERO_LENGTH_ARRAY];
197 };
198 typedef struct a4l_channels_desc a4l_chdesc_t;
199 
200 /* --- Range section --- */
201 
204 #define A4L_RNG_FACTOR 1000000
205 
209 #define A4L_RNG_VOLT_UNIT 0x0
210 
213 #define A4L_RNG_MAMP_UNIT 0x1
214 
217 #define A4L_RNG_NO_UNIT 0x2
218 
221 #define A4L_RNG_EXT_UNIT 0x4
222 
225 #define A4L_RNG_UNIT(x) (x & (A4L_RNG_VOLT_UNIT | \
226  A4L_RNG_MAMP_UNIT | \
227  A4L_RNG_NO_UNIT | \
228  A4L_RNG_EXT_UNIT))
229 
233 #define A4L_RNG_GLOBAL 0x8
234 
239 struct a4l_range {
240  long min;
241  long max;
242  unsigned long flags;
243 };
244 typedef struct a4l_range a4l_rng_t;
245 
249 #define RANGE(x,y) {(x * A4L_RNG_FACTOR), (y * A4L_RNG_FACTOR), \
250  A4L_RNG_NO_UNIT}
251 
254 #define RANGE_V(x,y) {(x * A4L_RNG_FACTOR),(y * A4L_RNG_FACTOR), \
255  A4L_RNG_VOLT_UNIT}
256 
259 #define RANGE_mA(x,y) {(x * A4L_RNG_FACTOR),(y * A4L_RNG_FACTOR), \
260  A4L_RNG_MAMP_UNIT}
261 
264 #define RANGE_ext(x,y) {(x * A4L_RNG_FACTOR),(y * A4L_RNG_FACTOR), \
265  A4L_RNG_EXT_UNIT}
266 
267 
268 /* Ranges tab descriptor */
269 #define A4L_RNGTAB(x) \
270  struct { \
271  unsigned char length; \
272  a4l_rng_t rngs[x]; \
273  }
274 typedef A4L_RNGTAB(GCC_ZERO_LENGTH_ARRAY) a4l_rngtab_t;
275 
279 #define A4L_RNG_GLOBAL_RNGDESC 0
280 
283 #define A4L_RNG_PERCHAN_RNGDESC 1
284 
285 /* Global ranges descriptor */
286 #define A4L_RNGDESC(x) \
287  struct { \
288  unsigned char mode; \
289  unsigned char length; \
290  a4l_rngtab_t *rngtabs[x]; \
291  }
292 typedef A4L_RNGDESC(GCC_ZERO_LENGTH_ARRAY) a4l_rngdesc_t;
293 
297 #define RNG_GLOBAL(x) { \
298  .mode = A4L_RNG_GLOBAL_RNGDESC, \
299  .length = 1, \
300  .rngtabs = {&(x)}, }
301 
302 extern a4l_rngdesc_t a4l_range_bipolar10;
303 extern a4l_rngdesc_t a4l_range_bipolar5;
304 extern a4l_rngdesc_t a4l_range_unipolar10;
305 extern a4l_rngdesc_t a4l_range_unipolar5;
306 extern a4l_rngdesc_t a4l_range_unknown;
307 extern a4l_rngdesc_t a4l_range_fake;
308 
309 #define range_digital a4l_range_unipolar5
310 
313 #endif /* __ANALOGY_CHANNEL_RANGE__ */
Structure describing some channel's characteristics.
Definition: channel_range.h:164
unsigned long flags
Definition: channel_range.h:242
unsigned long flags
Definition: channel_range.h:165
long max
Definition: channel_range.h:241
unsigned long length
Definition: channel_range.h:195
unsigned long mode
Definition: channel_range.h:194
Structure describing a (unique) range.
Definition: channel_range.h:239
long min
Definition: channel_range.h:240
unsigned long nb_bits
Definition: channel_range.h:166
Structure describing a channels set.
Definition: channel_range.h:193
a4l_chan_t chans[GCC_ZERO_LENGTH_ARRAY]
Definition: channel_range.h:196