2014-09-25 23:01:05 +00:00
|
|
|
//
|
|
|
|
|
// Copyright 2014 Ettus Research LLC
|
2018-02-19 23:30:32 +00:00
|
|
|
// Copyright 2018 Ettus Research, a National Instruments Company
|
2014-09-25 23:01:05 +00:00
|
|
|
//
|
2018-02-19 23:30:32 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2014-09-25 23:01:05 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
// This tiny program is meant as an example on how to set up UHD
|
|
|
|
|
// projects using CMake.
|
|
|
|
|
// The program itself only initializes a USRP. For more elaborate examples,
|
|
|
|
|
// have a look at the files in host/examples/.
|
|
|
|
|
|
|
|
|
|
#include <uhd/usrp/multi_usrp.hpp>
|
2019-01-14 18:35:25 +00:00
|
|
|
#include <uhd/utils/safe_main.hpp>
|
|
|
|
|
#include <uhd/utils/thread.hpp>
|
2014-09-25 23:01:05 +00:00
|
|
|
#include <boost/format.hpp>
|
2019-01-14 18:35:25 +00:00
|
|
|
#include <boost/program_options.hpp>
|
2014-09-25 23:01:05 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
namespace po = boost::program_options;
|
|
|
|
|
|
2019-01-14 18:35:25 +00:00
|
|
|
int UHD_SAFE_MAIN(int argc, char* argv[])
|
|
|
|
|
{
|
|
|
|
|
// variables to be set by po
|
2014-09-25 23:01:05 +00:00
|
|
|
std::string args;
|
|
|
|
|
|
2019-01-14 18:35:25 +00:00
|
|
|
// setup the program options
|
2014-09-25 23:01:05 +00:00
|
|
|
po::options_description desc("Allowed options");
|
2019-01-14 18:35:25 +00:00
|
|
|
desc.add_options()("help", "help message")("args",
|
|
|
|
|
po::value<std::string>(&args)->default_value(""),
|
|
|
|
|
"multi uhd device address args");
|
2014-09-25 23:01:05 +00:00
|
|
|
po::variables_map vm;
|
|
|
|
|
po::store(po::parse_command_line(argc, argv, desc), vm);
|
|
|
|
|
po::notify(vm);
|
|
|
|
|
|
2019-01-14 18:35:25 +00:00
|
|
|
// print the help message
|
|
|
|
|
if (vm.count("help")) {
|
|
|
|
|
std::cout << boost::format("Mini-example to initialize a USRP (args==%s).") % args
|
|
|
|
|
<< std::endl;
|
2014-09-25 23:01:05 +00:00
|
|
|
return ~0;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-14 18:35:25 +00:00
|
|
|
// create a usrp device
|
2014-09-25 23:01:05 +00:00
|
|
|
std::cout << std::endl;
|
2019-01-14 18:35:25 +00:00
|
|
|
std::cout << boost::format("Creating the usrp device with: %s...") % args
|
|
|
|
|
<< std::endl;
|
2014-09-25 23:01:05 +00:00
|
|
|
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
|
|
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
|
}
|