From 4e6f595c400454bce80b4c43acea5d79b090b043 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Fri, 29 Nov 2002 18:09:05 +0000 Subject: [PATCH] *** empty log message *** --- comedi/drivers/ni_mio_common.c | 82 ++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 9476b2cb..feeb4851 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -238,6 +238,8 @@ static int ni_gpct_insn_config(comedi_device *dev,comedi_subdevice *s, #define AIMODE_SCAN 2 #define AIMODE_SAMPLE 3 +static const int num_adc_stages_611x = 3; + static void handle_a_interrupt(comedi_device *dev,unsigned short status, unsigned int m_status); static void handle_b_interrupt(comedi_device *dev,unsigned short status, @@ -1147,40 +1149,57 @@ static int ni_ai_insn_read(comedi_device *dev,comedi_subdevice *s,comedi_insn *i wsave=win_save(); - win_out(1,ADC_FIFO_Clear); - ni_load_channelgain_list(dev,1,&insn->chanspec); + win_out(1,ADC_FIFO_Clear); + mask=(1<ai_offset[0]; - for(n=0;nn;n++){ - win_out(AI_CONVERT_Pulse, AI_Command_1_Register); - if(boardtype.reg_611x){ + if(boardtype.reg_611x){ + for(n=0; n < num_adc_stages_611x; n++){ + win_out(AI_CONVERT_Pulse, AI_Command_1_Register); + udelay(1); + } + for(n=0; nn; n++){ + win_out(AI_CONVERT_Pulse, AI_Command_1_Register); /* The 611x has screwy 32-bit FIFOs. */ - for(i=0;i> 16 ) & 0xffff; break; - } - rt_printk("ni_mio_common: timeout in ni_ai_insn_read (ignored)\n"); - i = 0; - }else{ - for(i=0;in;n++){ + win_out(AI_CONVERT_Pulse, AI_Command_1_Register); + for(i=0;in; @@ -1294,12 +1313,8 @@ static void ni_load_channelgain_list(comedi_device *dev,unsigned int n_chan, } /* prime the channel/gain list */ - - if(boardtype.reg_611x){ - win_out(1,AI_Command_1_Register); - return; - }else{ - win_out(1,AI_Command_1_Register); + if(boardtype.reg_611x == 0){ + win_out(AI_CONVERT_Pulse, AI_Command_1_Register); for(i=0;istop_src){ case TRIG_COUNT: + stop_count = cmd->stop_arg - 1; + if( boardtype.reg_611x ){ // have to take 3 stage adc pipeline into account - win_out2(cmd->stop_arg + 1, AI_SC_Load_A_Registers); - } - else{ - /* stage number of scans */ - win_out2(cmd->stop_arg-1,AI_SC_Load_A_Registers); + stop_count += num_adc_stages_611x; } + /* stage number of scans */ + win_out2( stop_count, AI_SC_Load_A_Registers); mode1 |= AI_Start_Stop | AI_Mode_1_Reserved | AI_Trigger_Once; win_out(mode1,AI_Mode_1_Register); -- 2.26.2