From 925090b605a7e896607d9c25e419774a240cafb8 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Sat, 29 Sep 2007 00:01:47 +0000 Subject: [PATCH] Fixed use of ai channels >= 64 on 6225. Based on patch from Ingmar Schoegl . --- comedi/drivers/ni_mio_common.c | 2 +- comedi/drivers/ni_stc.h | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 552a4c6f..b3c68e95 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -1795,7 +1795,7 @@ static void ni_m_series_load_channelgain_list(comedi_device *dev,unsigned int n_ break; } config_bits |= MSeries_AI_Config_Channel_Bits(chan); - config_bits |= MSeries_AI_Config_Bank_Bits(chan); + config_bits |= MSeries_AI_Config_Bank_Bits(boardtype.reg_type, chan); config_bits |= MSeries_AI_Config_Gain_Bits(range_code); if(i == n_chan - 1) config_bits |= MSeries_AI_Config_Last_Channel_Bit; if(dither) config_bits |= MSeries_AI_Config_Dither_Bit; diff --git a/comedi/drivers/ni_stc.h b/comedi/drivers/ni_stc.h index e544d8d3..a2184514 100644 --- a/comedi/drivers/ni_stc.h +++ b/comedi/drivers/ni_stc.h @@ -1142,9 +1142,15 @@ static inline unsigned MSeries_AI_Config_Channel_Bits(unsigned channel) { return channel & 0xf; } -static inline unsigned MSeries_AI_Config_Bank_Bits(unsigned channel) +static inline unsigned MSeries_AI_Config_Bank_Bits(enum ni_reg_type reg_type, unsigned channel) { - return channel & 0x30; + unsigned bits = channel & 0x30; + if(reg_type == ni_reg_622x) + { + if(channel & 0x40) + bits |= 0x400; + } + return bits; } static inline unsigned MSeries_AI_Config_Gain_Bits(unsigned range) { -- 2.26.2