comedi_dio_bitfield2 man page
comedi_dio_bitfield2 — read/write multiple digital channels
int comedi_dio_bitfield2 (comedi_t * device, unsigned int subdevice, unsigned int write_mask, unsigned int * bits, unsigned int base_channel);
The function comedi_dio_bitfield2() allows multiple channels to be read or written together on a digital input, output, or configurable digital I/O device. The parameter write_mask and the value pointed to by bits are interpreted as bit fields, with the least significant bit representing channel base_channel. For each bit in write_mask that is set to 1, the cooresponding bit in *bits is written to the digital output channel. After writing all the output channels, each channel is read, and the result placed in the approprate bits in *bits. The result of reading an output channel is the last value written to the output channel.
All the channels may not be read or written at the exact same time. For example, the driver may need to sequentially write to several ports in order to set all the digital channels specified by the write_mask.