diff options
author | Josh Blum <josh@joshknows.com> | 2011-10-11 10:29:33 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-11-03 20:37:12 -0700 |
commit | fce49fd66f577b92482af6ad516944befa31b861 (patch) | |
tree | 2c58e9f23facd1b43945981f759ed1b15a5e084d /host/lib | |
parent | 0946176f513dd58407869e3b019207ff3eef24f5 (diff) | |
download | uhd-fce49fd66f577b92482af6ad516944befa31b861.tar.gz uhd-fce49fd66f577b92482af6ad516944befa31b861.tar.bz2 uhd-fce49fd66f577b92482af6ad516944befa31b861.zip |
uhd: added one packet mode to rx streamer
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/transport/super_recv_packet_handler.hpp | 14 | ||||
-rw-r--r-- | host/lib/transport/super_send_packet_handler.hpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/io_impl.cpp | 18 |
3 files changed, 23 insertions, 15 deletions
diff --git a/host/lib/transport/super_recv_packet_handler.hpp b/host/lib/transport/super_recv_packet_handler.hpp index 83c8988e8..6762a8a00 100644 --- a/host/lib/transport/super_recv_packet_handler.hpp +++ b/host/lib/transport/super_recv_packet_handler.hpp @@ -148,7 +148,8 @@ public: const uhd::rx_streamer::buffs_type &buffs, const size_t nsamps_per_buff, uhd::rx_metadata_t &metadata, - double timeout + const double timeout, + const bool one_packet ){ //handle metadata queued from a previous receive if (_queue_error_for_next_call){ @@ -163,9 +164,7 @@ public: buffs, nsamps_per_buff, metadata, timeout ); - #ifdef SRPH_TEST_MODE_ONE_PACKET - return accum_num_samps; - #endif + if (one_packet) return accum_num_samps; //first recv had an error code set, return immediately if (metadata.error_code != rx_metadata_t::ERROR_CODE_NONE) return accum_num_samps; @@ -493,7 +492,7 @@ private: const uhd::rx_streamer::buffs_type &buffs, const size_t nsamps_per_buff, uhd::rx_metadata_t &metadata, - double timeout, + const double timeout, const size_t buffer_offset_bytes = 0 ){ //get the next buffer if the current one has expired @@ -571,9 +570,10 @@ public: const rx_streamer::buffs_type &buffs, const size_t nsamps_per_buff, uhd::rx_metadata_t &metadata, - double timeout + const double timeout, + const bool one_packet ){ - return recv_packet_handler::recv(buffs, nsamps_per_buff, metadata, timeout); + return recv_packet_handler::recv(buffs, nsamps_per_buff, metadata, timeout, one_packet); } private: diff --git a/host/lib/transport/super_send_packet_handler.hpp b/host/lib/transport/super_send_packet_handler.hpp index 1ac178ad2..5b5ee2981 100644 --- a/host/lib/transport/super_send_packet_handler.hpp +++ b/host/lib/transport/super_send_packet_handler.hpp @@ -128,7 +128,7 @@ public: const uhd::tx_streamer::buffs_type &buffs, const size_t nsamps_per_buff, const uhd::tx_metadata_t &metadata, - double timeout + const double timeout ){ //translate the metadata to vrt if packet info vrt::if_packet_info_t if_packet_info; @@ -215,7 +215,7 @@ private: const uhd::tx_streamer::buffs_type &buffs, const size_t nsamps_per_buff, vrt::if_packet_info_t &if_packet_info, - double timeout, + const double timeout, const size_t buffer_offset_bytes = 0 ){ //load the rest of the if_packet_info in here @@ -269,7 +269,7 @@ public: const tx_streamer::buffs_type &buffs, const size_t nsamps_per_buff, const uhd::tx_metadata_t &metadata, - double timeout + const double timeout ){ return send_packet_handler::send(buffs, nsamps_per_buff, metadata, timeout); } diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index c199e4178..a0fdfc6bf 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -325,13 +325,14 @@ public: const rx_streamer::buffs_type &buffs, const size_t nsamps_per_buff, uhd::rx_metadata_t &metadata, - double timeout + const double timeout, + const bool one_packet ){ //interleave a "soft" inline message into the receive stream: if (_stc->get_inline_queue().pop_with_haste(metadata)) return 0; size_t num_samps_recvd = sph::recv_packet_handler::recv( - buffs, nsamps_per_buff, metadata, timeout + buffs, nsamps_per_buff, metadata, timeout, one_packet ); return _stc->recv_post(metadata, num_samps_recvd); @@ -366,8 +367,9 @@ public: const tx_streamer::buffs_type &buffs, const size_t nsamps_per_buff, const uhd::tx_metadata_t &metadata, - double timeout + const double timeout_ ){ + double timeout = timeout_; //rw copy _stc->send_pre(metadata, timeout); _tx_enb_fcn(true); //always enable (it will do the right thing) @@ -545,7 +547,10 @@ rx_streamer::sptr usrp1_impl::get_rx_stream(const uhd::stream_args_t &args_){ //setup defaults for unspecified values args.otw_format = args.otw_format.empty()? "sc16" : args.otw_format; - args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; + args.channels.clear(); //NOTE: we have no choice about the channel mapping + for (size_t ch = 0; ch < _rx_subdev_spec.size(); ch++){ + args.channels.push_back(ch); + } if (args.otw_format == "sc16"){ _iface->poke32(FR_RX_FORMAT, 0 @@ -610,7 +615,10 @@ tx_streamer::sptr usrp1_impl::get_tx_stream(const uhd::stream_args_t &args_){ //setup defaults for unspecified values args.otw_format = args.otw_format.empty()? "sc16" : args.otw_format; - args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; + args.channels.clear(); //NOTE: we have no choice about the channel mapping + for (size_t ch = 0; ch < _tx_subdev_spec.size(); ch++){ + args.channels.push_back(ch); + } if (args.otw_format != "sc16"){ throw uhd::value_error("USRP1 TX cannot handle requested wire format: " + args.otw_format); |