unsigned int chunk_counter;
unsigned int chunk_num_samples;
- int ao_readback;
-
unsigned int div1;
unsigned int div2;
struct comedi_insn *insn,
unsigned int *data)
{
- struct pci9111_private_data *dev_private = dev->private;
- unsigned int val = 0;
+ unsigned int chan = CR_CHAN(insn->chanspec);
+ unsigned int val = s->readback[chan];
int i;
for (i = 0; i < insn->n; i++) {
val = data[i];
outw(val, dev->iobase + PCI9111_AO_REG);
}
- dev_private->ao_readback = val;
-
- return insn->n;
-}
-
-static int pci9111_ao_insn_read(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned int *data)
-{
- struct pci9111_private_data *dev_private = dev->private;
- int i;
-
- for (i = 0; i < insn->n; i++)
- data[i] = dev_private->ao_readback;
+ s->readback[chan] = val;
return insn->n;
}
s->len_chanlist = 1;
s->range_table = &range_bipolar10;
s->insn_write = pci9111_ao_insn_write;
- s->insn_read = pci9111_ao_insn_read;
+ s->insn_read = comedi_readback_insn_read;
+
+ ret = comedi_alloc_subdev_readback(s);
+ if (ret)
+ return ret;
s = &dev->subdevices[2];
s->type = COMEDI_SUBD_DI;