aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/common
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/common')
-rw-r--r--host/lib/usrp/common/CMakeLists.txt1
-rw-r--r--host/lib/usrp/common/ad9361_ctrl.cpp6
-rw-r--r--host/lib/usrp/common/ad9361_driver/ad9361_client.h4
-rw-r--r--host/lib/usrp/common/ad9361_driver/ad9361_device.cpp34
-rw-r--r--host/lib/usrp/common/ad936x_manager.cpp21
-rw-r--r--host/lib/usrp/common/ad936x_manager.hpp1
-rw-r--r--host/lib/usrp/common/adf4001_ctrl.cpp2
-rw-r--r--host/lib/usrp/common/adf435x.hpp10
-rw-r--r--host/lib/usrp/common/apply_corrections.cpp15
-rw-r--r--host/lib/usrp/common/async_packet_handler.hpp8
-rw-r--r--host/lib/usrp/common/constrained_device_args.hpp2
-rw-r--r--host/lib/usrp/common/fifo_ctrl_excelsior.cpp6
-rw-r--r--host/lib/usrp/common/fw_comm_protocol.h102
-rw-r--r--host/lib/usrp/common/fx2_ctrl.cpp14
-rw-r--r--host/lib/usrp/common/max287x.hpp10
-rw-r--r--host/lib/usrp/common/recv_packet_demuxer.cpp4
-rw-r--r--host/lib/usrp/common/recv_packet_demuxer_3000.hpp6
-rw-r--r--host/lib/usrp/common/usrp3_fw_ctrl_iface.cpp246
-rw-r--r--host/lib/usrp/common/usrp3_fw_ctrl_iface.hpp72
-rw-r--r--host/lib/usrp/common/validate_subdev_spec.cpp9
20 files changed, 75 insertions, 498 deletions
diff --git a/host/lib/usrp/common/CMakeLists.txt b/host/lib/usrp/common/CMakeLists.txt
index 9f4cf09b5..9480d0284 100644
--- a/host/lib/usrp/common/CMakeLists.txt
+++ b/host/lib/usrp/common/CMakeLists.txt
@@ -38,5 +38,4 @@ LIBUHD_APPEND_SOURCES(
${CMAKE_CURRENT_SOURCE_DIR}/validate_subdev_spec.cpp
${CMAKE_CURRENT_SOURCE_DIR}/recv_packet_demuxer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fifo_ctrl_excelsior.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/usrp3_fw_ctrl_iface.cpp
)
diff --git a/host/lib/usrp/common/ad9361_ctrl.cpp b/host/lib/usrp/common/ad9361_ctrl.cpp
index 0dc5e7919..a1c158eae 100644
--- a/host/lib/usrp/common/ad9361_ctrl.cpp
+++ b/host/lib/usrp/common/ad9361_ctrl.cpp
@@ -17,7 +17,7 @@
#include "ad9361_ctrl.hpp"
#include <uhd/types/ranges.hpp>
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/types/serial.hpp>
#include <cstring>
#include <boost/format.hpp>
@@ -153,10 +153,10 @@ public:
const double clipped_rate = clock_rate_range.clip(rate);
if (clipped_rate != rate) {
- UHD_MSG(warning) << boost::format(
+ UHD_LOGGER_WARNING("AD936X") << boost::format(
"The requested master_clock_rate %f MHz exceeds bounds imposed by UHD.\n"
"The master_clock_rate has been forced to %f MHz.\n"
- ) % (rate/1e6) % (clipped_rate/1e6) << std::endl;
+ ) % (rate/1e6) % (clipped_rate/1e6) ;
}
double return_rate = _device.set_clock_rate(clipped_rate);
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_client.h b/host/lib/usrp/common/ad9361_driver/ad9361_client.h
index 921045fbd..4fea53521 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_client.h
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_client.h
@@ -34,10 +34,10 @@ typedef enum {
/*!
* Clocking mode
*/
-typedef enum {
+enum class clocking_mode_t {
AD9361_XTAL_P_CLK_PATH,
AD9361_XTAL_N_CLK_PATH
-} clocking_mode_t;
+};
/*!
* Digital interface specific
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
index e2ed2c77d..e11079ae3 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
@@ -24,7 +24,7 @@
#include <cmath>
#include <uhd/exception.hpp>
#include <uhd/utils/log.hpp>
-#include <uhd/utils/msg.hpp>
+
#include <stdint.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread/thread.hpp>
@@ -321,7 +321,7 @@ double ad9361_device_t::_calibrate_baseband_rx_analog_filter(double req_rfbw)
double bbbw = req_rfbw / 2.0;
if(bbbw > _baseband_bw / 2.0)
{
- UHD_LOG << "baseband bandwidth too large for current sample rate. Setting bandwidth to: "<<_baseband_bw;
+ UHD_LOGGER_DEBUG("AD936X")<< "baseband bandwidth too large for current sample rate. Setting bandwidth to: "<<_baseband_bw;
bbbw = _baseband_bw / 2.0;
}
@@ -388,7 +388,7 @@ double ad9361_device_t::_calibrate_baseband_tx_analog_filter(double req_rfbw)
if(bbbw > _baseband_bw / 2.0)
{
- UHD_LOG << "baseband bandwidth too large for current sample rate. Setting bandwidth to: "<<_baseband_bw;
+ UHD_LOGGER_DEBUG("AD936X")<< "baseband bandwidth too large for current sample rate. Setting bandwidth to: "<<_baseband_bw;
bbbw = _baseband_bw / 2.0;
}
@@ -443,7 +443,7 @@ double ad9361_device_t::_calibrate_secondary_tx_filter(double req_rfbw)
if(bbbw > _baseband_bw / 2.0)
{
- UHD_LOG << "baseband bandwidth too large for current sample rate. Setting bandwidth to: "<<_baseband_bw;
+ UHD_LOGGER_DEBUG("AD936X")<< "baseband bandwidth too large for current sample rate. Setting bandwidth to: "<<_baseband_bw;
bbbw = _baseband_bw / 2.0;
}
@@ -539,7 +539,7 @@ double ad9361_device_t::_calibrate_rx_TIAs(double req_rfbw)
if(bbbw > _baseband_bw / 2.0)
{
- UHD_LOG << "baseband bandwidth too large for current sample rate. Setting bandwidth to: "<<_baseband_bw;
+ UHD_LOGGER_DEBUG("AD936X")<< "baseband bandwidth too large for current sample rate. Setting bandwidth to: "<<_baseband_bw;
bbbw = _baseband_bw / 2.0;
}
@@ -1169,7 +1169,7 @@ void ad9361_device_t::_setup_synth(direction_t direction, double vcorate)
* fed to the public set_clock_rate function. */
double ad9361_device_t::_tune_bbvco(const double rate)
{
- UHD_LOG << boost::format("[ad9361_device_t::_tune_bbvco] rate=%.10f\n") % rate;
+ UHD_LOGGER_DEBUG("AD936X")<< boost::format("[ad9361_device_t::_tune_bbvco] rate=%.10f\n") % rate;
/* Let's not re-tune to the same frequency over and over... */
if (freq_is_nearly_equal(rate, _req_coreclk)) {
@@ -1197,13 +1197,13 @@ double ad9361_device_t::_tune_bbvco(const double rate)
if (i == 7)
throw uhd::runtime_error("[ad9361_device_t] _tune_bbvco: wrong vcorate");
- UHD_LOG << boost::format("[ad9361_device_t::_tune_bbvco] vcodiv=%d vcorate=%.10f\n") % vcodiv % vcorate;
+ UHD_LOGGER_DEBUG("AD936X")<< boost::format("[ad9361_device_t::_tune_bbvco] vcodiv=%d vcorate=%.10f\n") % vcodiv % vcorate;
/* Fo = Fref * (Nint + Nfrac / mod) */
int nint = static_cast<int>(vcorate / fref);
- UHD_LOG << boost::format("[ad9361_device_t::_tune_bbvco] (nint)=%.10f\n") % (vcorate / fref);
+ UHD_LOGGER_DEBUG("AD936X")<< boost::format("[ad9361_device_t::_tune_bbvco] (nint)=%.10f\n") % (vcorate / fref);
int nfrac = static_cast<int>(boost::math::round(((vcorate / fref) - (double) nint) * (double) modulus));
- UHD_LOG << boost::format("[ad9361_device_t::_tune_bbvco] (nfrac)=%.10f\n") % (((vcorate / fref) - (double) nint) * (double) modulus);
- UHD_LOG << boost::format("[ad9361_device_t::_tune_bbvco] nint=%d nfrac=%d\n") % nint % nfrac;
+ UHD_LOGGER_DEBUG("AD936X")<< boost::format("[ad9361_device_t::_tune_bbvco] (nfrac)=%.10f\n") % (((vcorate / fref) - (double) nint) * (double) modulus);
+ UHD_LOGGER_DEBUG("AD936X")<< boost::format("[ad9361_device_t::_tune_bbvco] nint=%d nfrac=%d\n") % nint % nfrac;
double actual_vcorate = fref
* ((double) nint + ((double) nfrac / (double) modulus));
@@ -1381,7 +1381,7 @@ double ad9361_device_t::_setup_rates(const double rate)
/* If we make it into this function, then we are tuning to a new rate.
* Store the new rate. */
_req_clock_rate = rate;
- UHD_LOG << boost::format("[ad9361_device_t::_setup_rates] rate=%.6d\n") % rate;
+ UHD_LOGGER_DEBUG("AD936X")<< boost::format("[ad9361_device_t::_setup_rates] rate=%.6d\n") % rate;
/* Set the decimation and interpolation values in the RX and TX chains.
* This also switches filters in / out. Note that all transmitters and
@@ -1467,7 +1467,7 @@ double ad9361_device_t::_setup_rates(const double rate)
throw uhd::runtime_error("[ad9361_device_t] [_setup_rates] INVALID_CODE_PATH");
}
- UHD_LOG << boost::format("[ad9361_device_t::_setup_rates] divfactor=%d\n") % divfactor;
+ UHD_LOGGER_DEBUG("AD936X")<< boost::format("[ad9361_device_t::_setup_rates] divfactor=%d\n") % divfactor;
/* Tune the BBPLL to get the ADC and DAC clocks. */
const double adcclk = _tune_bbvco(rate * divfactor);
@@ -1489,7 +1489,7 @@ double ad9361_device_t::_setup_rates(const double rate)
_io_iface->poke8(0x004, _regs.inputsel);
_io_iface->poke8(0x00A, _regs.bbpll);
- UHD_LOG << boost::format("[ad9361_device_t::_setup_rates] adcclk=%f\n") % adcclk;
+ UHD_LOGGER_DEBUG("AD936X")<< boost::format("[ad9361_device_t::_setup_rates] adcclk=%f\n") % adcclk;
_baseband_bw = (adcclk / divfactor);
/*
@@ -1583,11 +1583,11 @@ void ad9361_device_t::initialize()
/* Enable clocks. */
switch (_client_params->get_clocking_mode()) {
- case AD9361_XTAL_N_CLK_PATH: {
+ case clocking_mode_t::AD9361_XTAL_N_CLK_PATH: {
_io_iface->poke8(0x009, 0x17);
} break;
- case AD9361_XTAL_P_CLK_PATH: {
+ case clocking_mode_t::AD9361_XTAL_P_CLK_PATH: {
_io_iface->poke8(0x009, 0x07);
_io_iface->poke8(0x292, 0x08);
_io_iface->poke8(0x293, 0x80);
@@ -1798,7 +1798,7 @@ double ad9361_device_t::set_clock_rate(const double req_rate)
throw uhd::runtime_error("[ad9361_device_t] Requested master clock rate outside range");
}
- UHD_LOG << boost::format("[ad9361_device_t::set_clock_rate] req_rate=%.10f\n") % req_rate;
+ UHD_LOGGER_DEBUG("AD936X")<< boost::format("[ad9361_device_t::set_clock_rate] req_rate=%.10f\n") % req_rate;
/* UHD has a habit of requesting the same rate like four times when it
* starts up. This prevents that, and any bugs in user code that request
@@ -1840,7 +1840,7 @@ double ad9361_device_t::set_clock_rate(const double req_rate)
* all the hard work gets done. */
double rate = _setup_rates(req_rate);
- UHD_LOG << boost::format("[ad9361_device_t::set_clock_rate] rate=%.10f\n") % rate;
+ UHD_LOGGER_DEBUG("AD936X")<< boost::format("[ad9361_device_t::set_clock_rate] rate=%.10f\n") % rate;
/* Transition to the ALERT state and calibrate everything. */
_io_iface->poke8(0x015, 0x04); //dual synth mode, synth en ctrl en
diff --git a/host/lib/usrp/common/ad936x_manager.cpp b/host/lib/usrp/common/ad936x_manager.cpp
index 2b6d69c15..503678554 100644
--- a/host/lib/usrp/common/ad936x_manager.cpp
+++ b/host/lib/usrp/common/ad936x_manager.cpp
@@ -16,8 +16,7 @@
//
#include "ad936x_manager.hpp"
-#include <uhd/utils/msg.hpp>
-#include <boost/foreach.hpp>
+#include <uhd/utils/log.hpp>
#include <boost/functional/hash.hpp>
#include <boost/thread/thread.hpp>
@@ -66,7 +65,7 @@ class ad936x_manager_impl : public ad936x_manager
***********************************************************************/
void init_codec()
{
- BOOST_FOREACH(const std::string &rx_fe, _rx_frontends) {
+ for(const std::string &rx_fe: _rx_frontends) {
_codec_ctrl->set_gain(rx_fe, DEFAULT_GAIN);
_codec_ctrl->set_bw_filter(rx_fe, DEFAULT_BANDWIDTH);
_codec_ctrl->tune(rx_fe, DEFAULT_FREQ);
@@ -74,7 +73,7 @@ class ad936x_manager_impl : public ad936x_manager
_codec_ctrl->set_iq_balance_auto(rx_fe, DEFAULT_AUTO_IQ_BALANCE);
_codec_ctrl->set_agc(rx_fe, DEFAULT_AGC_ENABLE);
}
- BOOST_FOREACH(const std::string &tx_fe, _tx_frontends) {
+ for(const std::string &tx_fe: _tx_frontends) {
_codec_ctrl->set_gain(tx_fe, DEFAULT_GAIN);
_codec_ctrl->set_bw_filter(tx_fe, DEFAULT_BANDWIDTH);
_codec_ctrl->tune(tx_fe, DEFAULT_FREQ);
@@ -98,7 +97,7 @@ class ad936x_manager_impl : public ad936x_manager
) {
// Put AD936x in loopback mode
_codec_ctrl->data_port_loopback(true);
- UHD_MSG(status) << "Performing CODEC loopback test... " << std::flush;
+ UHD_LOGGER_INFO("AD936X") << "Performing CODEC loopback test... ";
size_t hash = size_t(time(NULL));
// Allow some time for AD936x to enter loopback mode.
@@ -127,11 +126,11 @@ class ad936x_manager_impl : public ad936x_manager
bool test_fail = word32 != rb_tx or word32 != rb_rx;
if(test_fail)
{
- UHD_MSG(status) << "fail" << std::endl;
+ UHD_LOGGER_INFO("AD936X") << "CODEC loopback test failed";
throw uhd::runtime_error("CODEC loopback test failed.");
}
}
- UHD_MSG(status) << "pass" << std::endl;
+ UHD_LOGGER_INFO("AD936X") << "CODEC loopback test passed";
// Zero out the idle data.
poker_functor(0);
@@ -194,10 +193,10 @@ class ad936x_manager_impl : public ad936x_manager
bool check_bandwidth(double rate, const std::string dir)
{
if (rate > _codec_ctrl->get_bw_filter_range(dir).stop()) {
- UHD_MSG(warning)
+ UHD_LOGGER_WARNING("AD936X")
<< "Selected " << dir << " bandwidth (" << (rate/1e6) << " MHz) exceeds\n"
<< "analog frontend filter bandwidth (" << (_codec_ctrl->get_bw_filter_range(dir).stop()/1e6) << " MHz)."
- << std::endl;
+ ;
return false;
}
return true;
@@ -218,7 +217,7 @@ class ad936x_manager_impl : public ad936x_manager
}
// Gains
- BOOST_FOREACH(const std::string &name, ad9361_ctrl::get_gain_names(key))
+ for(const std::string &name: ad9361_ctrl::get_gain_names(key))
{
subtree->create<meta_range_t>(uhd::fs_path("gains") / name / "range")
.set(ad9361_ctrl::get_gain_range(key));
@@ -278,7 +277,7 @@ class ad936x_manager_impl : public ad936x_manager
}
// Frontend filters
- BOOST_FOREACH(const std::string &filter_name, _codec_ctrl->get_filter_names(key)) {
+ for(const std::string &filter_name: _codec_ctrl->get_filter_names(key)) {
subtree->create<filter_info_base::sptr>(uhd::fs_path("filters") / filter_name / "value" )
.set_publisher(boost::bind(&ad9361_ctrl::get_filter, _codec_ctrl, key, filter_name))
.add_coerced_subscriber(boost::bind(&ad9361_ctrl::set_filter, _codec_ctrl, key, filter_name, _1));
diff --git a/host/lib/usrp/common/ad936x_manager.hpp b/host/lib/usrp/common/ad936x_manager.hpp
index c456715e3..99464d0af 100644
--- a/host/lib/usrp/common/ad936x_manager.hpp
+++ b/host/lib/usrp/common/ad936x_manager.hpp
@@ -22,6 +22,7 @@
#include <uhd/utils/math.hpp>
#include <uhd/property_tree.hpp>
#include <uhd/types/direction.hpp>
+#include <boost/format.hpp>
#include <boost/shared_ptr.hpp>
#include "ad9361_ctrl.hpp"
#include <stdint.h>
diff --git a/host/lib/usrp/common/adf4001_ctrl.cpp b/host/lib/usrp/common/adf4001_ctrl.cpp
index 01a35dbec..b824824a4 100644
--- a/host/lib/usrp/common/adf4001_ctrl.cpp
+++ b/host/lib/usrp/common/adf4001_ctrl.cpp
@@ -22,7 +22,7 @@
#include "adf4001_ctrl.hpp"
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <iostream>
#include <iomanip>
diff --git a/host/lib/usrp/common/adf435x.hpp b/host/lib/usrp/common/adf435x.hpp
index ff7b1a2f4..daa539982 100644
--- a/host/lib/usrp/common/adf435x.hpp
+++ b/host/lib/usrp/common/adf435x.hpp
@@ -268,14 +268,14 @@ public:
adf435x_regs_t::LDF_FRAC_N;
std::string tuning_str = (int_n_mode) ? "Integer-N" : "Fractional";
- UHD_LOGV(often)
+ UHD_LOGGER_DEBUG("ADF435X")
<< boost::format("ADF 435X Frequencies (MHz): REQUESTED=%0.9f, ACTUAL=%0.9f"
- ) % (target_freq/1e6) % (actual_freq/1e6) << std::endl
+ ) % (target_freq/1e6) % (actual_freq/1e6)
<< boost::format("ADF 435X Intermediates (MHz): Feedback=%0.2f, VCO=%0.2f, PFD=%0.2f, BAND=%0.2f, REF=%0.2f"
- ) % (feedback_freq/1e6) % (vco_freq/1e6) % (pfd_freq/1e6) % (pfd_freq/BS/1e6) % (_reference_freq/1e6) << std::endl
- << boost::format("ADF 435X Tuning: %s") % tuning_str.c_str() << std::endl
+ ) % (feedback_freq/1e6) % (vco_freq/1e6) % (pfd_freq/1e6) % (pfd_freq/BS/1e6) % (_reference_freq/1e6)
+ << boost::format("ADF 435X Tuning: %s") % tuning_str.c_str()
<< boost::format("ADF 435X Settings: R=%d, BS=%d, N=%d, FRAC=%d, MOD=%d, T=%d, D=%d, RFdiv=%d"
- ) % R % BS % N % FRAC % MOD % T % D % RFdiv << std::endl;
+ ) % R % BS % N % FRAC % MOD % T % D % RFdiv ;
UHD_ASSERT_THROW((_regs.frac_12_bit & ((uint16_t)~0xFFF)) == 0);
UHD_ASSERT_THROW((_regs.mod_12_bit & ((uint16_t)~0xFFF)) == 0);
diff --git a/host/lib/usrp/common/apply_corrections.cpp b/host/lib/usrp/common/apply_corrections.cpp
index 272e0e093..32c7e3c45 100644
--- a/host/lib/usrp/common/apply_corrections.cpp
+++ b/host/lib/usrp/common/apply_corrections.cpp
@@ -18,11 +18,10 @@
#include "apply_corrections.hpp"
#include <uhd/usrp/dboard_eeprom.hpp>
#include <uhd/utils/paths.hpp>
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/utils/csv.hpp>
#include <uhd/types/dict.hpp>
#include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
#include <boost/thread/mutex.hpp>
#include <cstdio>
#include <complex>
@@ -114,7 +113,7 @@ static void apply_fe_corrections(
bool read_data = false, skip_next = false;;
std::vector<fe_cal_t> datas;
- BOOST_FOREACH(const uhd::csv::row_type &row, rows){
+ for(const uhd::csv::row_type &row: rows){
if (not read_data and not row.empty() and row[0] == "DATA STARTS HERE"){
read_data = true;
skip_next = true;
@@ -133,7 +132,7 @@ static void apply_fe_corrections(
}
std::sort(datas.begin(), datas.end(), fe_cal_comp);
fe_cal_cache[cal_data_path.string()] = datas;
- UHD_MSG(status) << "Loaded " << cal_data_path.string() << std::endl;
+ UHD_LOGGER_INFO("CAL") << "Calibration data loaded: " << cal_data_path.string();
}
@@ -168,7 +167,7 @@ void uhd::usrp::apply_tx_fe_corrections( //overloading to work according to rfno
);
}
catch(const std::exception &e){
- UHD_MSG(error) << "Failure in apply_tx_fe_corrections: " << e.what() << std::endl;
+ UHD_LOGGER_ERROR("CAL") << "Failure in apply_tx_fe_corrections: " << e.what();
}
}
@@ -195,7 +194,7 @@ void uhd::usrp::apply_tx_fe_corrections(
);
}
catch(const std::exception &e){
- UHD_MSG(error) << "Failure in apply_tx_fe_corrections: " << e.what() << std::endl;
+ UHD_LOGGER_ERROR("CAL") << "Failure in apply_tx_fe_corrections: " << e.what();
}
}
@@ -216,7 +215,7 @@ void uhd::usrp::apply_rx_fe_corrections( //overloading to work according to rfno
);
}
catch(const std::exception &e){
- UHD_MSG(error) << "Failure in apply_tx_fe_corrections: " << e.what() << std::endl;
+ UHD_LOGGER_ERROR("CAL") << "Failure in apply_tx_fe_corrections: " << e.what();
}
}
@@ -236,6 +235,6 @@ void uhd::usrp::apply_rx_fe_corrections(
);
}
catch(const std::exception &e){
- UHD_MSG(error) << "Failure in apply_rx_fe_corrections: " << e.what() << std::endl;
+ UHD_LOGGER_ERROR("CAL") << "Failure in apply_rx_fe_corrections: " << e.what();
}
}
diff --git a/host/lib/usrp/common/async_packet_handler.hpp b/host/lib/usrp/common/async_packet_handler.hpp
index 20409c77a..15f05e508 100644
--- a/host/lib/usrp/common/async_packet_handler.hpp
+++ b/host/lib/usrp/common/async_packet_handler.hpp
@@ -22,7 +22,7 @@
#include <uhd/transport/vrt_if_packet.hpp>
#include <uhd/types/metadata.hpp>
#include <uhd/utils/byteswap.hpp>
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
namespace uhd{ namespace usrp{
@@ -55,14 +55,14 @@ namespace uhd{ namespace usrp{
if (metadata.event_code &
( async_metadata_t::EVENT_CODE_UNDERFLOW
| async_metadata_t::EVENT_CODE_UNDERFLOW_IN_PACKET)
- ) UHD_MSG(fastpath) << "U";
+ ) UHD_LOG_FASTPATH("U")
else if (metadata.event_code &
( async_metadata_t::EVENT_CODE_SEQ_ERROR
| async_metadata_t::EVENT_CODE_SEQ_ERROR_IN_BURST)
- ) UHD_MSG(fastpath) << "S";
+ ) UHD_LOG_FASTPATH("S")
else if (metadata.event_code &
async_metadata_t::EVENT_CODE_TIME_ERROR
- ) UHD_MSG(fastpath) << "L";
+ ) UHD_LOG_FASTPATH("L")
}
diff --git a/host/lib/usrp/common/constrained_device_args.hpp b/host/lib/usrp/common/constrained_device_args.hpp
index 1bfd1df00..47c5f4cc0 100644
--- a/host/lib/usrp/common/constrained_device_args.hpp
+++ b/host/lib/usrp/common/constrained_device_args.hpp
@@ -260,7 +260,7 @@ namespace usrp {
template<typename arg_t, typename data_t>
static inline void _enforce_discrete(const arg_t& arg, const std::vector<data_t>& valid_values) {
bool match = false;
- BOOST_FOREACH(const data_t& val, valid_values) {
+ for(const data_t& val: valid_values) {
if (val == arg.get()) {
match = true;
break;
diff --git a/host/lib/usrp/common/fifo_ctrl_excelsior.cpp b/host/lib/usrp/common/fifo_ctrl_excelsior.cpp
index a9995a161..c86380354 100644
--- a/host/lib/usrp/common/fifo_ctrl_excelsior.cpp
+++ b/host/lib/usrp/common/fifo_ctrl_excelsior.cpp
@@ -18,7 +18,7 @@
#include "fifo_ctrl_excelsior.hpp"
#include "async_packet_handler.hpp"
#include <uhd/exception.hpp>
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/utils/byteswap.hpp>
#include <uhd/utils/tasks.hpp>
#include <uhd/utils/safe_call.hpp>
@@ -97,7 +97,7 @@ public:
vrt::if_hdr_unpack_le(pkt, packet_info);
}
catch(const std::exception &ex){
- UHD_MSG(error) << "FIFO ctrl bad VITA packet: " << ex.what() << std::endl;
+ UHD_LOGGER_ERROR("UHD") << "FIFO ctrl bad VITA packet: " << ex.what();
}
if (packet_info.has_sid and packet_info.sid == _config.ctrl_sid_base){
ctrl_result_t res = ctrl_result_t();
@@ -112,7 +112,7 @@ public:
standard_async_msg_prints(metadata);
}
else{
- UHD_MSG(error) << "FIFO ctrl got unknown SID: " << packet_info.sid << std::endl;
+ UHD_LOGGER_ERROR("UHD") << "FIFO ctrl got unknown SID: " << packet_info.sid ;
}
}
diff --git a/host/lib/usrp/common/fw_comm_protocol.h b/host/lib/usrp/common/fw_comm_protocol.h
deleted file mode 100644
index 14adb33a9..000000000
--- a/host/lib/usrp/common/fw_comm_protocol.h
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// Copyright 2014 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#ifndef INCLUDED_FW_COMM_PROTOCOL
-#define INCLUDED_FW_COMM_PROTOCOL
-
-#include <stdint.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
-
-/*!
- * Structs and constants for communication between firmware and host.
- * This header is shared by the firmware and host code.
- * Therefore, this header may only contain valid C code.
- */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FW_COMM_PROTOCOL_SIGNATURE 0xACE3
-#define FW_COMM_PROTOCOL_VERSION 0
-#define FW_COMM_MAX_DATA_WORDS 16
-#define FW_COMM_PROTOCOL_MTU 256
-
-#define FW_COMM_FLAGS_ACK 0x00000001
-#define FW_COMM_FLAGS_CMD_MASK 0x00000FF0
-#define FW_COMM_FLAGS_ERROR_MASK 0xFF000000
-
-#define FW_COMM_CMD_ECHO 0x00000000
-#define FW_COMM_CMD_POKE32 0x00000010
-#define FW_COMM_CMD_PEEK32 0x00000020
-#define FW_COMM_CMD_BLOCK_POKE32 0x00000030
-#define FW_COMM_CMD_BLOCK_PEEK32 0x00000040
-
-#define FW_COMM_ERR_PKT_ERROR 0x80000000
-#define FW_COMM_ERR_CMD_ERROR 0x40000000
-#define FW_COMM_ERR_SIZE_ERROR 0x20000000
-
-#define FW_COMM_GENERATE_ID(prod) ((((uint32_t) FW_COMM_PROTOCOL_SIGNATURE) << 0) | \
- (((uint32_t) prod) << 16) | \
- (((uint32_t) FW_COMM_PROTOCOL_VERSION) << 24))
-
-#define FW_COMM_GET_PROTOCOL_SIG(id) ((uint16_t)(id & 0xFFFF))
-#define FW_COMM_GET_PRODUCT_ID(id) ((uint8_t)(id >> 16))
-#define FW_COMM_GET_PROTOCOL_VER(id) ((uint8_t)(id >> 24))
-
-typedef struct
-{
- uint32_t id; //Protocol and device identifier
- uint32_t flags; //Holds commands and ack messages
- uint32_t sequence; //Sequence number (specific to FW communication transactions)
- uint32_t data_words; //Number of data words in payload
- uint32_t addr; //Address field for the command in flags
- uint32_t data[FW_COMM_MAX_DATA_WORDS]; //Data field for the command in flags
-} fw_comm_pkt_t;
-
-#ifdef __cplusplus
-} //extern "C"
-#endif
-
-// The following definitions are only useful in firmware. Exclude in host code.
-#ifndef __cplusplus
-
-typedef void (*poke32_func)(const uint32_t addr, const uint32_t data);
-typedef uint32_t (*peek32_func)(const uint32_t addr);
-
-/*!
- * Process a firmware communication packet and compute a response.
- * Args:
- * - (in) request: Pointer to the request struct
- * - (out) response: Pointer to the response struct
- * - (in) product_id: The 8-bit usrp3 specific product ID (for request filtering)
- * - (func) poke_callback, peek_callback: Callback functions for a single peek/poke
- * - return value: Send a response packet
- */
-bool process_fw_comm_protocol_pkt(
- const fw_comm_pkt_t* request,
- fw_comm_pkt_t* response,
- uint8_t product_id,
- uint32_t iface_id,
- poke32_func poke_callback,
- peek32_func peek_callback
-);
-
-#endif //ifdef __cplusplus
-
-#endif /* INCLUDED_FW_COMM_PROTOCOL */
diff --git a/host/lib/usrp/common/fx2_ctrl.cpp b/host/lib/usrp/common/fx2_ctrl.cpp
index c69223747..9fa774851 100644
--- a/host/lib/usrp/common/fx2_ctrl.cpp
+++ b/host/lib/usrp/common/fx2_ctrl.cpp
@@ -16,7 +16,7 @@
//
#include "fx2_ctrl.hpp"
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/exception.hpp>
#include <uhd/transport/usb_control.hpp>
#include <boost/functional/hash.hpp>
@@ -177,7 +177,7 @@ public:
unsigned char reset_n = 0;
//hit the reset line
- if (load_img_msg) UHD_MSG(status) << "Loading firmware image: " << filestring << "..." << std::flush;
+ if (load_img_msg) UHD_LOGGER_INFO("FX2") << "Loading firmware image: " << filestring << "...";
usrp_control_write(FX2_FIRMWARE_LOAD, 0xe600, 0, &reset_y, 1);
while (!file.eof()) {
@@ -205,7 +205,7 @@ public:
//wait for things to settle
boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
- if (load_img_msg) UHD_MSG(status) << " done" << std::endl;
+ if (load_img_msg) UHD_LOGGER_INFO("FX2") << "Firmware loaded";
return;
}
//type anything else is unhandled
@@ -242,7 +242,7 @@ public:
const int ep0_size = 64;
unsigned char buf[ep0_size];
- if (load_img_msg) UHD_MSG(status) << "Loading FPGA image: " << filestring << "..." << std::flush;
+ if (load_img_msg) UHD_LOGGER_INFO("FX2") << "Loading FPGA image: " << filestring << "...";
std::ifstream file;
file.open(filename, std::ios::in | std::ios::binary);
if (not file.good()) {
@@ -274,12 +274,12 @@ public:
usrp_fpga_reset(false); //done loading, take fpga out of reset
file.close();
- if (load_img_msg) UHD_MSG(status) << " done" << std::endl;
+ if (load_img_msg) UHD_LOGGER_INFO("FX2") << "FPGA image loaded";
}
void usrp_load_eeprom(std::string filestring)
{
- if (load_img_msg) UHD_MSG(status) << "Loading EEPROM image: " << filestring << "..." << std::flush;
+ if (load_img_msg) UHD_LOGGER_INFO("FX2") << "Loading EEPROM image: " << filestring << "...";
const char *filename = filestring.c_str();
const uint16_t i2c_addr = 0x50;
@@ -315,7 +315,7 @@ public:
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
}
file.close();
- if (load_img_msg) UHD_MSG(status) << " done" << std::endl;
+ if (load_img_msg) UHD_LOGGER_INFO("FX2") << "EEPROM image loaded";
}
diff --git a/host/lib/usrp/common/max287x.hpp b/host/lib/usrp/common/max287x.hpp
index 2e87dc6ff..1209d194e 100644
--- a/host/lib/usrp/common/max287x.hpp
+++ b/host/lib/usrp/common/max287x.hpp
@@ -403,7 +403,7 @@ public:
while (vco_freq < MIN_VCO_FREQ)
vco_freq *=2;
uint8_t vco_index = 0xFF;
- BOOST_FOREACH(const vco_map_t::value_type &vco, max2871_vco_map)
+ for(const vco_map_t::value_type &vco: max2871_vco_map)
{
if (uhd::math::fp_compare::fp_compare_epsilon<double>(vco_freq) < vco.second.stop())
{
@@ -638,13 +638,13 @@ double max287x<max287x_regs_t>::set_frequency(
//actual frequency calculation
double actual_freq = double((N + (double(FRAC)/double(MOD)))*ref_freq*(1+int(D))/(R*(1+int(T)))) * fb_divisor / RFdiv;
- UHD_LOGV(rarely)
+ UHD_LOGGER_DEBUG("MAX287X")
<< boost::format("MAX287x: Intermediates: ref=%0.2f, outdiv=%f, fbdiv=%f"
- ) % ref_freq % double(RFdiv*2) % double(N + double(FRAC)/double(MOD)) << std::endl
+ ) % ref_freq % double(RFdiv*2) % double(N + double(FRAC)/double(MOD))
<< boost::format("MAX287x: tune: R=%d, BS=%d, N=%d, FRAC=%d, MOD=%d, T=%d, D=%d, RFdiv=%d, type=%s"
- ) % R % BS % N % FRAC % MOD % T % D % RFdiv % ((is_int_n) ? "Integer-N" : "Fractional") << std::endl
+ ) % R % BS % N % FRAC % MOD % T % D % RFdiv % ((is_int_n) ? "Integer-N" : "Fractional")
<< boost::format("MAX287x: Frequencies (MHz): REQ=%0.2f, ACT=%0.2f, VCO=%0.2f, PFD=%0.2f, BAND=%0.2f"
- ) % (target_freq/1e6) % (actual_freq/1e6) % (vco_freq/1e6) % (pfd_freq/1e6) % (pfd_freq/BS/1e6) << std::endl;
+ ) % (target_freq/1e6) % (actual_freq/1e6) % (vco_freq/1e6) % (pfd_freq/1e6) % (pfd_freq/BS/1e6) ;
//load the register values
_regs.rf_output_enable = max287x_regs_t::RF_OUTPUT_ENABLE_ENABLED;
diff --git a/host/lib/usrp/common/recv_packet_demuxer.cpp b/host/lib/usrp/common/recv_packet_demuxer.cpp
index 8d9dcee9e..2a4c4d705 100644
--- a/host/lib/usrp/common/recv_packet_demuxer.cpp
+++ b/host/lib/usrp/common/recv_packet_demuxer.cpp
@@ -16,7 +16,7 @@
//
#include "recv_packet_demuxer.hpp"
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/utils/byteswap.hpp>
#include <boost/thread/mutex.hpp>
#include <uhd/transport/vrt_if_packet.hpp>
@@ -87,7 +87,7 @@ public:
if (rx_index < _queues.size()) _queues[rx_index].wrapper.push(buff);
else
{
- UHD_MSG(error) << "Got a data packet with unknown SID " << extract_sid(buff) << std::endl;
+ UHD_LOGGER_ERROR("STREAMER") << "Got a data packet with unknown SID " << extract_sid(buff) ;
recv_pkt_demux_mrb *mrb = new recv_pkt_demux_mrb();
vrt::if_packet_info_t info;
info.packet_type = vrt::if_packet_info_t::PACKET_TYPE_DATA;
diff --git a/host/lib/usrp/common/recv_packet_demuxer_3000.hpp b/host/lib/usrp/common/recv_packet_demuxer_3000.hpp
index 3ad76f1a0..a970e81a5 100644
--- a/host/lib/usrp/common/recv_packet_demuxer_3000.hpp
+++ b/host/lib/usrp/common/recv_packet_demuxer_3000.hpp
@@ -22,7 +22,7 @@
#include <uhd/transport/zero_copy.hpp>
#include <stdint.h>
#include <boost/thread.hpp>
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/utils/atomic.hpp>
#include <uhd/types/time_spec.hpp>
#include <uhd/utils/byteswap.hpp>
@@ -103,9 +103,9 @@ namespace uhd{ namespace usrp{
if (new_sid != sid)
{
boost::mutex::scoped_lock l(mutex);
- if (_queues.count(new_sid) == 0) UHD_MSG(error)
+ if (_queues.count(new_sid) == 0) UHD_LOGGER_ERROR("STREAMER")
<< "recv packet demuxer unexpected sid 0x" << std::hex << new_sid << std::dec
- << std::endl;
+ ;
else _queues[new_sid].push(buff);
buff.reset();
}
diff --git a/host/lib/usrp/common/usrp3_fw_ctrl_iface.cpp b/host/lib/usrp/common/usrp3_fw_ctrl_iface.cpp
deleted file mode 100644
index 16ee84140..000000000
--- a/host/lib/usrp/common/usrp3_fw_ctrl_iface.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-//
-// Copyright 2013 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#include "usrp3_fw_ctrl_iface.hpp"
-
-#include <uhd/utils/byteswap.hpp>
-#include <uhd/utils/msg.hpp>
-#include <uhd/exception.hpp>
-#include <boost/format.hpp>
-#include <boost/asio.hpp> //used for htonl and ntohl
-#include <boost/foreach.hpp>
-#include "fw_comm_protocol.h"
-
-namespace uhd { namespace usrp { namespace usrp3 {
-
-//----------------------------------------------------------
-// Factory method
-//----------------------------------------------------------
-uhd::wb_iface::sptr usrp3_fw_ctrl_iface::make(
- uhd::transport::udp_simple::sptr udp_xport,
- const uint16_t product_id,
- const bool verbose)
-{
- return wb_iface::sptr(new usrp3_fw_ctrl_iface(udp_xport, product_id, verbose));
-}
-
-//----------------------------------------------------------
-// udp_fw_ctrl_iface
-//----------------------------------------------------------
-
-usrp3_fw_ctrl_iface::usrp3_fw_ctrl_iface(
- uhd::transport::udp_simple::sptr udp_xport,
- const uint16_t product_id,
- const bool verbose) :
- _product_id(product_id), _verbose(verbose), _udp_xport(udp_xport),
- _seq_num(0)
-{
- flush();
- peek32(0);
-}
-
-usrp3_fw_ctrl_iface::~usrp3_fw_ctrl_iface()
-{
- flush();
-}
-
-void usrp3_fw_ctrl_iface::flush()
-{
- boost::mutex::scoped_lock lock(_mutex);
- _flush();
-}
-
-void usrp3_fw_ctrl_iface::poke32(const wb_addr_type addr, const uint32_t data)
-{
- boost::mutex::scoped_lock lock(_mutex);
-
- for (size_t i = 1; i <= NUM_RETRIES; i++) {
- try {
- _poke32(addr, data);
- return;
- } catch(const std::exception &ex) {
- const std::string error_msg = str(boost::format(
- "udp fw poke32 failure #%u\n%s") % i % ex.what());
- if (_verbose) UHD_MSG(warning) << error_msg << std::endl;
- if (i == NUM_RETRIES) throw uhd::io_error(error_msg);
- }
- }
-}
-
-uint32_t usrp3_fw_ctrl_iface::peek32(const wb_addr_type addr)
-{
- boost::mutex::scoped_lock lock(_mutex);
-
- for (size_t i = 1; i <= NUM_RETRIES; i++) {
- try {
- return _peek32(addr);
- } catch(const std::exception &ex) {
- const std::string error_msg = str(boost::format(
- "udp fw peek32 failure #%u\n%s") % i % ex.what());
- if (_verbose) UHD_MSG(warning) << error_msg << std::endl;
- if (i == NUM_RETRIES) throw uhd::io_error(error_msg);
- }
- }
- return 0;
-}
-
-void usrp3_fw_ctrl_iface::_poke32(const wb_addr_type addr, const uint32_t data)
-{
- //Load request struct
- fw_comm_pkt_t request;
- request.id = uhd::htonx<uint32_t>(FW_COMM_GENERATE_ID(_product_id));
- request.flags = uhd::htonx<uint32_t>(FW_COMM_FLAGS_ACK | FW_COMM_CMD_POKE32);
- request.sequence = uhd::htonx<uint32_t>(_seq_num++);
- request.addr = uhd::htonx(addr);
- request.data_words = 1;
- request.data[0] = uhd::htonx(data);
-
- //Send request
- _flush();
- _udp_xport->send(boost::asio::buffer(&request, sizeof(request)));
-
- //Recv reply
- fw_comm_pkt_t reply;
- const size_t nbytes = _udp_xport->recv(boost::asio::buffer(&reply, sizeof(reply)), 1.0);
- if (nbytes == 0) throw uhd::io_error("udp fw poke32 - reply timed out");
-
- //Sanity checks
- const size_t flags = uhd::ntohx<uint32_t>(reply.flags);
- UHD_ASSERT_THROW(nbytes == sizeof(reply));
- UHD_ASSERT_THROW(not (flags & FW_COMM_FLAGS_ERROR_MASK));
- UHD_ASSERT_THROW(flags & FW_COMM_CMD_POKE32);
- UHD_ASSERT_THROW(flags & FW_COMM_FLAGS_ACK);
- UHD_ASSERT_THROW(reply.sequence == request.sequence);
- UHD_ASSERT_THROW(reply.addr == request.addr);
- UHD_ASSERT_THROW(reply.data[0] == request.data[0]);
-}
-
-uint32_t usrp3_fw_ctrl_iface::_peek32(const wb_addr_type addr)
-{
- //Load request struct
- fw_comm_pkt_t request;
- request.id = uhd::htonx<uint32_t>(FW_COMM_GENERATE_ID(_product_id));
- request.flags = uhd::htonx<uint32_t>(FW_COMM_FLAGS_ACK | FW_COMM_CMD_PEEK32);
- request.sequence = uhd::htonx<uint32_t>(_seq_num++);
- request.addr = uhd::htonx(addr);
- request.data_words = 1;
- request.data[0] = 0;
-
- //Send request
- _flush();
- _udp_xport->send(boost::asio::buffer(&request, sizeof(request)));
-
- //Recv reply
- fw_comm_pkt_t reply;
- const size_t nbytes = _udp_xport->recv(boost::asio::buffer(&reply, sizeof(reply)), 1.0);
- if (nbytes == 0) throw uhd::io_error("udp fw peek32 - reply timed out");
-
- //Sanity checks
- const size_t flags = uhd::ntohx<uint32_t>(reply.flags);
- UHD_ASSERT_THROW(nbytes == sizeof(reply));
- UHD_ASSERT_THROW(not (flags & FW_COMM_FLAGS_ERROR_MASK));
- UHD_ASSERT_THROW(flags & FW_COMM_CMD_PEEK32);
- UHD_ASSERT_THROW(flags & FW_COMM_FLAGS_ACK);
- UHD_ASSERT_THROW(reply.sequence == request.sequence);
- UHD_ASSERT_THROW(reply.addr == request.addr);
-
- //return result!
- return uhd::ntohx<uint32_t>(reply.data[0]);
-}
-
-void usrp3_fw_ctrl_iface::_flush(void)
-{
- char buff[FW_COMM_PROTOCOL_MTU] = {};
- while (_udp_xport->recv(boost::asio::buffer(buff), 0.0)) {
- /*NOP*/
- }
-}
-
-std::vector<std::string> usrp3_fw_ctrl_iface::discover_devices(
- const std::string& addr_hint, const std::string& port,
- uint16_t product_id)
-{
- std::vector<std::string> addrs;
-
- //Create a UDP transport to communicate:
- //Some devices will cause a throw when opened for a broadcast address.
- //We print and recover so the caller can loop through all bcast addrs.
- uhd::transport::udp_simple::sptr udp_bcast_xport;
- try {
- udp_bcast_xport = uhd::transport::udp_simple::make_broadcast(addr_hint, port);
- } catch(const std::exception &e) {
- UHD_MSG(error) << boost::format("Cannot open UDP transport on %s for discovery\n%s")
- % addr_hint % e.what() << std::endl;
- return addrs;
- }
-
- //Send dummy request
- fw_comm_pkt_t request;
- request.id = uhd::htonx<uint32_t>(FW_COMM_GENERATE_ID(product_id));
- request.flags = uhd::htonx<uint32_t>(FW_COMM_FLAGS_ACK|FW_COMM_CMD_ECHO);
- request.sequence = uhd::htonx<uint32_t>(std::rand());
- udp_bcast_xport->send(boost::asio::buffer(&request, sizeof(request)));
-
- //loop for replies until timeout
- while (true) {
- char buff[FW_COMM_PROTOCOL_MTU] = {};
- const size_t nbytes = udp_bcast_xport->recv(boost::asio::buffer(buff), 0.050);
- if (nbytes != sizeof(fw_comm_pkt_t)) break; //No more responses or responses are invalid
-
- const fw_comm_pkt_t *reply = (const fw_comm_pkt_t *)buff;
- if (request.id == reply->id &&
- request.flags == reply->flags &&
- request.sequence == reply->sequence)
- {
- addrs.push_back(udp_bcast_xport->get_recv_addr());
- }
- }
-
- return addrs;
-}
-
-uint32_t usrp3_fw_ctrl_iface::get_iface_id(
- const std::string& addr, const std::string& port,
- uint16_t product_id)
-{
- uhd::transport::udp_simple::sptr udp_xport =
- uhd::transport::udp_simple::make_connected(addr, port);
-
- //Send dummy request
- fw_comm_pkt_t request;
- request.id = uhd::htonx<uint32_t>(FW_COMM_GENERATE_ID(product_id));
- request.flags = uhd::htonx<uint32_t>(FW_COMM_FLAGS_ACK|FW_COMM_CMD_ECHO);
- request.sequence = uhd::htonx<uint32_t>(std::rand());
- udp_xport->send(boost::asio::buffer(&request, sizeof(request)));
-
- //loop for replies until timeout
- char buff[FW_COMM_PROTOCOL_MTU] = {};
- const size_t nbytes = udp_xport->recv(boost::asio::buffer(buff), 1.0);
-
- const fw_comm_pkt_t *reply = (const fw_comm_pkt_t *)buff;
- if (nbytes > 0 &&
- request.id == reply->id &&
- request.flags == reply->flags &&
- request.sequence == reply->sequence)
- {
- return uhd::ntohx<uint32_t>(reply->data[0]);
- } else {
- throw uhd::io_error("udp get_iface_id - bad response");
- }
-}
-
-}}} //namespace
diff --git a/host/lib/usrp/common/usrp3_fw_ctrl_iface.hpp b/host/lib/usrp/common/usrp3_fw_ctrl_iface.hpp
deleted file mode 100644
index 9dc35ef9e..000000000
--- a/host/lib/usrp/common/usrp3_fw_ctrl_iface.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// Copyright 2014 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#ifndef INCLUDED_LIBUHD_USRP_USRP3_UDP_FW_CTRL_IFACE_HPP
-#define INCLUDED_LIBUHD_USRP_USRP3_UDP_FW_CTRL_IFACE_HPP
-
-#include <uhd/types/wb_iface.hpp>
-#include <uhd/transport/udp_simple.hpp>
-#include <boost/thread/mutex.hpp>
-#include <vector>
-
-namespace uhd { namespace usrp { namespace usrp3 {
-
-class usrp3_fw_ctrl_iface : public uhd::wb_iface
-{
-public:
- usrp3_fw_ctrl_iface(
- uhd::transport::udp_simple::sptr udp_xport,
- const uint16_t product_id,
- const bool verbose);
- virtual ~usrp3_fw_ctrl_iface();
-
- // -- uhd::wb_iface --
- void poke32(const wb_addr_type addr, const uint32_t data);
- uint32_t peek32(const wb_addr_type addr);
- void flush();
-
- static uhd::wb_iface::sptr make(
- uhd::transport::udp_simple::sptr udp_xport,
- const uint16_t product_id,
- const bool verbose = true);
- // -- uhd::wb_iface --
-
- static std::vector<std::string> discover_devices(
- const std::string& addr_hint, const std::string& port,
- uint16_t product_id);
-
- static uint32_t get_iface_id(
- const std::string& addr, const std::string& port,
- uint16_t product_id);
-
-private:
- void _poke32(const wb_addr_type addr, const uint32_t data);
- uint32_t _peek32(const wb_addr_type addr);
- void _flush(void);
-
- const uint16_t _product_id;
- const bool _verbose;
- uhd::transport::udp_simple::sptr _udp_xport;
- uint32_t _seq_num;
- boost::mutex _mutex;
-
- static const size_t NUM_RETRIES = 3;
-};
-
-}}} //namespace
-
-#endif //INCLUDED_LIBUHD_USRP_USRP3_USRP3_UDP_FW_CTRL_HPP
diff --git a/host/lib/usrp/common/validate_subdev_spec.cpp b/host/lib/usrp/common/validate_subdev_spec.cpp
index fab40b204..76e61221e 100644
--- a/host/lib/usrp/common/validate_subdev_spec.cpp
+++ b/host/lib/usrp/common/validate_subdev_spec.cpp
@@ -18,7 +18,6 @@
#include "validate_subdev_spec.hpp"
#include <uhd/exception.hpp>
#include <uhd/utils/assert_has.hpp>
-#include <boost/foreach.hpp>
#include <boost/format.hpp>
using namespace uhd;
@@ -52,19 +51,19 @@ void uhd::usrp::validate_subdev_spec(
//make a list of all possible specs
subdev_spec_t all_specs;
- BOOST_FOREACH(const std::string &db, tree->list(str(boost::format("/mboards/%s/dboards") % mb))){
- BOOST_FOREACH(const std::string &sd, tree->list(str(boost::format("/mboards/%s/dboards/%s/%s_frontends") % mb % db % type))){
+ for(const std::string &db: tree->list(str(boost::format("/mboards/%s/dboards") % mb))){
+ for(const std::string &sd: tree->list(str(boost::format("/mboards/%s/dboards/%s/%s_frontends") % mb % db % type))){
all_specs.push_back(subdev_spec_pair_t(db, sd));
}
}
//validate that the spec is possible
- BOOST_FOREACH(const subdev_spec_pair_t &pair, spec){
+ for(const subdev_spec_pair_t &pair: spec){
uhd::assert_has(all_specs, pair, str(boost::format("%s subdevice specification on mboard %s") % type % mb));
}
//enable selected frontends, disable others
- BOOST_FOREACH(const subdev_spec_pair_t &pair, all_specs){
+ for(const subdev_spec_pair_t &pair: all_specs){
const bool enb = uhd::has(spec, pair);
tree->access<bool>(str(boost::format(
"/mboards/%s/dboards/%s/%s_frontends/%s/enabled"