diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-01-09 13:33:34 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-01-10 17:31:21 -0800 |
commit | 7d67fe5c291b155f8bf41556c17283b264a2908d (patch) | |
tree | 67210dbe3ed4c6e20610752931a745443a20c122 /mpm | |
parent | 410e87e2828616e8e02627b60c9af5344b9249e1 (diff) | |
download | uhd-7d67fe5c291b155f8bf41556c17283b264a2908d.tar.gz uhd-7d67fe5c291b155f8bf41556c17283b264a2908d.tar.bz2 uhd-7d67fe5c291b155f8bf41556c17283b264a2908d.zip |
mpm: n310: Shuffle around location of functions for better browsability
Diffstat (limited to 'mpm')
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/n310.py | 81 |
1 files changed, 44 insertions, 37 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py index eb1f2a523..58d2ad28f 100644 --- a/mpm/python/usrp_mpm/periph_manager/n310.py +++ b/mpm/python/usrp_mpm/periph_manager/n310.py @@ -297,6 +297,9 @@ class n310(PeriphManagerBase): """ return ['n3xx'] + ########################################################################### + # Ctor and device initialization tasks + ########################################################################### def __init__(self, args): super(n310, self).__init__(args) self._device_initialized = False @@ -324,13 +327,50 @@ class n310(PeriphManagerBase): log=self.log ) + def _init_ref_clock_and_time(self, default_args): + """ + Initialize clock and time sources. After this function returns, the + reference signals going to the FPGA are valid. + """ + self._ext_clock_freq = float( + default_args.get('ext_clock_freq', N3XX_DEFAULT_EXT_CLOCK_FREQ) + ) + if len(self.dboards) == 0: + self.log.warning( + "No dboards found, skipping setting clock and time source " \ + "configuration." + ) + self._clock_source = N3XX_DEFAULT_CLOCK_SOURCE + self._time_source = N3XX_DEFAULT_TIME_SOURCE + else: + self.set_clock_source( + default_args.get('clock_source', N3XX_DEFAULT_CLOCK_SOURCE) + ) + self.set_time_source( + default_args.get('time_source', N3XX_DEFAULT_TIME_SOURCE) + ) + self.enable_pps_out( + default_args.get('pps_export', True) + ) + + def _init_meas_clock(self): + """ + Initialize the TDC measurement clock. After this function returns, the + FPGA TDC meas_clock is valid. + """ + # No need to toggle reset here, simply confirm it is out of reset. + self.mboard_regs_control.reset_meas_clk_mmcm(False) + if not self.mboard_regs_control.get_meas_clock_mmcm_lock(): + raise RuntimeError("Measurement clock failed to init") + def _init_peripherals(self, args): """ Turn on all peripherals. This may throw an error on failure, so make sure to catch it. """ # Init Mboard Regs - self.mboard_regs_control = MboardRegsControl(self.mboard_regs_label, self.log) + self.mboard_regs_control = MboardRegsControl( + self.mboard_regs_label, self.log) self.mboard_regs_control.get_git_hash() self.mboard_regs_control.get_build_timestamp() self._check_fpga_compat() @@ -366,42 +406,9 @@ class n310(PeriphManagerBase): # Init complete. self.log.info("mboard info: {}".format(self.mboard_info)) - def _init_ref_clock_and_time(self, default_args): - """ - Initialize clock and time sources. After this function returns, the - reference signals going to the FPGA are valid. - """ - self._ext_clock_freq = float( - default_args.get('ext_clock_freq', N3XX_DEFAULT_EXT_CLOCK_FREQ) - ) - if len(self.dboards) == 0: - self.log.warning( - "No dboards found, skipping setting clock and time source " \ - "configuration." - ) - self._clock_source = N3XX_DEFAULT_CLOCK_SOURCE - self._time_source = N3XX_DEFAULT_TIME_SOURCE - else: - self.set_clock_source( - default_args.get('clock_source', N3XX_DEFAULT_CLOCK_SOURCE) - ) - self.set_time_source( - default_args.get('time_source', N3XX_DEFAULT_TIME_SOURCE) - ) - self.enable_pps_out( - default_args.get('pps_export', True) - ) - - def _init_meas_clock(self): - """ - Initialize the TDC measurement clock. After this function returns, the - FPGA TDC meas_clock is valid. - """ - # No need to toggle reset here, simply confirm it is out of reset. - self.mboard_regs_control.reset_meas_clk_mmcm(False) - if not self.mboard_regs_control.get_meas_clock_mmcm_lock(): - raise RuntimeError("Measurement clock failed to init") - + ########################################################################### + # Session init and deinit + ########################################################################### def init(self, args): """ Calls init() on the parent class, and then programs the Ethernet |