diff options
author | Josh Blum <josh@joshknows.com> | 2011-12-05 13:04:23 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-12-05 13:04:23 -0800 |
commit | 40c637bfb723be607800f67a3115aa1eee31f9d7 (patch) | |
tree | 212c41e164bb53f3468042f8fbf4569ce6009683 /host/lib/usrp/usrp2 | |
parent | 07c9d41014e7e8003b2e642c0e6b7c3ac5ad6cfb (diff) | |
download | uhd-40c637bfb723be607800f67a3115aa1eee31f9d7.tar.gz uhd-40c637bfb723be607800f67a3115aa1eee31f9d7.tar.bz2 uhd-40c637bfb723be607800f67a3115aa1eee31f9d7.zip |
uhd: work with stream clearing
dont clear when using the compat device API
tx clear also resets expected seqnum
tx clear on usrp2 resets flow control monitor
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 742fe3e94..f3a00c119 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -70,11 +70,15 @@ public: * Make a new flow control monitor. * \param max_seqs_out num seqs before throttling */ - flow_control_monitor(seq_type max_seqs_out){ + flow_control_monitor(seq_type max_seqs_out):_max_seqs_out(max_seqs_out){ + this->clear(); + _ready_fcn = boost::bind(&flow_control_monitor::ready, this); + } + + //! Clear the monitor, Ex: when a streamer is created + void clear(void){ _last_seq_out = 0; _last_seq_ack = 0; - _max_seqs_out = max_seqs_out; - _ready_fcn = boost::bind(&flow_control_monitor::ready, this); } /*! @@ -116,7 +120,8 @@ private: boost::mutex _fc_mutex; boost::condition _fc_cond; - seq_type _last_seq_out, _last_seq_ack, _max_seqs_out; + seq_type _last_seq_out, _last_seq_ack; + const seq_type _max_seqs_out; boost::function<bool(void)> _ready_fcn; }; @@ -407,6 +412,7 @@ rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args_){ if (chan < num_chan_so_far){ const size_t dsp = chan + _mbc[mb].rx_chan_occ - num_chan_so_far; _mbc[mb].rx_dsps[dsp]->set_nsamps_per_packet(spp); //seems to be a good place to set this + if (not args.args.has_key("noclear")) _mbc[mb].rx_dsps[dsp]->clear(); _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 @@ -474,7 +480,10 @@ tx_streamer::sptr usrp2_impl::get_tx_stream(const uhd::stream_args_t &args_){ num_chan_so_far += _mbc[mb].tx_chan_occ; if (chan < num_chan_so_far){ const size_t dsp = chan + _mbc[mb].tx_chan_occ - num_chan_so_far; - _mbc[mb].tx_dsp->clear(); + if (not args.args.has_key("noclear")){ + _mbc[mb].tx_dsp->clear(); + _io_impl->fc_mons[abs]->clear(); + } my_streamer->set_xport_chan_get_buff(chan_i, boost::bind( &usrp2_impl::io_impl::get_send_buff, _io_impl.get(), abs, _1 )); |