pcl812: Untested bug fix for multi-channel AI commands. Update MUX on
authorIan Abbott <abbotti@mev.co.uk>
Wed, 20 Jan 2010 11:52:49 +0000 (11:52 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Wed, 20 Jan 2010 11:52:49 +0000 (11:52 +0000)
AI interrupt.

comedi/drivers/pcl812.c

index 807394d754e52c64cbf23eff9130e4ec50e096f0..eac1021cdc06aa20f69508664d31baf336c5d966 100644 (file)
@@ -924,6 +924,7 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d)
        unsigned int mask, timeout;
        comedi_device *dev = d;
        comedi_subdevice *s = dev->subdevices + 0;
+       unsigned int next_chan;
 
        s->async->events = 0;
 
@@ -962,10 +963,18 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d)
                ((inb(dev->iobase + PCL812_AD_HI) << 8) | inb(dev->iobase +
                                PCL812_AD_LO)) & mask);
 
+       /* Set up next channel.  Added by abbotti 2010-01-20, but untested. */
+       next_chan = s->async->cur_chan + 1;
+       if (next_chan >= devpriv->ai_n_chan)
+               next_chan = 0;
+       if (devpriv->ai_chanlist[s->async->cur_chan] !=
+                       devpriv->ai_chanlist[next_chan])
+               setup_range_channel(dev, s, devpriv->ai_chanlist[next_chan], 0);
+
        outb(0, dev->iobase + PCL812_CLRINT);   /* clear INT request */
 
-       s->async->cur_chan++;
-       if (s->async->cur_chan >= devpriv->ai_n_chan) { /* one scan done */
+       s->async->cur_chan = next_chan;
+       if (next_chan == 0) {   /* one scan done */
                s->async->cur_chan = 0;
                devpriv->ai_act_scan++;
                if (!(devpriv->ai_neverending))