return result;
}
-static int s526_ai_eoc(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned long context)
+static int s526_eoc(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned long context)
{
unsigned int status;
status = inw(dev->iobase + S526_INT_STATUS_REG);
- if (status & S526_INT_AI)
+ if (status & context) {
+ /* we got our eoc event, clear it */
+ outw(context, dev->iobase + S526_INT_STATUS_REG);
return 0;
+ }
return -EBUSY;
}
outw(ctrl, dev->iobase + S526_AI_CTRL_REG);
/* wait for conversion to end */
- ret = comedi_timeout(dev, s, insn, s526_ai_eoc, 0);
+ ret = comedi_timeout(dev, s, insn, s526_eoc, S526_INT_AI);
if (ret)
return ret;
- outw(S526_INT_AI, dev->iobase + S526_INT_STATUS_REG);
-
d = inw(dev->iobase + S526_AI_REG);
/* munge data */
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int ctrl = S526_AO_CTRL_CHAN(chan);
unsigned int val = s->readback[chan];
+ int ret;
int i;
outw(ctrl, dev->iobase + S526_AO_CTRL_REG);
val = data[i];
outw(val, dev->iobase + S526_AO_REG);
outw(ctrl, dev->iobase + S526_AO_CTRL_REG);
+
+ /* wait for conversion to end */
+ ret = comedi_timeout(dev, s, insn, s526_eoc, S526_INT_AO);
+ if (ret)
+ return ret;
}
s->readback[chan] = val;