aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/periph_manager/base.py
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-09-09 16:29:32 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 12:21:33 -0800
commit025ffdce3475585b3f65e955af32afbab9181e13 (patch)
treefaea7b200ec2fa09d61224f21dd8aa7302b011b4 /mpm/python/usrp_mpm/periph_manager/base.py
parentd76cca76dd7699ed224b38cd30146c25ad2ac1f8 (diff)
downloaduhd-025ffdce3475585b3f65e955af32afbab9181e13.tar.gz
uhd-025ffdce3475585b3f65e955af32afbab9181e13.tar.bz2
uhd-025ffdce3475585b3f65e955af32afbab9181e13.zip
mpm: Move common mboard regs code to common location
This assumes an existence of mboard_regs_control in PeriphManagerBase and implements most TK controls there. All the *_periphs.py files can now use a common class for registers, including the TK access, but also git hash, build date, and device ID access. This also fixes two issues: - set_timekeeper_time() and set_tick_period() had a bug that would incorrectly calculate the upper 32 bits of their respective registers. - N3xx had a bug that would swap around set time now and next PPS. This got auto-fixed because the common code never had this bug.
Diffstat (limited to 'mpm/python/usrp_mpm/periph_manager/base.py')
-rw-r--r--mpm/python/usrp_mpm/periph_manager/base.py55
1 files changed, 30 insertions, 25 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py
index 4ae30778a..5e5d3889e 100644
--- a/mpm/python/usrp_mpm/periph_manager/base.py
+++ b/mpm/python/usrp_mpm/periph_manager/base.py
@@ -176,6 +176,8 @@ class PeriphManagerBase(object):
# Device initialization (at MPM startup)
###########################################################################
def __init__(self):
+ # This gets set in the child class
+ self.mboard_regs_control = None
# Note: args is a dictionary.
assert self.pids
assert self.mboard_eeprom_magic is not None
@@ -513,7 +515,7 @@ class PeriphManagerBase(object):
self.log.trace("Teardown called for Peripheral Manager base.")
###########################################################################
- # Misc device status controls and indicators
+ # RFNoC and Device info
###########################################################################
def set_device_id(self, device_id):
"""
@@ -521,7 +523,8 @@ class PeriphManagerBase(object):
The device ID is used to identify the RFNoC components associated with
this motherboard.
"""
- raise NotImplementedError("set_device_id() not implemented.")
+ self.log.debug("Setting device ID to `{}'".format(device_id))
+ self.mboard_regs_control.set_device_id(device_id)
def get_device_id(self):
"""
@@ -529,8 +532,28 @@ class PeriphManagerBase(object):
The device ID is used to identify the RFNoC components associated with
this motherboard.
"""
- raise NotImplementedError("get_device_id() not implemented.")
+ return self.mboard_regs_control.get_device_id()
+
+ def get_proto_ver(self):
+ """
+ Return RFNoC protocol version
+ """
+ proto_ver = self.mboard_regs_control.get_proto_ver()
+ self.log.debug("RFNoC protocol version supported by this device is {}".format(proto_ver))
+ return proto_ver
+
+ def get_chdr_width(self):
+ """
+ Return RFNoC CHDR width
+ """
+ chdr_width = self.mboard_regs_control.get_chdr_width()
+ self.log.debug("CHDR width supported by the device is {}".format(chdr_width))
+ return chdr_width
+
+ ###########################################################################
+ # Misc device status controls and indicators
+ ###########################################################################
def get_init_status(self):
"""
Returns the status of the device after its initialization (that happens
@@ -611,20 +634,6 @@ class PeriphManagerBase(object):
"""
return [dboard.device_info for dboard in self.dboards]
- @no_claim
- def get_proto_ver(self):
- """
- Return RFNoC protocol version
- """
- raise NotImplementedError("get_proto_ver() not implemented.")
-
- @no_claim
- def get_chdr_width(self):
- """
- Return RFNoC CHDR width
- """
- raise NotImplementedError("get_chdr_width() not implemented.")
-
###########################################################################
# Component updating
###########################################################################
@@ -871,7 +880,7 @@ class PeriphManagerBase(object):
"""
Return the number of timekeepers
"""
- raise NotImplementedError("get_num_timekeepers() not implemented.")
+ return self.mboard_regs_control.get_num_timekeepers()
def get_timekeeper_time(self, tk_idx, last_pps):
"""
@@ -881,8 +890,7 @@ class PeriphManagerBase(object):
tk_idx: Index of timekeeper
next_pps: If True, get time at last PPS. Otherwise, get time now.
"""
- raise NotImplementedError(
- "get_ticks_now({}, {}) not implemented.".format(tk_idx, last_pps))
+ return self.mboard_regs_control.get_timekeeper_time(tk_idx, last_pps)
def set_timekeeper_time(self, tk_idx, ticks, next_pps):
"""
@@ -893,9 +901,7 @@ class PeriphManagerBase(object):
ticks: Time in ticks
next_pps: If True, set time at next PPS. Otherwise, set time now.
"""
- raise NotImplementedError(
- "set_ticks_last_pps({}, {}, {}) not implemented."
- .format(tk_idx, ticks, next_pps))
+ self.mboard_regs_control.set_timekeeper_time(tk_idx, ticks, next_pps)
def set_tick_period(self, tk_idx, period_ns):
"""
@@ -905,8 +911,7 @@ class PeriphManagerBase(object):
tk_idx: Index of timekeeper
period_ns: Period in nanoseconds
"""
- raise NotImplementedError(
- "set_tick_period({}) not implemented.".format(tk_idx, period_ns))
+ self.mboard_regs_control.set_tick_period(tk_idx, period_ns)
def get_clocks(self):
"""