From: Frank Mori Hess Date: Tue, 10 Oct 2006 00:35:28 +0000 (+0000) Subject: Mask off bogus high bits for m-series boards with 16 bits or less. X-Git-Tag: r0_7_74~208 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cde497ffe602a97fa5cbbd998f02573a3ee844e2;p=comedi.git Mask off bogus high bits for m-series boards with 16 bits or less. --- diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 4f7456f8..46348590 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -1305,7 +1305,7 @@ static int ni_ai_poll(comedi_device *dev,comedi_subdevice *s) static int ni_ai_insn_read(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { int i,n; - unsigned int mask; + const unsigned int mask = (1 << boardtype.adbits) - 1; unsigned signbits; unsigned short d; unsigned long dl; @@ -1314,7 +1314,6 @@ static int ni_ai_insn_read(comedi_device *dev,comedi_subdevice *s,comedi_insn *i ni_flush_ai_fifo(dev); - mask=(1<ai_offset[0]; if(boardtype.reg_type == ni_reg_611x){ for(n=0; n < num_adc_stages_611x; n++){ @@ -1377,8 +1376,7 @@ static int ni_ai_insn_read(comedi_device *dev,comedi_subdevice *s,comedi_insn *i } if(boardtype.reg_type == ni_reg_m_series) { - data[n] = ni_readl(M_Offset_AI_FIFO_Data); - data[n] += signbits; + data[n] = ni_readl(M_Offset_AI_FIFO_Data) & mask; }else { d = ni_readw(ADC_FIFO_Data_Register);