diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-10-09 17:44:02 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:04:02 -0800 |
commit | cea45dda8f7d7918930a6b1150913390d4480037 (patch) | |
tree | 66ca4ca6bdabe32e023317afae8bde674ecaf329 /mpm | |
parent | 9a9759e2cfea3de602dda3053c1a4a46005abeb1 (diff) | |
download | uhd-cea45dda8f7d7918930a6b1150913390d4480037.tar.gz uhd-cea45dda8f7d7918930a6b1150913390d4480037.tar.bz2 uhd-cea45dda8f7d7918930a6b1150913390d4480037.zip |
mpm: Add mboard EEPROM support
MPMD binds a property for the mboard EEPROM to the appropriate RPC
calls. PeriphManager now provides default implementations for an mboard
EEPROM.
Diffstat (limited to 'mpm')
-rw-r--r-- | mpm/python/usrp_mpm/dboard_manager/base.py | 6 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/base.py | 26 |
2 files changed, 28 insertions, 4 deletions
diff --git a/mpm/python/usrp_mpm/dboard_manager/base.py b/mpm/python/usrp_mpm/dboard_manager/base.py index b87033860..cf3510abf 100644 --- a/mpm/python/usrp_mpm/dboard_manager/base.py +++ b/mpm/python/usrp_mpm/dboard_manager/base.py @@ -134,8 +134,8 @@ class DboardManagerBase(object): format. """ callback_map = \ - rx_sensor_callback_map if direction.lower() == 'rx' \ - else tx_sensor_callback_map + self.rx_sensor_callback_map if direction.lower() == 'rx' \ + else self.tx_sensor_callback_map if sensor_name not in callback_map: error_msg = "Was asked for non-existent sensor `{}'.".format( sensor_name @@ -143,6 +143,6 @@ class DboardManagerBase(object): self.log.error(error_msg) raise RuntimeError(error_msg) return getattr( - self, self.callback_map.get('sensor_name') + self, callback_map.get('sensor_name') )() diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py index 72066b9ef..dc52b3a1b 100644 --- a/mpm/python/usrp_mpm/periph_manager/base.py +++ b/mpm/python/usrp_mpm/periph_manager/base.py @@ -174,7 +174,7 @@ class PeriphManagerBase(object): ) self.log.trace("Found EEPROM metadata: `{}'".format(str(self._eeprom_head))) self.log.trace("Read {} bytes of EEPROM data.".format(len(self._eeprom_rawdata))) - for key in ('pid', 'serial', 'rev'): + for key in ('pid', 'serial', 'rev', 'eeprom_version'): # In C++, we can only handle dicts if all the values are of the # same type. So we must convert them all to strings here: try: @@ -464,6 +464,9 @@ class PeriphManagerBase(object): xbar_file.write(laddr_value) return True + ########################################################################## + # Mboard Sensors + ########################################################################## def get_mb_sensors(self): """ Return a list of sensor names. @@ -499,3 +502,24 @@ class PeriphManagerBase(object): self, self.mboard_sensor_callback_map.get(sensor_name) )() + ########################################################################## + # EEPROMS + ########################################################################## + def get_mb_eeprom(self): + """ + Return a dictionary with EEPROM contents + + All key/value pairs are string -> string + """ + return {k: str(v) for k, v in iteritems(self._eeprom_head)} + + def set_mb_eeprom(self, eeprom_vals): + """ + eeprom_vals is a dictionary (string -> string) + + By default, we do nothing. Writing EEPROMs is highly device specific + and is thus defined in the individual device classes. + """ + self.log.warn("Called set_mb_eeprom(), but not implemented!") + raise NotImplementedError + |