From 2e85b023b8ae432474342b88915cd6f351fdc67d Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Mon, 3 Jun 2002 00:04:06 +0000 Subject: [PATCH] fixed analog output insn for 4020 --- comedi/drivers/cb_pcidas64.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/comedi/drivers/cb_pcidas64.c b/comedi/drivers/cb_pcidas64.c index 49a1ad1d..0649682c 100644 --- a/comedi/drivers/cb_pcidas64.c +++ b/comedi/drivers/cb_pcidas64.c @@ -215,6 +215,8 @@ TODO: #define DAC_OUTPUT_ENABLE_BIT 0x80 // dac output enable bit #define DAC_BUFFER_CLEAR_REG 0x66 // clear dac buffer #define DAC_CONVERT_REG(channel) ((0x70) + (2 * ((channel) & 0x1))) +#define DAC_LSB_4020_REG( channel ) ((0x70) + (4 * ((channel) & 0x1))) +#define DAC_MSB_4020_REG( channel ) ((0x72) + (4 * ((channel) & 0x1))) // read-only #define HW_STATUS_REG 0x0 // hardware status register, reading this apparently clears pending interrupts as well #define DAC_UNDERRUN_BIT 0x1 @@ -2066,7 +2068,14 @@ static int ao_winsn(comedi_device *dev, comedi_subdevice *s, writew(0, private(dev)->main_iobase + DAC_BUFFER_CLEAR_REG); // write to channel - writew(data[0], private(dev)->main_iobase + DAC_CONVERT_REG(chan)); + if( board(dev)->layout == LAYOUT_4020 ) + { + writew( data[0] & 0xff , private(dev)->main_iobase + DAC_LSB_4020_REG(chan)); + writew( (data[0] >> 8) & 0xf , private(dev)->main_iobase + DAC_MSB_4020_REG(chan)); + }else + { + writew(data[0], private(dev)->main_iobase + DAC_CONVERT_REG(chan)); + } // remember output value private(dev)->ao_value[chan] = data[0]; -- 2.26.2