/*
* Called to start acquisition for an 'INTERRUPT' subdevice.
*/
-static void
+static int
dio200_start_intr(comedi_device *dev, comedi_subdevice *s)
{
unsigned int n;
unsigned isn_bits;
dio200_subdev_intr *subpriv = s->private;
comedi_cmd *cmd = &s->async->cmd;
+ int retval = 0;
if (!subpriv->continuous && subpriv->stopcount == 0) {
/* An empty acquisition! */
s->async->events |= COMEDI_CB_EOA;
- comedi_event(dev, s, s->async->events);
subpriv->active = 0;
+ retval = 1;
} else {
/* Determine interrupt sources to enable. */
isn_bits = 0;
subpriv->enabled_isns = isn_bits;
outb(isn_bits, subpriv->iobase);
}
+
+ return retval;
}
/*
{
dio200_subdev_intr *subpriv;
unsigned long flags;
+ int event = 0;
if (trignum != 0) return -EINVAL;
comedi_spin_lock_irqsave(&subpriv->spinlock, flags);
s->async->inttrig = 0;
if (subpriv->active) {
- dio200_start_intr(dev, s);
+ event = dio200_start_intr(dev, s);
}
comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags);
+ if (event) {
+ comedi_event(dev, s, s->async->events);
+ }
+
return 1;
}
unsigned triggered;
unsigned intstat;
unsigned cur_enabled;
+ unsigned int oldevents;
unsigned long flags;
triggered = 0;
comedi_spin_lock_irqsave(&subpriv->spinlock, flags);
+ oldevents = s->async->events;
/*
* Collect interrupt sources that have triggered and disable them
* temporarily. Loop around until no extra interrupt sources have
}
}
}
-
- if (s->async->events) {
- comedi_event(dev, s, s->async->events);
- }
}
}
}
comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags);
+ if (oldevents != s->async->events) {
+ comedi_event(dev, s, s->async->events);
+ }
+
return (triggered != 0);
}
comedi_cmd *cmd = &s->async->cmd;
dio200_subdev_intr *subpriv = s->private;
unsigned long flags;
+ int event = 0;
comedi_spin_lock_irqsave(&subpriv->spinlock, flags);
subpriv->active = 1;
break;
default:
/* TRIG_NOW */
- dio200_start_intr(dev, s);
+ event = dio200_start_intr(dev, s);
break;
}
comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags);
+ if (event) {
+ comedi_event(dev, s, s->async->events);
+ }
+
return 0;
}