aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/device3/device3_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/device3/device3_impl.cpp')
-rw-r--r--host/lib/usrp/device3/device3_impl.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/host/lib/usrp/device3/device3_impl.cpp b/host/lib/usrp/device3/device3_impl.cpp
index 50598a519..35faf601f 100644
--- a/host/lib/usrp/device3/device3_impl.cpp
+++ b/host/lib/usrp/device3/device3_impl.cpp
@@ -18,17 +18,16 @@
#include "device3_impl.hpp"
#include "graph_impl.hpp"
#include "ctrl_iface.hpp"
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/rfnoc/block_ctrl_base.hpp>
#include <boost/make_shared.hpp>
#include <algorithm>
-#define UHD_DEVICE3_LOG() UHD_LOGV(never)
+#define UHD_DEVICE3_LOG() UHD_LOGGER_TRACE("DEVICE3")
using namespace uhd::usrp;
device3_impl::device3_impl()
- : _sid_framer(0)
{
_type = uhd::device::USRP;
_async_md.reset(new async_md_type(1000/*messages deep*/));
@@ -70,7 +69,7 @@ void device3_impl::merge_channel_defs(
// - All block indices that are in chan_ids may be overwritten in the channel definition
// - If the channels in chan_ids are not yet in the property tree channel list,
// they are appended.
- BOOST_FOREACH(const std::string &chan_idx, curr_channels) {
+ for(const std::string &chan_idx: curr_channels) {
if (_tree->exists(chans_root / chan_idx)) {
rfnoc::block_id_t chan_block_id = _tree->access<rfnoc::block_id_t>(chans_root / chan_idx).get();
if (std::find(chan_ids.begin(), chan_ids.end(), chan_block_id) != chan_ids.end()) {
@@ -105,8 +104,7 @@ void device3_impl::enumerate_rfnoc_blocks(
size_t n_blocks,
size_t base_port,
const uhd::sid_t &base_sid,
- uhd::device_addr_t transport_args,
- uhd::endianness_t endianness
+ uhd::device_addr_t transport_args
) {
// entries that are already connected to this block
uhd::sid_t ctrl_sid = base_sid;
@@ -120,7 +118,7 @@ void device3_impl::enumerate_rfnoc_blocks(
// TODO: Clear out all the old block control classes
// 3) Create new block controllers
for (size_t i = 0; i < n_blocks; i++) {
- UHD_DEVICE3_LOG() << "[RFNOC] ------- Block Setup -----------" << std::endl;
+ UHD_DEVICE3_LOG() << "[RFNOC] ------- Block Setup -----------" ;
// First, make a transport for port number zero, because we always need that:
ctrl_sid.set_dst_xbarport(base_port + i);
ctrl_sid.set_dst_blockport(0);
@@ -131,24 +129,24 @@ void device3_impl::enumerate_rfnoc_blocks(
);
UHD_DEVICE3_LOG() << str(boost::format("Setting up NoC-Shell Control for port #0 (SID: %s)...") % xport.send_sid.to_pp_string_hex());
uhd::rfnoc::ctrl_iface::sptr ctrl = uhd::rfnoc::ctrl_iface::make(
- endianness == ENDIANNESS_BIG,
+ xport.endianness == uhd::ENDIANNESS_BIG,
xport.send,
xport.recv,
xport.send_sid,
str(boost::format("CE_%02d_Port_%02X") % i % ctrl_sid.get_dst_endpoint())
);
- UHD_DEVICE3_LOG() << "OK" << std::endl;
+ UHD_DEVICE3_LOG() << "OK" ;
uint64_t noc_id = ctrl->peek64(uhd::rfnoc::SR_READBACK_REG_ID);
- UHD_DEVICE3_LOG() << str(boost::format("Port %d: Found NoC-Block with ID %016X.") % int(ctrl_sid.get_dst_endpoint()) % noc_id) << std::endl;
+ UHD_DEVICE3_LOG() << str(boost::format("Port %d: Found NoC-Block with ID %016X.") % int(ctrl_sid.get_dst_endpoint()) % noc_id) ;
uhd::rfnoc::make_args_t make_args;
uhd::rfnoc::blockdef::sptr block_def = uhd::rfnoc::blockdef::make_from_noc_id(noc_id);
if (not block_def) {
- UHD_DEVICE3_LOG() << "Using default block configuration." << std::endl;
+ UHD_DEVICE3_LOG() << "Using default block configuration." ;
block_def = uhd::rfnoc::blockdef::make_from_noc_id(uhd::rfnoc::DEFAULT_NOC_ID);
}
UHD_ASSERT_THROW(block_def);
make_args.ctrl_ifaces[0] = ctrl;
- BOOST_FOREACH(const size_t port_number, block_def->get_all_port_numbers()) {
+ for(const size_t port_number: block_def->get_all_port_numbers()) {
if (port_number == 0) { // We've already set this up
continue;
}
@@ -160,21 +158,23 @@ void device3_impl::enumerate_rfnoc_blocks(
);
UHD_DEVICE3_LOG() << str(boost::format("Setting up NoC-Shell Control for port #%d (SID: %s)...") % port_number % xport1.send_sid.to_pp_string_hex());
uhd::rfnoc::ctrl_iface::sptr ctrl1 = uhd::rfnoc::ctrl_iface::make(
- endianness == ENDIANNESS_BIG,
+ xport1.endianness == uhd::ENDIANNESS_BIG,
xport1.send,
xport1.recv,
xport1.send_sid,
str(boost::format("CE_%02d_Port_%02d") % i % ctrl_sid.get_dst_endpoint())
);
- UHD_DEVICE3_LOG() << "OK" << std::endl;
+ UHD_DEVICE3_LOG() << "OK" ;
make_args.ctrl_ifaces[port_number] = ctrl1;
}
make_args.base_address = xport.send_sid.get_dst();
make_args.device_index = device_index;
make_args.tree = subtree;
- make_args.is_big_endian = (endianness == ENDIANNESS_BIG);
- _rfnoc_block_ctrl.push_back(uhd::rfnoc::block_ctrl_base::make(make_args, noc_id));
+ { //Critical section for block_ctrl vector access
+ boost::lock_guard<boost::mutex> lock(_block_ctrl_mutex);
+ _rfnoc_block_ctrl.push_back(uhd::rfnoc::block_ctrl_base::make(make_args, noc_id));
+ }
}
}