Added support for INSN_CONFIG_GET_CLOCK_SRC
authorFrank Mori Hess <fmhess@speakeasy.net>
Fri, 20 Oct 2006 15:31:21 +0000 (15:31 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Fri, 20 Oct 2006 15:31:21 +0000 (15:31 +0000)
comedi/drivers/ni_mio_common.c
comedi/drivers/ni_stc.h

index 37a0244f7686d33e85f3ae2a044636831399f03b..f440874d4c2115b33b58b6d3e202fade9ec37406 100644 (file)
@@ -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;
        }
index 291e58f47c8bbdaffe759427695d253fc69edfd8..84cbb1c0bf2d085de4e7afad20eddb49c4e3d171 100644 (file)
@@ -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;                               \