From 77cb9836ab8018a8807e30d54ea4b91d63ff6e3d Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 4 Nov 2019 13:03:40 -0800 Subject: examples: gpio: Add --list-banks option The gpio example can now list all available banks before running tests. Use like this: gpio --args $args --list-banks --- host/examples/gpio.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/host/examples/gpio.cpp b/host/examples/gpio.cpp index 5576fa7a4..1a6579d02 100644 --- a/host/examples/gpio.cpp +++ b/host/examples/gpio.cpp @@ -148,6 +148,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("help", "help message") ("args", po::value(&args)->default_value(""), "multi uhd device address args") ("repeat", "repeat loop until Ctrl-C is pressed") + ("list-banks", "print list of banks before running tests") ("cpu", po::value(&cpu)->default_value(GPIO_DEFAULT_CPU_FORMAT), "cpu data format") ("otw", po::value(&otw)->default_value(GPIO_DEFAULT_OTW_FORMAT), "over the wire data format") ("rx_rate", po::value(&rx_rate)->default_value(GPIO_DEFAULT_RX_RATE), "rx sample rate") @@ -177,6 +178,14 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args); std::cout << boost::format("Using Device: %s") % usrp->get_pp_string() << std::endl; + if (vm.count("list-banks")) { + std::cout << "Available GPIO banks: " << std::endl; + auto banks = usrp->get_gpio_banks(0); + for (auto& bank : banks) { + std::cout << "* " << bank << std::endl; + } + } + // print out initial unconfigured state of FP GPIO std::cout << "Initial GPIO values:" << std::endl; output_reg_values(gpio, usrp, num_bits); -- cgit v1.2.3