/* divisors of master clock for analog output pacing */
unsigned int ao_divisor1;
unsigned int ao_divisor2;
- unsigned int trimpot_value[NUM_CHANNELS_8402];
unsigned int dac08_value;
unsigned int calibration_source;
};
struct comedi_insn *insn,
unsigned int *data)
{
- struct cb_pcidas_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
if (insn->n) {
unsigned int val = data[insn->n - 1];
- if (devpriv->trimpot_value[chan] != val) {
+ if (s->readback[chan] != val) {
cb_pcidas_trimpot_write(dev, chan, val);
- devpriv->trimpot_value[chan] = val;
+ s->readback[chan] = val;
}
}
return insn->n;
}
-static int trimpot_read_insn(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
-{
- struct cb_pcidas_private *devpriv = dev->private;
- unsigned int channel = CR_CHAN(insn->chanspec);
-
- data[0] = devpriv->trimpot_value[channel];
-
- return 1;
-}
-
static int cb_pcidas_ai_check_chanlist(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_cmd *cmd)
s->n_chan = NUM_CHANNELS_8402;
s->maxdata = 0xff;
}
- s->insn_read = trimpot_read_insn;
s->insn_write = cb_pcidas_trimpot_insn_write;
+
+ ret = comedi_alloc_subdev_readback(s);
+ if (ret)
+ return ret;
+
for (i = 0; i < s->n_chan; i++) {
cb_pcidas_trimpot_write(dev, i, s->maxdata / 2);
- devpriv->trimpot_value[i] = s->maxdata / 2;
+ s->readback[i] = s->maxdata / 2;
}
/* dac08 caldac */