From 227fe34217e5430f78c6b679ba215b68a6a5c1a0 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 8 May 2019 13:13:32 -0700 Subject: n3xx: mg: Make set_freq() call asynchronous This does not change the MPM/UHD API, but it makes the set_freq() call asynchronous on the MPM side. The upside is that it will release the GIL if the set_freq() call takes too long, e.g., because of MPM calibrations. --- mpm/python/usrp_mpm/dboard_manager/magnesium.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mpm/python') diff --git a/mpm/python/usrp_mpm/dboard_manager/magnesium.py b/mpm/python/usrp_mpm/dboard_manager/magnesium.py index 13e621414..c4e2f4131 100644 --- a/mpm/python/usrp_mpm/dboard_manager/magnesium.py +++ b/mpm/python/usrp_mpm/dboard_manager/magnesium.py @@ -18,6 +18,7 @@ from usrp_mpm.cores import nijesdcore from usrp_mpm.mpmlog import get_logger from usrp_mpm.sys_utils.uio import open_uio from usrp_mpm.user_eeprom import BfrfsEEPROM +from usrp_mpm.mpmutils import async_exec ############################################################################### # SPI Helpers @@ -328,6 +329,19 @@ class Magnesium(BfrfsEEPROM, DboardManagerBase): # The reference clock is handled elsewhere since it is a motherboard- # level clock. + def set_freq(self, which, freq, wait_for_lock): + """ + Perform asynchronous tuning. This will, under the hood, call set_freq() + on the AD937X object, but will spin it out into an asynchronous + execution. We do this because under some circumstances, the set_freq() + call can take a long time to execute, and we want to release the GIL + during that time. + + Note: This overrides the set_freq() call provided from self.mykonos. + """ + self.log.trace("Tuning {} {} {}".format(which, freq, wait_for_lock)) + async_exec(self.mykonos, "set_freq", which, freq, wait_for_lock) + return self.mykonos.get_freq(which) def _reinit(self, master_clock_rate): """ -- cgit v1.2.3