This file is indexed.

/usr/include/xenomai/analogy/channel_range.h is in libxenomai-dev 2.6.2.1-2ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/**
 * @file
 * Analogy for Linux, channel, range related features
 *
 * Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org>
 * Copyright (C) 2008 Alexis Berlemont <alexis.berlemont@free.fr>
 *
 * Xenomai is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Xenomai is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Xenomai; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef __ANALOGY_CHANNEL_RANGE__
#define __ANALOGY_CHANNEL_RANGE__

#if __GNUC__ >= 3
#define GCC_ZERO_LENGTH_ARRAY
#else
#define GCC_ZERO_LENGTH_ARRAY 0
#endif

/*!
 * @ingroup driverfacilities
 * @defgroup channelrange Channels and ranges
 *
 * Channels
 *
 * According to the Analogy nomenclature, the channel is the elementary
 * acquisition entity. One channel is supposed to acquire one data at
 * a time. A channel can be:
 * - an analog input or an analog ouput;
 * - a digital input or a digital ouput;
 *
 * Channels are defined by their type and by some other
 * characteristics like:
 * - their resolutions for analog channels (which usually ranges from
     8 to 32 bits);
 * - their references;
 *
 * Such parameters must be declared for each channel composing a
 * subdevice. The structure a4l_channel (a4l_chan_t) is used to
 * define one channel.
 *
 * Another structure named a4l_channels_desc (a4l_chdesc_t)
 * gathers all channels for a specific subdevice. This latter
 * structure also stores :
 * - the channels count;
 * - the channels declaration mode (A4L_CHAN_GLOBAL_CHANDESC or
     A4L_CHAN_PERCHAN_CHANDESC): if all the channels composing a
     subdevice are identical, there is no need to declare the
     parameters for each channel; the global declaration mode eases
     the structure composition.
 *
 * Usually the channels descriptor looks like this:
 * <tt> @verbatim
a4l_chdesc_t example_chan = {
	mode: A4L_CHAN_GLOBAL_CHANDESC, -> Global declaration
					      mode is set
	length: 8, -> 8 channels
	chans: {
		{A4L_CHAN_AREF_GROUND, 16}, -> Each channel is 16 bits
						  wide with the ground as
						  reference
	},
};
@endverbatim </tt>
 *
 * Ranges
 *
 * So as to perform conversion from logical values acquired by the
 * device to physical units, some range structure(s) must be declared
 * on the driver side.
 *
 * Such structures contain:
 * - the physical unit type (Volt, Ampere, none);
 * - the minimal and maximal values;
 *
 * These range structures must be associated with the channels at
 * subdevice registration time as a channel can work with many
 * ranges. At configuration time (thanks to an Analogy command), one
 * range will be selected for each enabled channel.
 *
 * Consequently, for each channel, the developer must declare all the
 * possible ranges in a structure called a4l_rngtab_t. Here is an
 * example:
 * <tt> @verbatim
a4l_rngtab_t example_tab = {
    length: 2,
    rngs: {
	RANGE_V(-5,5),
	RANGE_V(-10,10),
    },
};
@endverbatim </tt>
 *
 * For each subdevice, a specific structure is designed to gather all
 * the ranges tabs of all the channels. In this structure, called
 * a4l_rngdesc_t, three fields must be filled:
 * - the declaration mode (A4L_RNG_GLOBAL_RNGDESC or
 *   A4L_RNG_PERCHAN_RNGDESC);
 * - the number of ranges tab;
 * - the tab of ranges tabs pointers;
 *
 * Most of the time, the channels which belong to the same subdevice
 * use the same set of ranges. So, there is no need to declare the
 * same ranges for each channel. A macro is defined to prevent
 * redundant declarations: RNG_GLOBAL().
 *
 * Here is an example:
 * <tt> @verbatim
a4l_rngdesc_t example_rng = RNG_GLOBAL(example_tab);
@endverbatim </tt>
 *
 * @{
 */


/* --- Channel section --- */

/*!
 * @anchor A4L_CHAN_AREF_xxx @name Channel reference
 * @brief Flags to define the channel's reference
 * @{
 */

/**
 * Ground reference
 */
#define A4L_CHAN_AREF_GROUND 0x1
/**
 * Common reference
 */
#define A4L_CHAN_AREF_COMMON 0x2
/**
 * Differential reference
 */
#define A4L_CHAN_AREF_DIFF 0x4
/**
 * Misc reference
 */
#define A4L_CHAN_AREF_OTHER 0x8

	  /*! @} A4L_CHAN_AREF_xxx */

/**
 * Internal use flag (must not be used by driver developer)
 */
#define A4L_CHAN_GLOBAL 0x10

/*!
 * @brief Structure describing some channel's characteristics
 */

struct a4l_channel {
	unsigned long flags; /*!< Channel flags to define the reference. */
	unsigned long nb_bits; /*!< Channel resolution. */
};
typedef struct a4l_channel a4l_chan_t;

/*!
 * @anchor A4L_CHAN_xxx @name Channels declaration mode
 * @brief Constant to define whether the channels in a descriptor are
 * identical
 * @{
 */

/**
 * Global declaration, the set contains channels with similar
 * characteristics
 */
#define A4L_CHAN_GLOBAL_CHANDESC 0
/**
 * Per channel declaration, the decriptor gathers differents channels
 */
#define A4L_CHAN_PERCHAN_CHANDESC 1

	  /*! @} A4L_CHAN_xxx */

/*!
 * @brief Structure describing a channels set
 */

struct a4l_channels_desc {
	unsigned long mode; /*!< Declaration mode (global or per channel) */
	unsigned long length; /*!< Channels count */
	a4l_chan_t chans[GCC_ZERO_LENGTH_ARRAY]; /*!< Channels tab */
};
typedef struct a4l_channels_desc a4l_chdesc_t;

/* --- Range section --- */

/** Constant for internal use only (must not be used by driver
    developer).  */
#define A4L_RNG_FACTOR 1000000

/**
 * Volt unit range flag
 */
#define A4L_RNG_VOLT_UNIT 0x0
/**
 * MilliAmpere unit range flag
 */
#define A4L_RNG_MAMP_UNIT 0x1
/**
 * No unit range flag
 */
#define A4L_RNG_NO_UNIT 0x2
/**
 * External unit range flag
 */
#define A4L_RNG_EXT_UNIT 0x4
/**
 * Macro to retrieve the range unit from the range flags
 */
#define A4L_RNG_UNIT(x) (x & (A4L_RNG_VOLT_UNIT |	\
			      A4L_RNG_MAMP_UNIT |	\
			      A4L_RNG_NO_UNIT |		\
			      A4L_RNG_EXT_UNIT))

/**
 * Internal use flag (must not be used by driver developer)
 */
#define A4L_RNG_GLOBAL 0x8

/*!
 * @brief Structure describing a (unique) range
 */

struct a4l_range {
	long min; /*!< Minimal value */
	long max; /*!< Maximal falue */
	unsigned long flags; /*!< Range flags (unit, etc.) */
};
typedef struct a4l_range a4l_rng_t;

/**
 * Macro to declare a (unique) range with no unit defined
 */
#define RANGE(x,y) {(x * A4L_RNG_FACTOR), (y * A4L_RNG_FACTOR),	\
			A4L_RNG_NO_UNIT}
/**
 * Macro to declare a (unique) range in Volt
 */
#define RANGE_V(x,y) {(x * A4L_RNG_FACTOR),(y * A4L_RNG_FACTOR), \
			A4L_RNG_VOLT_UNIT}
/**
 * Macro to declare a (unique) range in milliAmpere
 */
#define RANGE_mA(x,y) {(x * A4L_RNG_FACTOR),(y * A4L_RNG_FACTOR), \
			A4L_RNG_MAMP_UNIT}
/**
 * Macro to declare a (unique) range in some external reference
 */
#define RANGE_ext(x,y) {(x * A4L_RNG_FACTOR),(y * A4L_RNG_FACTOR), \
			A4L_RNG_EXT_UNIT}


/* Ranges tab descriptor */
#define A4L_RNGTAB(x)				\
	struct {				\
		unsigned char length;		\
		a4l_rng_t rngs[x];		\
	}
typedef A4L_RNGTAB(GCC_ZERO_LENGTH_ARRAY) a4l_rngtab_t;

/**
 * Constant to define a ranges descriptor as global (inter-channel)
 */
#define A4L_RNG_GLOBAL_RNGDESC 0
/**
 * Constant to define a ranges descriptor as specific for a channel
 */
#define A4L_RNG_PERCHAN_RNGDESC 1

/* Global ranges descriptor */
#define A4L_RNGDESC(x)				\
	struct {				\
		unsigned char mode;		\
		unsigned char length;		\
		a4l_rngtab_t *rngtabs[x];	\
	}
typedef A4L_RNGDESC(GCC_ZERO_LENGTH_ARRAY) a4l_rngdesc_t;

/**
 * Macro to declare a ranges global descriptor in one line
 */
#define RNG_GLOBAL(x) {				\
	.mode = A4L_RNG_GLOBAL_RNGDESC, 	\
	.length =  1,				\
	.rngtabs = {&(x)}, }

extern a4l_rngdesc_t a4l_range_bipolar10;
extern a4l_rngdesc_t a4l_range_bipolar5;
extern a4l_rngdesc_t a4l_range_unipolar10;
extern a4l_rngdesc_t a4l_range_unipolar5;
extern a4l_rngdesc_t a4l_range_unknown;
extern a4l_rngdesc_t a4l_range_fake;

#define range_digital a4l_range_unipolar5

	  /*! @} channelrange */

#endif /* __ANALOGY_CHANNEL_RANGE__ */