|
Xenomai 3.3.2
|
Channels. More...
Data Structures | |
| struct | a4l_channel |
| Structure describing some channel's characteristics. More... | |
| struct | a4l_channels_desc |
| Structure describing a channels set. More... | |
| struct | a4l_range |
| Structure describing a (unique) range. More... | |
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:
Channels are defined by their type and by some other characteristics like:
Such parameters must be declared for each channel composing a subdevice. The structure a4l_channel (struct a4l_channel) is used to define one channel.
Another structure named a4l_channels_desc (struct a4l_channels_desc) gathers all channels for a specific subdevice. This latter structure also stores :
Usually the channels descriptor looks like this:
struct a4l_channels_desc 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
},
};
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:
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 struct a4l_rngtab. Here is an example:
struct a4l_rngtab example_tab = {
length: 2,
rngs: {
RANGE_V(-5,5),
RANGE_V(-10,10),
},
};
For each subdevice, a specific structure is designed to gather all the ranges tabs of all the channels. In this structure, called struct a4l_rngdesc, three fields must be filled:
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:
struct a4l_rngdesc example_rng = RNG_GLOBAL(example_tab);