pcl812: bug fix: scan counter was being incremented after every sample.
authorIan Abbott <abbotti@mev.co.uk>
Mon, 18 Jan 2010 16:20:08 +0000 (16:20 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Mon, 18 Jan 2010 16:20:08 +0000 (16:20 +0000)
Keep track of current channel and update scan counter at end of scan.

comedi/drivers/pcl812.c

index b8bf82505dfed8c555682fee9477db6791270347..807394d754e52c64cbf23eff9130e4ec50e096f0 100644 (file)
@@ -964,7 +964,9 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d)
 
        outb(0, dev->iobase + PCL812_CLRINT);   /* clear INT request */
 
-       if (s->async->cur_chan == 0) {  /* one scan done */
+       s->async->cur_chan++;
+       if (s->async->cur_chan >= devpriv->ai_n_chan) { /* one scan done */
+               s->async->cur_chan = 0;
                devpriv->ai_act_scan++;
                if (!(devpriv->ai_neverending))
                        if (devpriv->ai_act_scan >= devpriv->ai_scans) {        /* all data sampled */
@@ -989,7 +991,9 @@ static void transfer_from_dma_buf(comedi_device * dev, comedi_subdevice * s,
        for (i = len; i; i--) {
                comedi_buf_put(s->async, ptr[bufptr++]);        // get one sample
 
-               if (s->async->cur_chan == 0) {
+               s->async->cur_chan++;
+               if (s->async->cur_chan >= devpriv->ai_n_chan) {
+                       s->async->cur_chan = 0;
                        devpriv->ai_act_scan++;
                        if (!devpriv->ai_neverending)
                                if (devpriv->ai_act_scan >= devpriv->ai_scans) {        /* all data sampled */