aboutsummaryrefslogtreecommitdiffstats
path: root/mpm
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-06-01 18:39:04 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:58 -0800
commit18098228932f3e25e3ac1750599c5e531657f161 (patch)
treea2c3385c6628c8692eb4b0ec3675a0d2c78541a9 /mpm
parent3f47aeaf13b8ab2bf3672b271b721dbae62aafbb (diff)
downloaduhd-18098228932f3e25e3ac1750599c5e531657f161.tar.gz
uhd-18098228932f3e25e3ac1750599c5e531657f161.tar.bz2
uhd-18098228932f3e25e3ac1750599c5e531657f161.zip
mpm/mpmd: Further improvements on multi-device operations
- Crossbar local addr is now written during initialization of UHD session - Support for multiple crossbars per device (at least on UHD side) - Crossbars are now sequentially given a unique address
Diffstat (limited to 'mpm')
-rw-r--r--mpm/python/usrp_mpm/periph_manager/base.py26
-rw-r--r--mpm/python/usrp_mpm/periph_manager/n310.py2
2 files changed, 23 insertions, 5 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py
index 4e6d461d8..ef9e4b092 100644
--- a/mpm/python/usrp_mpm/periph_manager/base.py
+++ b/mpm/python/usrp_mpm/periph_manager/base.py
@@ -387,8 +387,12 @@ class PeriphManagerBase(object):
xbar_index -- The index of the crossbar that's being queried.
docstring for get_num_blocks"""
- # FIXME
- return int(open('/sys/class/rfnoc_crossbar/crossbar0/nports').read().strip()) - 3
+ # FIXME udev lookup
+ xbar_sysfs_path = '/sys/class/rfnoc_crossbar/crossbar{}/nports'.format(
+ xbar_index
+ )
+ return int(open(xbar_sysfs_path).read().strip()) - \
+ self.get_base_port(xbar_index)
@no_claim
def get_base_port(self, xbar_index):
@@ -401,5 +405,21 @@ class PeriphManagerBase(object):
xbar_index -- The index of the crossbar that's being queried
"""
- return 3 # FIXME This is the same 3 as in get_num_blocks
+ return 3 # FIXME It's 3 because 0,1,2 are SFP,SFP,DMA
+
+ def set_xbar_local_addr(self, xbar_index, local_addr):
+ """
+ Program crossbar xbar_index to have the local address local_addr.
+ """
+ # FIXME udev lookup
+ xbar_sysfs_path = '/sys/class/rfnoc_crossbar/crossbar{}/local_addr'.format(
+ xbar_index
+ )
+ laddr_value = "0x{:X}".format(local_addr)
+ self.log.trace("Setting local address for xbar {} to {}.".format(
+ xbar_sysfs_path, laddr_value
+ ))
+ with open(xbar_sysfs_path, "w") as xbar_file:
+ xbar_file.write(laddr_value)
+ return True
diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py
index 5817998e7..f49b6d052 100644
--- a/mpm/python/usrp_mpm/periph_manager/n310.py
+++ b/mpm/python/usrp_mpm/periph_manager/n310.py
@@ -131,8 +131,6 @@ class n310(PeriphManagerBase):
args.default_args.get('clock_source', N3XX_DEFAULT_CLOCK_SOURCE)
)
- with open("/sys/class/rfnoc_crossbar/crossbar0/local_addr", "w") as xbar:
- xbar.write("0x2")
# if header.get("dataversion", 0) == 1:
self.log.info("mboard info: {}".format(self.mboard_info))
# Define some attributes so PyLint stays quiet