diff options
author | Andrej Rode <andrej.rode@ettus.com> | 2017-03-21 19:46:50 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:44 -0800 |
commit | ef6326a174e6880be5e2eaeac26a2c5de0768807 (patch) | |
tree | c949545e02390745c3a373e657bcf2404e62e191 /mpm/python/usrp_mpm/periphs.py | |
parent | b29246a9e2d7ed1e03e44cfc6804615fcfa5a5d8 (diff) | |
download | uhd-ef6326a174e6880be5e2eaeac26a2c5de0768807.tar.gz uhd-ef6326a174e6880be5e2eaeac26a2c5de0768807.tar.bz2 uhd-ef6326a174e6880be5e2eaeac26a2c5de0768807.zip |
mpm: python refactoring
Diffstat (limited to 'mpm/python/usrp_mpm/periphs.py')
-rw-r--r-- | mpm/python/usrp_mpm/periphs.py | 47 |
1 files changed, 7 insertions, 40 deletions
diff --git a/mpm/python/usrp_mpm/periphs.py b/mpm/python/usrp_mpm/periphs.py index 3a78f224b..8c00d8f50 100644 --- a/mpm/python/usrp_mpm/periphs.py +++ b/mpm/python/usrp_mpm/periphs.py @@ -19,52 +19,19 @@ """ import libpyusrp_periphs as lib -import re import logging -log = logging.Logger("usrp_mpm.periphs") +import periph_manager +import dboard_manager + +log = logging.Logger("usrp_mpm.periphs") def init_periph_manager(mb_type=None, db_types={}, fpga=None): - # Detect motherboard type if not already specified - if mb_type is None: - mb_files = lib.helper.find_mb_file() - with open(mb_files, "r") as f: - info = "".join(f.readlines()) - device_type = re.match("^.*USRP;([-\w])+;.*", info) - if device_type is None: - log.fatal("Could not determine device type from {}".format(info)) - exit(1) - mb_type = device_type.group(1) - # Check if we have an implementation for this motherboard type - try: - device_class = getattr(lib, mb_type) - except AttributeError: - log.fatal("Motherboard class implementation for {} device not found!".format(mb_type)) - exit(1) + pass + # Moved to periph_manager/base.py __init__ - # Detect daughterboard type if not already specified - if not db_types: - db_files = lib.helper.find_db_files() - db_types = {} - for db in db_files: - with open(db, "r") as f: - info = "".join(f.readlines()) - device_type = re.match("^.*SLOT;([\w]);DB;([-\w])+;.*", info) - if device_type is None: - log.fatal("Could not determine device type from: {}".format(info)) - exit(2) - slot = device_type.group(1) - db_type = device_type.group(2) - db_types.update({slot: db_type}) - # Check if we have an implementation for the daughterboard types - for db in db_types.values(): - try: - getattr(lib.db, db) - except AttributeError: - log.fatal("Daughterboard class implementation for {} device not found!".format(db)) - exit(1) - # Next steps + # Next steps implemented in periph_manager/derived class # # 1. Load FPGA image # 2. Use motherboard and daughterboard types to load the FPGA image |