struct labpc_private {
/* number of data points left to be taken */
unsigned long long count;
- /* software copy of analog output values */
- unsigned int ao_value[NUM_AO_CHAN];
/* software copys of bits written to command registers */
unsigned int cmd1;
unsigned int cmd2;
devpriv->write_byte(dev, val & 0xff, DAC_LSB_REG(chan));
devpriv->write_byte(dev, (val >> 8) & 0xff, DAC_MSB_REG(chan));
- devpriv->ao_value[chan] = val;
+ s->readback[chan] = val;
}
static int labpc_ao_insn_write(struct comedi_device *dev,
return 1;
}
-static int labpc_ao_insn_read(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned int *data)
-{
- struct labpc_private *devpriv = dev->private;
-
- data[0] = devpriv->ao_value[CR_CHAN(insn->chanspec)];
-
- return 1;
-}
-
/* lowlevel write to eeprom/dac */
static void labpc_serial_out(struct comedi_device *dev, unsigned int value,
unsigned int value_width)
s->n_chan = NUM_AO_CHAN;
s->maxdata = 0x0fff;
s->range_table = &range_labpc_ao;
- s->insn_read = labpc_ao_insn_read;
s->insn_write = labpc_ao_insn_write;
+ ret = comedi_alloc_subdev_readback(s);
+ if (ret)
+ return ret;
+
/* initialize analog outputs to a known value */
for (i = 0; i < s->n_chan; i++)
labpc_ao_write(dev, s, i, s->maxdata / 2);