pcl818: Fix option handling for FIFO mode (hopefully!).
authorIan Abbott <abbotti@mev.co.uk>
Thu, 26 Feb 2009 18:47:55 +0000 (18:47 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Thu, 26 Feb 2009 18:47:55 +0000 (18:47 +0000)
comedi/drivers/pcl818.c

index 62595dd13ddbb8a74f0033f25be264170233e914..e4a71e0bf29893e4f6893991803885cb5941f7a2 100644 (file)
@@ -1021,25 +1021,26 @@ static int pcl818_ai_cmd_mode(int mode, comedi_device * dev,
                }
 #endif
                break;
-       case 0:         // IRQ
-               // rt_printk("IRQ\n");
-               if (mode == 1) {
-                       devpriv->ai_mode = INT_TYPE_AI1_INT;
-                       outb(0x83 | (dev->irq << 4), dev->iobase + PCL818_CONTROL);     /* Pacer+IRQ */
-               } else {
-                       devpriv->ai_mode = INT_TYPE_AI3_INT;
-                       outb(0x82 | (dev->irq << 4), dev->iobase + PCL818_CONTROL);     /* Ext trig+IRQ */
-               };
-               break;
-       case -1:                // FIFO
-               outb(1, dev->iobase + PCL818_FI_ENABLE);        // enable FIFO
-               if (mode == 1) {
-                       devpriv->ai_mode = INT_TYPE_AI1_FIFO;
-                       outb(0x03, dev->iobase + PCL818_CONTROL);       /* Pacer */
-               } else {
-                       devpriv->ai_mode = INT_TYPE_AI3_FIFO;
-                       outb(0x02, dev->iobase + PCL818_CONTROL);
-               };              /* Ext trig */
+       case 0:
+               if (!devpriv->usefifo) {        // IRQ
+                       // rt_printk("IRQ\n");
+                       if (mode == 1) {
+                               devpriv->ai_mode = INT_TYPE_AI1_INT;
+                               outb(0x83 | (dev->irq << 4), dev->iobase + PCL818_CONTROL);     /* Pacer+IRQ */
+                       } else {
+                               devpriv->ai_mode = INT_TYPE_AI3_INT;
+                               outb(0x82 | (dev->irq << 4), dev->iobase + PCL818_CONTROL);     /* Ext trig+IRQ */
+                       };
+               } else {                        // FIFO
+                       outb(1, dev->iobase + PCL818_FI_ENABLE);        // enable FIFO
+                       if (mode == 1) {
+                               devpriv->ai_mode = INT_TYPE_AI1_FIFO;
+                               outb(0x03, dev->iobase + PCL818_CONTROL);       /* Pacer */
+                       } else {
+                               devpriv->ai_mode = INT_TYPE_AI3_FIFO;
+                               outb(0x02, dev->iobase + PCL818_CONTROL);
+                       };              /* Ext trig */
+               }
                break;
        }
 
@@ -1679,7 +1680,8 @@ static int pcl818_attach(comedi_device * dev, comedi_devconfig * it)
 {
        int ret;
        unsigned long iobase;
-       unsigned int irq, dma;
+       unsigned int irq;
+       int dma;
        unsigned long pages;
        comedi_subdevice *s;