aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2013-08-26 13:51:30 -0700
committerNicholas Corgan <nick.corgan@ettus.com>2013-08-26 16:04:18 -0700
commit96e50aebb7a4b3f98aac3c11aa1a3f06c14c0849 (patch)
tree33ae54ed19b82a396749581c9c0f56bfc847f5aa /host
parent970afec3803677c739ecef0e37e45f77323820dd (diff)
downloaduhd-96e50aebb7a4b3f98aac3c11aa1a3f06c14c0849.tar.gz
uhd-96e50aebb7a4b3f98aac3c11aa1a3f06c14c0849.tar.bz2
uhd-96e50aebb7a4b3f98aac3c11aa1a3f06c14c0849.zip
examples: changed examples that force usage of all channels to allow user to input which channels to use
Diffstat (limited to 'host')
-rw-r--r--host/examples/benchmark_rate.cpp24
-rw-r--r--host/examples/rx_multi_samples.cpp20
-rw-r--r--host/examples/tx_bursts.cpp24
-rw-r--r--host/examples/tx_waveforms.cpp39
-rw-r--r--host/examples/txrx_loopback_to_file.cpp61
5 files changed, 127 insertions, 41 deletions
diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp
index 02e5ef60a..3b2ab8a1f 100644
--- a/host/examples/benchmark_rate.cpp
+++ b/host/examples/benchmark_rate.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2011-2012 Ettus Research LLC
+// Copyright 2011-2013 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -22,6 +22,8 @@
#include <boost/program_options.hpp>
#include <boost/format.hpp>
#include <boost/thread/thread.hpp>
+#include <boost/algorithm/string.hpp>
+#include <boost/lexical_cast.hpp>
#include <iostream>
#include <complex>
#include <cstdlib>
@@ -167,6 +169,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::string rx_otw, tx_otw;
std::string rx_cpu, tx_cpu;
std::string mode;
+ std::string channel_list;
//setup the program options
po::options_description desc("Allowed options");
@@ -181,6 +184,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("rx_cpu", po::value<std::string>(&rx_cpu)->default_value("fc32"), "specify the host/cpu sample mode for RX")
("tx_cpu", po::value<std::string>(&tx_cpu)->default_value("fc32"), "specify the host/cpu sample mode for TX")
("mode", po::value<std::string>(&mode)->default_value("none"), "multi-channel sync mode option: none, mimo")
+ ("channels", po::value<std::string>(&channel_list)->default_value("0"), "which channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -216,13 +220,24 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
boost::thread_group thread_group;
+ //detect which channels to use
+ std::vector<std::string> channel_strings;
+ std::vector<size_t> channel_nums;
+ boost::split(channel_strings, channel_list, boost::is_any_of("\"',"));
+ for(size_t ch = 0; ch < channel_strings.size(); ch++){
+ size_t chan = boost::lexical_cast<int>(channel_strings[ch]);
+ if(chan >= usrp->get_tx_num_channels() or chan >= usrp->get_tx_num_channels()){
+ throw std::runtime_error("Invalid channel(s) specified.");
+ }
+ else channel_nums.push_back(boost::lexical_cast<int>(channel_strings[ch]));
+ }
+
//spawn the receive test thread
if (vm.count("rx_rate")){
usrp->set_rx_rate(rx_rate);
//create a receive streamer
uhd::stream_args_t stream_args(rx_cpu, rx_otw);
- for (size_t ch = 0; ch < usrp->get_rx_num_channels(); ch++) //linear channel mapping
- stream_args.channels.push_back(ch);
+ stream_args.channels = channel_nums;
uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
thread_group.create_thread(boost::bind(&benchmark_rx_rate, usrp, rx_cpu, rx_stream));
}
@@ -232,8 +247,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
usrp->set_tx_rate(tx_rate);
//create a transmit streamer
uhd::stream_args_t stream_args(tx_cpu, tx_otw);
- for (size_t ch = 0; ch < usrp->get_tx_num_channels(); ch++) //linear channel mapping
- stream_args.channels.push_back(ch);
+ stream_args.channels = channel_nums;
uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args);
thread_group.create_thread(boost::bind(&benchmark_tx_rate, usrp, tx_cpu, tx_stream));
thread_group.create_thread(boost::bind(&benchmark_tx_rate_async_helper, tx_stream));
diff --git a/host/examples/rx_multi_samples.cpp b/host/examples/rx_multi_samples.cpp
index 4f312ad36..9e5970978 100644
--- a/host/examples/rx_multi_samples.cpp
+++ b/host/examples/rx_multi_samples.cpp
@@ -21,6 +21,8 @@
#include <boost/program_options.hpp>
#include <boost/format.hpp>
#include <boost/thread.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string.hpp>
#include <iostream>
#include <complex>
@@ -30,7 +32,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::set_thread_priority_safe();
//variables to be set by po
- std::string args, sync, subdev;
+ std::string args, sync, subdev, channel_list;
double seconds_in_future;
size_t total_num_samps;
double rate;
@@ -46,6 +48,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("sync", po::value<std::string>(&sync)->default_value("now"), "synchronization method: now, pps, mimo")
("subdev", po::value<std::string>(&subdev), "subdev spec (homogeneous across motherboards)")
("dilv", "specify to disable inner-loop verbose")
+ ("channels", po::value<std::string>(&channel_list)->default_value("0"), "which channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -110,11 +113,22 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
}
+ //detect which channels to use
+ std::vector<std::string> channel_strings;
+ std::vector<size_t> channel_nums;
+ boost::split(channel_strings, channel_list, boost::is_any_of("\"',"));
+ for(size_t ch = 0; ch < channel_strings.size(); ch++){
+ size_t chan = boost::lexical_cast<int>(channel_strings[ch]);
+ if(chan >= usrp->get_rx_num_channels()){
+ throw std::runtime_error("Invalid channel(s) specified.");
+ }
+ else channel_nums.push_back(boost::lexical_cast<int>(channel_strings[ch]));
+ }
+
//create a receive streamer
//linearly map channels (index0 = channel0, index1 = channel1, ...)
uhd::stream_args_t stream_args("fc32"); //complex floats
- for (size_t chan = 0; chan < usrp->get_rx_num_channels(); chan++)
- stream_args.channels.push_back(chan); //linear mapping
+ stream_args.channels = channel_nums;
uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
//setup streaming
diff --git a/host/examples/tx_bursts.cpp b/host/examples/tx_bursts.cpp
index c58d3e178..eada1a618 100644
--- a/host/examples/tx_bursts.cpp
+++ b/host/examples/tx_bursts.cpp
@@ -21,6 +21,8 @@
#include <boost/program_options.hpp>
#include <boost/thread/thread.hpp>
#include <boost/format.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string.hpp>
#include <csignal>
#include <iostream>
#include <complex>
@@ -34,7 +36,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::set_thread_priority_safe();
//variables to be set by po
- std::string args;
+ std::string args, channel_list;
double seconds_in_future;
size_t total_num_samps;
double rate;
@@ -57,6 +59,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("freq", po::value<double>(&freq)->default_value(0), "center frequency")
("gain", po::value<double>(&gain)->default_value(0), "gain")
("dilv", "specify to disable inner-loop verbose")
+ ("channels", po::value<std::string>(&channel_list)->default_value("0"), "which channel(s) to use (specify \"0\", \"1\", \"0,1\", etc")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -77,17 +80,29 @@ 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;
+ //detect which channels to use
+ std::vector<std::string> channel_strings;
+ std::vector<size_t> channel_nums;
+ boost::split(channel_strings, channel_list, boost::is_any_of("\"',"));
+ for(size_t ch = 0; ch < channel_strings.size(); ch++){
+ size_t chan = boost::lexical_cast<int>(channel_strings[ch]);
+ if(chan >= usrp->get_tx_num_channels()){
+ throw std::runtime_error("Invalid channel(s) specified.");
+ }
+ else channel_nums.push_back(boost::lexical_cast<int>(channel_strings[ch]));
+ }
+
//set the tx sample rate
std::cout << boost::format("Setting TX Rate: %f Msps...") % (rate/1e6) << std::endl;
usrp->set_tx_rate(rate);
std::cout << boost::format("Actual TX Rate: %f Msps...") % (usrp->get_tx_rate()/1e6) << std::endl << std::endl;
std::cout << boost::format("Setting TX Freq: %f MHz...") % (freq/1e6) << std::endl;
- for(size_t i=0; i < usrp->get_tx_num_channels(); i++) usrp->set_tx_freq(freq, i);
+ for(size_t i=0; i < channel_nums.size(); i++) usrp->set_tx_freq(freq, channel_nums[i]);
std::cout << boost::format("Actual TX Freq: %f MHz...") % (usrp->get_tx_freq()/1e6) << std::endl << std::endl;
std::cout << boost::format("Setting TX Gain: %f...") % (gain) << std::endl;
- for(size_t i=0; i < usrp->get_tx_num_channels(); i++) usrp->set_tx_gain(gain, i);
+ for(size_t i=0; i < channel_nums.size(); i++) usrp->set_tx_gain(gain, channel_nums[i]);
std::cout << boost::format("Actual TX Gain: %f...") % (usrp->get_tx_gain()) << std::endl << std::endl;
std::cout << boost::format("Setting device timestamp to 0...") << std::endl;
@@ -95,13 +110,14 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//create a transmit streamer
uhd::stream_args_t stream_args("fc32"); //complex floats
+ stream_args.channels = channel_nums;
uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args);
//allocate buffer with data to send
const size_t spb = tx_stream->get_max_num_samps();
std::vector<std::complex<float> > buff(spb, std::complex<float>(ampl, ampl));
- std::vector<std::complex<float> *> buffs(usrp->get_tx_num_channels(), &buff.front());
+ std::vector<std::complex<float> *> buffs(channel_nums.size(), &buff.front());
std::signal(SIGINT, &sig_int_handler);
if(repeat) std::cout << "Press Ctrl + C to quit..." << std::endl;
diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp
index 40326ae93..9474642df 100644
--- a/host/examples/tx_waveforms.cpp
+++ b/host/examples/tx_waveforms.cpp
@@ -25,6 +25,8 @@
#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <boost/thread.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string.hpp>
#include <iostream>
#include <complex>
#include <csignal>
@@ -91,7 +93,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, otw;
+ std::string args, wave_type, ant, subdev, ref, otw, channel_list;
size_t spb;
double rate, freq, gain, wave_freq, bw;
float ampl;
@@ -113,6 +115,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("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")
+ ("channels", po::value<std::string>(&channel_list)->default_value("0"), "which channels to use (specify \"0\", \"1\", \"0,1\", etc)")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -129,6 +132,19 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format("Creating the usrp device with: %s...") % args << std::endl;
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
+ //detect which channels to use
+ std::vector<std::string> channel_strings;
+ std::vector<size_t> channel_nums;
+ boost::split(channel_strings, channel_list, boost::is_any_of("\"',"));
+ for(size_t ch = 0; ch < channel_strings.size(); ch++){
+ size_t chan = boost::lexical_cast<int>(channel_strings[ch]);
+ if(chan >= usrp->get_tx_num_channels() or chan >= usrp->get_tx_num_channels()){
+ throw std::runtime_error("Invalid channel(s) specified.");
+ }
+ else channel_nums.push_back(boost::lexical_cast<int>(channel_strings[ch]));
+ }
+
+
//Lock mboard clocks
usrp->set_clock_source(ref);
@@ -152,27 +168,27 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
return ~0;
}
- for(size_t chan = 0; chan < usrp->get_tx_num_channels(); chan++) {
+ for(size_t ch = 0; ch < channel_nums.size(); ch++) {
std::cout << boost::format("Setting TX Freq: %f MHz...") % (freq/1e6) << std::endl;
- usrp->set_tx_freq(freq, chan);
- std::cout << boost::format("Actual TX Freq: %f MHz...") % (usrp->get_tx_freq(chan)/1e6) << std::endl << std::endl;
+ usrp->set_tx_freq(freq, channel_nums[ch]);
+ std::cout << boost::format("Actual TX Freq: %f MHz...") % (usrp->get_tx_freq(channel_nums[ch])/1e6) << std::endl << std::endl;
//set the rf gain
if (vm.count("gain")){
std::cout << boost::format("Setting TX Gain: %f dB...") % gain << std::endl;
- usrp->set_tx_gain(gain, chan);
- std::cout << boost::format("Actual TX Gain: %f dB...") % usrp->get_tx_gain(chan) << std::endl << std::endl;
+ usrp->set_tx_gain(gain, channel_nums[ch]);
+ std::cout << boost::format("Actual TX Gain: %f dB...") % usrp->get_tx_gain(channel_nums[ch]) << std::endl << std::endl;
}
//set the IF filter bandwidth
if (vm.count("bw")){
std::cout << boost::format("Setting TX Bandwidth: %f MHz...") % bw << std::endl;
- usrp->set_tx_bandwidth(bw, chan);
- std::cout << boost::format("Actual TX Bandwidth: %f MHz...") % usrp->get_tx_bandwidth(chan) << std::endl << std::endl;
+ usrp->set_tx_bandwidth(bw, channel_nums[ch]);
+ std::cout << boost::format("Actual TX Bandwidth: %f MHz...") % usrp->get_tx_bandwidth(channel_nums[ch]) << std::endl << std::endl;
}
//set the antenna
- if (vm.count("ant")) usrp->set_tx_antenna(ant, chan);
+ if (vm.count("ant")) usrp->set_tx_antenna(ant, channel_nums[ch]);
}
boost::this_thread::sleep(boost::posix_time::seconds(1)); //allow for some setup time
@@ -198,14 +214,13 @@ 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", otw);
- for (size_t chan = 0; chan < usrp->get_tx_num_channels(); chan++)
- stream_args.channels.push_back(chan); //linear mapping
+ stream_args.channels = channel_nums;
uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args);
//allocate a buffer which we re-use for each channel
if (spb == 0) spb = tx_stream->get_max_num_samps()*10;
std::vector<std::complex<float> > buff(spb);
- std::vector<std::complex<float> *> buffs(usrp->get_tx_num_channels(), &buff.front());
+ std::vector<std::complex<float> *> buffs(channel_nums.size(), &buff.front());
//setup the metadata flags
uhd::tx_metadata_t md;
diff --git a/host/examples/txrx_loopback_to_file.cpp b/host/examples/txrx_loopback_to_file.cpp
index ef119b689..666153edb 100644
--- a/host/examples/txrx_loopback_to_file.cpp
+++ b/host/examples/txrx_loopback_to_file.cpp
@@ -25,6 +25,8 @@
#include <boost/math/special_functions/round.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string.hpp>
#include <iostream>
#include <fstream>
#include <complex>
@@ -130,11 +132,13 @@ template<typename samp_type> void recv_to_file(
const std::string &file,
size_t samps_per_buff,
int num_requested_samples,
- float settling_time
+ float settling_time,
+ std::vector<size_t> rx_channel_nums
){
int num_total_samps = 0;
//create a receive streamer
uhd::stream_args_t stream_args(cpu_format,wire_format);
+ stream_args.channels = rx_channel_nums;
uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
uhd::rx_metadata_t md;
@@ -196,12 +200,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::set_thread_priority_safe();
//transmit variables to be set by po
- std::string tx_args, wave_type, tx_ant, tx_subdev, ref, otw;
+ std::string tx_args, wave_type, tx_ant, tx_subdev, ref, otw, tx_channels;
double tx_rate, tx_freq, tx_gain, wave_freq, tx_bw;
float ampl;
//receive variables to be set by po
- std::string rx_args, file, type, rx_ant, rx_subdev;
+ std::string rx_args, file, type, rx_ant, rx_subdev, rx_channels;
size_t total_num_samps, spb;
double rx_rate, rx_freq, rx_gain, rx_bw;
float settling;
@@ -234,6 +238,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("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")
+ ("tx-channels", po::value<std::string>(&tx_channels)->default_value("0"), "which TX channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)")
+ ("rx-channels", po::value<std::string>(&rx_channels)->default_value("0"), "which RX channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -253,6 +259,28 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format("Creating the receive usrp device with: %s...") % rx_args << std::endl;
uhd::usrp::multi_usrp::sptr rx_usrp = uhd::usrp::multi_usrp::make(rx_args);
+ //detect which channels to use
+ std::vector<std::string> tx_channel_strings;
+ std::vector<size_t> tx_channel_nums;
+ boost::split(tx_channel_strings, tx_channels, boost::is_any_of("\"',"));
+ for(size_t ch = 0; ch < tx_channel_strings.size(); ch++){
+ size_t chan = boost::lexical_cast<int>(tx_channel_strings[ch]);
+ if(chan >= tx_usrp->get_tx_num_channels()){
+ throw std::runtime_error("Invalid TX channel(s) specified.");
+ }
+ else tx_channel_nums.push_back(boost::lexical_cast<int>(tx_channel_strings[ch]));
+ }
+ std::vector<std::string> rx_channel_strings;
+ std::vector<size_t> rx_channel_nums;
+ boost::split(rx_channel_strings, rx_channels, boost::is_any_of("\"',"));
+ for(size_t ch = 0; ch < rx_channel_strings.size(); ch++){
+ size_t chan = boost::lexical_cast<int>(rx_channel_strings[ch]);
+ if(chan >= rx_usrp->get_rx_num_channels()){
+ throw std::runtime_error("Invalid RX channel(s) specified.");
+ }
+ else rx_channel_nums.push_back(boost::lexical_cast<int>(rx_channel_strings[ch]));
+ }
+
//Lock mboard clocks
tx_usrp->set_clock_source(ref);
rx_usrp->set_clock_source(ref);
@@ -288,27 +316,27 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
return ~0;
}
- for(size_t chan = 0; chan < tx_usrp->get_tx_num_channels(); chan++) {
+ for(size_t ch = 0; ch < tx_channel_nums.size(); ch++) {
std::cout << boost::format("Setting TX Freq: %f MHz...") % (tx_freq/1e6) << std::endl;
- tx_usrp->set_tx_freq(tx_freq, chan);
- std::cout << boost::format("Actual TX Freq: %f MHz...") % (tx_usrp->get_tx_freq(chan)/1e6) << std::endl << std::endl;
+ tx_usrp->set_tx_freq(tx_freq, tx_channel_nums[ch]);
+ std::cout << boost::format("Actual TX Freq: %f MHz...") % (tx_usrp->get_tx_freq(tx_channel_nums[ch])/1e6) << std::endl << std::endl;
//set the rf gain
if (vm.count("tx-gain")){
std::cout << boost::format("Setting TX Gain: %f dB...") % tx_gain << std::endl;
- tx_usrp->set_tx_gain(tx_gain, chan);
- std::cout << boost::format("Actual TX Gain: %f dB...") % tx_usrp->get_tx_gain(chan) << std::endl << std::endl;
+ tx_usrp->set_tx_gain(tx_gain, tx_channel_nums[ch]);
+ std::cout << boost::format("Actual TX Gain: %f dB...") % tx_usrp->get_tx_gain(tx_channel_nums[ch]) << std::endl << std::endl;
}
//set the IF filter bandwidth
if (vm.count("tx-bw")){
std::cout << boost::format("Setting TX Bandwidth: %f MHz...") % tx_bw << std::endl;
- tx_usrp->set_tx_bandwidth(tx_bw, chan);
- std::cout << boost::format("Actual TX Bandwidth: %f MHz...") % tx_usrp->get_tx_bandwidth(chan) << std::endl << std::endl;
+ tx_usrp->set_tx_bandwidth(tx_bw, tx_channel_nums[ch]);
+ std::cout << boost::format("Actual TX Bandwidth: %f MHz...") % tx_usrp->get_tx_bandwidth(tx_channel_nums[ch]) << std::endl << std::endl;
}
//set the antenna
- if (vm.count("tx-ant")) tx_usrp->set_tx_antenna(tx_ant, chan);
+ if (vm.count("tx-ant")) tx_usrp->set_tx_antenna(tx_ant, tx_channel_nums[ch]);
}
//set the receive center frequency
@@ -358,14 +386,13 @@ 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", otw);
- for (size_t chan = 0; chan < tx_usrp->get_tx_num_channels(); chan++)
- stream_args.channels.push_back(chan); //linear mapping
+ stream_args.channels = tx_channel_nums;
uhd::tx_streamer::sptr tx_stream = tx_usrp->get_tx_stream(stream_args);
//allocate a buffer which we re-use for each channel
if (spb == 0) spb = tx_stream->get_max_num_samps()*10;
std::vector<std::complex<float> > buff(spb);
- int num_channels = tx_usrp->get_tx_num_channels();
+ int num_channels = tx_channel_nums.size();
//setup the metadata flags
uhd::tx_metadata_t md;
@@ -427,9 +454,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
transmit_thread.create_thread(boost::bind(&transmit_worker, buff, wave_table, tx_stream, md, step, index, num_channels));
//recv to file
- if (type == "double") recv_to_file<std::complex<double> >(rx_usrp, "fc64", otw, file, spb, total_num_samps, settling);
- else if (type == "float") recv_to_file<std::complex<float> >(rx_usrp, "fc32", otw, file, spb, total_num_samps, settling);
- else if (type == "short") recv_to_file<std::complex<short> >(rx_usrp, "sc16", otw, file, spb, total_num_samps, settling);
+ if (type == "double") recv_to_file<std::complex<double> >(rx_usrp, "fc64", otw, file, spb, total_num_samps, settling, rx_channel_nums);
+ else if (type == "float") recv_to_file<std::complex<float> >(rx_usrp, "fc32", otw, file, spb, total_num_samps, settling, rx_channel_nums);
+ else if (type == "short") recv_to_file<std::complex<short> >(rx_usrp, "sc16", otw, file, spb, total_num_samps, settling, rx_channel_nums);
else {
//clean up transmit worker
stop_signal_called = true;