From: Frank Mori Hess Date: Fri, 20 Oct 2006 15:31:21 +0000 (+0000) Subject: Added support for INSN_CONFIG_GET_CLOCK_SRC X-Git-Tag: r0_7_74~185 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7e6f1c8d261fc412aab1f6924b52c9020fb06c2f;p=comedi.git Added support for INSN_CONFIG_GET_CLOCK_SRC --- diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 37a0244f..f440874d 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -4427,6 +4427,7 @@ static int ni_mseries_set_pll_master_clock(comedi_device *dev, unsigned source, pll_control_bits |= MSeries_PLL_Divisor_Bits(freq_divider) | MSeries_PLL_Multiplier_Bits(freq_multiplier); // rt_printk("using divider=%i, multiplier=%i for PLL.\n", freq_divider, freq_multiplier); ni_writew(pll_control_bits, M_Offset_PLL_Control); + devpriv->clock_source = source; unsigned i; static const unsigned timeout = 1000; /* it seems to typically take a few hundred microseconds for PLL to lock */ @@ -4461,6 +4462,7 @@ static int ni_set_master_clock(comedi_device *dev, unsigned source, unsigned per ni_writew(devpriv->clock_and_fout2, M_Offset_Clock_and_Fout2); ni_writew(0, M_Offset_PLL_Control); } + devpriv->clock_source = source; break; case NI_MIO_RTSI_CLOCK: devpriv->rtsi_trig_direction_reg |= Use_RTSI_Clock_Bit; @@ -4473,6 +4475,7 @@ static int ni_set_master_clock(comedi_device *dev, unsigned source, unsigned per ni_writew(devpriv->clock_and_fout2, M_Offset_Clock_and_Fout2); ni_writew(0, M_Offset_PLL_Control); } + devpriv->clock_source = source; break; default: if(boardtype.reg_type == ni_reg_m_series) @@ -4523,6 +4526,11 @@ static int ni_rtsi_insn_config(comedi_device *dev,comedi_subdevice *s, case INSN_CONFIG_SET_CLOCK_SRC: return ni_set_master_clock(dev, data[1], data[2]); break; + case INSN_CONFIG_GET_CLOCK_SRC: + data[1] = devpriv->clock_source; + data[2] = devpriv->clock_ns; + return 3; + break; default: return -EINVAL; } diff --git a/comedi/drivers/ni_stc.h b/comedi/drivers/ni_stc.h index 291e58f4..84cbb1c0 100644 --- a/comedi/drivers/ni_stc.h +++ b/comedi/drivers/ni_stc.h @@ -1241,7 +1241,8 @@ static ni_board ni_boards[]; unsigned short rtsi_trig_direction_reg; \ \ unsigned clock_ns; \ - \ + unsigned clock_source; \ + \ unsigned short atrig_mode; \ unsigned short atrig_high; \ unsigned short atrig_low; \