aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/periph_manager/e31x.py
diff options
context:
space:
mode:
authorMichael Auchter <michael.auchter@ni.com>2019-09-24 09:50:22 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2021-02-11 12:26:10 -0600
commit5ef29d93966aecb3c678aa5ee92cf60b0db835e5 (patch)
tree29aeb0513c2e7e27e486e092cb48cb85d936566e /mpm/python/usrp_mpm/periph_manager/e31x.py
parent9ffdd46974fa83db7ef4a76202e6708f776a327a (diff)
downloaduhd-5ef29d93966aecb3c678aa5ee92cf60b0db835e5.tar.gz
uhd-5ef29d93966aecb3c678aa5ee92cf60b0db835e5.tar.bz2
uhd-5ef29d93966aecb3c678aa5ee92cf60b0db835e5.zip
mpm: deduplicate dboard eeprom handling
The _get_dboard_eeprom_info implementations are the same with the exception of how the dboard eeprom is actually read. Break that out into a _read_dboard_eeprom method to reduce code duplication. The base class now defines a lambda expression for the eeprom reader which can be changed in subclasses. Co-authored-by: Lars Amsel <lars.amsel@ni.com> Co-authored-by: Michael Auchter <michael.auchter@ni.com>
Diffstat (limited to 'mpm/python/usrp_mpm/periph_manager/e31x.py')
-rw-r--r--mpm/python/usrp_mpm/periph_manager/e31x.py26
1 files changed, 2 insertions, 24 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/e31x.py b/mpm/python/usrp_mpm/periph_manager/e31x.py
index 17cd09c16..94d6f7529 100644
--- a/mpm/python/usrp_mpm/periph_manager/e31x.py
+++ b/mpm/python/usrp_mpm/periph_manager/e31x.py
@@ -361,18 +361,8 @@ class e31x(ZynqComponents, PeriphManagerBase):
self.log.trace("Read %d bytes of EEPROM data.", len(eeprom_rawdata))
return eeprom_head, eeprom_rawdata
- def _get_dboard_eeprom_info(self):
- """
- Read back EEPROM info from the daughterboards
- """
- assert self.dboard_eeprom_addr
- self.log.trace("Identifying dboard EEPROM paths from `{}'..."
- .format(self.dboard_eeprom_addr))
- dboard_eeprom_path = \
- get_eeprom_paths(self.dboard_eeprom_addr)[self.dboard_eeprom_path_index]
- self.log.trace("Using dboard EEPROM paths: {}".format(dboard_eeprom_path))
- self.log.debug("Reading EEPROM info for dboard...")
- dboard_eeprom_md, dboard_eeprom_rawdata = e31x_legacy_eeprom.read_eeprom(
+ def _read_dboard_eeprom(self, dboard_eeprom_path):
+ return e31x_legacy_eeprom.read_eeprom(
False, # is not motherboard.
dboard_eeprom_path,
self.dboard_eeprom_offset,
@@ -380,18 +370,6 @@ class e31x(ZynqComponents, PeriphManagerBase):
e31x_legacy_eeprom.DboardEEPROM.eeprom_header_keys,
self.dboard_eeprom_max_len
)
- self.log.trace("Read %d bytes of dboard EEPROM data.",
- len(dboard_eeprom_rawdata))
- db_pid = dboard_eeprom_md.get('pid')
- if db_pid is None:
- self.log.warning("No DB PID found in dboard EEPROM!")
- else:
- self.log.debug("Found DB PID in EEPROM: 0x{:04X}".format(db_pid))
- return [{
- 'eeprom_md': dboard_eeprom_md,
- 'eeprom_rawdata': dboard_eeprom_rawdata,
- 'pid': db_pid,
- }]
###########################################################################
# Session init and deinit