summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-01-16 22:31:03 -0800
committerJosh Blum <josh@joshknows.com>2012-01-23 13:03:09 -0800
commitb8e41cbbc9666a9758d0f9f3a57272530716935a (patch)
treefc8eb1546d5ac4ab3ec5ae742335b45144fa0bc2 /host/lib
parent287958ba36072f699090aa61ad2b6bbee6846d66 (diff)
downloaduhd-b8e41cbbc9666a9758d0f9f3a57272530716935a.tar.gz
uhd-b8e41cbbc9666a9758d0f9f3a57272530716935a.tar.bz2
uhd-b8e41cbbc9666a9758d0f9f3a57272530716935a.zip
uhd: flush transport for new rx streamers
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/transport/super_recv_packet_handler.hpp5
-rw-r--r--host/lib/usrp/b100/io_impl.cpp2
-rw-r--r--host/lib/usrp/cores/rx_dsp_core_200.cpp2
-rw-r--r--host/lib/usrp/e100/io_impl.cpp2
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp2
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp4
6 files changed, 9 insertions, 8 deletions
diff --git a/host/lib/transport/super_recv_packet_handler.hpp b/host/lib/transport/super_recv_packet_handler.hpp
index 05cad93ea..a5876c8bf 100644
--- a/host/lib/transport/super_recv_packet_handler.hpp
+++ b/host/lib/transport/super_recv_packet_handler.hpp
@@ -116,7 +116,10 @@ public:
* \param xport_chan which transport channel
* \param get_buff the getter function
*/
- void set_xport_chan_get_buff(const size_t xport_chan, const get_buff_type &get_buff){
+ void set_xport_chan_get_buff(const size_t xport_chan, const get_buff_type &get_buff, const bool flush = false){
+ if (flush){
+ while (get_buff(0.0));
+ }
_props.at(xport_chan).get_buff = get_buff;
}
diff --git a/host/lib/usrp/b100/io_impl.cpp b/host/lib/usrp/b100/io_impl.cpp
index 7e4cd6f8e..692ede6d5 100644
--- a/host/lib/usrp/b100/io_impl.cpp
+++ b/host/lib/usrp/b100/io_impl.cpp
@@ -236,7 +236,7 @@ rx_streamer::sptr b100_impl::get_rx_stream(const uhd::stream_args_t &args_){
_rx_dsps[dsp]->set_format(args.otw_format, sc8_scalar);
my_streamer->set_xport_chan_get_buff(chan_i, boost::bind(
&recv_packet_demuxer::get_recv_buff, _io_impl->demuxer, dsp, _1
- ));
+ ), true /*flush*/);
my_streamer->set_overflow_handler(chan_i, boost::bind(
&rx_dsp_core_200::handle_overflow, _rx_dsps[dsp]
));
diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp
index 7c4231103..2e21cc895 100644
--- a/host/lib/usrp/cores/rx_dsp_core_200.cpp
+++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp
@@ -20,6 +20,7 @@
#include <uhd/exception.hpp>
#include <uhd/utils/algorithm.hpp>
#include <boost/assign/list_of.hpp>
+#include <boost/thread/thread.hpp> //thread sleep
#include <boost/math/special_functions/round.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <algorithm>
@@ -65,6 +66,7 @@ public:
stream_cmd_t stream_cmd(stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
stream_cmd.num_samps = 1;
issue_stream_command(stream_cmd);
+ boost::this_thread::sleep(boost::posix_time::milliseconds(10)); //lets lingering pkt propagate
}
this->clear();
diff --git a/host/lib/usrp/e100/io_impl.cpp b/host/lib/usrp/e100/io_impl.cpp
index 0cc09bd6d..92905526c 100644
--- a/host/lib/usrp/e100/io_impl.cpp
+++ b/host/lib/usrp/e100/io_impl.cpp
@@ -312,7 +312,7 @@ rx_streamer::sptr e100_impl::get_rx_stream(const uhd::stream_args_t &args_){
_rx_dsps[dsp]->set_format(args.otw_format, sc8_scalar);
my_streamer->set_xport_chan_get_buff(chan_i, boost::bind(
&recv_packet_demuxer::get_recv_buff, _io_impl->demuxer, dsp, _1
- ));
+ ), true /*flush*/);
my_streamer->set_overflow_handler(chan_i, boost::bind(
&rx_dsp_core_200::handle_overflow, _rx_dsps[dsp]
));
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index 44ab513ac..fd81071fb 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -419,7 +419,7 @@ rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args_){
_mbc[mb].rx_dsps[dsp]->set_format(args.otw_format, sc8_scalar);
my_streamer->set_xport_chan_get_buff(chan_i, boost::bind(
&zero_copy_if::get_recv_buff, _mbc[mb].rx_dsp_xports[dsp], _1
- ));
+ ), true /*flush*/);
_mbc[mb].rx_streamers[dsp] = my_streamer; //store weak pointer
break;
}
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 4d7f221c6..ef7151cee 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -498,10 +498,6 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
_mbc[mb].rx_dsps[dspno]->set_link_rate(USRP2_LINK_RATE_BPS);
_tree->access<double>(mb_path / "tick_rate")
.subscribe(boost::bind(&rx_dsp_core_200::set_tick_rate, _mbc[mb].rx_dsps[dspno], _1));
- //This is a hack/fix for the lingering packet problem.
- //The dsp core starts streaming briefly... now we flush
- _mbc[mb].rx_dsp_xports[dspno]->get_recv_buff(0.01).get(); //recv with timeout for lingering
- _mbc[mb].rx_dsp_xports[dspno]->get_recv_buff(0.01).get(); //recv with timeout for expected
fs_path rx_dsp_path = mb_path / str(boost::format("rx_dsps/%u") % dspno);
_tree->create<meta_range_t>(rx_dsp_path / "rate/range")
.publish(boost::bind(&rx_dsp_core_200::get_host_rates, _mbc[mb].rx_dsps[dspno]));