diff options
Diffstat (limited to 'host/examples')
| -rw-r--r-- | host/examples/benchmark_rate.cpp | 15 | ||||
| -rw-r--r-- | host/examples/test_messages.cpp | 3 | ||||
| -rw-r--r-- | host/examples/tx_waveforms.cpp | 5 | 
3 files changed, 14 insertions, 9 deletions
diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp index fce184514..8f00e25de 100644 --- a/host/examples/benchmark_rate.cpp +++ b/host/examples/benchmark_rate.cpp @@ -40,11 +40,11 @@ unsigned long long num_seq_errors = 0;  /***********************************************************************   * Benchmark RX Rate   **********************************************************************/ -void benchmark_rx_rate(uhd::usrp::multi_usrp::sptr usrp){ +void benchmark_rx_rate(uhd::usrp::multi_usrp::sptr usrp, const std::string &rx_otw){      uhd::set_thread_priority_safe();      //create a receive streamer -    uhd::stream_args_t stream_args("fc32"); //complex floats +    uhd::stream_args_t stream_args("fc32", rx_otw); //complex floats      uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);      //print pre-test summary @@ -94,11 +94,11 @@ void benchmark_rx_rate(uhd::usrp::multi_usrp::sptr usrp){  /***********************************************************************   * Benchmark TX Rate   **********************************************************************/ -void benchmark_tx_rate(uhd::usrp::multi_usrp::sptr usrp){ +void benchmark_tx_rate(uhd::usrp::multi_usrp::sptr usrp, const std::string &tx_otw){      uhd::set_thread_priority_safe();      //create a transmit streamer -    uhd::stream_args_t stream_args("fc32"); //complex floats +    uhd::stream_args_t stream_args("fc32", tx_otw); //complex floats      uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args);      //print pre-test summary @@ -162,6 +162,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      std::string args;      double duration;      double rx_rate, tx_rate; +    std::string rx_otw, tx_otw;      //setup the program options      po::options_description desc("Allowed options"); @@ -171,6 +172,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){          ("duration", po::value<double>(&duration)->default_value(10.0), "duration for the test in seconds")          ("rx_rate", po::value<double>(&rx_rate), "specify to perform a RX rate test (sps)")          ("tx_rate", po::value<double>(&tx_rate), "specify to perform a TX rate test (sps)") +        ("rx_otw", po::value<std::string>(&rx_otw)->default_value("sc16"), "specify the over-the-wire sample mode for RX") +        ("tx_otw", po::value<std::string>(&tx_otw)->default_value("sc16"), "specify the over-the-wire sample mode for TX")      ;      po::variables_map vm;      po::store(po::parse_command_line(argc, argv, desc), vm); @@ -203,13 +206,13 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      //spawn the receive test thread      if (vm.count("rx_rate")){          usrp->set_rx_rate(rx_rate); -        thread_group.create_thread(boost::bind(&benchmark_rx_rate, usrp)); +        thread_group.create_thread(boost::bind(&benchmark_rx_rate, usrp, rx_otw));      }      //spawn the transmit test thread      if (vm.count("tx_rate")){          usrp->set_tx_rate(tx_rate); -        thread_group.create_thread(boost::bind(&benchmark_tx_rate, usrp)); +        thread_group.create_thread(boost::bind(&benchmark_tx_rate, usrp, tx_otw));          thread_group.create_thread(boost::bind(&benchmark_tx_rate_async_helper, usrp));      } diff --git a/host/examples/test_messages.cpp b/host/examples/test_messages.cpp index f24a172d1..afb092092 100644 --- a/host/examples/test_messages.cpp +++ b/host/examples/test_messages.cpp @@ -26,6 +26,7 @@  #include <boost/bind.hpp>  #include <boost/format.hpp>  #include <cstdlib> +#include <ctime>  #include <complex>  #include <iostream> @@ -326,7 +327,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      }      //run the tests, pick at random -    std::srand(uhd::time_spec_t::get_system_time().get_full_secs()); +    std::srand((unsigned int) time(NULL));      for (size_t n = 0; n < ntests; n++){          std::string key = tests.keys()[std::rand() % tests.size()];          bool pass = tests[key](usrp, rx_stream, tx_stream); diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp index 39f70aec6..6a377fdac 100644 --- a/host/examples/tx_waveforms.cpp +++ b/host/examples/tx_waveforms.cpp @@ -90,7 +90,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      uhd::set_thread_priority_safe();      //variables to be set by po -    std::string args, wave_type, ant, subdev, ref; +    std::string args, wave_type, ant, subdev, ref, otw;      size_t spb;      double rate, freq, gain, wave_freq, bw;      float ampl; @@ -111,6 +111,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){          ("wave-type", po::value<std::string>(&wave_type)->default_value("CONST"), "waveform type (CONST, SQUARE, RAMP, SINE)")          ("wave-freq", po::value<double>(&wave_freq)->default_value(0), "waveform frequency in Hz")          ("ref", po::value<std::string>(&ref)->default_value("internal"), "clock reference (internal, external, mimo)") +        ("otw", po::value<std::string>(&otw)->default_value("sc16"), "specify the over-the-wire sample mode")      ;      po::variables_map vm;      po::store(po::parse_command_line(argc, argv, desc), vm); @@ -193,7 +194,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      //create a transmit streamer      //linearly map channels (index0 = channel0, index1 = channel1, ...) -    uhd::stream_args_t stream_args("fc32"); +    uhd::stream_args_t stream_args("fc32", otw);      for (size_t chan = 0; chan < usrp->get_tx_num_channels(); chan++)          stream_args.channels.push_back(chan); //linear mapping      uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args);  | 
