aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-02-28 14:20:56 -0800
committerMartin Braun <martin.braun@ettus.com>2018-03-05 15:56:41 -0800
commit725debb96408f0e1134fe1f365c4afaf07f1a949 (patch)
tree7acb4ca6d880469909fa4151e601dd8678339954 /mpm/python
parent9d55c5885800ac6659d93ab90af849ba0e5d5b97 (diff)
downloaduhd-725debb96408f0e1134fe1f365c4afaf07f1a949.tar.gz
uhd-725debb96408f0e1134fe1f365c4afaf07f1a949.tar.bz2
uhd-725debb96408f0e1134fe1f365c4afaf07f1a949.zip
mpm: Rename n310 to n3xx
This module (and class) are, in fact, used for all N3xx-derivates so renaming it is the more correct thing to do.
Diffstat (limited to 'mpm/python')
-rwxr-xr-xmpm/python/n3xx_bist28
-rwxr-xr-xmpm/python/usrp_hwd.py2
-rwxr-xr-xmpm/python/usrp_mpm/dboard_manager/magnesium_update_cpld.py2
-rw-r--r--mpm/python/usrp_mpm/periph_manager/CMakeLists.txt2
-rw-r--r--mpm/python/usrp_mpm/periph_manager/n3xx.py (renamed from mpm/python/usrp_mpm/periph_manager/n310.py)38
-rw-r--r--mpm/python/usrp_mpm/rpc_server.py2
-rw-r--r--mpm/python/usrp_mpm/sys_utils/net.py2
7 files changed, 39 insertions, 37 deletions
diff --git a/mpm/python/n3xx_bist b/mpm/python/n3xx_bist
index ae243d95e..00732a6c3 100755
--- a/mpm/python/n3xx_bist
+++ b/mpm/python/n3xx_bist
@@ -5,7 +5,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#
"""
-N310 Built-In Self Test (BIST)
+N3XX Built-In Self Test (BIST)
+
+Will work on all derivatives of the N3xx series.
"""
from __future__ import print_function
@@ -230,7 +232,7 @@ def expand_options(option_list):
##############################################################################
# Bist class
##############################################################################
-class N310BIST(object):
+class N3XXBIST(object):
"""
BIST Tool for the USRP N3xx series
"""
@@ -280,11 +282,11 @@ class N310BIST(object):
return parser
def __init__(self):
- self.args = N310BIST.make_arg_parser().parse_args()
+ self.args = N3XXBIST.make_arg_parser().parse_args()
self.args.option = expand_options(self.args.option)
try:
- from usrp_mpm.periph_manager.n310 import n310
- default_rev = n310.mboard_max_rev
+ from usrp_mpm.periph_manager.n3xx import n3xx
+ default_rev = n3xx.mboard_max_rev
except ImportError:
# This means we're in dry run mode or something like that, so just
# pick something
@@ -456,8 +458,8 @@ class N310BIST(object):
"eps": 34.11,
"mode": 3
}
- from usrp_mpm.periph_manager import n310
- gpio_tca6424 = n310.TCA6424(self.mb_rev)
+ from usrp_mpm.periph_manager import n3xx
+ gpio_tca6424 = n3xx.TCA6424(self.mb_rev)
# Turn on GPS, give some time to acclimatize
gpio_tca6424.set("PWREN-GPS")
time.sleep(5)
@@ -687,10 +689,10 @@ class N310BIST(object):
'write_patterns': list(patterns),
'read_patterns': list(patterns),
}
- from usrp_mpm.periph_manager import n310
- gpio_tca6424 = n310.TCA6424(self.mb_rev)
+ from usrp_mpm.periph_manager import n3xx
+ gpio_tca6424 = n3xx.TCA6424(self.mb_rev)
gpio_tca6424.set("FPGA-GPIO-EN")
- mb_regs = n310.MboardRegsControl(n310.n310.mboard_regs_label, self.log)
+ mb_regs = n3xx.MboardRegsControl(n3xx.n3xx.mboard_regs_label, self.log)
mb_regs.set_fp_gpio_master(0xFFF)
# Allow some time for the front-panel GPIOs to become usable
time.sleep(.5)
@@ -698,7 +700,7 @@ class N310BIST(object):
ddr2 = 0xfc0
def _run_gpio(ddr, patterns):
" Run a GPIO test for a given set of patterns "
- gpio_ctrl = n310.FrontpanelGPIO(ddr)
+ gpio_ctrl = n3xx.FrontpanelGPIO(ddr)
for pattern in patterns:
gpio_set_all(gpio_ctrl, pattern, GPIO_WIDTH, ddr)
time.sleep(0.1)
@@ -771,7 +773,7 @@ def gpio_set_all(gpio_bank, value, gpio_size, ddr_mask):
gpio_bank -- gpio bank type.
value -- value to set onto gpio bank.
gpio_size -- size of the gpio bank
- ddr_mask -- data direction register bit mask. 0 is input; 1 is output.
+ ddr_mask -- data direction register bit mask. 0 is input; 1 is output.
"""
ddr_size = bin(ddr_mask).count("1")
value_bitstring = ('{0:0' + str(ddr_size) + 'b}').format(value)[-(gpio_size):]
@@ -785,7 +787,7 @@ def gpio_set_all(gpio_bank, value, gpio_size, ddr_mask):
##############################################################################
def main():
" Go, go, go! "
- return N310BIST().run()
+ return N3XXBIST().run()
if __name__ == '__main__':
exit(not main())
diff --git a/mpm/python/usrp_hwd.py b/mpm/python/usrp_hwd.py
index 267415601..0b2cd1ecb 100755
--- a/mpm/python/usrp_hwd.py
+++ b/mpm/python/usrp_hwd.py
@@ -112,7 +112,7 @@ def init_only(log, default_args):
"""
# Create the periph_manager for this device
# This call will be forwarded to the device specific implementation
- # e.g. in periph_manager/n310.py
+ # e.g. in periph_manager/n3xx.py
# Which implementation is called will be determined during
# configuration with cmake (-DMPM_DEVICE).
# mgr is thus derived from PeriphManagerBase
diff --git a/mpm/python/usrp_mpm/dboard_manager/magnesium_update_cpld.py b/mpm/python/usrp_mpm/dboard_manager/magnesium_update_cpld.py
index a5ccde40b..8459d90b9 100755
--- a/mpm/python/usrp_mpm/dboard_manager/magnesium_update_cpld.py
+++ b/mpm/python/usrp_mpm/dboard_manager/magnesium_update_cpld.py
@@ -12,7 +12,7 @@ import argparse
import subprocess
import pyudev
from usrp_mpm.mpmlog import get_logger
-from usrp_mpm.periph_manager.n310 import MboardRegsControl
+from usrp_mpm.periph_manager.n3xx import MboardRegsControl
OPENOCD_DIR = "/usr/share/openocd/scripts"
CONFIGS = {
diff --git a/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt b/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt
index 7c988c96d..8000ebc6d 100644
--- a/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt
+++ b/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt
@@ -11,7 +11,7 @@ SET(USRP_MPM_FILES ${USRP_MPM_FILES})
SET(USRP_MPM_PERIPHMGR_FILES
${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in
${CMAKE_CURRENT_SOURCE_DIR}/base.py
- ${CMAKE_CURRENT_SOURCE_DIR}/n310.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/n3xx.py
${CMAKE_CURRENT_SOURCE_DIR}/test.py
)
LIST(APPEND USRP_MPM_FILES ${USRP_MPM_PERIPHMGR_FILES})
diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n3xx.py
index cff7da997..455206d84 100644
--- a/mpm/python/usrp_mpm/periph_manager/n310.py
+++ b/mpm/python/usrp_mpm/periph_manager/n3xx.py
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#
"""
-N310 implementation module
+N3xx implementation module
"""
from __future__ import print_function
@@ -407,8 +407,8 @@ class MboardRegsControl(object):
###############################################################################
# Transport managers
###############################################################################
-class N310XportMgrUDP(XportMgrUDP):
- " N310-specific UDP configuration "
+class N3xxXportMgrUDP(XportMgrUDP):
+ " N3xx-specific UDP configuration "
xbar_dev = "/dev/crossbar0"
iface_config = {
'sfp0': {
@@ -437,8 +437,8 @@ class N310XportMgrUDP(XportMgrUDP):
},
}
-class N310XportMgrLiberio(XportMgrLiberio):
- " N310-specific Liberio configuration "
+class N3xxXportMgrLiberio(XportMgrLiberio):
+ " N3xx-specific Liberio configuration "
max_chan = 10
xbar_dev = "/dev/crossbar0"
xbar_port = 2
@@ -446,9 +446,9 @@ class N310XportMgrLiberio(XportMgrLiberio):
###############################################################################
# Main Class
###############################################################################
-class n310(PeriphManagerBase):
+class n3xx(PeriphManagerBase):
"""
- Holds N310 specific attributes and methods
+ Holds N3xx specific attributes and methods
"""
#########################################################################
# Overridables
@@ -478,7 +478,7 @@ class n310(PeriphManagerBase):
# We're on a Zynq target, so the following two come from the Zynq standard
# device tree overlay (tree/arch/arm/boot/dts/zynq-7000.dtsi)
dboard_spimaster_addrs = ["e0006000.spi", "e0007000.spi"]
- # N310-specific settings
+ # N3xx-specific settings
# Label for the mboard UIO
mboard_regs_label = "mboard-regs"
# Override the list of updateable components
@@ -508,7 +508,7 @@ class n310(PeriphManagerBase):
"""
# In the N3xx case, we name the dtbo file the same as the product.
# N310 -> n310.dtbo, N300 -> n300.dtbo and so on.
- return [n310.pids[eeprom_md['pid']]]
+ return [n3xx.pids[eeprom_md['pid']]]
###########################################################################
# Ctor and device initialization tasks
@@ -521,7 +521,7 @@ class n310(PeriphManagerBase):
self._time_source = None
self._available_endpoints = list(range(256))
self._bp_leds = None
- super(n310, self).__init__(args)
+ super(n3xx, self).__init__(args)
if not self._device_initialized:
# Don't try and figure out what's going on. Just give up.
return
@@ -654,8 +654,8 @@ class n310(PeriphManagerBase):
self._init_meas_clock()
# Init CHDR transports
self._xport_mgrs = {
- 'udp': N310XportMgrUDP(self.log.getChild('UDP')),
- 'liberio': N310XportMgrLiberio(self.log.getChild('liberio')),
+ 'udp': N3xxXportMgrUDP(self.log.getChild('UDP')),
+ 'liberio': N3xxXportMgrLiberio(self.log.getChild('liberio')),
}
# Spawn status monitoring thread
self.log.trace("Spawning status monitor thread...")
@@ -684,7 +684,7 @@ class n310(PeriphManagerBase):
self.set_clock_source(args.get("clock_source"))
if "clock_source" in args or "time_source" in args:
self.set_time_source(args.get("time_source", self.get_time_source()))
- result = super(n310, self).init(args)
+ result = super(n3xx, self).init(args)
for xport_mgr in itervalues(self._xport_mgrs):
xport_mgr.init(args)
return result
@@ -697,7 +697,7 @@ class n310(PeriphManagerBase):
self.log.warning(
"Cannot run deinit(), device was never fully initialized!")
return
- super(n310, self).deinit()
+ super(n3xx, self).deinit()
for xport_mgr in itervalues(self._xport_mgrs):
xport_mgr.deinit()
self.log.trace("Resetting SID pool...")
@@ -707,7 +707,7 @@ class n310(PeriphManagerBase):
"""
Tear down all members that need to be specially handled before
deconstruction.
- For N310, this means the overlay.
+ For N3xx, this means the overlay.
"""
self.log.trace("Tearing down N3xx device...")
self._tear_down = True
@@ -716,7 +716,7 @@ class n310(PeriphManagerBase):
if self._status_monitor_thread.is_alive():
self.log.error("Could not terminate monitor thread!")
active_overlays = self.list_active_overlays()
- self.log.trace("N310 has active device tree overlays: {}".format(
+ self.log.trace("N3xx has active device tree overlays: {}".format(
active_overlays
))
for overlay in active_overlays:
@@ -984,7 +984,7 @@ class n310(PeriphManagerBase):
###########################################################################
def get_ref_lock_sensor(self):
"""
- The N310 has no ref lock sensor, but because the ref lock is
+ The N3xx has no ref lock sensor, but because the ref lock is
historically considered a motherboard-level sensor, we will return the
combined lock status of all daughterboards. If no dboard is connected,
or none has a ref lock sensor, we simply return True.
@@ -1219,7 +1219,7 @@ class n310(PeriphManagerBase):
# Cut off the period from the file extension
file_extension = file_extension[1:].lower()
binfile_path = self.updateable_components['fpga']['path'].format(
- self.mboard_info['product'])
+ self.mboard_info['product'])
if file_extension == "bit":
self.log.trace("Converting bit to bin file and writing to {}"
.format(binfile_path))
@@ -1232,7 +1232,7 @@ class n310(PeriphManagerBase):
else:
self.log.error("Invalid FPGA bitfile: {}"
.format(filepath))
- raise RuntimeError("Invalid N310 FPGA bitfile")
+ raise RuntimeError("Invalid N3xx FPGA bitfile")
# RPC server will reload the periph manager after this.
return True
diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py
index 3dbda4161..a983b6dcf 100644
--- a/mpm/python/usrp_mpm/rpc_server.py
+++ b/mpm/python/usrp_mpm/rpc_server.py
@@ -70,7 +70,7 @@ class MPMServer(RPCServer):
self.session_id = None
# Create the periph_manager for this device
# This call will be forwarded to the device specific implementation
- # e.g. in periph_manager/n310.py
+ # e.g. in periph_manager/n3xx.py
# Which implementation is called will be determined during
# configuration with cmake (-DMPM_DEVICE).
# mgr is thus derived from PeriphManagerBase
diff --git a/mpm/python/usrp_mpm/sys_utils/net.py b/mpm/python/usrp_mpm/sys_utils/net.py
index 61b9f2c91..ccce0762e 100644
--- a/mpm/python/usrp_mpm/sys_utils/net.py
+++ b/mpm/python/usrp_mpm/sys_utils/net.py
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#
"""
-N310 implementation module
+Network utilities for MPM
"""
import itertools
import socket