aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300
diff options
context:
space:
mode:
authorAndrej Rode <andrej.rode@ettus.com>2017-02-09 23:19:55 -0800
committerMartin Braun <martin.braun@ettus.com>2017-02-10 16:44:33 -0800
commit26cc20847cde543e759aa5cee9a27eaa69c5dd9e (patch)
treeeee102333381e2313af59e725d6b7a06b665161f /host/lib/usrp/x300
parentf3a004faf7d50cbb5564f5e2f67f54ee07e051dd (diff)
downloaduhd-26cc20847cde543e759aa5cee9a27eaa69c5dd9e.tar.gz
uhd-26cc20847cde543e759aa5cee9a27eaa69c5dd9e.tar.bz2
uhd-26cc20847cde543e759aa5cee9a27eaa69c5dd9e.zip
uhd: replace BOOST_FOREACH with C++11 range-based for loop
Note: This is the first commit that uses for-range, and range-based for-loops are now usable for UHD development.
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r--host/lib/usrp/x300/x300_adc_ctrl.cpp1
-rw-r--r--host/lib/usrp/x300/x300_dac_ctrl.cpp1
-rw-r--r--host/lib/usrp/x300/x300_dboard_iface.cpp2
-rw-r--r--host/lib/usrp/x300/x300_fw_uart.cpp3
-rw-r--r--host/lib/usrp/x300/x300_image_loader.cpp2
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp25
-rw-r--r--host/lib/usrp/x300/x300_io_impl.cpp3
-rw-r--r--host/lib/usrp/x300/x300_radio_ctrl_impl.cpp8
8 files changed, 20 insertions, 25 deletions
diff --git a/host/lib/usrp/x300/x300_adc_ctrl.cpp b/host/lib/usrp/x300/x300_adc_ctrl.cpp
index fed2ffaf7..d9d0cb168 100644
--- a/host/lib/usrp/x300/x300_adc_ctrl.cpp
+++ b/host/lib/usrp/x300/x300_adc_ctrl.cpp
@@ -21,7 +21,6 @@
#include <uhd/utils/log.hpp>
#include <uhd/utils/safe_call.hpp>
#include <uhd/exception.hpp>
-#include <boost/foreach.hpp>
using namespace uhd;
diff --git a/host/lib/usrp/x300/x300_dac_ctrl.cpp b/host/lib/usrp/x300/x300_dac_ctrl.cpp
index 162eeb143..eb36f0798 100644
--- a/host/lib/usrp/x300/x300_dac_ctrl.cpp
+++ b/host/lib/usrp/x300/x300_dac_ctrl.cpp
@@ -22,7 +22,6 @@
#include <uhd/utils/log.hpp>
#include <uhd/utils/safe_call.hpp>
#include <uhd/exception.hpp>
-#include <boost/foreach.hpp>
#include <boost/thread/thread.hpp> //sleep
#define X300_DAC_FRONTEND_SYNC_FAILURE_FATAL
diff --git a/host/lib/usrp/x300/x300_dboard_iface.cpp b/host/lib/usrp/x300/x300_dboard_iface.cpp
index 092c888b0..e492fe2b3 100644
--- a/host/lib/usrp/x300/x300_dboard_iface.cpp
+++ b/host/lib/usrp/x300/x300_dboard_iface.cpp
@@ -34,7 +34,7 @@ x300_dboard_iface::x300_dboard_iface(const x300_dboard_iface_config_t &config):
//reset the aux dacs
_dac_regs[UNIT_RX] = ad5623_regs_t();
_dac_regs[UNIT_TX] = ad5623_regs_t();
- BOOST_FOREACH(unit_t unit, _dac_regs.keys())
+ for(unit_t unit: _dac_regs.keys())
{
_dac_regs[unit].data = 1;
_dac_regs[unit].addr = ad5623_regs_t::ADDR_ALL;
diff --git a/host/lib/usrp/x300/x300_fw_uart.cpp b/host/lib/usrp/x300/x300_fw_uart.cpp
index a2cbcc908..593873569 100644
--- a/host/lib/usrp/x300/x300_fw_uart.cpp
+++ b/host/lib/usrp/x300/x300_fw_uart.cpp
@@ -22,7 +22,6 @@
#include <uhd/types/serial.hpp>
#include <uhd/exception.hpp>
#include <boost/format.hpp>
-#include <boost/foreach.hpp>
#include <boost/thread/thread.hpp>
using namespace uhd;
@@ -65,7 +64,7 @@ struct x300_uart_iface : uart_iface
void write_uart(const std::string &buff)
{
boost::mutex::scoped_lock(_write_mutex);
- BOOST_FOREACH(const char ch, buff)
+ for(const char ch: buff)
{
this->putchar(ch);
}
diff --git a/host/lib/usrp/x300/x300_image_loader.cpp b/host/lib/usrp/x300/x300_image_loader.cpp
index f08b21f9b..e8c2a1329 100644
--- a/host/lib/usrp/x300/x300_image_loader.cpp
+++ b/host/lib/usrp/x300/x300_image_loader.cpp
@@ -167,7 +167,7 @@ static void x300_setup_session(x300_session_t &session,
std::string err_msg = "Could not resolve given args to a single X-Series device.\n"
"Applicable devices:\n";
- BOOST_FOREACH(const uhd::device_addr_t &dev, devs){
+ for(const uhd::device_addr_t &dev: devs){
std::string identifier = dev.has_key("addr") ? "addr"
: "resource";
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index edf254130..116e1e6eb 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -28,7 +28,6 @@
#include <uhd/utils/safe_call.hpp>
#include <uhd/usrp/subdev_spec.hpp>
#include <uhd/transport/if_addrs.hpp>
-#include <boost/foreach.hpp>
#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
#include <boost/functional/hash.hpp>
@@ -183,7 +182,7 @@ static device_addrs_t x300_find_pcie(const device_addr_t &hint, bool explicit_qu
nirio_status status = niusrprio_session::enumerate(rpc_port_name, dev_info_vtr);
if (explicit_query) nirio_status_to_exception(status, "x300_find_pcie: Error enumerating NI-RIO devices.");
- BOOST_FOREACH(niusrprio_session::device_info &dev_info, dev_info_vtr)
+ for(niusrprio_session::device_info &dev_info: dev_info_vtr)
{
device_addr_t new_addr;
new_addr["type"] = "x300";
@@ -278,7 +277,7 @@ device_addrs_t x300_find(const device_addr_t &hint_)
{
device_addrs_t found_devices;
std::string error_msg;
- BOOST_FOREACH(const device_addr_t &hint_i, hints)
+ for(const device_addr_t &hint_i: hints)
{
device_addrs_t found_devices_i = x300_find(hint_i);
if (found_devices_i.size() != 1) error_msg += str(boost::format(
@@ -322,7 +321,7 @@ device_addrs_t x300_find(const device_addr_t &hint_)
if (!hint.has_key("resource"))
{
//otherwise, no address was specified, send a broadcast on each interface
- BOOST_FOREACH(const if_addrs_t &if_addrs, get_if_addrs())
+ for(const if_addrs_t &if_addrs: get_if_addrs())
{
//avoid the loopback device
if (if_addrs.inet == asio::ip::address_v4::loopback().to_string()) continue;
@@ -396,9 +395,9 @@ static void thread_msg_handler(uhd::msg::type_t type, const std::string &msg)
if (msg == thread_final_msg)
{
- BOOST_FOREACH(const thread_map_t::value_type &thread_pair, thread_list)
+ for(const thread_map_t::value_type &thread_pair: thread_list)
{
- BOOST_FOREACH(const msg_pair_t &msg_pair, thread_pair.second)
+ for(const msg_pair_t &msg_pair: thread_pair.second)
{
// Forward the message to the default handler
uhd::msg::default_msg_handler(msg_pair.first, msg_pair.second);
@@ -469,7 +468,7 @@ void x300_impl::mboard_members_t::discover_eth(
mb_eeprom_addrs.push_back(mb_eeprom[key]);
}
- BOOST_FOREACH(const std::string& addr, ip_addrs) {
+ for(const std::string& addr: ip_addrs) {
x300_eth_conn_t conn_iface;
conn_iface.addr = addr;
conn_iface.type = X300_IFACE_NONE;
@@ -626,7 +625,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
_tree->create<double>(mb_path / "link_max_rate").set(X300_MAX_RATE_PCIE);
}
- BOOST_FOREACH(const std::string &key, dev_addr.keys())
+ for(const std::string &key: dev_addr.keys())
{
if (key.find("recv") != std::string::npos) mb.recv_args[key] = dev_addr[key];
if (key.find("send") != std::string::npos) mb.send_args[key] = dev_addr[key];
@@ -932,7 +931,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
}
if (mb.gps and mb.gps->gps_detected())
{
- BOOST_FOREACH(const std::string &name, mb.gps->get_sensors())
+ for(const std::string &name: mb.gps->get_sensors())
{
_tree->create<sensor_value_t>(mb_path / "sensors" / name)
.set_publisher(boost::bind(&gps_ctrl::get_sensor, mb.gps, name));
@@ -1015,7 +1014,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
radio_ids.resize(2);
}
- BOOST_FOREACH(const rfnoc::block_id_t &id, radio_ids) {
+ for(const rfnoc::block_id_t &id: radio_ids) {
rfnoc::x300_radio_ctrl_impl::sptr radio(get_block_ctrl<rfnoc::x300_radio_ctrl_impl>(id));
mb.radios.push_back(radio);
radio->setup_radio(
@@ -1063,7 +1062,7 @@ x300_impl::~x300_impl(void)
{
try
{
- BOOST_FOREACH(mboard_members_t &mb, _mb)
+ for(mboard_members_t &mb: _mb)
{
//kill the claimer task and unclaim the device
mb.claimer_task.reset();
@@ -1432,7 +1431,7 @@ void x300_impl::update_clock_source(mboard_members_t &mb, const std::string &sou
}
// Reset ADCs and DACs
- BOOST_FOREACH(rfnoc::x300_radio_ctrl_impl::sptr r, mb.radios) {
+ for(rfnoc::x300_radio_ctrl_impl::sptr r: mb.radios) {
r->reset_codec();
}
}
@@ -1464,7 +1463,7 @@ void x300_impl::update_time_source(mboard_members_t &mb, const std::string &sour
void x300_impl::sync_times(mboard_members_t &mb, const uhd::time_spec_t& t)
{
std::vector<rfnoc::block_id_t> radio_ids = find_blocks<rfnoc::x300_radio_ctrl_impl>("Radio");
- BOOST_FOREACH(const rfnoc::block_id_t &id, radio_ids) {
+ for(const rfnoc::block_id_t &id: radio_ids) {
get_block_ctrl<rfnoc::x300_radio_ctrl_impl>(id)->set_time_sync(t);
}
diff --git a/host/lib/usrp/x300/x300_io_impl.cpp b/host/lib/usrp/x300/x300_io_impl.cpp
index 1584cee24..4dd9dce8a 100644
--- a/host/lib/usrp/x300/x300_io_impl.cpp
+++ b/host/lib/usrp/x300/x300_io_impl.cpp
@@ -26,7 +26,6 @@
#include <uhd/utils/tasks.hpp>
#include <uhd/utils/log.hpp>
#include <uhd/utils/msg.hpp>
-#include <boost/foreach.hpp>
#include <boost/make_shared.hpp>
using namespace uhd;
@@ -73,7 +72,7 @@ void x300_impl::post_streamer_hooks(direction_t dir)
// Loop through all tx streamers. Find all radios connected to one
// streamer. Sync those.
- BOOST_FOREACH(const boost::weak_ptr<uhd::tx_streamer> &streamer_w, _tx_streamers.vals()) {
+ for(const boost::weak_ptr<uhd::tx_streamer> &streamer_w: _tx_streamers.vals()) {
const boost::shared_ptr<sph::send_packet_streamer> streamer =
boost::dynamic_pointer_cast<sph::send_packet_streamer>(streamer_w.lock());
if (not streamer) {
diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
index 9bf61f998..31a977884 100644
--- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
+++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
@@ -82,7 +82,7 @@ UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR(x300_radio_ctrl)
if (_radio_type==PRIMARY) {
_fp_gpio = gpio_atr::gpio_atr_3000::make(ctrl, regs::sr_addr(regs::FP_GPIO), regs::RB_FP_GPIO);
- BOOST_FOREACH(const gpio_atr::gpio_attr_map_t::value_type attr, gpio_atr::gpio_attr_map) {
+ for(const gpio_atr::gpio_attr_map_t::value_type attr: gpio_atr::gpio_attr_map) {
_tree->create<uint32_t>(fs_path("gpio") / "FP0" / attr.second)
.set(0)
.add_coerced_subscriber(boost::bind(&gpio_atr::gpio_atr_3000::set_gpio_attr, _fp_gpio, attr.first, _1));
@@ -149,7 +149,7 @@ x300_radio_ctrl_impl::~x300_radio_ctrl_impl()
_tree->remove(_root_path / "rx_fe_corrections");
_tree->remove(_root_path / "tx_fe_corrections");
if (_radio_type==PRIMARY) {
- BOOST_FOREACH(const gpio_atr::gpio_attr_map_t::value_type attr, gpio_atr::gpio_attr_map) {
+ for(const gpio_atr::gpio_attr_map_t::value_type attr: gpio_atr::gpio_attr_map) {
_tree->remove(fs_path("gpio") / "FP0" / attr.second);
}
_tree->remove(fs_path("gpio") / "FP0" / "READBACK");
@@ -380,7 +380,7 @@ void x300_radio_ctrl_impl::setup_radio(
);
size_t rx_chan = 0, tx_chan = 0;
- BOOST_FOREACH(const std::string& fe, _db_manager->get_rx_frontends()) {
+ for(const std::string& fe: _db_manager->get_rx_frontends()) {
if (rx_chan >= _get_num_radios()) {
break;
}
@@ -393,7 +393,7 @@ void x300_radio_ctrl_impl::setup_radio(
_rx_fe_map[rx_chan].core->set_fe_connection(usrp::fe_connection_t(conn, if_freq));
rx_chan++;
}
- BOOST_FOREACH(const std::string& fe, _db_manager->get_tx_frontends()) {
+ for(const std::string& fe: _db_manager->get_tx_frontends()) {
if (tx_chan >= _get_num_radios()) {
break;
}