aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/stream.hpp6
-rw-r--r--host/lib/usrp/b100/io_impl.cpp1
-rw-r--r--host/lib/usrp/cores/tx_dsp_core_200.cpp12
-rw-r--r--host/lib/usrp/cores/tx_dsp_core_200.hpp2
-rw-r--r--host/lib/usrp/e100/io_impl.cpp1
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp1
6 files changed, 22 insertions, 1 deletions
diff --git a/host/include/uhd/stream.hpp b/host/include/uhd/stream.hpp
index 8f3219dbd..b41c1733d 100644
--- a/host/include/uhd/stream.hpp
+++ b/host/include/uhd/stream.hpp
@@ -78,10 +78,16 @@ struct UHD_API stream_args_t{
/*!
* The args parameter is used to pass arbitrary key/value pairs.
* Possible keys used by args (depends on implementation):
+ *
* - scalar: an integer scaling factor used with the sc8 wire format.
* The key/value pair scalar=1024 means that the sample in the DSP
* was multiplied by 1024 before its upper 8 bits were harvested.
*
+ * - underflow_policy: how the TX DSP should recover from underflow.
+ * Possible options are "next_burst" or "next_packet".
+ * In the "next_burst" mode, the DSP drops incoming packets until a new burst is started.
+ * In the "next_packet" mode, the DSP starts transmitting again at the next packet.
+ *
* The following are not implemented, but are listed for conceptual purposes:
* - function: magnitude or phase/magnitude
* - units: numeric units like counts or dBm
diff --git a/host/lib/usrp/b100/io_impl.cpp b/host/lib/usrp/b100/io_impl.cpp
index 5b2fa4686..7e4cd6f8e 100644
--- a/host/lib/usrp/b100/io_impl.cpp
+++ b/host/lib/usrp/b100/io_impl.cpp
@@ -291,6 +291,7 @@ tx_streamer::sptr b100_impl::get_tx_stream(const uhd::stream_args_t &args_){
const size_t dsp = args.channels[chan_i];
UHD_ASSERT_THROW(dsp == 0); //always 0
if (not args.args.has_key("noclear")) _tx_dsp->clear();
+ if (args.args.has_key("underflow_policy")) _tx_dsp->set_underflow_policy(args.args["underflow_policy"]);
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/tx_dsp_core_200.cpp b/host/lib/usrp/cores/tx_dsp_core_200.cpp
index 4e1a3e44d..c5de4e361 100644
--- a/host/lib/usrp/cores/tx_dsp_core_200.cpp
+++ b/host/lib/usrp/cores/tx_dsp_core_200.cpp
@@ -60,13 +60,23 @@ public:
{
//init the tx control registers
this->clear();
+ this->set_underflow_policy("next_packet");
}
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_underflow_policy(const std::string &policy){
+ if (policy == "next_packet"){
+ _iface->poke32(REG_TX_CTRL_POLICY, FLAG_TX_CTRL_POLICY_NEXT_PACKET);
+ }
+ else if (policy == "next_burst"){
+ _iface->poke32(REG_TX_CTRL_POLICY, FLAG_TX_CTRL_POLICY_NEXT_BURST);
+ }
+ else throw uhd::value_error("USRP TX cannot handle requested underflow policy: " + policy);
}
void set_tick_rate(const double rate){
diff --git a/host/lib/usrp/cores/tx_dsp_core_200.hpp b/host/lib/usrp/cores/tx_dsp_core_200.hpp
index 50d128df4..4b39a5b07 100644
--- a/host/lib/usrp/cores/tx_dsp_core_200.hpp
+++ b/host/lib/usrp/cores/tx_dsp_core_200.hpp
@@ -50,6 +50,8 @@ public:
virtual void set_updates(const size_t cycles_per_up, const size_t packets_per_up) = 0;
+ virtual void set_underflow_policy(const std::string &policy) = 0;
+
};
#endif /* INCLUDED_LIBUHD_USRP_TX_DSP_CORE_200_HPP */
diff --git a/host/lib/usrp/e100/io_impl.cpp b/host/lib/usrp/e100/io_impl.cpp
index 5dddeef25..0cc09bd6d 100644
--- a/host/lib/usrp/e100/io_impl.cpp
+++ b/host/lib/usrp/e100/io_impl.cpp
@@ -367,6 +367,7 @@ tx_streamer::sptr e100_impl::get_tx_stream(const uhd::stream_args_t &args_){
const size_t dsp = args.channels[chan_i];
UHD_ASSERT_THROW(dsp == 0); //always 0
if (not args.args.has_key("noclear")) _tx_dsp->clear();
+ if (args.args.has_key("underflow_policy")) _tx_dsp->set_underflow_policy(args.args["underflow_policy"]);
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 62941ac79..44ab513ac 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -487,6 +487,7 @@ tx_streamer::sptr usrp2_impl::get_tx_stream(const uhd::stream_args_t &args_){
_mbc[mb].tx_dsp->clear();
_io_impl->fc_mons[abs]->clear();
}
+ if (args.args.has_key("underflow_policy")) _mbc[mb].tx_dsp->set_underflow_policy(args.args["underflow_policy"]);
my_streamer->set_xport_chan_get_buff(chan_i, boost::bind(
&usrp2_impl::io_impl::get_send_buff, _io_impl.get(), abs, _1
));