aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/legacy_compat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/rfnoc/legacy_compat.cpp')
-rw-r--r--host/lib/rfnoc/legacy_compat.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/host/lib/rfnoc/legacy_compat.cpp b/host/lib/rfnoc/legacy_compat.cpp
index bf653a89a..7b80bf175 100644
--- a/host/lib/rfnoc/legacy_compat.cpp
+++ b/host/lib/rfnoc/legacy_compat.cpp
@@ -26,14 +26,14 @@
#include <uhd/types/stream_cmd.hpp>
#include <uhd/types/direction.hpp>
#include <uhd/types/ranges.hpp>
-#include <uhd/utils/msg.hpp>
+
#include <uhd/utils/log.hpp>
#include <uhd/transport/chdr.hpp>
#include <uhd/usrp/multi_usrp.hpp>
#include <boost/make_shared.hpp>
#include <boost/assign.hpp>
-#define UHD_LEGACY_LOG() UHD_LOGV(never)
+#define UHD_LEGACY_LOG() UHD_LOGGER_TRACE("RFNOC")
using namespace uhd::rfnoc;
using uhd::usrp::subdev_spec_t;
@@ -97,16 +97,6 @@ size_t calc_num_tx_chans_per_radio(
);
}
-double lambda_const_double(const double d)
-{
- return d;
-}
-
-uhd::meta_range_t lambda_const_meta_range(const double start, const double stop, const double step)
-{
- return uhd::meta_range_t(start, stop, step);
-}
-
/*! Recreate passed property without bound subscribers. Maintains current property value.
*/
template <typename T>
@@ -115,6 +105,7 @@ static void recreate_property(const uhd::fs_path &path, uhd::property_tree::sptr
tree->remove(path);
tree->create<T>(path).set(temp);
}
+
/************************************************************************
* Class Definition
***********************************************************************/
@@ -154,16 +145,16 @@ public:
}
connect_blocks();
if (args.has_key("skip_ddc")) {
- UHD_LEGACY_LOG() << "[legacy_compat] Skipping DDCs by user request." << std::endl;
+ UHD_LEGACY_LOG() << "[legacy_compat] Skipping DDCs by user request." ;
} else if (not _has_ddcs) {
- UHD_MSG(warning)
+ UHD_LOGGER_WARNING("RFNOC")
<< "[legacy_compat] No DDCs detected. You will only be able to receive at the radio frontend rate."
- << std::endl;
+ ;
}
if (args.has_key("skip_duc")) {
- UHD_LEGACY_LOG() << "[legacy_compat] Skipping DUCs by user request." << std::endl;
+ UHD_LEGACY_LOG() << "[legacy_compat] Skipping DUCs by user request." ;
} else if (not _has_ducs) {
- UHD_MSG(warning) << "[legacy_compat] No DUCs detected. You will only be able to transmit at the radio frontend rate." << std::endl;
+ UHD_LOGGER_WARNING("RFNOC") << "[legacy_compat] No DUCs detected. You will only be able to transmit at the radio frontend rate." ;
}
if (args.has_key("skip_dram")) {
UHD_LEGACY_LOG() << "[legacy_compat] Skipping DRAM by user request." << std::endl;
@@ -172,7 +163,7 @@ public:
UHD_LEGACY_LOG() << "[legacy_compat] Skipping SRAM by user request." << std::endl;
}
if (not _has_dmafifo and not _has_sramfifo) {
- UHD_MSG(warning) << "[legacy_compat] No FIFO detected. Higher transmit rates may encounter errors." << std::endl;
+ UHD_LOGGER_WARNING("RFNOC") << "[legacy_compat] No FIFO detected. Higher transmit rates may encounter errors.";
}
for (size_t mboard = 0; mboard < _num_mboards; mboard++) {
@@ -256,7 +247,7 @@ public:
void issue_stream_cmd(const stream_cmd_t &stream_cmd, size_t mboard, size_t chan)
{
- UHD_LEGACY_LOG() << "[legacy_compat] issue_stream_cmd() " << std::endl;
+ UHD_LEGACY_LOG() << "[legacy_compat] issue_stream_cmd() " ;
const size_t &radio_index = _rx_channel_map[mboard][chan].radio_index;
const size_t &port_index = _rx_channel_map[mboard][chan].port_index;
if (_has_ddcs) {
@@ -274,9 +265,9 @@ public:
args.otw_format = "sc16";
}
_update_stream_args_for_streaming<uhd::RX_DIRECTION>(args, _rx_channel_map);
- UHD_LEGACY_LOG() << "[legacy_compat] rx stream args: " << args.args.to_string() << std::endl;
+ UHD_LEGACY_LOG() << "[legacy_compat] rx stream args: " << args.args.to_string() ;
uhd::rx_streamer::sptr streamer = _device->get_rx_stream(args);
- BOOST_FOREACH(const size_t chan, args.channels) {
+ for(const size_t chan: args.channels) {
_rx_stream_cache[chan] = streamer;
}
return streamer;
@@ -291,9 +282,9 @@ public:
args.otw_format = "sc16";
}
_update_stream_args_for_streaming<uhd::TX_DIRECTION>(args, _tx_channel_map);
- UHD_LEGACY_LOG() << "[legacy_compat] tx stream args: " << args.args.to_string() << std::endl;
+ UHD_LEGACY_LOG() << "[legacy_compat] tx stream args: " << args.args.to_string() ;
uhd::tx_streamer::sptr streamer = _device->get_tx_stream(args);
- BOOST_FOREACH(const size_t chan, args.channels) {
+ for(const size_t chan: args.channels) {
_tx_stream_cache[chan] = streamer;
}
return streamer;
@@ -347,14 +338,14 @@ public:
if (_rx_stream_cache.count(chan)) {
uhd::rx_streamer::sptr str_ptr = _rx_stream_cache[chan].lock();
if (str_ptr) {
- BOOST_FOREACH(const rx_stream_map_type::value_type &chan_streamer_pair, _rx_stream_cache) {
+ for(const rx_stream_map_type::value_type &chan_streamer_pair: _rx_stream_cache) {
if (chan_streamer_pair.second.lock() == str_ptr) {
chans_to_change.insert(chan_streamer_pair.first);
}
}
}
}
- BOOST_FOREACH(const size_t this_chan, chans_to_change) {
+ for(const size_t this_chan: chans_to_change) {
size_t mboard, mb_chan;
chan_to_mcp<uhd::RX_DIRECTION>(this_chan, _rx_channel_map, mboard, mb_chan);
const size_t dsp_index = _rx_channel_map[mboard][mb_chan].radio_index;
@@ -390,14 +381,14 @@ public:
if (_tx_stream_cache.count(chan)) {
uhd::tx_streamer::sptr str_ptr = _tx_stream_cache[chan].lock();
if (str_ptr) {
- BOOST_FOREACH(const tx_stream_map_type::value_type &chan_streamer_pair, _tx_stream_cache) {
+ for(const tx_stream_map_type::value_type &chan_streamer_pair: _tx_stream_cache) {
if (chan_streamer_pair.second.lock() == str_ptr) {
chans_to_change.insert(chan_streamer_pair.first);
}
}
}
}
- BOOST_FOREACH(const size_t this_chan, chans_to_change) {
+ for(const size_t this_chan: chans_to_change) {
size_t mboard, mb_chan;
chan_to_mcp<uhd::TX_DIRECTION>(this_chan, _tx_channel_map, mboard, mb_chan);
const size_t dsp_index = _tx_channel_map[mboard][mb_chan].radio_index;
@@ -529,7 +520,10 @@ private: // methods
) {
if (dir == uhd::TX_DIRECTION) {
if (_has_sramfifo) {
- return block_id_t(mboard_idx, SFIFO_BLOCK_NAME, radio_index).to_string();
+ const size_t sfifo_idx =
+ radio_index * _num_tx_chans_per_radio + port_index;
+ port_index = 0;
+ return block_id_t(mboard_idx, SFIFO_BLOCK_NAME, sfifo_idx).to_string();
} else if (_has_dmafifo) {
port_index = radio_index;
return block_id_t(mboard_idx, DFIFO_BLOCK_NAME, 0).to_string();
@@ -590,7 +584,7 @@ private: // methods
const size_t this_spp = get_block_ctrl<radio_ctrl>(i, RADIO_BLOCK_NAME, k)->get_arg<int>("spp");
if (this_spp != _rx_spp) {
- UHD_LOG << str(
+ UHD_LOGGER_WARNING("RFNOC") << str(
boost::format("[legacy compat] Radios have differing spp values: %s has %d, others have %d. UHD will use smaller spp value for all connections. Performance might be not optimal.")
% radio_block_id.to_string() % this_spp % _rx_spp
);
@@ -653,10 +647,10 @@ private: // methods
)
;
_tree->create<double>(rx_dsp_base_path / "freq/value")
- .set_publisher(boost::bind(&lambda_const_double, 0.0))
+ .set_publisher([](){ return 0.0; })
;
_tree->create<uhd::meta_range_t>(rx_dsp_base_path / "freq/range")
- .set_publisher(boost::bind(&lambda_const_meta_range, 0.0, 0.0, 0.0))
+ .set_publisher([](){ return uhd::meta_range_t(0.0, 0.0, 0.0); })
;
}
}
@@ -686,10 +680,10 @@ private: // methods
)
;
_tree->create<double>(tx_dsp_base_path / "freq/value")
- .set_publisher(boost::bind(&lambda_const_double, 0.0))
+ .set_publisher([](){ return 0.0; })
;
_tree->create<uhd::meta_range_t>(tx_dsp_base_path / "freq/range")
- .set_publisher(boost::bind(&lambda_const_meta_range, 0.0, 0.0, 0.0))
+ .set_publisher([](){ return uhd::meta_range_t(0.0, 0.0, 0.0); })
;
}
}
@@ -747,8 +741,11 @@ private: // methods
// Prioritize SRAM over DRAM for performance
if (_has_sramfifo) {
// We have SRAM FIFO *and* DUCs
+ // SRAM FIFOs have only 1 channel per block
+ const size_t sfifo_idx =
+ _num_tx_chans_per_radio * radio + chan;
_graph->connect(
- block_id_t(mboard, SFIFO_BLOCK_NAME, radio), chan,
+ block_id_t(mboard, SFIFO_BLOCK_NAME, sfifo_idx), chan,
block_id_t(mboard, DUC_BLOCK_NAME, radio), chan,
tx_bpp
);
@@ -762,8 +759,11 @@ private: // methods
}
} else if (_has_sramfifo) {
// We have SRAM FIFO, *no* DUCs
+ // SRAM FIFOs have only 1 channel per block
+ const size_t sfifo_idx =
+ _num_tx_chans_per_radio * radio + chan;
_graph->connect(
- block_id_t(mboard, SFIFO_BLOCK_NAME, radio), radio,
+ block_id_t(mboard, SFIFO_BLOCK_NAME, sfifo_idx), 0,
block_id_t(mboard, RADIO_BLOCK_NAME, radio), chan,
tx_bpp
);
@@ -898,7 +898,7 @@ legacy_compat::sptr legacy_compat::make(
if (legacy_cache.count(device.get()) and not legacy_cache.at(device.get()).expired()) {
legacy_compat::sptr legacy_compat_copy = legacy_cache.at(device.get()).lock();
UHD_ASSERT_THROW(bool(legacy_compat_copy));
- UHD_LEGACY_LOG() << "[legacy_compat] Using existing legacy compat object for this device." << std::endl;
+ UHD_LEGACY_LOG() << "[legacy_compat] Using existing legacy compat object for this device." ;
return legacy_compat_copy;
}