aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python
diff options
context:
space:
mode:
authorTrung N Tran <trung.tran@ettus.com>2018-04-27 15:27:13 -0700
committerMartin Braun <martin.braun@ettus.com>2018-04-30 14:36:29 -0700
commit546aa04355ff34924ce1d00fd003cb0ee63c8cf9 (patch)
tree7922390d41b4dbc90c1bd71f763b42e05ca85b44 /mpm/python
parent4e2fd551ad48e1ee13d2b7a203f624dd828c2c3b (diff)
downloaduhd-546aa04355ff34924ce1d00fd003cb0ee63c8cf9.tar.gz
uhd-546aa04355ff34924ce1d00fd003cb0ee63c8cf9.tar.bz2
uhd-546aa04355ff34924ce1d00fd003cb0ee63c8cf9.zip
mpm: replace long execution function with async call
- Replace mykonos finish_initialization with async version - Replace myknonos setup_cal with async version - Remove disable_timeout on rpc_server init()
Diffstat (limited to 'mpm/python')
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/magnesium.py15
-rw-r--r--mpm/python/usrp_mpm/mpmutils.py15
2 files changed, 24 insertions, 6 deletions
diff --git a/mpm/python/usrp_mpm/dboard_manager/magnesium.py b/mpm/python/usrp_mpm/dboard_manager/magnesium.py
index 53341c206..2385b05eb 100644
--- a/mpm/python/usrp_mpm/dboard_manager/magnesium.py
+++ b/mpm/python/usrp_mpm/dboard_manager/magnesium.py
@@ -21,6 +21,7 @@ from usrp_mpm.dboard_manager.mg_periphs import TCA6408, MgCPLD
from usrp_mpm.dboard_manager.mg_periphs import DboardClockControl
from usrp_mpm.cores import nijesdcore
from usrp_mpm.mpmlog import get_logger
+from usrp_mpm.mpmutils import async_exec
from usrp_mpm.sys_utils.uio import open_uio
from usrp_mpm.sys_utils.udev import get_eeprom_paths
from usrp_mpm.cores import ClockSynchronizer
@@ -63,6 +64,7 @@ TRACKING_CALIBRATION_TABLE = {"TRACK_RX1_QEC" : 0x01,
"ALL" : 0xF3,
}
+
def create_spidev_iface_lmk(dev_node):
"""
Create a regs iface from a spidev node
@@ -513,9 +515,13 @@ class Magnesium(DboardManagerBase):
.format(self._init_cals_mask))
self.log.debug("args[tracking_cals]=0x{:02X}"
.format(self._tracking_cals_mask))
- self.mykonos.setup_cal(self._init_cals_mask,
- self._tracking_cals_mask,
- self._init_cals_timeout)
+ async_exec(
+ self.mykonos,
+ "setup_cal",
+ self._init_cals_mask,
+ self._tracking_cals_mask,
+ self._init_cals_timeout
+ )
def init_lo_source(self, args):
"""Set all LO
@@ -561,10 +567,9 @@ class Magnesium(DboardManagerBase):
jesdcore.send_sysref_pulse()
time.sleep(0.001) # 17us... ish.
jesdcore.send_sysref_pulse()
- self.mykonos.finish_initialization()
+ async_exec(self.mykonos, "finish_initialization")
# TODO:can we call this after JESD?
self.init_rf_cal(args)
-
self.log.trace("Starting JESD204b Link Initialization...")
# Generally, enable the source before the sink. Start with the DAC side.
self.log.trace("Starting FPGA framer...")
diff --git a/mpm/python/usrp_mpm/mpmutils.py b/mpm/python/usrp_mpm/mpmutils.py
index 539cd8de4..151713988 100644
--- a/mpm/python/usrp_mpm/mpmutils.py
+++ b/mpm/python/usrp_mpm/mpmutils.py
@@ -8,7 +8,6 @@ Miscellaneous utilities for MPM
"""
import time
-import sys
def poll_with_timeout(state_check, timeout_ms, interval_ms):
"""
@@ -150,3 +149,17 @@ def str2bool(value):
except AttributeError:
return bool(value)
+
+def async_exec(parent, method_name, *args):
+ """Execute method_name asynchronously.
+ Requires the parent class to have this feature enabled.
+ """
+ async_name = 'async__' + method_name
+ await_name = 'await__' + method_name
+ # Spawn async
+ getattr(parent, async_name)(*args)
+ awaitable_method = getattr(parent, await_name)
+ # await
+ while not awaitable_method():
+ time.sleep(0.1)
+