From d9157133fbd23c2e550ed46840da3ebbafa52d5c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 18 Jun 2012 10:07:59 -0700 Subject: uhd: added wire format option for tx samples example --- host/examples/tx_samples_from_file.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'host') diff --git a/host/examples/tx_samples_from_file.cpp b/host/examples/tx_samples_from_file.cpp index ea4add403..c0812c007 100644 --- a/host/examples/tx_samples_from_file.cpp +++ b/host/examples/tx_samples_from_file.cpp @@ -30,11 +30,12 @@ namespace po = boost::program_options; template void send_from_file( uhd::usrp::multi_usrp::sptr usrp, const std::string &cpu_format, + const std::string &wire_format, const std::string &file, size_t samps_per_buff ){ //create a transmit streamer - uhd::stream_args_t stream_args(cpu_format); + uhd::stream_args_t stream_args(cpu_format, wire_format); uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args); uhd::tx_metadata_t md; @@ -61,7 +62,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ uhd::set_thread_priority_safe(); //variables to be set by po - std::string args, file, type, ant, subdev, ref; + std::string args, file, type, ant, subdev, ref, wirefmt; size_t spb; double rate, freq, gain, bw; @@ -80,6 +81,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("subdev", po::value(&subdev), "daughterboard subdevice specification") ("bw", po::value(&bw), "daughterboard IF filter bandwidth in Hz") ("ref", po::value(&ref)->default_value("internal"), "waveform type (internal, external, mimo)") + ("wirefmt", po::value(&wirefmt)->default_value("sc16"), "wire format (sc8 or sc16)") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); @@ -162,9 +164,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ } //send from file - if (type == "double") send_from_file >(usrp, "fc64", file, spb); - else if (type == "float") send_from_file >(usrp, "fc32", file, spb); - else if (type == "short") send_from_file >(usrp, "sc16", file, spb); + if (type == "double") send_from_file >(usrp, "fc64", wirefmt, file, spb); + else if (type == "float") send_from_file >(usrp, "fc32", wirefmt, file, spb); + else if (type == "short") send_from_file >(usrp, "sc16", wirefmt, file, spb); else throw std::runtime_error("Unknown type " + type); //finished -- cgit v1.2.3