aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-03-01 18:06:08 -0800
committerMartin Braun <martin.braun@ettus.com>2018-03-01 18:34:28 -0800
commitc3cc98cc7623bd7f11dde513011435a919bda6fe (patch)
tree8e1a2a6fc07df6138a0834d749d5616b27aee2ce /mpm/python
parent8ff61759600b77dac4e5213ef54f6f938443624c (diff)
downloaduhd-c3cc98cc7623bd7f11dde513011435a919bda6fe.tar.gz
uhd-c3cc98cc7623bd7f11dde513011435a919bda6fe.tar.bz2
uhd-c3cc98cc7623bd7f11dde513011435a919bda6fe.zip
mpm: n3xx: Fix usage of UIO in Aurora tests
Diffstat (limited to 'mpm/python')
-rw-r--r--mpm/python/aurora_bist_test.py66
-rwxr-xr-xmpm/python/n3xx_bist35
2 files changed, 61 insertions, 40 deletions
diff --git a/mpm/python/aurora_bist_test.py b/mpm/python/aurora_bist_test.py
index 9fe6f10b4..da0cdc17e 100644
--- a/mpm/python/aurora_bist_test.py
+++ b/mpm/python/aurora_bist_test.py
@@ -11,7 +11,7 @@ Aurora BIST command line utility
from __future__ import print_function
import argparse
import usrp_mpm as mpm
-from usrp_mpm.uio import UIO
+from usrp_mpm.sys_utils.uio import UIO
from usrp_mpm.aurora_control import AuroraControl
########################################################################
@@ -23,7 +23,7 @@ def parse_args():
description='Controller for Ettus Aurora BIST Engine'
)
parser.add_argument(
- '--uio-dev', default='misc-enet-regs0',
+ '--uio-dev', default='misc-auro-regs0',
help='UIO device for master device peeks and pokes'
)
parser.add_argument(
@@ -62,33 +62,43 @@ def main():
args = parse_args()
# Initialize logger for downstream components
mpm.get_main_logger().getChild('main')
- master_core = AuroraControl(
- UIO(label=args.uio_dev, read_only=False),
- args.base_addr,
- )
- slave_core = None if args.slave_uio_dev is None else AuroraControl(
- UIO(label=args.slave_uio_dev, read_only=False),
- args.slave_base_addr,
- )
- if args.loopback:
- master_core.reset_core()
- master_core.set_loopback(enable=True)
- return True
- # Run BIST
- if args.test == 'ber':
- print("Performing BER BIST test.")
- master_core.run_ber_loopback_bist(
- args.duration,
- args.rate * 8e6,
- slave_core,
- )
- else:
- print("Performing Latency BIST test.")
- master_core.run_latency_loopback_bist(
- args.duration,
- args.rate * 8e6,
- slave_core,
+ master_core_uio = UIO(label=args.uio_dev, read_only=False)
+ master_core_uio.open()
+ if args.slave_uio_dev:
+ slave_core_uio = UIO(label=args.uio_dev, read_only=False)
+ slave_core_uio.open()
+ try:
+ master_core = AuroraControl(master_core_uio, args.base_addr)
+ slave_core = None if args.slave_uio_dev is None else AuroraControl(
+ slave_core_uio,
+ args.slave_base_addr,
)
+ if args.loopback:
+ master_core.reset_core()
+ master_core.set_loopback(enable=True)
+ return True
+ # Run BIST
+ if args.test == 'ber':
+ print("Performing BER BIST test.")
+ master_core.run_ber_loopback_bist(
+ args.duration,
+ args.rate * 8e6,
+ slave_core,
+ )
+ else:
+ print("Performing Latency BIST test.")
+ master_core.run_latency_loopback_bist(
+ args.duration,
+ args.rate * 8e6,
+ slave_core,
+ )
+ except Exception as ex:
+ print("Unexpected exception: {}".format(str(ex)))
+ return False
+ finally:
+ master_core_uio.close()
+ if args.slave_uio_dev:
+ slave_core_uio.close()
if __name__ == '__main__':
exit(not main())
diff --git a/mpm/python/n3xx_bist b/mpm/python/n3xx_bist
index 14f9370d0..ae243d95e 100755
--- a/mpm/python/n3xx_bist
+++ b/mpm/python/n3xx_bist
@@ -2,7 +2,7 @@
#
# Copyright 2017 Ettus Research, National Instruments Company
#
-# SPDX-License-Identifier: GPL-3.0
+# SPDX-License-Identifier: GPL-3.0-or-later
#
"""
N310 Built-In Self Test (BIST)
@@ -48,17 +48,28 @@ def run_aurora_bist(master, slave=None):
"""
from usrp_mpm import aurora_control
from usrp_mpm.sys_utils.uio import UIO
- master_au_ctrl = aurora_control.AuroraControl(
- UIO(label=master, read_only=False),
- )
- slave_au_ctrl = None if slave is None else aurora_control.AuroraControl(
- UIO(label=slave, read_only=False),
- )
- return master_au_ctrl.run_ber_loopback_bist(
- duration=10,
- requested_rate=1300 * 8e6,
- slave=slave_au_ctrl,
- )
+ try:
+ master_au_uio = UIO(label=master, read_only=False)
+ master_au_uio.open()
+ master_au_ctrl = aurora_control.AuroraControl(master_au_uio)
+ if slave is not None:
+ slave_au_uio = UIO(label=slave, read_only=False)
+ slave_au_uio.open()
+ slave_au_ctrl = None if slave is None else aurora_control.AuroraControl(
+ slave_au_uio
+ )
+ return master_au_ctrl.run_ber_loopback_bist(
+ duration=10,
+ requested_rate=1300 * 8e6,
+ slave=slave_au_ctrl,
+ )
+ except Exception as ex:
+ print("Unexpected exception: {}".format(str(ex)))
+ exit(1)
+ finally:
+ master_au_uio.close()
+ if slave is not None:
+ slave_au_uio.close()
def aurora_results_to_status(bist_results):
"""