From f746f15dc99a4c50ad744340a6c2724dd008ecb2 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Fri, 26 Mar 2004 00:24:23 +0000 Subject: [PATCH] fix analog output channel interaction for boards with analog output fifo --- comedi/drivers/cb_pcidas.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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]; -- 2.26.2