aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/ethtable.py
diff options
context:
space:
mode:
authorBrent Stapleton <brent.stapleton@ettus.com>2018-07-20 16:07:38 -0700
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-07-23 10:33:34 -0700
commit5b18614d39f5cebdd8bf3bf6e5acf3a34f204191 (patch)
treed250c2e3189628e06f1467d2b6001e620b60b8a4 /mpm/python/usrp_mpm/ethtable.py
parent102fcc0ff897f6ff4ddce03b29d4b57b492d6ead (diff)
downloaduhd-5b18614d39f5cebdd8bf3bf6e5acf3a34f204191.tar.gz
uhd-5b18614d39f5cebdd8bf3bf6e5acf3a34f204191.tar.bz2
uhd-5b18614d39f5cebdd8bf3bf6e5acf3a34f204191.zip
uio: mpm: Fixup for opening mboard-regs UIO
- Fix the syntax to open mboard-regs UIO objects, and change the open() and close() functions to be private. - We were calling open() twice in every context manager line- once manually, and once in __enter__. This commit corrects those usages, and allows the context manager to fully manage the opening and closing of UIO objects.
Diffstat (limited to 'mpm/python/usrp_mpm/ethtable.py')
-rw-r--r--mpm/python/usrp_mpm/ethtable.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mpm/python/usrp_mpm/ethtable.py b/mpm/python/usrp_mpm/ethtable.py
index e3a3035ec..1721f4724 100644
--- a/mpm/python/usrp_mpm/ethtable.py
+++ b/mpm/python/usrp_mpm/ethtable.py
@@ -41,7 +41,7 @@ class EthDispatcherTable(object):
"""
self.log.debug("Setting my own IP address to `{}'".format(ip_addr))
ip_addr_int = int(netaddr.IPAddress(ip_addr))
- with self._regs.open():
+ with self._regs:
self.poke32(self.OWN_IP_OFFSET, ip_addr_int)
def set_vita_port(self, port_value=None, port_idx=None):
@@ -53,7 +53,7 @@ class EthDispatcherTable(object):
port_value = port_value or self.DEFAULT_VITA_PORT[port_idx]
assert port_idx in (0) #FIXME: Fix port_idx = 1
port_reg_addr = self.OWN_PORT_OFFSET
- with self._regs.open():
+ with self._regs:
self.poke32(port_reg_addr, port_value)
def set_route(self, sid, ip_addr, udp_port, mac_addr=None):
@@ -102,7 +102,7 @@ class EthDispatcherTable(object):
))
self.poke32(addr, data)
- with self._regs.open():
+ with self._regs:
poke_and_trace(
self.SID_IP_OFFSET + sid_offset,
ip_addr_int
@@ -125,5 +125,5 @@ class EthDispatcherTable(object):
self.log.trace("Writing to address 0x{:04X}: 0x{:04X}".format(
self.FORWARD_ETH_BCAST_OFFSET, reg_value
))
- with self._regs.open():
+ with self._regs:
self.poke32(self.FORWARD_ETH_BCAST_OFFSET, reg_value)