From eaeab0c9bd36212971a814e114110455029c8f23 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 15 Sep 2018 10:44:59 +0800 Subject: [PATCH] frontend: add artiq_rtiomon --- artiq/frontend/artiq_rtiomon.py | 39 +++++++++++++++++++++++++++++++++ setup.py | 1 + 2 files changed, 40 insertions(+) create mode 100755 artiq/frontend/artiq_rtiomon.py diff --git a/artiq/frontend/artiq_rtiomon.py b/artiq/frontend/artiq_rtiomon.py new file mode 100755 index 000000000..eed6a9074 --- /dev/null +++ b/artiq/frontend/artiq_rtiomon.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +import argparse +import asyncio + +from artiq.coredevice.comm_moninj import * + + +def get_argparser(): + parser = argparse.ArgumentParser( + description="ARTIQ RTIO monitor") + parser.add_argument("core_addr", metavar="CORE_ADDR", + help="hostname or IP address of the core device") + parser.add_argument("channel", metavar="CHANNEL", type=lambda x: int(x, 0), nargs="+", + help="channel(s) to monitor") + return parser + + +def main(): + args = get_argparser().parse_args() + + loop = asyncio.get_event_loop() + try: + comm = CommMonInj( + lambda channel, probe, value: print("0x{:06x}: {}".format(channel, value)), + lambda channel, override, value: None) + loop.run_until_complete(comm.connect(args.core_addr)) + try: + for channel in args.channel: + comm.monitor_probe(True, channel, 0) + loop.run_forever() + finally: + loop.run_until_complete(comm.close()) + finally: + loop.close() + + +if __name__ == "__main__": + main() diff --git a/setup.py b/setup.py index a85f23ae5..0c7b31cc2 100755 --- a/setup.py +++ b/setup.py @@ -29,6 +29,7 @@ console_scripts = [ "artiq_influxdb = artiq.frontend.artiq_influxdb:main", "artiq_master = artiq.frontend.artiq_master:main", "artiq_mkfs = artiq.frontend.artiq_mkfs:main", + "artiq_rtiomon = artiq.frontend.artiq_rtiomon:main", "artiq_session = artiq.frontend.artiq_session:main", "artiq_rpctool = artiq.frontend.artiq_rpctool:main", "artiq_run = artiq.frontend.artiq_run:main",