aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/dboard_manager
diff options
context:
space:
mode:
Diffstat (limited to 'mpm/python/usrp_mpm/dboard_manager')
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/base.py30
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/eiscat.py8
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/magnesium.py14
3 files changed, 38 insertions, 14 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):
"""
diff --git a/mpm/python/usrp_mpm/dboard_manager/eiscat.py b/mpm/python/usrp_mpm/dboard_manager/eiscat.py
index 7a930af79..78d5d0e18 100644
--- a/mpm/python/usrp_mpm/dboard_manager/eiscat.py
+++ b/mpm/python/usrp_mpm/dboard_manager/eiscat.py
@@ -30,7 +30,7 @@ N_CHANS = 8 # Chans per dboard
# Power enable pins
POWER_ENB = 0x200C # Address of the power enable register
-PWR_CHAN_EN_2V5 = [(1<<x) for x in xrange(8)]
+PWR_CHAN_EN_2V5 = [(1<<chan_en) for chan_en in xrange(8)]
PWR2_5V_DC_CTRL_ENB = 1<<8
PWR2_5V_DC_PWR_EN = 1<<9
PWR2_5V_LNA_CTRL_EN = 1<<10
@@ -382,12 +382,15 @@ class EISCAT(DboardManagerBase):
self.mmcm = None
self._spi_ifaces = None
- def init_device(self):
+ def init(self, args):
"""
Execute necessary actions to bring up the daughterboard
This assumes that an appropriate overlay was loaded.
"""
+ self.log.info("init() called with args `{}'".format(
+ ",".join(['{}={}'.format(x, args[x]) for x in args])
+ ))
self.log.trace("Getting uio...")
self.radio_regs = UIO(label="jesd204b-regs", read_only=False)
# Create JESD cores. They will also test the UIO regs on initialization.
@@ -456,6 +459,7 @@ class EISCAT(DboardManagerBase):
for i in xrange(2):
if not self.jesd_cores[i].check_deframer_status():
raise RuntimeError("JESD Core {}: Deframer status not lookin' so good!".format(i))
+ self.log.info("JESD core initialized, link up!")
self.phase_dac = self._spi_ifaces['phase_dac']
## END OF THE JEPSON SEQUENCE ##
diff --git a/mpm/python/usrp_mpm/dboard_manager/magnesium.py b/mpm/python/usrp_mpm/dboard_manager/magnesium.py
index edb9a24db..9edfe497c 100644
--- a/mpm/python/usrp_mpm/dboard_manager/magnesium.py
+++ b/mpm/python/usrp_mpm/dboard_manager/magnesium.py
@@ -65,12 +65,14 @@ class Magnesium(DboardManagerBase):
def __init__(self, slot_idx, **kwargs):
super(Magnesium, self).__init__(*args, **kwargs)
self.log = get_logger("Magnesium")
- # eeprom_data is a tuple (head_dict, raw_data)
- def init_device(self):
+ def init(self, args):
"""
Execute necessary init dance to bring up dboard
"""
+ self.log.info("init() called with args `{}'".format(
+ ",".join(['{}={}'.format(x, args[x]) for x in args])
+ ))
self.clock_regs = create_spidev_iface(self._spi_nodes['lmk'])
self.log.debug("Loading C++ drivers...")
self._device = lib.dboards.magnesium_manager(
@@ -144,11 +146,3 @@ class Magnesium(DboardManagerBase):
print("%08X" % self.radio_regs.peek32(i + j)),
print("")
- def read_eeprom_v1(self, data):
- """
- read eeprom data version 1
- """
- # magnesium eeprom contains
- # nothing
- return struct.unpack_from("x", data)
-