From 21aad77c9ca07f4271136b9241f5adb00a6bb908 Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Tue, 7 Feb 2017 16:37:25 -0800 Subject: utils: introduce new logging API and remove msg API --- host/lib/usrp/n230/n230_clk_pps_ctrl.cpp | 6 +++--- host/lib/usrp/n230/n230_eeprom_manager.cpp | 2 +- host/lib/usrp/n230/n230_frontend_ctrl.cpp | 2 +- host/lib/usrp/n230/n230_fw_ctrl_iface.cpp | 10 +++++----- host/lib/usrp/n230/n230_impl.cpp | 12 ++++++------ host/lib/usrp/n230/n230_resource_manager.cpp | 16 ++++++++-------- host/lib/usrp/n230/n230_stream_manager.cpp | 2 +- host/lib/usrp/n230/n230_uart.cpp | 2 +- 8 files changed, 26 insertions(+), 26 deletions(-) (limited to 'host/lib/usrp/n230') diff --git a/host/lib/usrp/n230/n230_clk_pps_ctrl.cpp b/host/lib/usrp/n230/n230_clk_pps_ctrl.cpp index ff4289922..372325fbe 100644 --- a/host/lib/usrp/n230/n230_clk_pps_ctrl.cpp +++ b/host/lib/usrp/n230/n230_clk_pps_ctrl.cpp @@ -17,7 +17,7 @@ #include "n230_clk_pps_ctrl.hpp" -#include +#include #include #include #include @@ -55,9 +55,9 @@ public: double set_tick_rate(const double rate) { - UHD_MSG(status) << "Configuring a tick rate of " << rate/1e6 << " MHz... "; + UHD_LOGGER_INFO("N230") << "Configuring a tick rate of " << rate/1e6 << " MHz... "; _tick_rate = _codec_ctrl->set_clock_rate(rate); - UHD_MSG(status) << "got " << _tick_rate/1e6 << " MHz\n"; + UHD_LOGGER_INFO("N230") << "got " << _tick_rate/1e6 << " MHz\n"; for(time_core_3000::sptr& time_core: _time_cores) { time_core->set_tick_rate(_tick_rate); diff --git a/host/lib/usrp/n230/n230_eeprom_manager.cpp b/host/lib/usrp/n230/n230_eeprom_manager.cpp index d9d02c58c..c21eb9ddb 100644 --- a/host/lib/usrp/n230/n230_eeprom_manager.cpp +++ b/host/lib/usrp/n230/n230_eeprom_manager.cpp @@ -17,7 +17,7 @@ #include "n230_eeprom.h" #include -#include +#include #include #include #include diff --git a/host/lib/usrp/n230/n230_frontend_ctrl.cpp b/host/lib/usrp/n230/n230_frontend_ctrl.cpp index 3d81721ec..80f1232b1 100644 --- a/host/lib/usrp/n230/n230_frontend_ctrl.cpp +++ b/host/lib/usrp/n230/n230_frontend_ctrl.cpp @@ -17,7 +17,7 @@ #include "n230_frontend_ctrl.hpp" -#include +#include #include #include #include diff --git a/host/lib/usrp/n230/n230_fw_ctrl_iface.cpp b/host/lib/usrp/n230/n230_fw_ctrl_iface.cpp index 68fad3035..07f9bb7d6 100644 --- a/host/lib/usrp/n230/n230_fw_ctrl_iface.cpp +++ b/host/lib/usrp/n230/n230_fw_ctrl_iface.cpp @@ -18,7 +18,7 @@ #include "n230_fw_ctrl_iface.hpp" #include -#include +#include #include #include #include //used for htonl and ntohl @@ -74,7 +74,7 @@ void n230_fw_ctrl_iface::poke32(const wb_addr_type addr, const uint32_t data) } 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 (_verbose) UHD_LOGGER_WARNING("N230") << error_msg ; if (i == NUM_RETRIES) throw uhd::io_error(error_msg); } } @@ -90,7 +90,7 @@ uint32_t n230_fw_ctrl_iface::peek32(const wb_addr_type 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 (_verbose) UHD_LOGGER_WARNING("N230") << error_msg ; if (i == NUM_RETRIES) throw uhd::io_error(error_msg); } } @@ -182,8 +182,8 @@ std::vector n230_fw_ctrl_iface::discover_devices( 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; + UHD_LOGGER_ERROR("N230") << boost::format("Cannot open UDP transport on %s for discovery\n%s") + % addr_hint % e.what() ; return addrs; } diff --git a/host/lib/usrp/n230/n230_impl.cpp b/host/lib/usrp/n230/n230_impl.cpp index 817868ef0..63971fb34 100644 --- a/host/lib/usrp/n230/n230_impl.cpp +++ b/host/lib/usrp/n230/n230_impl.cpp @@ -25,7 +25,7 @@ #include #include #include -#include + #include #include #include @@ -190,7 +190,7 @@ device::sptr n230_impl::n230_make(const device_addr_t &device_addr) **********************************************************************/ n230_impl::n230_impl(const uhd::device_addr_t& dev_addr) { - UHD_MSG(status) << "N230 initialization sequence..." << std::endl; + UHD_LOGGER_INFO("N230") << "N230 initialization sequence..."; _dev_args.parse(dev_addr); _tree = uhd::property_tree::make(); @@ -208,9 +208,9 @@ n230_impl::n230_impl(const uhd::device_addr_t& dev_addr) const mboard_eeprom_t& mb_eeprom = _eeprom_mgr->get_mb_eeprom(); 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("N230") << "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!"; } uint16_t hw_rev = boost::lexical_cast(mb_eeprom["revision"]); uint16_t hw_rev_compat = boost::lexical_cast(mb_eeprom["revision_compat"]); @@ -232,11 +232,11 @@ n230_impl::n230_impl(const uhd::device_addr_t& dev_addr) //Debug loopback mode switch(_dev_args.get_loopback_mode()) { case n230_device_args_t::LOOPBACK_RADIO: - UHD_MSG(status) << "DEBUG: Running in TX->RX Radio loopback mode.\n"; + UHD_LOGGER_INFO("N230") << "DEBUG: Running in TX->RX Radio loopback mode."; _resource_mgr->get_frontend_ctrl().set_self_test_mode(LOOPBACK_RADIO); break; case n230_device_args_t::LOOPBACK_CODEC: - UHD_MSG(status) << "DEBUG: Running in TX->RX CODEC loopback mode.\n"; + UHD_LOGGER_INFO("N230") << "DEBUG: Running in TX->RX CODEC loopback mode."; _resource_mgr->get_frontend_ctrl().set_self_test_mode(LOOPBACK_CODEC); break; default: diff --git a/host/lib/usrp/n230/n230_resource_manager.cpp b/host/lib/usrp/n230/n230_resource_manager.cpp index c5617bbf7..4de5f77ec 100644 --- a/host/lib/usrp/n230/n230_resource_manager.cpp +++ b/host/lib/usrp/n230/n230_resource_manager.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -80,8 +80,8 @@ n230_resource_manager::n230_resource_manager( _safe_mode(safe_mode), _last_host_enpoint(0) { - if (_safe_mode) UHD_MSG(warning) << "Initializing device in safe mode\n"; - UHD_MSG(status) << "Setup basic communication...\n"; + if (_safe_mode) UHD_LOGGER_WARNING("N230") << "Initializing device in safe mode\n"; + UHD_LOGGER_INFO("N230") << "Setup basic communication..."; //Discover ethernet interfaces bool dual_eth_expected = (ip_addrs.size() > 1); @@ -145,7 +145,7 @@ n230_resource_manager::n230_resource_manager( } _check_fpga_compat(); - UHD_MSG(status) << boost::format("Version signatures... Firmware:%s FPGA:%s...\n") + UHD_LOGGER_INFO("N230") << boost::format("Version signatures... Firmware:%s FPGA:%s...") % _fw_version.get_hash_str() % _fpga_version.get_hash_str(); _core_radio_ctrl_reg.initialize(*_core_ctrl, true /*flush*/); @@ -160,7 +160,7 @@ n230_resource_manager::n230_resource_manager( } //Create AD9361 interface - UHD_MSG(status) << "Initializing CODEC...\n"; + UHD_LOGGER_INFO("N230") << "Initializing CODEC..."; _codec_ctrl = ad9361_ctrl::make_spi( boost::make_shared(), _core_spi_ctrl, fpga::AD9361_SPI_SLAVE_NUM); if (_codec_ctrl.get() == NULL) { @@ -210,7 +210,7 @@ n230_resource_manager::n230_resource_manager( //Create GPSDO interface if (_core_status_reg.read(fpga::core_status_reg_t::GPSDO_STATUS) != fpga::GPSDO_ST_ABSENT) { - UHD_MSG(status) << "Detecting GPSDO.... " << std::flush; + UHD_LOGGER_INFO("N230") << "Detecting GPSDO.... "; try { const sid_t gps_uart_sid = _generate_sid(GPS_UART, _get_conn(PRI_ETH).type); transport::zero_copy_if::sptr gps_uart_xport = @@ -221,7 +221,7 @@ n230_resource_manager::n230_resource_manager( boost::this_thread::sleep(boost::posix_time::seconds(1)); //allow for a little propagation _gps_ctrl = gps_ctrl::make(_gps_uart); } catch(std::exception &e) { - UHD_MSG(error) << "An error occurred making GPSDO control: " << e.what() << std::endl; + UHD_LOGGER_ERROR("N230") << "An error occurred making GPSDO control: " << e.what() ; } if (not is_gpsdo_present()) { _core_ctrl->poke32(fpga::sr_addr(fpga::SR_CORE_GPSDO_ST), fpga::GPSDO_ST_ABSENT); @@ -488,7 +488,7 @@ bool n230_resource_manager::_radio_data_loopback_self_test(wb_iface::sptr iface) const uint32_t rb_rx = uint32_t(rb_word64 & 0xffffffff); test_fail = word32 != rb_tx or word32 != rb_rx; if (test_fail){ - UHD_MSG(fastpath) << boost::format("mismatch (exp:%x, got:%x and %x)... ") % word32 % rb_tx % rb_rx; + UHD_LOG_FASTPATH(boost::format("mismatch (exp:%x, got:%x and %x)... ") % word32 % rb_tx % rb_rx) break; //exit loop on any failure } } diff --git a/host/lib/usrp/n230/n230_stream_manager.cpp b/host/lib/usrp/n230/n230_stream_manager.cpp index 7c936a184..95da2752e 100644 --- a/host/lib/usrp/n230/n230_stream_manager.cpp +++ b/host/lib/usrp/n230/n230_stream_manager.cpp @@ -477,7 +477,7 @@ void n230_stream_manager::_handle_tx_async_msgs( _cvita_hdr_unpack(packet_buff, if_packet_info); endian_conv = uhd::ntohx; } catch(const std::exception &ex) { - UHD_MSG(error) << "Error parsing async message packet: " << ex.what() << std::endl; + UHD_LOGGER_ERROR("N230") << "Error parsing async message packet: " << ex.what() ; return; } diff --git a/host/lib/usrp/n230/n230_uart.cpp b/host/lib/usrp/n230/n230_uart.cpp index 7291a7276..7330dff4a 100644 --- a/host/lib/usrp/n230/n230_uart.cpp +++ b/host/lib/usrp/n230/n230_uart.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include -- cgit v1.2.3