From 87d42bb0eec40d1fd4a465f9c8fb9203c73cead8 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Sat, 5 Jun 2004 16:55:18 +0000 Subject: [PATCH] fix CR_EDGE and CR_INVERT flags for ai scan_begin_src = TRIG_EXT --- comedi/drivers/ni_mio_common.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index af80c417..8892704f 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -1430,8 +1430,7 @@ static int ni_ai_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd) unsigned int tmp = CR_CHAN(cmd->scan_begin_arg); if(tmp>9)tmp=9; - /* XXX for now, use the top bit to invert the signal */ - tmp |= (cmd->scan_begin_arg&0x80000000); + tmp |= (cmd->scan_begin_arg & (CR_INVERT | CR_EDGE)); if(cmd->scan_begin_arg!=tmp){ cmd->scan_begin_arg = tmp; err++; @@ -1654,18 +1653,15 @@ static int ni_ai_cmd(comedi_device *dev,comedi_subdevice *s) win_out(AI_SI_Load,AI_Command_1_Register); break; case TRIG_EXT: - -/* Level trigger usually doesn't work, making it the default - * doesn't make sense. Disabling it. */ -/* if( cmd->scan_begin_arg & CR_EDGE ) */ - start_stop_select |= AI_START_Edge; + if( cmd->scan_begin_arg & CR_EDGE ) + start_stop_select |= AI_START_Edge; /* AI_START_Polarity==1 is falling edge */ if( cmd->scan_begin_arg & CR_INVERT ) start_stop_select |= AI_START_Polarity; if( cmd->scan_begin_src != cmd->convert_src || ( cmd->scan_begin_arg & ~CR_EDGE ) != ( cmd->convert_arg & ~CR_EDGE ) ) start_stop_select |= AI_START_Sync; - start_stop_select |= AI_START_Select(1+(cmd->scan_begin_arg&0xf)); + start_stop_select |= AI_START_Select(1 + CR_CHAN(cmd->scan_begin_arg)); win_out(start_stop_select, AI_START_STOP_Select_Register); break; } -- 2.26.2