unsigned int ofs; /* Counter base offset */
unsigned int clock_src[3]; /* Current clock sources */
unsigned int gate_src[3]; /* Current gate sources */
- spinlock_t spinlock;
};
struct dio200_subdev_8255 {
struct comedi_insn *insn,
unsigned int *data)
{
- struct dio200_subdev_8254 *subpriv = s->private;
int chan = CR_CHAN(insn->chanspec);
unsigned int n;
- unsigned long flags;
- for (n = 0; n < insn->n; n++) {
- spin_lock_irqsave(&subpriv->spinlock, flags);
+ for (n = 0; n < insn->n; n++)
data[n] = dio200_subdev_8254_read_chan(dev, s, chan);
- spin_unlock_irqrestore(&subpriv->spinlock, flags);
- }
+
return insn->n;
}
struct comedi_insn *insn,
unsigned int *data)
{
- struct dio200_subdev_8254 *subpriv = s->private;
int chan = CR_CHAN(insn->chanspec);
unsigned int n;
- unsigned long flags;
- for (n = 0; n < insn->n; n++) {
- spin_lock_irqsave(&subpriv->spinlock, flags);
+ for (n = 0; n < insn->n; n++)
dio200_subdev_8254_write_chan(dev, s, chan, data[n]);
- spin_unlock_irqrestore(&subpriv->spinlock, flags);
- }
+
return insn->n;
}
struct comedi_insn *insn,
unsigned int *data)
{
- struct dio200_subdev_8254 *subpriv = s->private;
int ret = 0;
int chan = CR_CHAN(insn->chanspec);
- unsigned long flags;
- spin_lock_irqsave(&subpriv->spinlock, flags);
switch (data[0]) {
case INSN_CONFIG_SET_COUNTER_MODE:
if (data[1] > (I8254_MODE5 | I8254_BCD))
ret = -EINVAL;
break;
}
- spin_unlock_irqrestore(&subpriv->spinlock, flags);
+
return ret < 0 ? ret : insn->n;
}
s->insn_write = dio200_subdev_8254_write;
s->insn_config = dio200_subdev_8254_config;
- spin_lock_init(&subpriv->spinlock);
subpriv->ofs = offset;
/* Initialize channels. */