Specifications

Comedi
142 / 148
In addition to these data entities that are also known at the user level (device, sub-device, channel), the device driver level provides
two more data structures which the application programmer doesn’t get in touch with: the data structure comedi_driver that stores
the device driver information that is relevant at the operating system level, and the data structure comedi_async that stores the
information about all asynchronous activities (interrupts, callbacks and events).
6.2.1.1 comedi_lrange
The channel information is simple, since it contains only the signal range information:
struct comedi_lrange_struct{
int length;
comedi_krange range[GCC_ZERO_LENGTH_ARRAY];
};
6.2.1.2 comedi_subdevice
The subdevice is the smallest Comedi entity that can be used for ‘stand-alone’ DAQ, so it is no surprise that it is quite big:
struct comedi_subdevice_struct{
int type;
int n_chan;
int subdev_flags;
int len_chanlist; /
*
maximum length of channel/gain list
*
/
void
*
private;
comedi_async
*
async;
void
*
lock;
void
*
busy;
unsigned int runflags;
int io_bits;
lsampl_t maxdata; /
*
if maxdata==0, use list
*
/
lsampl_t
*
maxdata_list; /
*
list is channel specific
*
/
unsigned int flags;
unsigned int
*
flaglist;
comedi_lrange
*
range_table;
comedi_lrange
**
range_table_list;
unsigned int
*
chanlist; /
*
driver-owned chanlist (not used)
*
/
int (
*
insn_read)(comedi_device
*
,comedi_subdevice
*
,comedi_insn
*
,lsampl_t
*
);
int (
*
insn_write)(comedi_device
*
,comedi_subdevice
*
,comedi_insn
*
,lsampl_t
*
);
int (
*
insn_bits)(comedi_device
*
,comedi_subdevice
*
,comedi_insn
*
,lsampl_t
*
);
int (
*
insn_config)(comedi_device
*
,comedi_subdevice
*
,comedi_insn
*
,lsampl_t
*
);
int (
*
do_cmd)(comedi_device
*
,comedi_subdevice
*
);
int (
*
do_cmdtest)(comedi_device
*
,comedi_subdevice
*
,comedi_cmd
*
);
int (
*
poll)(comedi_device
*
,comedi_subdevice
*
);
int (
*
cancel)(comedi_device
*
,comedi_subdevice
*
);
int (
*
buf_change)(comedi_device
*
,comedi_subdevice
*
s,unsigned long new_size);
void (
*
munge)(comedi_device
*
, comedi_subdevice
*
s, void
*
data, unsigned int num_bytes, -
unsigned int start_chan_index );
unsigned int state;