From 839ff6c9b79b233502c261f67beda6d2832692e8 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 18 Jan 2010 16:20:08 +0000 Subject: [PATCH] pcl812: bug fix: scan counter was being incremented after every sample. Keep track of current channel and update scan counter at end of scan. --- comedi/drivers/pcl812.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/comedi/drivers/pcl812.c b/comedi/drivers/pcl812.c index b8bf8250..807394d7 100644 --- a/comedi/drivers/pcl812.c +++ b/comedi/drivers/pcl812.c @@ -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 */ -- 2.26.2