aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-12-05 13:04:23 -0800
committerJosh Blum <josh@joshknows.com>2011-12-05 13:04:23 -0800
commit40c637bfb723be607800f67a3115aa1eee31f9d7 (patch)
tree212c41e164bb53f3468042f8fbf4569ce6009683 /host
parent07c9d41014e7e8003b2e642c0e6b7c3ac5ad6cfb (diff)
downloaduhd-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')
-rw-r--r--host/include/uhd/device_deprecated.ipp4
-rw-r--r--host/lib/usrp/b100/io_impl.cpp3
-rw-r--r--host/lib/usrp/cores/rx_dsp_core_200.cpp1
-rw-r--r--host/lib/usrp/cores/tx_dsp_core_200.cpp11
-rw-r--r--host/lib/usrp/e100/io_impl.cpp3
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp19
6 files changed, 28 insertions, 13 deletions
diff --git a/host/include/uhd/device_deprecated.ipp b/host/include/uhd/device_deprecated.ipp
index 698a8a508..0ee1cd706 100644
--- a/host/include/uhd/device_deprecated.ipp
+++ b/host/include/uhd/device_deprecated.ipp
@@ -85,6 +85,7 @@ size_t send(
stream_args_t args;
args.cpu_format = (_send_tid == io_type_t::COMPLEX_FLOAT32)? "fc32" : "sc16";
args.otw_format = "sc16";
+ args.args["noclear"] = "1";
for (size_t ch = 0; ch < buffs.size(); ch++)
args.channels.push_back(ch); //linear mapping
_tx_streamer = get_tx_stream(args);
@@ -140,6 +141,7 @@ size_t recv(
stream_args_t args;
args.cpu_format = (_recv_tid == io_type_t::COMPLEX_FLOAT32)? "fc32" : "sc16";
args.otw_format = "sc16";
+ args.args["noclear"] = "1";
for (size_t ch = 0; ch < buffs.size(); ch++)
args.channels.push_back(ch); //linear mapping
_rx_streamer = get_rx_stream(args);
@@ -159,6 +161,7 @@ size_t get_max_send_samps_per_packet(void){
stream_args_t args;
args.cpu_format = "fc32";
args.otw_format = "sc16";
+ args.args["noclear"] = "1";
_tx_streamer = get_tx_stream(args);
_send_tid = io_type_t::COMPLEX_FLOAT32;
}
@@ -174,6 +177,7 @@ size_t get_max_recv_samps_per_packet(void){
stream_args_t args;
args.cpu_format = "fc32";
args.otw_format = "sc16";
+ args.args["noclear"] = "1";
_rx_streamer = get_rx_stream(args);
_recv_tid = io_type_t::COMPLEX_FLOAT32;
}
diff --git a/host/lib/usrp/b100/io_impl.cpp b/host/lib/usrp/b100/io_impl.cpp
index ccd00a91f..feafd3e4a 100644
--- a/host/lib/usrp/b100/io_impl.cpp
+++ b/host/lib/usrp/b100/io_impl.cpp
@@ -229,6 +229,7 @@ rx_streamer::sptr b100_impl::get_rx_stream(const uhd::stream_args_t &args_){
for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){
const size_t dsp = args.channels[chan_i];
_rx_dsps[dsp]->set_nsamps_per_packet(spp); //seems to be a good place to set this
+ if (not args.args.has_key("noclear")) _rx_dsps[dsp]->clear();
_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
@@ -286,7 +287,7 @@ tx_streamer::sptr b100_impl::get_tx_stream(const uhd::stream_args_t &args_){
for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){
const size_t dsp = args.channels[chan_i];
UHD_ASSERT_THROW(dsp == 0); //always 0
- _tx_dsp->clear();
+ if (not args.args.has_key("noclear")) _tx_dsp->clear();
my_streamer->set_xport_chan_get_buff(chan_i, boost::bind(
&zero_copy_if::get_send_buff, _data_transport, _1
));
diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp
index 7c9fe0695..481260e32 100644
--- a/host/lib/usrp/cores/rx_dsp_core_200.cpp
+++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp
@@ -84,7 +84,6 @@ public:
}
void set_nsamps_per_packet(const size_t nsamps){
- this->clear(); // a good place to clear as well!
_iface->poke32(REG_RX_CTRL_NSAMPS_PP, nsamps);
}
diff --git a/host/lib/usrp/cores/tx_dsp_core_200.cpp b/host/lib/usrp/cores/tx_dsp_core_200.cpp
index 38d04a7de..4e1a3e44d 100644
--- a/host/lib/usrp/cores/tx_dsp_core_200.cpp
+++ b/host/lib/usrp/cores/tx_dsp_core_200.cpp
@@ -56,17 +56,17 @@ public:
const size_t dsp_base, const size_t ctrl_base,
const boost::uint32_t sid
):
- _iface(iface), _dsp_base(dsp_base), _ctrl_base(ctrl_base)
+ _iface(iface), _dsp_base(dsp_base), _ctrl_base(ctrl_base), _sid(sid)
{
//init the tx control registers
- _iface->poke32(REG_TX_CTRL_CLEAR_STATE, 1); //reset
- _iface->poke32(REG_TX_CTRL_NUM_CHAN, 0); //1 channel
- _iface->poke32(REG_TX_CTRL_REPORT_SID, sid);
- _iface->poke32(REG_TX_CTRL_POLICY, FLAG_TX_CTRL_POLICY_NEXT_PACKET);
+ this->clear();
}
void clear(void){
_iface->poke32(REG_TX_CTRL_CLEAR_STATE, 1); //reset
+ _iface->poke32(REG_TX_CTRL_NUM_CHAN, 0); //1 channel
+ _iface->poke32(REG_TX_CTRL_REPORT_SID, _sid);
+ _iface->poke32(REG_TX_CTRL_POLICY, FLAG_TX_CTRL_POLICY_NEXT_PACKET);
}
void set_tick_rate(const double rate){
@@ -150,6 +150,7 @@ private:
wb_iface::sptr _iface;
const size_t _dsp_base, _ctrl_base;
double _tick_rate, _link_rate;
+ const boost::uint32_t _sid;
};
tx_dsp_core_200::sptr tx_dsp_core_200::make(wb_iface::sptr iface, const size_t dsp_base, const size_t ctrl_base, const boost::uint32_t sid){
diff --git a/host/lib/usrp/e100/io_impl.cpp b/host/lib/usrp/e100/io_impl.cpp
index 855fda0d7..dc090ad28 100644
--- a/host/lib/usrp/e100/io_impl.cpp
+++ b/host/lib/usrp/e100/io_impl.cpp
@@ -305,6 +305,7 @@ rx_streamer::sptr e100_impl::get_rx_stream(const uhd::stream_args_t &args_){
for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){
const size_t dsp = args.channels[chan_i];
_rx_dsps[dsp]->set_nsamps_per_packet(spp); //seems to be a good place to set this
+ if (not args.args.has_key("noclear")) _rx_dsps[dsp]->clear();
_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
@@ -362,7 +363,7 @@ tx_streamer::sptr e100_impl::get_tx_stream(const uhd::stream_args_t &args_){
for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){
const size_t dsp = args.channels[chan_i];
UHD_ASSERT_THROW(dsp == 0); //always 0
- _tx_dsp->clear();
+ if (not args.args.has_key("noclear")) _tx_dsp->clear();
my_streamer->set_xport_chan_get_buff(chan_i, boost::bind(
&zero_copy_if::get_send_buff, _data_transport, _1
));
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
));