aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python
diff options
context:
space:
mode:
authorVirendra Kakade <virendra.kakade@ni.com>2019-04-30 17:11:15 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2021-02-18 07:25:46 -0600
commit91073787b1a292d038bf1bd4d460aa8ddcfc8b16 (patch)
tree3b3bb617e2fc4d7877ee3825fd664f3bea6d4393 /mpm/python
parentf11fa1bff7a54b4a12e25d90ae0b41560ee625ca (diff)
downloaduhd-91073787b1a292d038bf1bd4d460aa8ddcfc8b16.tar.gz
uhd-91073787b1a292d038bf1bd4d460aa8ddcfc8b16.tar.bz2
uhd-91073787b1a292d038bf1bd4d460aa8ddcfc8b16.zip
mpm: Add support to safely reset peripheral manager from uhd
Provide a way to safely reset the peripheral manager from uhd and as a result, a mechanism to reload the fpga/dts components. Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
Diffstat (limited to 'mpm/python')
-rw-r--r--mpm/python/usrp_mpm/rpc_server.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py
index 262bedb6c..f1d2620f5 100644
--- a/mpm/python/usrp_mpm/rpc_server.py
+++ b/mpm/python/usrp_mpm/rpc_server.py
@@ -504,6 +504,35 @@ class MPMServer(RPCServer):
# methods from the old peripheral manager (the one before reset)
self.clear_method_registry()
+ def reset_timer_and_mgr(self, token):
+ """
+ Pause the timers, reset the peripheral manager and restart the
+ timers.
+ """
+ # Check the claimed status
+ if not self._check_token_valid(token):
+ self._last_error =\
+ "Attempt to reset manager without valid claim from {}".format(
+ self.client_host
+ )
+ self.log.error(self._last_error)
+ raise RuntimeError("Attempt to reset manager without valid claim.")
+
+ # Stop the timer, reset_timer_and_mgr can take some time:
+ self._disable_timeouts = True
+ try:
+ self.reset_mgr()
+ self.log.debug("Reset the periph manager")
+ except Exception as ex:
+ self.log.error(
+ "Error in reset_timer_and_mgr: {}".format(
+ ex
+ ))
+ self._last_error = str(ex)
+
+ self.log.debug("End of reset_timer_and_mgr")
+ self._reset_timer()
+
def update_component(self, token, file_metadata_l, data_l):
""""
Updates the device component files specified by the metadata and data