From 5e7c82f818254987e068949f8d2db6899cd47c4b Mon Sep 17 00:00:00 2001 From: David Schleef Date: Wed, 14 Jun 2000 07:02:02 +0000 Subject: [PATCH] finally fix 2's compliment bug in asynchronous --- comedi/drivers/ni_atmio.c | 3 +++ comedi/drivers/ni_mio_common.c | 15 +++++++++++++-- comedi/drivers/ni_stc.h | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/comedi/drivers/ni_atmio.c b/comedi/drivers/ni_atmio.c index d0c16f3c..b82f64b6 100644 --- a/comedi/drivers/ni_atmio.c +++ b/comedi/drivers/ni_atmio.c @@ -269,6 +269,9 @@ typedef struct{ unsigned short gpct_command1; unsigned short gpct_input_select0; unsigned short gpct_input_select1; + + int ai_chanlistptr; + int ai_chanlist[512]; }ni_private; #define devpriv ((ni_private *)dev->private) diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index a083921e..d55f0fa6 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -334,10 +334,21 @@ static void ni_ai_fifo_read(comedi_device *dev,comedi_subdevice *s, sampl_t *data,int n) { int i; + sampl_t d; + int j; + int range; + j=devpriv->ai_chanlistptr; for(i=0;iai_chanlist[j]); + if(range>=8)d^=0x800; + d&=0xfff; + data[i]=d; + j++; + if(j>=s->cur_trig.n_chan)j=0; } + devpriv->ai_chanlistptr=j; } @@ -539,7 +550,7 @@ static void ni_load_channelgain_list(comedi_device *dev,unsigned int n_chan,unsi /* fix the external/internal range differences */ range=ni_gainlkup[boardtype.gainlkup][range]; - list[i]=CR_PACK(chan,range,aref); + devpriv->ai_chanlist[i]=CR_PACK(chan,range,aref); hi=ni_modebits1[aref]|(chan&ni_modebits2[aref]); ni_writew(hi,Configuration_Memory_High); diff --git a/comedi/drivers/ni_stc.h b/comedi/drivers/ni_stc.h index 1582a5a2..6cef7f43 100644 --- a/comedi/drivers/ni_stc.h +++ b/comedi/drivers/ni_stc.h @@ -493,7 +493,7 @@ typedef struct ni_board_struct{ int has_8255; - int n_gpct; /* CLO */ + int n_gpct; struct caldac_struct **caldac; }ni_board; -- 2.26.2