really fixing munging this time
authorFrank Mori Hess <fmhess@speakeasy.net>
Fri, 22 Nov 2002 21:37:10 +0000 (21:37 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Fri, 22 Nov 2002 21:37:10 +0000 (21:37 +0000)
comedi/drivers/ni_mio_common.c
comedi/drivers/ni_stc.h

index b2eba7116a8018cd67dc8beaa900e490ab6127d8..3de281ba81bbdf3e496847622086b7ff3b8dad04 100644 (file)
@@ -921,15 +921,18 @@ static void ni_handle_fifo_dregs(comedi_device *dev)
                        dl=ni_readl(ADC_FIFO_Data_611x);
 
                        /* This may get the hi/lo data in the wrong order */
-                       data = (dl>>16) + devpriv->ai_xorlist[async->cur_chan];
+                       data = (dl>>16) + devpriv->ai_offset[async->cur_chan++];
+                       async->cur_chan %= async->cmd.chanlist_len;
                        err &= comedi_buf_put(s->async, data);
-                       data = (dl&0xffff) + devpriv->ai_xorlist[async->cur_chan];
+                       data = (dl&0xffff) + devpriv->ai_offset[async->cur_chan++];
+                       async->cur_chan %= async->cmd.chanlist_len;
                        err &= comedi_buf_put(s->async, data);
                }
        }else{
                while((win_in(AI_Status_1_Register)&AI_FIFO_Empty_St) == 0){
                        data=ni_readw(ADC_FIFO_Data_Register);
-                       data+=devpriv->ai_xorlist[async->cur_chan];
+                       data+=devpriv->ai_offset[async->cur_chan++];
+                       async->cur_chan %= async->cmd.chanlist_len;
                        err &= comedi_buf_put(s->async, data);
                }
        }
@@ -951,7 +954,8 @@ static void get_last_sample_611x( comedi_device *dev )
        /* Check if there's a single sample stuck in the FIFO */
        if(ni_readb(Status_611x)&0x80){
                dl=ni_readl(ADC_FIFO_Data_611x);
-               data = (dl&0xffff) + devpriv->ai_xorlist[async->cur_chan];
+               data = (dl&0xffff) + devpriv->ai_offset[async->cur_chan++];
+               async->cur_chan %= async->cmd.chanlist_len;
                err &= comedi_buf_put(s->async, data);
        }
        if(err==0){
@@ -972,7 +976,7 @@ static void ni_ai_munge(comedi_device *dev, comedi_subdevice *s,
 #ifdef PCIDMA
                array[i] = __le16_to_cpu(array[i]);
 #endif
-               array[i] ^= devpriv->ai_xorlist[ chan_index ];
+               array[i] += devpriv->ai_offset[ chan_index ];
                chan_index++;
                chan_index %= async->cmd.chanlist_len;
        }
@@ -1148,7 +1152,7 @@ static int ni_ai_insn_read(comedi_device *dev,comedi_subdevice *s,comedi_insn *i
        ni_load_channelgain_list(dev,1,&insn->chanspec);
 
        mask=(1<<boardtype.adbits)-1;
-       signbits=devpriv->ai_xorlist[0];
+       signbits=devpriv->ai_offset[0];
        for(n=0;n<insn->n;n++){
                win_out(AI_CONVERT_Pulse, AI_Command_1_Register);
                if(boardtype.reg_611x){
@@ -1250,9 +1254,9 @@ static void ni_load_channelgain_list(comedi_device *dev,unsigned int n_chan,
                /* fix the external/internal range differences */
                range = ni_gainlkup[boardtype.gainlkup][range];
                if( boardtype.reg_611x )
-                       devpriv->ai_xorlist[i] = offset;
+                       devpriv->ai_offset[i] = offset;
                else
-                       devpriv->ai_xorlist[i] = (range&0x100)?0:offset;
+                       devpriv->ai_offset[i] = (range&0x100)?0:offset;
 
                hi = 0;
                if( ( list[i] & CR_ALT_SOURCE ) )
index 739765c19dbb5d103aff7379705f4f27e08666f2..15b61aec773553a5644fd938f7a2e20607135676 100644 (file)
@@ -759,7 +759,7 @@ static ni_board ni_boards[];
        int gpct_cur_operation[2];                              \
        unsigned short an_trig_etc_reg;                         \
                                                                \
-       unsigned short ai_xorlist[512];                         \
+       unsigned short ai_offset[512];                          \
                                                                \
        unsigned long serial_interval_ns;                       \
        unsigned char serial_hw_mode;                           \