Specifications

Comedi
36 / 148
Comedi instructions are described by the comedi_insn structure. Applications send instructions to the driver in order to perform
control and measurement operations that are done immediately or synchronously, i.e., the operations complete before program
control returns to the application. In particular, instructions cannot describe acquisition that involves timers or external events.
The field insn determines the type of instruction that is sent to the driver. Valid instruction types are:
INSN_READ read values from an input channel
INSN_WRITE write values to an output channel
INSN_BITS read/write values on multiple digital I/O channels
INSN_CONFIG configure a subdevice
INSN_GTOD read a timestamp, identical to gettimeofday() except the seconds and microseconds values are of type
lsampl_t.
INSN_WAIT wait a specified number of nanoseconds
The number of samples to read or write, or the size of the configuration structure is specified by the field n, and the buffer for
those samples by data. The field subdev is the subdevice index that the instruction is sent to. The field chanspec specifies the
channel, range, and analog reference (if applicable).
Instructions can be sent to drivers using comedi_do_insn(). Multiple instructions can be sent to drivers in the same system
call using comedi_do_insnlist().
5.3.9 comedi_range
typedef struct comedi_range_struct comedi_range;
struct comedi_range_struct{
double min;
double max;
unsigned int unit;
}comedi_range;
The comedi_range structure conveys part of the information necessary to translate sample values to physical units, in particular,
the endpoints of the range and the physical unit type. The physical unit type is specified by the field unit, which may take the
values UNIT_volt for volts, UNIT_mA for milliamps, or UNIT_none for unitless. The endpoints are specified by the fields
min and max.
5.3.10 comedi_krange
typedef struct comedi_krange_struct comedi_krange;
struct comedi_krange_struct{
int min;
int max;
unsigned int flags;
};
The comedi_krange structure is used to transfer range information between the driver and Comedilib, and should not normally
be used by applications. The structure conveys the same information as the comedi_range structure, except the fields min and
max are integers, multiplied by a factor of 1000000 compared to the counterparts in comedi_range.
In addition, kcomedilib uses the comedi_krange structure in place of the comedi_range structure.