From: Frank Mori Hess <fmhess@speakeasy.net>
Date: Fri, 26 Mar 2004 00:24:23 +0000 (+0000)
Subject: fix analog output channel interaction for boards with analog output
X-Git-Tag: r0_7_69~73
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f746f15dc99a4c50ad744340a6c2724dd008ecb2;p=comedi.git

fix analog output channel interaction for boards with analog output
fifo
---

diff --git a/comedi/drivers/cb_pcidas.c b/comedi/drivers/cb_pcidas.c
index 3f5d938a..33169ee0 100644
--- a/comedi/drivers/cb_pcidas.c
+++ b/comedi/drivers/cb_pcidas.c
@@ -890,17 +890,18 @@ static int cb_pcidas_ao_fifo_winsn(comedi_device *dev, comedi_subdevice *s,
 	comedi_insn *insn, lsampl_t *data)
 {
 	int bits, channel;
+	unsigned long flags;
 
 	// clear dac fifo
 	outw(0, devpriv->ao_registers + DACFIFOCLR);
 
 	// set channel and range
-	channel = CR_CHAN(insn->chanspec);
-	bits = DACEN;
-	bits |= DAC_RANGE(channel, CR_RANGE(insn->chanspec));
-	bits |= DAC_CHAN_EN(channel);
-	bits |= DAC_START;	// not sure if this is necessary
-	outw(bits, devpriv->control_status + DAC_CSR);
+	comedi_spin_lock_irqsave( &dev->spinlock, flags );
+	devpriv->ao_control_bits &= ~DAC_MODE_UPDATE_BOTH & ~DAC_RANGE_MASK( channel ) &
+		~DAC_START & ~DAC_PACER_MASK;
+	devpriv->ao_control_bits |= DACEN | DAC_RANGE( channel, CR_RANGE( insn->chanspec ) );
+	outw( devpriv->ao_control_bits, devpriv->control_status + DAC_CSR );
+	comedi_spin_unlock_irqrestore( &dev->spinlock, flags );
 
 	// remember value for readback
 	devpriv->ao_value[channel] = data[0];