From c36e591bc583eb8813d7ddddc0e839993e895cc9 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Mon, 19 Dec 2005 00:42:35 +0000 Subject: [PATCH] Some fixes for m series ai/ao instructions. ao instructions definitely don't work yet. --- comedi/drivers/ni_mio_common.c | 98 ++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 27 deletions(-) diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 00149eba..ee91a76e 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -1213,9 +1213,16 @@ static int ni_ai_insn_read(comedi_device *dev,comedi_subdevice *s,comedi_insn *i rt_printk("ni_mio_common: timeout in ni_ai_insn_read\n"); return -ETIME; } - d = ni_readw(ADC_FIFO_Data_Register); - d += signbits; /* subtle: needs to be short addition */ - data[n] = d; + if(boardtype.reg_type == ni_reg_m_series) + { + data[n] = ni_readl(M_Offset_AI_FIFO_Data); + data[n] += signbits; + }else + { + d = ni_readw(ADC_FIFO_Data_Register); + d += signbits; /* subtle: needs to be short addition */ + data[n] = d; + } } } return insn->n; @@ -1999,34 +2006,60 @@ static int ni_ao_config_chanlist(comedi_device *dev, comedi_subdevice *s, for(i=0;iao_conf[chan] = conf; - - ni_writew(conf,AO_Configuration); } return invert; } @@ -2049,7 +2082,10 @@ static int ni_ao_insn_write(comedi_device *dev,comedi_subdevice *s, devpriv->ao[chan] = data[0]; - ni_writew(data[0] ^ invert,(chan)? DAC1_Direct_Data : DAC0_Direct_Data); + if(boardtype.reg_type == ni_reg_m_series) + ni_writew(data[0] ^ invert, M_Offset_DAC_Direct_Data(chan)); + else + ni_writew(data[0] ^ invert,(chan)? DAC1_Direct_Data : DAC0_Direct_Data); return 1; } @@ -2689,10 +2725,11 @@ static int ni_E_init(comedi_device *dev,comedi_devconfig *it) dev->read_subdev=s; if(boardtype.n_adchan){ s->type=COMEDI_SUBD_AI; - s->subdev_flags=SDF_READABLE|SDF_DIFF; + s->subdev_flags=SDF_READABLE | SDF_DIFF | SDF_DITHER; if(boardtype.reg_type != ni_reg_611x) s->subdev_flags |= SDF_GROUND | SDF_COMMON | SDF_OTHER; - s->subdev_flags|=SDF_DITHER; + if(boardtype.adbits > 16) + s->subdev_flags |= SDF_LSAMPL; s->n_chan=boardtype.n_adchan; s->len_chanlist=512; s->maxdata=(1<