diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-07-26 17:07:04 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:04:00 -0800 |
commit | 3ea3d8a33876ad4776b069a234c7becfa943852f (patch) | |
tree | eb6ebc7350063304a454a52c851fc229e5ea62a5 /mpm/python/aurora_bist_test.py | |
parent | 1bd648833cc2e06bb11088725763c403b3456808 (diff) | |
download | uhd-3ea3d8a33876ad4776b069a234c7becfa943852f.tar.gz uhd-3ea3d8a33876ad4776b069a234c7becfa943852f.tar.bz2 uhd-3ea3d8a33876ad4776b069a234c7becfa943852f.zip |
mpm/n310: Added Aurora BIST code
Diffstat (limited to 'mpm/python/aurora_bist_test.py')
-rw-r--r-- | mpm/python/aurora_bist_test.py | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/mpm/python/aurora_bist_test.py b/mpm/python/aurora_bist_test.py new file mode 100644 index 000000000..4d6227b60 --- /dev/null +++ b/mpm/python/aurora_bist_test.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python +# +# Copyright 2017 Ettus Research (National Instruments) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +""" +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.aurora_control import AuroraControl + +######################################################################## +# command line options +######################################################################## +def parse_args(): + " Create argparser, return args " + parser = argparse.ArgumentParser( + description='Controller for Ettus Aurora BIST Engine' + ) + parser.add_argument( + '--uio-dev', default='misc-enet-regs0', + help='UIO device for master device peeks and pokes' + ) + parser.add_argument( + '--base-addr', type=int, default=0, + help='Base address for register read/writes' + ) + parser.add_argument( + '--slave-uio-dev', default=None, + help='UIO device for slave device peeks and pokes' + ) + parser.add_argument( + '--slave-base-addr', type=int, default=0, + help='Base address for register read/writes on slave' + ) + parser.add_argument( + '--test', default='ber', choices=['ber', 'latency'], + help='Type of test to run' + ) + parser.add_argument( + '--duration', type=int, default=10, help='Duration of test in seconds' + ) + parser.add_argument( + '--rate', type=int, default=1245, help='BIST throughput in MB/s' + ) + parser.add_argument( + '--loopback', action="store_true", + help="Don't run a test, but set this Aurora into loopback mode" + ) + return parser.parse_args() + +######################################################################## +# main +######################################################################## +def main(): + " Dawaj, dawaj! " + 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, + ) + +if __name__ == '__main__': + exit(not main()) |