aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/periph_manager/base.py
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/python/usrp_mpm/periph_manager/base.py
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/python/usrp_mpm/periph_manager/base.py')
-rw-r--r--mpm/python/usrp_mpm/periph_manager/base.py26
1 files changed, 23 insertions, 3 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