/* DIO devices are slightly special. Although it is possible to implement the insn_read/insn_write interface, it is much more useful to applications if you implement the insn_bits interface. This allows packed reading/writing of the DIO channels. The comedi core can convert between insn_bits and insn_read/write  */
static int rtd_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
/* DIO devices are slightly special. Although it is possible to implement the insn_read/insn_write interface, it is much more useful to applications if you implement the insn_bits interface. This allows packed reading/writing of the DIO channels. The comedi core can convert between insn_bits and insn_read/write  */
static int rtd_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{
	if (insn->n != 2)
		return -EINVAL;
	if (data[0]) {
		s->state &= ~data[0];
		s->state |= data[0] & data[1];
		RtdDio0Write(dev, s->state);
	}
	data[1] = RtdDio0Read(dev);
	return 2;
}