diff options
author | Martin Braun <martin.braun@ettus.com> | 2022-01-28 11:55:14 +0100 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-02-16 14:53:37 -0600 |
commit | 3ad6dc8a699d302a1f31b101a0b94ada8e343bc0 (patch) | |
tree | 27f2ce126fa715aa4594629bb3bbbf632584a2ff /mpm/python/usrp_mpm | |
parent | 541865b88b0b6f7425bec7a6ade8a99763e92b3f (diff) | |
download | uhd-3ad6dc8a699d302a1f31b101a0b94ada8e343bc0.tar.gz uhd-3ad6dc8a699d302a1f31b101a0b94ada8e343bc0.tar.bz2 uhd-3ad6dc8a699d302a1f31b101a0b94ada8e343bc0.zip |
mpm: eeprom: Improve E320 and N3x0 EEPROM code/comments
- Fix some Pylint warnings in eeprom.py
- Improve comments in n3xx.py and e320.py regarding rev_compat values in
EEPROM
Diffstat (limited to 'mpm/python/usrp_mpm')
-rw-r--r-- | mpm/python/usrp_mpm/eeprom.py | 23 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/e320.py | 5 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/n3xx.py | 7 |
3 files changed, 23 insertions, 12 deletions
diff --git a/mpm/python/usrp_mpm/eeprom.py b/mpm/python/usrp_mpm/eeprom.py index 3a839d3a6..6aedc9f5e 100644 --- a/mpm/python/usrp_mpm/eeprom.py +++ b/mpm/python/usrp_mpm/eeprom.py @@ -9,12 +9,10 @@ EEPROM management code import struct import zlib -from builtins import zip -from builtins import object EEPROM_DEFAULT_HEADER = struct.Struct("!I I") -class MboardEEPROM(object): +class MboardEEPROM: """ Given a nvmem path, read out EEPROM values from the motherboard's EEPROM. The format of data in the EEPROM must follow the following standard: @@ -74,9 +72,12 @@ class MboardEEPROM(object): # Create one of these for every version of the EEPROM format: eeprom_header_format = ( None, # For laziness, we start at version 1 and thus index 0 stays empty - "!I I 16s H H 7s 1x 24s I", # Version 1 - "!I I 16s H H 7s 1x 6s H 6s H 6s 2x I", # Version 2 (Ignore the extra fields, it doesn't matter to MPM) - "!I I 16s H H 7s 1x 6s H 6s H 6s H I", # Version 3 (Ignore the extra fields, it doesn't matter to MPM) + # Version 1 + "!I I 16s H H 7s 1x 24s I", + # Version 2 (Ignore the extra fields, it doesn't matter to MPM) + "!I I 16s H H 7s 1x 6s H 6s H 6s 2x I", + # Version 3 (Ignore the extra fields, it doesn't matter to MPM) + "!I I 16s H H 7s 1x 6s H 6s H 6s H I", ) eeprom_header_keys = ( None, # For laziness, we start at version 1 and thus index 0 stays empty @@ -85,7 +86,7 @@ class MboardEEPROM(object): ('magic', 'eeprom_version', 'mcu_flags', 'pid', 'rev', 'serial', 'mac_eth0', 'dt_compat', 'mac_eth1', 'ec_compat', 'mac_eth2', 'rev_compat', 'CRC'), # Version 3 ) -class DboardEEPROM(object): +class DboardEEPROM: """ Given a nvmem path, read out EEPROM values from the daughterboard's EEPROM. The format of data in the EEPROM must follow the following standard: @@ -123,8 +124,10 @@ class DboardEEPROM(object): ) eeprom_header_keys = ( None, # For laziness, we start at version 1 and thus index 0 stays empty - ('magic', 'eeprom_version', 'pid', 'rev', 'serial', 'CRC'), # Version 1 - ('magic', 'eeprom_version', 'pid', 'rev', 'serial', 'CRC'), # Version 2 (Ignore the extra field, it doesn't matter to MPM) + # Version 1 + ('magic', 'eeprom_version', 'pid', 'rev', 'serial', 'CRC'), + # Version 2 (Ignore the extra field, it doesn't matter to MPM) + ('magic', 'eeprom_version', 'pid', 'rev', 'serial', 'CRC'), ) @@ -182,5 +185,3 @@ def read_eeprom( if eeprom_version >= len(eeprom_header_format): raise RuntimeError("Unexpected EEPROM version: `{}'".format(eeprom_version)) return (_parse_eeprom_data(data, eeprom_version), data) - - diff --git a/mpm/python/usrp_mpm/periph_manager/e320.py b/mpm/python/usrp_mpm/periph_manager/e320.py index fe7debd62..b191285e8 100644 --- a/mpm/python/usrp_mpm/periph_manager/e320.py +++ b/mpm/python/usrp_mpm/periph_manager/e320.py @@ -87,6 +87,11 @@ class e320(ZynqComponents, PeriphManagerBase): mboard_info = {"type": "e3xx", "product": "e320" } + # This is the latest HW revision that his version of MPM is aware of. This + # version of MPM will be able to run with any hardware which has a rev_compat + # field that is equal or less than this value. + # Note: If the hardware is revved in a non-compatible way, eeprom-init.c + # must also be updated (derive_rev_compat). mboard_max_rev = 4 # rev E mboard_sensor_callback_map = { 'ref_locked': 'get_ref_lock_sensor', diff --git a/mpm/python/usrp_mpm/periph_manager/n3xx.py b/mpm/python/usrp_mpm/periph_manager/n3xx.py index b780f2011..09386106d 100644 --- a/mpm/python/usrp_mpm/periph_manager/n3xx.py +++ b/mpm/python/usrp_mpm/periph_manager/n3xx.py @@ -126,7 +126,12 @@ class n3xx(ZynqComponents, PeriphManagerBase): mboard_eeprom_offset = 0 mboard_eeprom_max_len = 256 mboard_info = {"type": "n3xx"} - mboard_max_rev = 10 # latest HW revision that this version of MPM is aware of + # This is the latest HW revision that his version of MPM is aware of. This + # version of MPM will be able to run with any hardware which has a rev_compat + # field that is equal or less than this value. + # Note: If the hardware is revved in a non-compatible way, eeprom-init.c + # must also be updated (derive_rev_compat). + mboard_max_rev = 10 mboard_sensor_callback_map = { 'ref_locked': 'get_ref_lock_sensor', 'gps_locked': 'get_gps_lock_sensor', |