diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-05-12 14:27:59 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:53 -0800 |
commit | 9dee6175da45440997c8ed82fbf40f8f380dc4a7 (patch) | |
tree | ad791488d217c76f9187b318f026872f419939d5 /mpm/python/usrp_mpm/dboard_manager/base.py | |
parent | ca1723c02ea3d30f1003840f6fc1350e39c97485 (diff) | |
download | uhd-9dee6175da45440997c8ed82fbf40f8f380dc4a7.tar.gz uhd-9dee6175da45440997c8ed82fbf40f8f380dc4a7.tar.bz2 uhd-9dee6175da45440997c8ed82fbf40f8f380dc4a7.zip |
mpm: Moved device and dboard init/deinit to their own methods
Also cleaned up some cruft.
Diffstat (limited to 'mpm/python/usrp_mpm/dboard_manager/base.py')
-rw-r--r-- | mpm/python/usrp_mpm/dboard_manager/base.py | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/mpm/python/usrp_mpm/dboard_manager/base.py b/mpm/python/usrp_mpm/dboard_manager/base.py index 5bf31784f..c7e116fc0 100644 --- a/mpm/python/usrp_mpm/dboard_manager/base.py +++ b/mpm/python/usrp_mpm/dboard_manager/base.py @@ -42,12 +42,16 @@ class DboardManagerBase(object): def __init__(self, slot_idx, **kwargs): self.log = get_logger('dboardManager') self.slot_idx = slot_idx + self.device_info = {} self._init_spi_nodes(kwargs.get('spi_nodes', [])) def _init_spi_nodes(self, spi_devices): """ - docstring for _init_spi_nodes + Populates the self._spi_nodes dictionary. + Note that this won't instantiate any spidev objects, it'll just map + keys from self.spi_chipselect to spidev nodes, and do a sanity check + that enough nodes are available. """ if len(spi_devices) < len(self.spi_chipselect): self.log.error("Expected {0} spi devices, found {1} spi devices".format( @@ -59,8 +63,30 @@ class DboardManagerBase(object): self._spi_nodes[k] = spi_devices[v] self.log.debug("spidev device node map: {}".format(self._spi_nodes)) + def init(self, args): + """ + Run the dboard initialization. This typically happens at the beginning + of a UHD session. + + Must be overridden. + + args -- A dictionary of arbitrary settings that can be used by the + dboard code. Similar to device args for UHD. + """ + raise NotImplementedError("DboardManagerBase::init() not implemented!") + + def deinit(self): + """ + Power down the dboard. Does not have be implemented. If it does, it + needs to be safe to call multiple times. + """ + self.log.info("deinit() called, but not implemented.") + def get_serial(self): - return self._eeprom.get("serial", "") + """ + Return this daughterboard's serial number as a dictionary. + """ + return self.device_info.get("serial", "") def update_ref_clock_freq(self, freq): """ |