fix for analog output, based on patch from Simone Mannori
authorFrank Mori Hess <fmhess@speakeasy.net>
Mon, 13 Jun 2005 01:25:12 +0000 (01:25 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Mon, 13 Jun 2005 01:25:12 +0000 (01:25 +0000)
<smannori@f2n.it>

comedi/drivers/cb_das16_cs.c

index c437b83622b07cec62afb1ed5b8e5f0124b7b4e3..c654bc4f90a4de2d2cd417b17f94acdcdbec4171 100644 (file)
@@ -481,32 +481,30 @@ static int das16cs_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *
                devpriv->ao_readback[chan] = data[i];
                d = data[i];
 
-               //devpriv->status1 |= 0x0009;
                outw(devpriv->status1, dev->iobase + 4);
                comedi_udelay(1);
 
-               status1 = devpriv->status1;
-               //if(chan)status1 &= ~0x0008;
-               //else status1 &= ~0x0001;
-               if(chan)status1 |= 0x0008;
-               else status1 |= 0x0001;
+               status1 = devpriv->status1 & ~0xf;
+               if(chan) status1 |= 0x0001;
+               else status1 |= 0x0008;
 
-               printk("0x%04x\n",status1);
+/*             printk("0x%04x\n",status1);*/
                outw(status1, dev->iobase + 4);
                comedi_udelay(1);
 
                for(bit=15;bit>=0;bit--){
-                       int b = (d>>bit)&1;
-
-                       printk("0x%04x\n",status1 | b | 0x0000);
+                       int b = (d >> bit) & 0x1;
+                       b <<= 1;
+/*                     printk("0x%04x\n",status1 | b | 0x0000);*/
                        outw(status1 | b | 0x0000, dev->iobase + 4);
                        comedi_udelay(1);
-                       printk("0x%04x\n",status1 | b | 0x0004);
+/*                     printk("0x%04x\n",status1 | b | 0x0004);*/
                        outw(status1 | b | 0x0004, dev->iobase + 4);
                        comedi_udelay(1);
                }
-
-               outw(devpriv->status1, dev->iobase + 4);
+/*             make high both DAC0CS and DAC1CS to load
+               new data and update analog output*/
+               outw(status1 | 0x9, dev->iobase + 4);
        }
 
        return i;