diff options
author | Andrej Rode <andrej.rode@ettus.com> | 2017-02-07 16:37:25 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-02-20 17:13:15 -0800 |
commit | 21aad77c9ca07f4271136b9241f5adb00a6bb908 (patch) | |
tree | 636ffe3ab2296e9afa661d3a12eb359224cd3254 /host/lib/usrp/e300 | |
parent | 2b33f2bb4c01d4306fd46f78edf6e355a03e2ed7 (diff) | |
download | uhd-21aad77c9ca07f4271136b9241f5adb00a6bb908.tar.gz uhd-21aad77c9ca07f4271136b9241f5adb00a6bb908.tar.bz2 uhd-21aad77c9ca07f4271136b9241f5adb00a6bb908.zip |
utils: introduce new logging API and remove msg API
Diffstat (limited to 'host/lib/usrp/e300')
-rw-r--r-- | host/lib/usrp/e300/e300_common.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_fifo_config.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_impl.cpp | 48 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_io_impl.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_network.cpp | 56 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_remote_codec_ctrl.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_sysfs_hooks.cpp | 2 |
7 files changed, 67 insertions, 67 deletions
diff --git a/host/lib/usrp/e300/e300_common.cpp b/host/lib/usrp/e300/e300_common.cpp index 20cd4109f..61da3a2a2 100644 --- a/host/lib/usrp/e300/e300_common.cpp +++ b/host/lib/usrp/e300/e300_common.cpp @@ -15,7 +15,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // #include <uhd/image_loader.hpp> -#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <uhd/utils/paths.hpp> #include <uhd/utils/static.hpp> @@ -40,7 +40,7 @@ void load_fpga_image(const std::string &path) if (not boost::filesystem::exists("/dev/xdevcfg")) ::system("mknod /dev/xdevcfg c 259 0"); - UHD_MSG(status) << "Loading FPGA image: " << path << "..." << std::flush; + UHD_LOGGER_INFO("E300") << "Loading FPGA image: " << path << "..."; std::ifstream fpga_file(path.c_str(), std::ios_base::binary); UHD_ASSERT_THROW(fpga_file.good()); @@ -58,7 +58,7 @@ void load_fpga_image(const std::string &path) fpga_file.close(); std::fclose(wfile); - UHD_MSG(status) << " done" << std::endl; + UHD_LOGGER_INFO("E300") << "FPGA image loaded"; } static bool e300_image_loader(const image_loader::image_loader_args_t &image_loader_args) { diff --git a/host/lib/usrp/e300/e300_fifo_config.cpp b/host/lib/usrp/e300/e300_fifo_config.cpp index 4138bb581..b51896d82 100644 --- a/host/lib/usrp/e300/e300_fifo_config.cpp +++ b/host/lib/usrp/e300/e300_fifo_config.cpp @@ -81,7 +81,7 @@ static UHD_INLINE size_t ZF_STREAM_OFF(const size_t which) #include <fcntl.h> //open, close #include <poll.h> //poll #include <uhd/utils/log.hpp> -#include <uhd/utils/msg.hpp> + #include <boost/format.hpp> #include <boost/thread/thread.hpp> //sleep #include <uhd/types/time_spec.hpp> //timeout @@ -202,9 +202,9 @@ public: _index(0), _waiter(waiter) { - //UHD_MSG(status) << boost::format("phys 0x%x") % addrs.phys << std::endl; - //UHD_MSG(status) << boost::format("data 0x%x") % addrs.data << std::endl; - //UHD_MSG(status) << boost::format("ctrl 0x%x") % addrs.ctrl << std::endl; + //UHD_LOGGER_INFO("E300") << boost::format("phys 0x%x") % addrs.phys ; + //UHD_LOGGER_INFO("E300") << boost::format("data 0x%x") % addrs.data ; + //UHD_LOGGER_INFO("E300") << boost::format("ctrl 0x%x") % addrs.ctrl ; const uint32_t sig = zf_peek32(_addrs.ctrl + ARBITER_RD_SIG); UHD_ASSERT_THROW((sig >> 16) == 0xACE0); @@ -341,7 +341,7 @@ public: virtual ~e300_fifo_interface_impl(void) { delete _waiter; - UHD_LOG << "cleanup: munmap" << std::endl; + UHD_LOGGER_DEBUG("E300")<< "cleanup: munmap" ; ::munmap(_buff, _config.ctrl_length + _config.buff_length); ::close(_fd); } diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 64422a82b..ea326878e 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -25,7 +25,7 @@ #include "e300_common.hpp" #include "e300_remote_codec_ctrl.hpp" -#include <uhd/utils/msg.hpp> + #include <uhd/utils/log.hpp> #include <uhd/utils/static.hpp> #include <uhd/utils/paths.hpp> @@ -75,11 +75,11 @@ static std::vector<std::string> discover_ip_addrs( 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("E300") << boost::format("Cannot open UDP transport on %s for discovery%s") + % addr_hint % e.what() ; return addrs; } catch(...) { - UHD_MSG(error) << "E300 Network discovery unknown error" << std::endl; + UHD_LOGGER_ERROR("E300") << "E300 Network discovery unknown error"; return addrs; } @@ -95,10 +95,10 @@ static std::vector<std::string> discover_ip_addrs( try { udp_bcast_xport->send(boost::asio::buffer(&req, sizeof(req))); } catch (const std::exception &ex) { - UHD_MSG(error) << "E300 Network discovery error " << ex.what() << std::endl; + UHD_LOGGER_ERROR("E300") << "E300 Network discovery error " << ex.what(); return addrs; } catch(...) { - UHD_MSG(error) << "E300 Network discovery unknown error" << std::endl; + UHD_LOGGER_ERROR("E300") << "E300 Network discovery unknown error"; return addrs; } @@ -260,7 +260,7 @@ device_addrs_t e300_find(const device_addr_t &multi_dev_hint) **********************************************************************/ static device::sptr e300_make(const device_addr_t &device_addr) { - UHD_LOG << "e300_make with args " << device_addr.to_pp_string() << std::endl; + UHD_LOGGER_DEBUG("E300")<< "e300_make with args " << device_addr.to_pp_string() ; if(device_addr.has_key("server")) throw uhd::runtime_error( str(boost::format("Please run the server executable \"%s\"") @@ -295,8 +295,8 @@ void get_e3x0_fpga_images(const uhd::device_addr_t &device_addr, break; case e300_eeprom_manager::UNKNOWN: default: - UHD_MSG(warning) << "Unknown motherboard type, loading e300 image." - << std::endl; + UHD_LOGGER_WARNING("E300") << "Unknown motherboard type, loading e300 image." + ; fpga_image = device_addr.cast<std::string>("fpga", find_image_path(E300_FPGA_FILE_NAME)); idle_image = find_image_path(E3XX_SG1_FPGA_IDLE_FILE_NAME); @@ -405,14 +405,14 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) _codec_mgr = ad936x_manager::make(_codec_ctrl, fpga::NUM_RADIOS); #ifdef E300_GPSD - UHD_MSG(status) << "Detecting internal GPSDO " << std::flush; + UHD_LOGGER_INFO("E300") << "Detecting internal GPSDO "; try { if (_xport_path == AXI) _gps = gpsd_iface::make("localhost", 2947); else _gps = gpsd_iface::make(device_addr["addr"], 2947); } catch (std::exception &e) { - UHD_MSG(error) << "An error occured making GPSDd interface: " << e.what() << std::endl; + UHD_LOGGER_ERROR("E300") << "An error occured making GPSDd interface: " << e.what(); } if (_gps) { @@ -426,12 +426,12 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) break; } } - UHD_MSG(status) << (_gps->gps_detected() ? "found" : "not found") << std::endl; + UHD_LOGGER_INFO("E300") << "GPSDO " << (_gps->gps_detected() ? "found" : "not found"); } #endif // Verify we can talk to the e300 core control registers ... - UHD_MSG(status) << "Initializing core control..." << std::endl; + UHD_LOGGER_INFO("E300") << "Initializing core control..."; this->_register_loopback_self_test(_global_regs); // Verify fpga compatibility version matches at least for the major @@ -692,9 +692,9 @@ void e300_impl::_enforce_tick_rate_limits( double e300_impl::_set_tick_rate(const double rate) { - UHD_MSG(status) << "Asking for clock rate " << rate/1e6 << " MHz\n"; + UHD_LOGGER_INFO("E300") << "Asking for clock rate " << rate/1e6 << " MHz\n"; _tick_rate = _codec_ctrl->set_clock_rate(rate); - UHD_MSG(status) << "Actually got clock rate " << _tick_rate/1e6 << " MHz\n"; + UHD_LOGGER_INFO("E300") << "Actually got clock rate " << _tick_rate/1e6 << " MHz\n"; for(radio_perifs_t &perif: _radio_perifs) { @@ -707,7 +707,7 @@ double e300_impl::_set_tick_rate(const double rate) void e300_impl::_register_loopback_self_test(wb_iface::sptr iface) { bool test_fail = false; - UHD_MSG(status) << "Performing register loopback test... " << std::flush; + UHD_LOGGER_INFO("E300") << "Performing register loopback test... "; size_t hash = size_t(time(NULL)); for (size_t i = 0; i < 100; i++) { @@ -716,7 +716,7 @@ void e300_impl::_register_loopback_self_test(wb_iface::sptr iface) test_fail = iface->peek32(radio::RB32_TEST) != uint32_t(hash); if (test_fail) break; //exit loop on any failure } - UHD_MSG(status) << ((test_fail)? " fail" : "pass") << std::endl; + UHD_LOGGER_INFO("E300") << "Register loopback test " << ((test_fail)? " failed" : "passed"); } uint32_t e300_impl::_get_version(compat_t which) @@ -753,13 +753,13 @@ uint32_t e300_impl::_allocate_sid(const sid_config_t &config) | (config.router_addr_there << 8) | (stream << 0) ; - UHD_LOG << std::hex + UHD_LOGGER_DEBUG("E300")<< std::hex << " sid 0x" << sid << " framer 0x" << _sid_framer << " stream 0x" << stream << " router_dst_there 0x" << int(config.router_dst_there) << " router_addr_there 0x" << int(config.router_addr_there) - << std::dec << std::endl; + << std::dec ; // Program the E300 to recognize it's own local address. _global_regs->poke32(global_regs::SR_CORE_XB_LOCAL, config.router_addr_there); @@ -775,9 +775,9 @@ uint32_t e300_impl::_allocate_sid(const sid_config_t &config) _global_regs->poke32(XB_ADDR(E300_DEVICE_HERE), config.router_dst_here); - UHD_LOG << std::hex + UHD_LOGGER_DEBUG("E300") << std::hex << "done router config for sid 0x" << sid - << std::dec << std::endl; + << std::dec ; //increment for next setup _sid_framer++; @@ -787,14 +787,14 @@ uint32_t e300_impl::_allocate_sid(const sid_config_t &config) void e300_impl::_setup_dest_mapping(const uint32_t sid, const size_t which_stream) { - UHD_LOG << boost::format("Setting up dest map for 0x%lx to be stream %d") - % (sid & 0xff) % which_stream << std::endl; + UHD_LOGGER_DEBUG("E300") << boost::format("Setting up dest map for 0x%lx to be stream %d") + % (sid & 0xff) % which_stream ; _global_regs->poke32(DST_ADDR(sid & 0xff), which_stream); } void e300_impl::_update_time_source(const std::string &source) { - UHD_MSG(status) << boost::format("Setting time source to %s") % source << std::endl; + UHD_LOGGER_INFO("E300") << boost::format("Setting time source to %s") % source; if (source == "none" or source == "internal") { _misc.pps_sel = global_regs::PPS_INT; #ifdef E300_GPSD diff --git a/host/lib/usrp/e300/e300_io_impl.cpp b/host/lib/usrp/e300/e300_io_impl.cpp index bcdb8077b..4490afa21 100644 --- a/host/lib/usrp/e300/e300_io_impl.cpp +++ b/host/lib/usrp/e300/e300_io_impl.cpp @@ -335,7 +335,7 @@ static void handle_tx_async_msgs(boost::shared_ptr<e300_tx_fc_cache_t> fc_cache, } catch(const std::exception &ex) { - UHD_MSG(error) << "Error parsing async message packet: " << ex.what() << std::endl; + UHD_LOGGER_ERROR("E300") << "Error parsing async message packet: " << ex.what() ; return; } @@ -482,9 +482,9 @@ rx_streamer::sptr e300_impl::get_rx_stream(const uhd::stream_args_t &args_) E300_RX_SW_BUFF_FULLNESS); const size_t fc_handle_window = std::max<size_t>(1, fc_window / E300_RX_FC_REQUEST_FREQ); - UHD_LOG << "RX Flow Control Window = " << fc_window + UHD_LOGGER_DEBUG("E300") << "RX Flow Control Window = " << fc_window << ", RX Flow Control Handler Window = " - << fc_handle_window << std::endl; + << fc_handle_window ; perif.framer->configure_flow_control(fc_window); boost::shared_ptr<e300_rx_fc_cache_t> fc_cache(new e300_rx_fc_cache_t()); @@ -590,9 +590,9 @@ tx_streamer::sptr e300_impl::get_tx_stream(const uhd::stream_args_t &args_) const size_t fc_window = data_xports.send->get_num_send_frames(); const size_t fc_handle_window = std::max<size_t>(1, fc_window/E300_TX_FC_RESPONSE_FREQ); - UHD_LOG << "TX Flow Control Window = " << fc_window + UHD_LOGGER_DEBUG("E300") << "TX Flow Control Window = " << fc_window << ", TX Flow Control Handler Window = " - << fc_handle_window << std::endl; + << fc_handle_window ; perif.deframer->configure_flow_control(0/*cycs off*/, fc_handle_window/*pkts*/); boost::shared_ptr<e300_tx_fc_cache_t> fc_cache(new e300_tx_fc_cache_t()); diff --git a/host/lib/usrp/e300/e300_network.cpp b/host/lib/usrp/e300/e300_network.cpp index e68f2a54d..f3045eb2d 100644 --- a/host/lib/usrp/e300/e300_network.cpp +++ b/host/lib/usrp/e300/e300_network.cpp @@ -31,7 +31,7 @@ #include "e300_common.hpp" #include "e300_remote_codec_ctrl.hpp" -#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <uhd/utils/byteswap.hpp> #include <uhd/utils/paths.hpp> @@ -88,7 +88,7 @@ static void e300_recv_tunnel( //step 1 - get the buffer managed_recv_buffer::sptr buff = recver->get_recv_buff(); if (not buff) continue; - if (E300_NETWORK_DEBUG) UHD_MSG(status) << name << " got " << buff->size() << std::endl; + if (E300_NETWORK_DEBUG) UHD_LOGGER_INFO("E300") << name << " got " << buff->size(); //step 1.5 -- update endpoint { @@ -102,13 +102,13 @@ static void e300_recv_tunnel( } catch(const std::exception &ex) { - UHD_MSG(error) << "e300_recv_tunnel exit " << name << " " << ex.what() << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_recv_tunnel exit " << name << " " << ex.what(); } catch(...) { - UHD_MSG(error) << "e300_recv_tunnel exit " << name << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_recv_tunnel exit " << name ; } - UHD_MSG(status) << "e300_recv_tunnel exit " << name << std::endl; + UHD_LOGGER_INFO("E300") << "e300_recv_tunnel exit " << name; *running = false; } @@ -136,7 +136,7 @@ static void e300_send_tunnel( while (not wait_for_recv_ready(recver->native(), 100) and *running){} if (not *running) break; const size_t num_bytes = recver->receive_from(asio::buffer(buff->cast<void *>(), buff->size()), _rx_endpoint); - if (E300_NETWORK_DEBUG) UHD_MSG(status) << name << " got " << num_bytes << std::endl; + if (E300_NETWORK_DEBUG) UHD_LOGGER_INFO("E300") << name << " got " << num_bytes; //step 2.5 -- update endpoint { @@ -150,13 +150,13 @@ static void e300_send_tunnel( } catch(const std::exception &ex) { - UHD_MSG(error) << "e300_send_tunnel exit " << name << " " << ex.what() << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_send_tunnel exit " << name << " " << ex.what() ; } catch(...) { - UHD_MSG(error) << "e300_send_tunnel exit " << name << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_send_tunnel exit " << name ; } - UHD_MSG(status) << "e300_send_tunnel exit " << name << std::endl; + UHD_LOGGER_INFO("E300") << "e300_send_tunnel exit " << name; *running = false; } @@ -252,7 +252,7 @@ static void e300_codec_ctrl_tunnel( out->bw = _codec_ctrl->set_bw_filter(which_str, in->bw); break; default: - UHD_MSG(status) << "Got unknown request?!" << std::endl; + UHD_LOGGER_INFO("E300") << "Got unknown request?!"; //Zero out actions to fail this request on client out->action = uhd::htonx<uint32_t>(0); } @@ -262,13 +262,13 @@ static void e300_codec_ctrl_tunnel( } catch(const std::exception &ex) { - UHD_MSG(error) << "e300_ctrl_tunnel exit " << name << " " << ex.what() << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_ctrl_tunnel exit " << name << " " << ex.what() ; } catch(...) { - UHD_MSG(error) << "e300_ctrl_tunnel exit " << name << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_ctrl_tunnel exit " << name ; } - UHD_MSG(status) << "e300_ctrl_tunnel exit " << name << std::endl; + UHD_LOGGER_INFO("E300") << "e300_ctrl_tunnel exit " << name; *running = false; } @@ -309,13 +309,13 @@ static void e300_global_regs_tunnel( } catch(const std::exception &ex) { - UHD_MSG(error) << "e300_gregs_tunnel exit " << name << " " << ex.what() << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_gregs_tunnel exit " << name << " " << ex.what() ; } catch(...) { - UHD_MSG(error) << "e300_gregs_tunnel exit " << name << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_gregs_tunnel exit " << name ; } - UHD_MSG(status) << "e300_gregs_tunnel exit " << name << std::endl; + UHD_LOGGER_INFO("E300") << "e300_gregs_tunnel exit " << name; *running = false; } @@ -353,20 +353,20 @@ static void e300_sensor_tunnel( in->value = uhd::htonx<uint32_t>( sensor_manager->get_ref_lock().to_bool() ? 1 : 0); } else - UHD_MSG(status) << "Got unknown request?!" << std::endl; + UHD_LOGGER_INFO("E300") << "Got unknown request?!"; socket->send_to(asio::buffer(in_buff, sizeof(sensor_transaction_t)), *endpoint); } } catch(const std::exception &ex) { - UHD_MSG(error) << "e300_sensor_tunnel exit " << name << " " << ex.what() << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_sensor_tunnel exit " << name << " " << ex.what() ; } catch(...) { - UHD_MSG(error) << "e300_sensor_tunnel exit " << name << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_sensor_tunnel exit " << name ; } - UHD_MSG(status) << "e300_sensor_tunnel exit " << name << std::endl; + UHD_LOGGER_INFO("E300") << "e300_sensor_tunnel exit " << name; *running = false; } @@ -419,19 +419,19 @@ static void e300_i2c_tunnel( } } else { - UHD_MSG(error) << "e300_i2c_tunnel could not handle message." << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_i2c_tunnel could not handle message." ; } } } catch(const std::exception &ex) { - UHD_MSG(error) << "e300_i2c_tunnel exit " << name << " " << ex.what() << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_i2c_tunnel exit " << name << " " << ex.what() ; } catch(...) { - UHD_MSG(error) << "e300_i2c_tunnel exit " << name << std::endl; + UHD_LOGGER_ERROR("E300") << "e300_i2c_tunnel exit " << name ; } - UHD_MSG(status) << "e300_i2c_tunnel exit " << name << std::endl; + UHD_LOGGER_INFO("E300") << "e300_i2c_tunnel exit " << name; *running = false; } @@ -491,7 +491,7 @@ void network_server_impl::_run_server( //boost::shared_ptr<asio::ip::udp::acceptor> acceptor(new asio::ip::udp::acceptor(io_service, endpoint)); while (not boost::this_thread::interruption_requested()) { - UHD_MSG(status) << "e300 run server on port " << port << " for " << what << std::endl; + UHD_LOGGER_INFO("E300") << "e300 run server on port " << port << " for " << what; try { //while (not wait_for_recv_ready(acceptor->native(), 100)) @@ -501,7 +501,7 @@ void network_server_impl::_run_server( boost::shared_ptr<asio::ip::udp::socket> socket; socket.reset(new asio::ip::udp::socket(io_service, endpoint)); //acceptor->accept(*socket); - UHD_MSG(status) << "e300 socket accept on port " << port << " for " << what << std::endl; + UHD_LOGGER_INFO("E300") << "e300 socket accept on port " << port << " for " << what; //asio::ip::udp::no_delay option(true); //socket->set_option(option); boost::thread_group tg; @@ -586,8 +586,8 @@ network_server_impl::network_server_impl(const uhd::device_addr_t &device_addr) break; case e300_eeprom_manager::UNKNOWN: default: - UHD_MSG(warning) << "Unknown motherboard type, loading e300 image." - << std::endl; + UHD_LOGGER_WARNING("E300") << "Unknown motherboard type, loading e300 image." + ; fpga_image = find_image_path(E300_FPGA_FILE_NAME); break; } diff --git a/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp b/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp index b7c46c17d..d970d7221 100644 --- a/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp +++ b/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp @@ -242,7 +242,7 @@ public: //! Write back a filter void set_filter(const std::string &, const std::string &, const filter_info_base::sptr) { - UHD_MSG(warning) << "Attempting to set filter on E300 in network mode." << std::endl; + UHD_LOGGER_WARNING("E300") << "Attempting to set filter on E300 in network mode." ; } void output_digital_test_tone(UHD_UNUSED(bool enb)) diff --git a/host/lib/usrp/e300/e300_sysfs_hooks.cpp b/host/lib/usrp/e300/e300_sysfs_hooks.cpp index 7bd1d6d7e..bcfca8b92 100644 --- a/host/lib/usrp/e300/e300_sysfs_hooks.cpp +++ b/host/lib/usrp/e300/e300_sysfs_hooks.cpp @@ -32,7 +32,7 @@ #include <boost/format.hpp> #include <boost/lexical_cast.hpp> -#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <uhd/exception.hpp> static const std::string E300_AXI_FPGA_SYSFS = "40000000.axi-fpga"; |