From: Sean Cross Date: Fri, 19 Apr 2019 14:56:39 +0000 (+0100) Subject: utils: litex_server: add usb support X-Git-Tag: 24jan2021_ls180~1320^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c69183648f326ad28527f6309675facc8306ed3f;p=litex.git utils: litex_server: add usb support Add `--usb` and associated arguments to create a litex bridge over USB. This makes use of the new CommUSB module. Signed-off-by: Sean Cross --- diff --git a/litex/utils/litex_server.py b/litex/utils/litex_server.py index f8c6b116..49101225 100755 --- a/litex/utils/litex_server.py +++ b/litex/utils/litex_server.py @@ -122,6 +122,16 @@ def main(): help="Select PCIe interface") parser.add_argument("--pcie-bar", default=None, help="Set PCIe BAR") + + # USB arguments + parser.add_argument("--usb", action="store_true", + help="Select USB interface") + parser.add_argument("--usb-vid", default=None, + help="Set USB vendor ID") + parser.add_argument("--usb-pid", default=None, + help="Set USB product ID") + parser.add_argument("--usb-max-retries", default=10, + help="Number of times to try reconnecting to USB") args = parser.parse_args() @@ -148,6 +158,19 @@ def main(): exit() print("[CommPCIe] bar: {} / ".format(args.pcie_bar), end="") comm = CommPCIe(args.pcie_bar) + elif args.usb: + from litex.soc.tools.remote import CommUSB + if args.usb_pid is None and args.usb_vid is None: + print("Need to speficy --usb-vid or --usb-pid, exiting.") + exit() + print("[CommUSB] vid: {} / pid: {} / ".format(args.usb_vid, args.usb_pid), end="") + pid = args.usb_pid + if pid is not None: + pid = int(pid, base=0) + vid = args.usb_vid + if vid is not None: + vid = int(vid, base=0) + comm = CommUSB(vid=vid, pid=pid, max_retries=args.usb_max_retries) else: parser.print_help() exit()