From bc8713e7af36377abe1c0e969c095c6b627b00c7 Mon Sep 17 00:00:00 2001 From: Martin Anderseck Date: Thu, 17 Mar 2022 13:34:15 +0100 Subject: host: SPI: Read number of supported SPI slaves from device Add support for reading the number of supported SPI slaves from the device. This has become necessary because we may have bitfiles with different capabilities and we want to report this back correctly. --- host/examples/spi.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'host/examples/spi.cpp') diff --git a/host/examples/spi.cpp b/host/examples/spi.cpp index e5372cac3..e986eb7d3 100644 --- a/host/examples/spi.cpp +++ b/host/examples/spi.cpp @@ -68,8 +68,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) // create a usrp device std::cout << std::endl; - std::cout << "Creating the usrp device with: " << args << "..." - << std::endl; + std::cout << "Creating the usrp device with: " << args << "..." << std::endl; auto usrp = uhd::usrp::multi_usrp::make(args); if (vm.count("list-banks")) { @@ -80,7 +79,12 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) } } - // Get the SPI getter interface from where we'll get + // Get the SPI getter interface from where we'll get the SPI interface itself + if (!usrp->get_radio_control().has_feature()) { + std::cout << "Error: Could not find SPI_Getter_Iface. Please check if your FPGA " + "image is up to date.\n"; + return EXIT_FAILURE; + } auto& spi_getter_iface = usrp->get_radio_control().get_feature(); -- cgit v1.2.3