aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r--host/lib/usrp/x300/x300_adc_dac_utils.cpp24
-rw-r--r--host/lib/usrp/x300/x300_clock_ctrl.cpp5
-rw-r--r--host/lib/usrp/x300/x300_dac_ctrl.cpp4
-rw-r--r--host/lib/usrp/x300/x300_fw_ctrl.cpp6
-rw-r--r--host/lib/usrp/x300/x300_fw_uart.cpp2
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp135
-rw-r--r--host/lib/usrp/x300/x300_io_impl.cpp3
-rw-r--r--host/lib/usrp/x300/x300_mb_eeprom.cpp2
-rw-r--r--host/lib/usrp/x300/x300_radio_ctrl_impl.cpp41
9 files changed, 87 insertions, 135 deletions
diff --git a/host/lib/usrp/x300/x300_adc_dac_utils.cpp b/host/lib/usrp/x300/x300_adc_dac_utils.cpp
index 6fd0ca50b..fda0bb6c9 100644
--- a/host/lib/usrp/x300/x300_adc_dac_utils.cpp
+++ b/host/lib/usrp/x300/x300_adc_dac_utils.cpp
@@ -147,7 +147,7 @@ void x300_impl::self_test_adcs(mboard_members_t& mb, uint32_t ramp_time_ms) {
void x300_impl::extended_adc_test(mboard_members_t& mb, double duration_s)
{
static const size_t SECS_PER_ITER = 5;
- UHD_MSG(status) << boost::format("Running Extended ADC Self-Test (Duration=%.0fs, %ds/iteration)...\n")
+ UHD_LOGGER_INFO("X300") << boost::format("Running Extended ADC Self-Test (Duration=%.0fs, %ds/iteration)...")
% duration_s % SECS_PER_ITER;
size_t num_iters = static_cast<size_t>(ceil(duration_s/SECS_PER_ITER));
@@ -159,18 +159,18 @@ void x300_impl::extended_adc_test(mboard_members_t& mb, double duration_s)
time_strm.imbue(std::locale(std::locale::classic(), facet));
time_strm << boost::posix_time::second_clock::local_time();
//Run self-test
- UHD_MSG(status) << boost::format("-- [%s] Iteration %06d... ") % time_strm.str() % (iter+1);
+ UHD_LOGGER_INFO("X300") << boost::format("Running ADC Test Iteration %06d... ") % (iter+1);
try {
self_test_adcs(mb, SECS_PER_ITER*1000);
- UHD_MSG(status) << "passed" << std::endl;
+ UHD_LOGGER_INFO("X300") << boost::format("ADC Test Iteration %06d passed") % (iter+1);
} catch(std::exception &e) {
num_failures++;
- UHD_MSG(status) << e.what() << std::endl;
+ UHD_LOGGER_ERROR("X300") << e.what();
}
}
if (num_failures == 0) {
- UHD_MSG(status) << "Extended ADC Self-Test PASSED\n";
+ UHD_LOGGER_INFO("X300") << "Extended ADC Self-Test PASSED";
} else {
throw uhd::runtime_error(
(boost::format("Extended ADC Self-Test FAILED!!! (%d/%d failures)\n") % num_failures % num_iters).str());
@@ -184,7 +184,7 @@ void x300_impl::extended_adc_test(mboard_members_t& mb, double duration_s)
void x300_impl::self_cal_adc_capture_delay(mboard_members_t& mb, const size_t radio_i, bool print_status)
{
radio_perifs_t& perif = mb.radio_perifs[radio_i];
- if (print_status) UHD_MSG(status) << "Running ADC capture delay self-cal..." << std::flush;
+ if (print_status) UHD_LOGGER_INFO("X300") << "Running ADC capture delay self-cal...";
static const uint32_t NUM_DELAY_STEPS = 32; //The IDELAYE2 element has 32 steps
static const uint32_t NUM_RETRIES = 2; //Retry self-cal if it fails in warmup situations
@@ -247,7 +247,7 @@ void x300_impl::self_cal_adc_capture_delay(mboard_members_t& mb, const size_t ra
}
}
}
- //UHD_MSG(status) << (boost::format("CapTap=%d, Error=%d\n") % dly_tap % err_code);
+ //UHD_LOGGER_INFO("X300") << (boost::format("CapTap=%d, Error=%d") % dly_tap % err_code);
}
//Retry the self-cal if it fails
@@ -277,13 +277,13 @@ void x300_impl::self_cal_adc_capture_delay(mboard_members_t& mb, const size_t ra
if (print_status) {
double tap_delay = (1.0e12 / mb.clock->get_master_clock_rate()) / (2*32); //in ps
- UHD_MSG(status) << boost::format(" done (Tap=%d, Window=%d, TapDelay=%.3fps, Iter=%d)\n") % ideal_tap % (win_stop-win_start) % tap_delay % iter;
+ UHD_LOGGER_INFO("X300") << boost::format(" ADC capture delay self-cal done (Tap=%d, Window=%d, TapDelay=%.3fps, Iter=%d)") % ideal_tap % (win_stop-win_start) % tap_delay % iter;
}
}
double x300_impl::self_cal_adc_xfer_delay(mboard_members_t& mb, bool apply_delay)
{
- UHD_MSG(status) << "Running ADC transfer delay self-cal: " << std::flush;
+ UHD_LOGGER_INFO("X300") << "Running ADC transfer delay self-cal: ";
//Effective resolution of the self-cal.
static const size_t NUM_DELAY_STEPS = 100;
@@ -293,7 +293,6 @@ double x300_impl::self_cal_adc_xfer_delay(mboard_members_t& mb, bool apply_delay
double delay_range = 2 * master_clk_period;
double delay_incr = delay_range / NUM_DELAY_STEPS;
- UHD_MSG(status) << "Measuring..." << std::flush;
double cached_clk_delay = mb.clock->get_clock_delay(X300_CLOCK_WHICH_ADC0);
double fpga_clk_delay = mb.clock->get_clock_delay(X300_CLOCK_WHICH_FPGA);
@@ -339,7 +338,7 @@ double x300_impl::self_cal_adc_xfer_delay(mboard_members_t& mb, bool apply_delay
err_code += 100; //Increment error code by 100 to indicate no lock
}
}
- //UHD_MSG(status) << (boost::format("XferDelay=%fns, Error=%d\n") % delay % err_code);
+ //UHD_LOGGER_INFO("X300") << (boost::format("XferDelay=%fns, Error=%d") % delay % err_code);
results.push_back(std::pair<double,bool>(delay, err_code==0));
}
@@ -391,7 +390,6 @@ double x300_impl::self_cal_adc_xfer_delay(mboard_members_t& mb, bool apply_delay
}
if (apply_delay) {
- UHD_MSG(status) << "Validating..." << std::flush;
//Apply delay
win_center = mb.clock->set_clock_delay(X300_CLOCK_WHICH_ADC0, win_center); //Sets ADC0 and ADC1
wait_for_clk_locked(mb, fw_regmap_t::clk_status_reg_t::LMK_LOCK, 0.1);
@@ -407,7 +405,7 @@ double x300_impl::self_cal_adc_xfer_delay(mboard_members_t& mb, bool apply_delay
mb.radio_perifs[r].adc->set_test_word("normal", "normal");
mb.radio_perifs[r].regmap->misc_outs_reg.write(radio_regmap_t::misc_outs_reg_t::ADC_CHECKER_ENABLED, 0);
}
- UHD_MSG(status) << (boost::format(" done (FPGA->ADC=%.3fns%s, Window=%.3fns)\n") %
+ UHD_LOGGER_INFO("X300") << (boost::format("ADC transfer delay self-cal done (FPGA->ADC=%.3fns%s, Window=%.3fns)") %
(win_center-fpga_clk_delay) % (cycle_slip?" +cyc":"") % win_length);
return win_center;
diff --git a/host/lib/usrp/x300/x300_clock_ctrl.cpp b/host/lib/usrp/x300/x300_clock_ctrl.cpp
index b8b100ceb..7307bcc66 100644
--- a/host/lib/usrp/x300/x300_clock_ctrl.cpp
+++ b/host/lib/usrp/x300/x300_clock_ctrl.cpp
@@ -303,9 +303,8 @@ public:
//be close to what the client requested.
}
- UHD_LOGV(often)
- << boost::format("x300_clock_ctrl::set_clock_delay: Which=%d, Requested=%f, Digital Taps=%d, Half Shift=%d, Analog Delay=%d (%s), Coerced Delay=%fns"
- ) % which % delay_ns % ddly_value % (half_shift_en?"ON":"OFF") % ((int)adly_value) % (adly_en?"ON":"OFF") % coerced_delay << std::endl;
+ UHD_LOG_DEBUG("X300", boost::format("x300_clock_ctrl::set_clock_delay: Which=%d, Requested=%f, Digital Taps=%d, Half Shift=%d, Analog Delay=%d (%s), Coerced Delay=%fns"
+ ) % which % delay_ns % ddly_value % (half_shift_en?"ON":"OFF") % ((int)adly_value) % (adly_en?"ON":"OFF") % coerced_delay)
//Apply settings
switch (which)
diff --git a/host/lib/usrp/x300/x300_dac_ctrl.cpp b/host/lib/usrp/x300/x300_dac_ctrl.cpp
index eb36f0798..51b93662c 100644
--- a/host/lib/usrp/x300/x300_dac_ctrl.cpp
+++ b/host/lib/usrp/x300/x300_dac_ctrl.cpp
@@ -18,10 +18,10 @@
#include "x300_dac_ctrl.hpp"
#include "x300_regs.hpp"
#include <uhd/types/time_spec.hpp>
-#include <uhd/utils/msg.hpp>
#include <uhd/utils/log.hpp>
#include <uhd/utils/safe_call.hpp>
#include <uhd/exception.hpp>
+#include <boost/format.hpp>
#include <boost/thread/thread.hpp> //sleep
#define X300_DAC_FRONTEND_SYNC_FAILURE_FATAL
@@ -242,7 +242,7 @@ public:
if (failure_is_fatal) {
throw uhd::runtime_error(msg);
} else {
- UHD_MSG(warning) << msg;
+ UHD_LOGGER_WARNING("X300") << msg;
}
}
}
diff --git a/host/lib/usrp/x300/x300_fw_ctrl.cpp b/host/lib/usrp/x300/x300_fw_ctrl.cpp
index 080d235a4..1df0fa611 100644
--- a/host/lib/usrp/x300/x300_fw_ctrl.cpp
+++ b/host/lib/usrp/x300/x300_fw_ctrl.cpp
@@ -19,7 +19,7 @@
#include "x300_fw_common.h"
#include <uhd/transport/udp_simple.hpp>
#include <uhd/utils/byteswap.hpp>
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/exception.hpp>
#include <boost/format.hpp>
#include <boost/thread/mutex.hpp>
@@ -61,7 +61,7 @@ public:
{
std::string error_msg = str(boost::format(
"x300 fw communication failure #%u\n%s") % i % ex.what());
- if (errors) UHD_MSG(error) << error_msg << std::endl;
+ if (errors) UHD_LOGGER_ERROR("X300") << error_msg ;
if (i == num_retries) throw uhd::io_error(error_msg);
}
}
@@ -81,7 +81,7 @@ public:
{
std::string error_msg = str(boost::format(
"x300 fw communication failure #%u\n%s") % i % ex.what());
- if (errors) UHD_MSG(error) << error_msg << std::endl;
+ if (errors) UHD_LOGGER_ERROR("X300") << error_msg ;
if (i == num_retries) throw uhd::io_error(error_msg);
}
}
diff --git a/host/lib/usrp/x300/x300_fw_uart.cpp b/host/lib/usrp/x300/x300_fw_uart.cpp
index 593873569..83a564997 100644
--- a/host/lib/usrp/x300/x300_fw_uart.cpp
+++ b/host/lib/usrp/x300/x300_fw_uart.cpp
@@ -18,7 +18,7 @@
#include "x300_impl.hpp"
#include <uhd/types/wb_iface.hpp>
#include "x300_regs.hpp"
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/types/serial.hpp>
#include <uhd/exception.hpp>
#include <boost/format.hpp>
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index 13d1d6adc..07b0582d0 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -23,7 +23,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/asio.hpp>
#include <uhd/utils/static.hpp>
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/utils/paths.hpp>
#include <uhd/utils/safe_call.hpp>
#include <uhd/usrp/subdev_spec.hpp>
@@ -309,11 +309,11 @@ device_addrs_t x300_find(const device_addr_t &hint_)
}
catch(const std::exception &ex)
{
- UHD_MSG(error) << "X300 Network discovery error " << ex.what() << std::endl;
+ UHD_LOGGER_ERROR("X300") << "X300 Network discovery error " << ex.what() ;
}
catch(...)
{
- UHD_MSG(error) << "X300 Network discovery unknown error " << std::endl;
+ UHD_LOGGER_ERROR("X300") << "X300 Network discovery unknown error " ;
}
return reply_addrs;
}
@@ -357,7 +357,7 @@ UHD_STATIC_BLOCK(register_x300_device)
static void x300_load_fw(wb_iface::sptr fw_reg_ctrl, const std::string &file_name)
{
- UHD_MSG(status) << "Loading firmware " << file_name << std::flush;
+ UHD_LOGGER_INFO("X300") << "Loading firmware " << file_name;
//load file into memory
std::ifstream fw_file(file_name.c_str());
@@ -372,45 +372,18 @@ static void x300_load_fw(wb_iface::sptr fw_reg_ctrl, const std::string &file_nam
//@TODO: FIXME: Since x300_ctrl_iface acks each write and traps exceptions, the first try for the last word
// written will print an error because it triggers a FW reload and fails to reply.
fw_reg_ctrl->poke32(SR_ADDR(BOOT_LDR_BASE, BL_DATA), uhd::byteswap(fw_file_buff[i/sizeof(uint32_t)]));
- if ((i & 0x1fff) == 0) UHD_MSG(status) << "." << std::flush;
}
//Wait for fimrware to reboot. 3s is an upper bound
boost::this_thread::sleep(boost::posix_time::milliseconds(3000));
- UHD_MSG(status) << " done!" << std::endl;
-}
-
-static const std::string thread_final_msg = "Finished multi-threaded initialization\n";
-
-static void thread_msg_handler(uhd::msg::type_t type, const std::string &msg)
-{
- static boost::mutex msg_mutex;
- boost::mutex::scoped_lock lock(msg_mutex);
-
- typedef std::pair<uhd::msg::type_t, std::string> msg_pair_t;
- typedef std::map<boost::thread::id, std::vector<msg_pair_t> > thread_map_t;
-
- static thread_map_t thread_list;
- thread_list[boost::this_thread::get_id()].push_back(msg_pair_t(type, msg));
-
- if (msg == thread_final_msg)
- {
- for(const thread_map_t::value_type &thread_pair: thread_list)
- {
- 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);
- }
- }
- }
+ UHD_LOGGER_INFO("X300") << "Firmware loaded!" ;
}
x300_impl::x300_impl(const uhd::device_addr_t &dev_addr)
: device3_impl()
, _sid_framer(0)
{
- UHD_MSG(status) << "X300 initialization sequence..." << std::endl;
+ UHD_LOGGER_INFO("X300") << "X300 initialization sequence...";
_ignore_cal_file = dev_addr.has_key("ignore-cal-file");
_tree->create<std::string>("/name").set("X-Series Device");
@@ -426,9 +399,6 @@ x300_impl::x300_impl(const uhd::device_addr_t &dev_addr)
return;
}
- // Setup a custom messenger handler
- uhd::msg::handler_t current_handler = uhd::msg::get_handler();
- uhd::msg::register_handler(&thread_msg_handler);
// Initialize groups of USRPs in parallel
size_t total_usrps = device_args.size();
@@ -448,9 +418,6 @@ x300_impl::x300_impl(const uhd::device_addr_t &dev_addr)
num_usrps += init_usrps;
}
- // restore the original message handler
- UHD_MSG(status) << thread_final_msg;
- uhd::msg::register_handler(current_handler);
}
void x300_impl::mboard_members_t::discover_eth(
@@ -468,7 +435,7 @@ void x300_impl::mboard_members_t::discover_eth(
// Show a warning if there exists duplicate addresses in the mboard eeprom
if (std::find(mb_eeprom_addrs.begin(), mb_eeprom_addrs.end(), mb_eeprom[key]) != mb_eeprom_addrs.end()) {
- UHD_MSG(warning) << str(boost::format(
+ UHD_LOGGER_WARNING("X300") << str(boost::format(
"Duplicate IP address %s found in mboard EEPROM. "
"Device may not function properly.\nView and reprogram the values "
"using the usrp_burn_mb_eeprom utility.\n") % mb_eeprom[key]);
@@ -498,7 +465,7 @@ void x300_impl::mboard_members_t::discover_eth(
// Check default IP addresses if we couldn't
// determine the IP from the mboard eeprom
if (conn_iface.type == X300_IFACE_NONE) {
- UHD_MSG(warning) << str(boost::format(
+ UHD_LOGGER_WARNING("X300") << str(boost::format(
"Address %s not found in mboard EEPROM. Address may be wrong or "
"the EEPROM may be corrupt.\n Attempting to continue with default "
"IP addresses.\n") % conn_iface.addr
@@ -568,8 +535,6 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
"Thread ID " + thread_id + " for motherboard "
+ boost::lexical_cast<std::string>(mb_i)
);
- UHD_MSG(status) << std::endl;
- UHD_MSG(status) << thread_msg << std::endl;
std::vector<std::string> eth_addrs;
// Not choosing eth0 based on resource might cause user issues
@@ -602,7 +567,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
if (dev_addr.has_key("niusrpriorpc_port")) {
rpc_port_name = dev_addr["niusrpriorpc_port"];
}
- UHD_MSG(status) << boost::format("Connecting to niusrpriorpc at localhost:%s...\n") % rpc_port_name;
+ UHD_LOGGER_INFO("X300") << boost::format("Connecting to niusrpriorpc at localhost:%s...") % rpc_port_name;
//Instantiate the correct lvbitx object
nifpga_lvbitx::sptr lvbitx;
@@ -619,7 +584,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
drivers have loaded successfully.");
}
//Load the lvbitx onto the device
- UHD_MSG(status) << boost::format("Using LVBITX bitfile %s...\n") % lvbitx->get_bitfile_path();
+ UHD_LOGGER_INFO("X300") << boost::format("Using LVBITX bitfile %s...") % lvbitx->get_bitfile_path();
mb.rio_fpga_interface.reset(new niusrprio_session(dev_addr["resource"], rpc_port_name));
nirio_status_chain(mb.rio_fpga_interface->open(lvbitx, dev_addr.has_key("download-fpga")), status);
nirio_status_to_exception(status, "x300_impl: Could not initialize RIO session.");
@@ -692,33 +657,33 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
);
}
} catch(std::exception &e) {
- UHD_MSG(error) << e.what() << std::endl;
+ UHD_LOGGER_ERROR("X300") << e.what() ;
}
if ((mb.recv_args.has_key("recv_frame_size"))
&& (req_max_frame_size.recv_frame_size > _max_frame_sizes.recv_frame_size)) {
- UHD_MSG(warning)
+ UHD_LOGGER_WARNING("X300")
<< boost::format("You requested a receive frame size of (%lu) but your NIC's max frame size is (%lu).")
% req_max_frame_size.recv_frame_size
% _max_frame_sizes.recv_frame_size
- << std::endl
+
<< boost::format("Please verify your NIC's MTU setting using '%s' or set the recv_frame_size argument appropriately.")
- % mtu_tool << std::endl
+ % mtu_tool
<< "UHD will use the auto-detected max frame size for this connection."
- << std::endl;
+ ;
}
if ((mb.recv_args.has_key("send_frame_size"))
&& (req_max_frame_size.send_frame_size > _max_frame_sizes.send_frame_size)) {
- UHD_MSG(warning)
+ UHD_LOGGER_WARNING("X300")
<< boost::format("You requested a send frame size of (%lu) but your NIC's max frame size is (%lu).")
% req_max_frame_size.send_frame_size
% _max_frame_sizes.send_frame_size
- << std::endl
+
<< boost::format("Please verify your NIC's MTU setting using '%s' or set the send_frame_size argument appropriately.")
- % mtu_tool << std::endl
+ % mtu_tool
<< "UHD will use the auto-detected max frame size for this connection."
- << std::endl;
+ ;
}
_tree->create<size_t>(mb_path / "mtu/recv").set(_max_frame_sizes.recv_frame_size);
@@ -727,7 +692,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
}
//create basic communication
- UHD_MSG(status) << "Setup basic communication..." << std::endl;
+ UHD_LOGGER_INFO("X300") << "Setup basic communication...";
if (mb.xport_path == "nirio") {
boost::mutex::scoped_lock(pcie_zpu_iface_registry_mutex);
if (get_pcie_zpu_iface_registry().has_key(mb.get_pri_eth().addr)) {
@@ -787,11 +752,10 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
const uint32_t nbor_addr = mb.zpu_ctrl->peek32(SR_ADDR(routes_addr, i*2+1));
if (node_addr != 0 and nbor_addr != 0)
{
- UHD_MSG(status) << boost::format("%u: %s -> %s")
+ UHD_LOGGER_INFO("X300") << boost::format("%u: %s -> %s")
% i
% asio::ip::address_v4(node_addr).to_string()
- % asio::ip::address_v4(nbor_addr).to_string()
- << std::endl;
+ % asio::ip::address_v4(nbor_addr).to_string();
}
}
*/
@@ -799,11 +763,11 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
////////////////////////////////////////////////////////////////////
// setup the mboard eeprom
////////////////////////////////////////////////////////////////////
- UHD_MSG(status) << "Loading values from EEPROM..." << std::endl;
+ UHD_LOGGER_INFO("X300") << "Loading values from EEPROM...";
x300_mb_eeprom_iface::sptr eeprom16 = x300_mb_eeprom_iface::make(mb.zpu_ctrl, mb.zpu_i2c);
if (dev_addr.has_key("blank_eeprom"))
{
- UHD_MSG(warning) << "Obliterating the motherboard EEPROM..." << std::endl;
+ UHD_LOGGER_WARNING("X300") << "Obliterating the motherboard EEPROM..." ;
eeprom16->write_eeprom(0x50, 0, byte_vector_t(256, 0xff));
}
const mboard_eeprom_t mb_eeprom(*eeprom16, "X300");
@@ -813,9 +777,9 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
bool recover_mb_eeprom = dev_addr.has_key("recover_mb_eeprom");
if (recover_mb_eeprom) {
- UHD_MSG(warning) << "UHD is operating in EEPROM Recovery Mode which disables hardware version "
+ UHD_LOGGER_WARNING("X300") << "UHD is operating in EEPROM Recovery Mode which disables hardware version "
"checks.\nOperating in this mode may cause hardware damage and unstable "
- "radio performance!"<< std::endl;
+ "radio performance!";
}
////////////////////////////////////////////////////////////////////
@@ -895,7 +859,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
////////////////////////////////////////////////////////////////////
// create clock control objects
////////////////////////////////////////////////////////////////////
- UHD_MSG(status) << "Setup RF frontend clocking..." << std::endl;
+ UHD_LOGGER_INFO("X300") << "Setup RF frontend clocking...";
//Initialize clock control registers. NOTE: This does not configure the LMK yet.
mb.clock = x300_clock_ctrl::make(mb.zpu_spi,
@@ -917,8 +881,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
.set_publisher(boost::bind(&x300_clock_ctrl::get_master_clock_rate, mb.clock))
;
- UHD_MSG(status) << "Radio 1x clock:" << (mb.clock->get_master_clock_rate()/1e6)
- << std::endl;
+ UHD_LOGGER_INFO("X300") << "Radio 1x clock:" << (mb.clock->get_master_clock_rate()/1e6);
////////////////////////////////////////////////////////////////////
// Create the GPSDO control
@@ -928,14 +891,14 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
//otherwise if not disabled, look for the internal GPSDO
if (mb.zpu_ctrl->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_GPSDO_STATUS)) != dont_look_for_gpsdo)
{
- UHD_MSG(status) << "Detecting internal GPSDO.... " << std::flush;
+ UHD_LOGGER_INFO("X300") << "Detecting internal GPSDO.... ";
try
{
mb.gps = gps_ctrl::make(x300_make_uart_iface(mb.zpu_ctrl));
}
catch(std::exception &e)
{
- UHD_MSG(error) << "An error occurred making GPSDO control: " << e.what() << std::endl;
+ UHD_LOGGER_ERROR("X300") << "An error occurred making GPSDO control: " << e.what() ;
}
if (mb.gps and mb.gps->gps_detected())
{
@@ -1018,7 +981,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
find_blocks<rfnoc::x300_radio_ctrl_impl>(radio_blockid_hint);
if (not radio_ids.empty()) {
if (radio_ids.size() > 2) {
- UHD_MSG(warning) << "Too many Radio Blocks found. Using only the first two." << std::endl;
+ UHD_LOGGER_WARNING("X300") << "Too many Radio Blocks found. Using only the first two." ;
radio_ids.resize(2);
}
@@ -1060,7 +1023,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
}
} else {
- UHD_MSG(status) << "No Radio Block found. Assuming radio-less operation." << std::endl;
+ UHD_LOGGER_INFO("X300") << "No Radio Block found. Assuming radio-less operation.";
} /* end of radio block(s) initialization */
mb.initialization_done = true;
@@ -1103,8 +1066,8 @@ uint32_t x300_impl::mboard_members_t::allocate_pcie_dma_chan(const uhd::sid_t &t
if (_dma_chan_pool.count(raw_sid) == 0) {
_dma_chan_pool[raw_sid] = _dma_chan_pool.size() + FIRST_DATA_CHANNEL;
- UHD_LOG << "[X300] Assigning PCIe DMA channel " << _dma_chan_pool[raw_sid]
- << " to SID " << tx_sid.to_pp_string_hex() << std::endl;
+ UHD_LOGGER_DEBUG("X300") << "[X300] Assigning PCIe DMA channel " << _dma_chan_pool[raw_sid]
+ << " to SID " << tx_sid.to_pp_string_hex() ;
}
if (_dma_chan_pool.size() + FIRST_DATA_CHANNEL > X300_PCIE_MAX_CHANNELS) {
@@ -1239,23 +1202,23 @@ uhd::both_xports_t x300_impl::make_transport(
/* Print a warning if the system's max available frame size is less than the most optimal
* frame size for this type of connection. */
if (_max_frame_sizes.send_frame_size < eth_data_rec_frame_size) {
- UHD_MSG(warning)
+ UHD_LOGGER_WARNING("X300")
<< boost::format("For this connection, UHD recommends a send frame size of at least %lu for best\nperformance, but your system's MTU will only allow %lu.")
% eth_data_rec_frame_size
% _max_frame_sizes.send_frame_size
- << std::endl
+
<< "This will negatively impact your maximum achievable sample rate."
- << std::endl;
+ ;
}
if (_max_frame_sizes.recv_frame_size < eth_data_rec_frame_size) {
- UHD_MSG(warning)
+ UHD_LOGGER_WARNING("X300")
<< boost::format("For this connection, UHD recommends a receive frame size of at least %lu for best\nperformance, but your system's MTU will only allow %lu.")
% eth_data_rec_frame_size
% _max_frame_sizes.recv_frame_size
- << std::endl
+
<< "This will negatively impact your maximum achievable sample rate."
- << std::endl;
+ ;
}
size_t system_max_send_frame_size = (size_t) _max_frame_sizes.send_frame_size;
@@ -1313,8 +1276,8 @@ uhd::both_xports_t x300_impl::make_transport(
//send a mini packet with SID into the ZPU
//ZPU will reprogram the ethernet framer
- UHD_LOG << "programming packet for new xport on "
- << interface_addr << " sid " << xports.send_sid << std::endl;
+ UHD_LOGGER_DEBUG("X300") << "programming packet for new xport on "
+ << interface_addr << " sid " << xports.send_sid ;
//YES, get a __send__ buffer from the __recv__ socket
//-- this is the only way to program the framer for recv:
managed_send_buffer::sptr buff = xports.recv->get_send_buff();
@@ -1324,7 +1287,7 @@ uhd::both_xports_t x300_impl::make_transport(
buff.reset();
//reprogram the ethernet dispatcher's udp port (should be safe to always set)
- UHD_LOG << "reprogram the ethernet dispatcher's udp port" << std::endl;
+ UHD_LOGGER_DEBUG("X300") << "reprogram the ethernet dispatcher's udp port" ;
mb.zpu_ctrl->poke32(SR_ADDR(SET0_BASE, (ZPU_SR_ETHINT0+8+3)), X300_VITA_UDP_PORT);
mb.zpu_ctrl->poke32(SR_ADDR(SET0_BASE, (ZPU_SR_ETHINT1+8+3)), X300_VITA_UDP_PORT);
@@ -1356,7 +1319,7 @@ uhd::sid_t x300_impl::allocate_sid(
// This type of packet does not match the XB_LOCAL address and is looked up in the lower half of the CAM
mb.zpu_ctrl->poke32(SR_ADDR(SETXB_BASE, 0 + src_addr), src_dst);
- UHD_LOG << "done router config for sid " << sid << std::endl;
+ UHD_LOGGER_DEBUG("X300") << "done router config for sid " << sid ;
//increment for next setup
_sid_framer++;
@@ -1413,8 +1376,8 @@ void x300_impl::update_clock_source(mboard_members_t &mb, const std::string &sou
throw uhd::runtime_error((boost::format("Reference Clock PLL failed to lock to %s source.") % source).str());
} else {
//TODO: Re-enable this warning when we figure out a reliable lock time
- //UHD_MSG(warning) << "Reference clock failed to lock to " + source + " during device initialization. " <<
- // "Check for the lock before operation or ignore this warning if using another clock source." << std::endl;
+ //UHD_LOGGER_WARNING("X300") << "Reference clock failed to lock to " + source + " during device initialization. " <<
+ // "Check for the lock before operation or ignore this warning if using another clock source." ;
}
}
}
@@ -1632,7 +1595,7 @@ x300_impl::frame_size_t x300_impl::determine_max_frame_size(const std::string &a
size_t min_send_frame_size = sizeof(x300_mtu_t);
size_t max_send_frame_size = std::min(user_frame_size.send_frame_size, X300_10GE_DATA_FRAME_MAX_SIZE) & size_t(~3);
- UHD_MSG(status) << "Determining maximum frame size... ";
+ UHD_LOGGER_INFO("X300") << "Determining maximum frame size... ";
while (min_recv_frame_size < max_recv_frame_size)
{
size_t test_frame_size = (max_recv_frame_size/2 + min_recv_frame_size/2 + 3) & ~3;
@@ -1681,7 +1644,7 @@ x300_impl::frame_size_t x300_impl::determine_max_frame_size(const std::string &a
// of the recv and send frame sizes.
frame_size.recv_frame_size = std::min(min_recv_frame_size, min_send_frame_size);
frame_size.send_frame_size = std::min(min_recv_frame_size, min_send_frame_size);
- UHD_MSG(status) << frame_size.send_frame_size << " bytes." << std::endl;
+ UHD_LOGGER_INFO("X300") << "Maximim frame size: " << frame_size.send_frame_size << " bytes.";
return frame_size;
}
@@ -1862,7 +1825,7 @@ x300_impl::x300_mboard_t x300_impl::get_mb_type_from_eeprom(const uhd::usrp::mbo
case X310_2955R_PCIE_SSID_ADC_18:
mb_type = USRP_X310_MB; break;
default:
- UHD_MSG(warning) << "X300 unknown product code in EEPROM: " << product_num << std::endl;
+ UHD_LOGGER_WARNING("X300") << "X300 unknown product code in EEPROM: " << product_num ;
mb_type = UNKNOWN; break;
}
}
diff --git a/host/lib/usrp/x300/x300_io_impl.cpp b/host/lib/usrp/x300/x300_io_impl.cpp
index 4dd9dce8a..eeff4091f 100644
--- a/host/lib/usrp/x300/x300_io_impl.cpp
+++ b/host/lib/usrp/x300/x300_io_impl.cpp
@@ -25,7 +25,6 @@
#include <boost/bind.hpp>
#include <uhd/utils/tasks.hpp>
#include <uhd/utils/log.hpp>
-#include <uhd/utils/msg.hpp>
#include <boost/make_shared.hpp>
using namespace uhd;
@@ -82,7 +81,7 @@ void x300_impl::post_streamer_hooks(direction_t dir)
std::vector<rfnoc::x300_radio_ctrl_impl::sptr> radio_ctrl_blks =
streamer->get_terminator()->find_downstream_node<rfnoc::x300_radio_ctrl_impl>();
try {
- //UHD_MSG(status) << "[X300] syncing " << radio_ctrl_blks.size() << " radios " << std::endl;
+ //UHD_LOGGER_INFO("X300") << "[X300] syncing " << radio_ctrl_blks.size() << " radios " ;
rfnoc::x300_radio_ctrl_impl::synchronize_dacs(radio_ctrl_blks);
}
catch(const uhd::io_error &ex) {
diff --git a/host/lib/usrp/x300/x300_mb_eeprom.cpp b/host/lib/usrp/x300/x300_mb_eeprom.cpp
index e39b36af8..084685991 100644
--- a/host/lib/usrp/x300/x300_mb_eeprom.cpp
+++ b/host/lib/usrp/x300/x300_mb_eeprom.cpp
@@ -33,7 +33,7 @@
#include "x300_impl.hpp"
#include <uhd/exception.hpp>
#include <uhd/utils/platform.hpp>
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/utils/byteswap.hpp>
#include <boost/thread.hpp>
diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
index 31a977884..90cb20ce3 100644
--- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
+++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
@@ -22,7 +22,7 @@
#include "gpio_atr_3000.hpp"
#include "apply_corrections.hpp"
#include <uhd/usrp/dboard_eeprom.hpp>
-#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/usrp/dboard_iface.hpp>
#include <uhd/rfnoc/node_ctrl_base.hpp>
#include <uhd/transport/chdr.hpp>
@@ -44,7 +44,7 @@ static const size_t IO_MASTER_RADIO = 0;
UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR(x300_radio_ctrl)
, _ignore_cal_file(false)
{
- UHD_RFNOC_BLOCK_TRACE() << "x300_radio_ctrl_impl::ctor() " << std::endl;
+ UHD_RFNOC_BLOCK_TRACE() << "x300_radio_ctrl_impl::ctor() " ;
////////////////////////////////////////////////////////////////////
// Set up basic info
@@ -171,7 +171,7 @@ double x300_radio_ctrl_impl::set_rate(double rate)
{
const double actual_rate = get_rate();
if (not uhd::math::frequencies_are_equal(rate, actual_rate)) {
- UHD_MSG(warning) << "[X300 Radio] Requesting invalid sampling rate from device: " << rate/1e6 << " MHz. Actual rate is: " << actual_rate/1e6 << " MHz." << std::endl;
+ UHD_LOGGER_WARNING("X300 RADIO") << "Requesting invalid sampling rate from device: " << rate/1e6 << " MHz. Actual rate is: " << actual_rate/1e6 << " MHz." ;
}
// On X3x0, tick rate can't actually be changed at runtime
return actual_rate;
@@ -238,7 +238,7 @@ double x300_radio_ctrl_impl::set_tx_gain(const double gain, const size_t chan)
radio_ctrl_impl::set_tx_gain(actual_gain, chan);
return gain;
} else {
- UHD_MSG(warning) << "set_tx_gain: could not apply gain for this daughterboard.";
+ UHD_LOGGER_WARNING("X300 RADIO") << "set_tx_gain: could not apply gain for this daughterboard.";
radio_ctrl_impl::set_tx_gain(0.0, chan);
return 0.0;
}
@@ -254,7 +254,7 @@ double x300_radio_ctrl_impl::set_rx_gain(const double gain, const size_t chan)
radio_ctrl_impl::set_rx_gain(actual_gain, chan);
return gain;
} else {
- UHD_MSG(warning) << "set_rx_gain: could not apply gain for this daughterboard.";
+ UHD_LOGGER_WARNING("X300 RADIO") << "set_rx_gain: could not apply gain for this daughterboard.";
radio_ctrl_impl::set_tx_gain(0.0, chan);
return 0.0;
}
@@ -555,31 +555,26 @@ void x300_radio_ctrl_impl::self_test_adc(uint32_t ramp_time_ms)
void x300_radio_ctrl_impl::extended_adc_test(const std::vector<x300_radio_ctrl_impl::sptr>& radios, double duration_s)
{
static const size_t SECS_PER_ITER = 5;
- UHD_MSG(status) << boost::format("Running Extended ADC Self-Test (Duration=%.0fs, %ds/iteration)...\n")
+ UHD_LOGGER_INFO("X300 RADIO") << boost::format("Running Extended ADC Self-Test (Duration=%.0fs, %ds/iteration)...")
% duration_s % SECS_PER_ITER;
size_t num_iters = static_cast<size_t>(ceil(duration_s/SECS_PER_ITER));
size_t num_failures = 0;
for (size_t iter = 0; iter < num_iters; iter++) {
- //Print date and time
- boost::posix_time::time_facet *facet = new boost::posix_time::time_facet("%d-%b-%Y %H:%M:%S");
- std::ostringstream time_strm;
- time_strm.imbue(std::locale(std::locale::classic(), facet));
- time_strm << boost::posix_time::second_clock::local_time();
//Run self-test
- UHD_MSG(status) << boost::format("-- [%s] Iteration %06d... ") % time_strm.str() % (iter+1);
+ UHD_LOGGER_INFO("X300 RADIO") << boost::format("Extended ADC Self-Test Iteration %06d... ") % (iter+1);
try {
for (size_t i = 0; i < radios.size(); i++) {
radios[i]->self_test_adc((SECS_PER_ITER*1000)/radios.size());
}
- UHD_MSG(status) << "passed" << std::endl;
+ UHD_LOGGER_INFO("X300 RADIO") << boost::format("Extended ADC Self-Test Iteration %06d passed ") % (iter+1);
} catch(std::exception &e) {
num_failures++;
- UHD_MSG(status) << e.what() << std::endl;
+ UHD_LOGGER_ERROR("X300 RADIO") << e.what();
}
}
if (num_failures == 0) {
- UHD_MSG(status) << "Extended ADC Self-Test PASSED\n";
+ UHD_LOGGER_INFO("X300 RADIO") << "Extended ADC Self-Test PASSED";
} else {
throw uhd::runtime_error(
(boost::format("Extended ADC Self-Test FAILED!!! (%d/%d failures)\n") % num_failures % num_iters).str());
@@ -639,7 +634,7 @@ double x300_radio_ctrl_impl::self_cal_adc_xfer_delay(
boost::function<void(double)> wait_for_clk_locked,
bool apply_delay)
{
- UHD_MSG(status) << "Running ADC transfer delay self-cal: " << std::flush;
+ UHD_LOGGER_INFO("X300 RADIO") << "Running ADC transfer delay self-cal: ";
//Effective resolution of the self-cal.
static const size_t NUM_DELAY_STEPS = 100;
@@ -649,7 +644,6 @@ double x300_radio_ctrl_impl::self_cal_adc_xfer_delay(
double delay_range = 2 * master_clk_period;
double delay_incr = delay_range / NUM_DELAY_STEPS;
- UHD_MSG(status) << "Measuring..." << std::flush;
double cached_clk_delay = clock->get_clock_delay(X300_CLOCK_WHICH_ADC0);
double fpga_clk_delay = clock->get_clock_delay(X300_CLOCK_WHICH_FPGA);
@@ -695,7 +689,7 @@ double x300_radio_ctrl_impl::self_cal_adc_xfer_delay(
err_code += 100; //Increment error code by 100 to indicate no lock
}
}
- //UHD_MSG(status) << (boost::format("XferDelay=%fns, Error=%d\n") % delay % err_code);
+ //UHD_LOGGER_INFO("X300 RADIO") << (boost::format("XferDelay=%fns, Error=%d") % delay % err_code);
results.push_back(std::pair<double,bool>(delay, err_code==0));
}
@@ -747,7 +741,6 @@ double x300_radio_ctrl_impl::self_cal_adc_xfer_delay(
}
if (apply_delay) {
- UHD_MSG(status) << "Validating..." << std::flush;
//Apply delay
win_center = clock->set_clock_delay(X300_CLOCK_WHICH_ADC0, win_center); //Sets ADC0 and ADC1
wait_for_clk_locked(0.1);
@@ -765,7 +758,7 @@ double x300_radio_ctrl_impl::self_cal_adc_xfer_delay(
radios[r]->_adc->set_test_word("normal", "normal");
radios[r]->_regs->misc_outs_reg.write(radio_regmap_t::misc_outs_reg_t::ADC_CHECKER_ENABLED, 0);
}
- UHD_MSG(status) << (boost::format(" done (FPGA->ADC=%.3fns%s, Window=%.3fns)\n") %
+ UHD_LOGGER_INFO("X300 RADIO") << (boost::format("ADC transfer delay self-cal done (FPGA->ADC=%.3fns%s, Window=%.3fns)") %
(win_center-fpga_clk_delay) % (cycle_slip?" +cyc":"") % win_length);
return win_center;
@@ -789,7 +782,7 @@ void x300_radio_ctrl_impl::_update_atr_leds(const std::string &rx_ant, const siz
void x300_radio_ctrl_impl::_self_cal_adc_capture_delay(bool print_status)
{
- if (print_status) UHD_MSG(status) << "Running ADC capture delay self-cal..." << std::flush;
+ if (print_status) UHD_LOGGER_INFO("X300 RADIO") << "Running ADC capture delay self-cal...";
static const uint32_t NUM_DELAY_STEPS = 32; //The IDELAYE2 element has 32 steps
static const uint32_t NUM_RETRIES = 2; //Retry self-cal if it fails in warmup situations
@@ -852,7 +845,7 @@ void x300_radio_ctrl_impl::_self_cal_adc_capture_delay(bool print_status)
}
}
}
- //UHD_MSG(status) << (boost::format("CapTap=%d, Error=%d\n") % dly_tap % err_code);
+ //UHD_LOGGER_INFO("X300 RADIO") << (boost::format("CapTap=%d, Error=%d") % dly_tap % err_code);
}
//Retry the self-cal if it fails
@@ -882,7 +875,7 @@ void x300_radio_ctrl_impl::_self_cal_adc_capture_delay(bool print_status)
if (print_status) {
double tap_delay = (1.0e12 / _radio_clk_rate) / (2*32); //in ps
- UHD_MSG(status) << boost::format(" done (Tap=%d, Window=%d, TapDelay=%.3fps, Iter=%d)\n") % ideal_tap % (win_stop-win_start) % tap_delay % iter;
+ UHD_LOGGER_INFO("X300 RADIO") << boost::format("ADC capture delay self-cal done (Tap=%d, Window=%d, TapDelay=%.3fps, Iter=%d)") % ideal_tap % (win_stop-win_start) % tap_delay % iter;
}
}
@@ -912,7 +905,7 @@ void x300_radio_ctrl_impl::_set_db_eeprom(i2c_iface::sptr i2c, const size_t addr
***************************************************************************/
bool x300_radio_ctrl_impl::check_radio_config()
{
- UHD_RFNOC_BLOCK_TRACE() << "x300_radio_ctrl_impl::check_radio_config() " << std::endl;
+ UHD_RFNOC_BLOCK_TRACE() << "x300_radio_ctrl_impl::check_radio_config() " ;
const fs_path rx_fe_path = fs_path("dboards" / _radio_slot / "rx_frontends");
for (size_t chan = 0; chan < _get_num_radios(); chan++) {
if (_tree->exists(rx_fe_path / _rx_fe_map.at(chan).db_fe_name / "enabled")) {