aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-11-04 13:03:40 -0800
committerMartin Braun <martin.braun@ettus.com>2019-11-26 12:21:33 -0800
commit77cb9836ab8018a8807e30d54ea4b91d63ff6e3d (patch)
treeb8fc87104539945f0dd63e1d589a1effd4ef1477 /host
parentd997c235b84148f90ecfd16febc25190b1a7bc25 (diff)
downloaduhd-77cb9836ab8018a8807e30d54ea4b91d63ff6e3d.tar.gz
uhd-77cb9836ab8018a8807e30d54ea4b91d63ff6e3d.tar.bz2
uhd-77cb9836ab8018a8807e30d54ea4b91d63ff6e3d.zip
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
Diffstat (limited to 'host')
-rw-r--r--host/examples/gpio.cpp9
1 files changed, 9 insertions, 0 deletions
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<std::string>(&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<std::string>(&cpu)->default_value(GPIO_DEFAULT_CPU_FORMAT), "cpu data format")
("otw", po::value<std::string>(&otw)->default_value(GPIO_DEFAULT_OTW_FORMAT), "over the wire data format")
("rx_rate", po::value<double>(&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);