diff options
Diffstat (limited to 'host/lib/usrp/e300')
-rw-r--r-- | host/lib/usrp/e300/e300_common.cpp | 7 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_common.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_defaults.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_fifo_config.cpp | 19 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_impl.cpp | 80 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_impl.hpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_io_impl.cpp | 17 | ||||
-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 |
10 files changed, 98 insertions, 92 deletions
diff --git a/host/lib/usrp/e300/e300_common.cpp b/host/lib/usrp/e300/e300_common.cpp index 216713bc6..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> @@ -26,6 +26,7 @@ #include "e300_common.hpp" #include <boost/filesystem.hpp> +#include <boost/noncopyable.hpp> #include <fstream> #include <string> @@ -39,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()); @@ -57,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_common.hpp b/host/lib/usrp/e300/e300_common.hpp index d9a0afd9e..c0cb9e2fd 100644 --- a/host/lib/usrp/e300/e300_common.hpp +++ b/host/lib/usrp/e300/e300_common.hpp @@ -18,6 +18,8 @@ #ifndef INCLUDED_E300_COMMON_HPP #define INCLUDED_E300_COMMON_HPP +#include <string> + namespace uhd { namespace usrp { namespace e300 { namespace common { diff --git a/host/lib/usrp/e300/e300_defaults.hpp b/host/lib/usrp/e300/e300_defaults.hpp index 267897e03..cc810c0df 100644 --- a/host/lib/usrp/e300/e300_defaults.hpp +++ b/host/lib/usrp/e300/e300_defaults.hpp @@ -60,7 +60,7 @@ public: } } clocking_mode_t get_clocking_mode() { - return AD9361_XTAL_N_CLK_PATH; + return clocking_mode_t::AD9361_XTAL_N_CLK_PATH; } digital_interface_mode_t get_digital_interface_mode() { return AD9361_DDR_FDD_LVCMOS; diff --git a/host/lib/usrp/e300/e300_fifo_config.cpp b/host/lib/usrp/e300/e300_fifo_config.cpp index 43d14aa65..89162a048 100644 --- a/host/lib/usrp/e300/e300_fifo_config.cpp +++ b/host/lib/usrp/e300/e300_fifo_config.cpp @@ -1,5 +1,5 @@ // -// Copyright 2013-2014 Ettus Research LLC +// Copyright 2013-2017 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 @@ -17,8 +17,9 @@ #ifdef E300_NATIVE -#include <stdint.h> #include <uhd/config.hpp> +#include <stdint.h> +#include <atomic> // constants coded into the fpga parameters static const size_t ZF_CONFIG_BASE = 0x40000000; @@ -81,7 +82,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 @@ -101,6 +102,10 @@ struct e300_fifo_poll_waiter //NOP } + /*! + * Waits until the file descriptor fd has data to read. + * Access to the file descriptor is thread safe. + */ void wait(const double timeout) { if (timeout == 0) { @@ -210,9 +215,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); @@ -351,7 +356,7 @@ public: virtual ~e300_fifo_interface_impl(void) { delete _waiter; - UHD_LOG << "cleanup: munmap" << std::endl; + UHD_LOGGER_TRACE("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 e8cfd7d54..538eded79 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; } @@ -130,7 +130,7 @@ device_addrs_t e300_find(const device_addr_t &multi_dev_hint) if (hints.size() > 1) { device_addrs_t found_devices; std::string err_msg; - BOOST_FOREACH(const device_addr_t &hint_i, hints) + for(const device_addr_t &hint_i: hints) { device_addrs_t found_devices_i = e300_find(hint_i); if(found_devices_i.size() != 1) @@ -165,7 +165,7 @@ device_addrs_t e300_find(const device_addr_t &multi_dev_hint) if (not loopback_only) { // if no address or node has been specified, send a broadcast if ((not hint.has_key("addr")) and (not hint.has_key("node"))) { - BOOST_FOREACH(const if_addrs_t &if_addrs, get_if_addrs()) + for(const if_addrs_t &if_addrs: get_if_addrs()) { // avoid the loopback device if (is_loopback(if_addrs)) @@ -187,7 +187,7 @@ device_addrs_t e300_find(const device_addr_t &multi_dev_hint) std::vector<std::string> ip_addrs = discover_ip_addrs( hint["addr"], E300_SERVER_I2C_PORT); - BOOST_FOREACH(const std::string &ip_addr, ip_addrs) + for(const std::string &ip_addr: ip_addrs) { device_addr_t new_addr; new_addr["type"] = "e3x0"; @@ -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 GPS " << std::flush; + UHD_LOGGER_INFO("E300") << "Detecting internal GPS "; 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 @@ -468,14 +468,14 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) // and do the misc mboard sensors //////////////////////////////////////////////////////////////////// _tree->create<int>(mb_path / "sensors"); - BOOST_FOREACH(const std::string &name, _sensor_manager->get_sensors()) + for(const std::string &name: _sensor_manager->get_sensors()) { _tree->create<sensor_value_t>(mb_path / "sensors" / name) .set_publisher(boost::bind(&e300_sensor_manager::get_sensor, _sensor_manager, name)); } #ifdef E300_GPSD if (_gps) { - BOOST_FOREACH(const std::string &name, _gps->get_sensors()) + for(const std::string &name: _gps->get_sensors()) { _tree->create<sensor_value_t>(mb_path / "sensors" / name) .set_publisher(boost::bind(&gpsd_iface::get_sensor, _gps, name)); @@ -511,7 +511,7 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) this->_setup_radio(instance); //now test each radio module's connection to the codec interface - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { _codec_mgr->loopback_self_test( boost::bind( @@ -524,7 +524,7 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) // internal gpios //////////////////////////////////////////////////////////////////// gpio_atr_3000::sptr fp_gpio = gpio_atr_3000::make(_radio_perifs[0].ctrl, radio::sr_addr(radio::FP_GPIO), radio::RB32_FP_GPIO); - BOOST_FOREACH(const gpio_attr_map_t::value_type attr, gpio_attr_map) + for(const gpio_attr_map_t::value_type attr: gpio_attr_map) { _tree->create<uint32_t>(mb_path / "gpio" / "INT0" / attr.second) .add_coerced_subscriber(boost::bind(&gpio_atr_3000::set_gpio_attr, fp_gpio, attr.first, _1)) @@ -625,11 +625,11 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) // subdev spec contains full width of selections subdev_spec_t rx_spec, tx_spec; - BOOST_FOREACH(const std::string &fe, _tree->list(mb_path / "dboards" / "A" / "rx_frontends")) + for(const std::string &fe: _tree->list(mb_path / "dboards" / "A" / "rx_frontends")) { rx_spec.push_back(subdev_spec_pair_t("A", fe)); } - BOOST_FOREACH(const std::string &fe, _tree->list(mb_path / "dboards" / "A" / "tx_frontends")) + for(const std::string &fe: _tree->list(mb_path / "dboards" / "A" / "tx_frontends")) { tx_spec.push_back(subdev_spec_pair_t("A", fe)); } @@ -692,11 +692,11 @@ 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"; - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { perif.time64->set_tick_rate(_tick_rate); perif.time64->self_test(); @@ -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) @@ -747,19 +747,20 @@ uint32_t e300_impl::_allocate_sid(const sid_config_t &config) { const uint32_t stream = (config.dst_prefix | (config.router_dst_there << 2)) & 0xff; + const size_t sid_framer = _sid_framer++; //increment for next setup const uint32_t sid = 0 | (E300_DEVICE_HERE << 24) - | (_sid_framer << 16) + | (sid_framer << 16) | (config.router_addr_there << 8) | (stream << 0) ; - UHD_LOG << std::hex + UHD_LOGGER_DEBUG("E300")<< std::hex << " sid 0x" << sid - << " framer 0x" << _sid_framer + << " 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,26 +776,23 @@ 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_TRACE("E300") << std::hex << "done router config for sid 0x" << sid - << std::dec << std::endl; - - //increment for next setup - _sid_framer++; + << std::dec ; return sid; } 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 @@ -811,7 +809,7 @@ void e300_impl::_update_time_source(const std::string &source) void e300_impl::_set_time(const uhd::time_spec_t& t) { - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) perif.time64->set_time_sync(t); _misc.time_sync = 1; _update_gpio_state(); @@ -1037,7 +1035,7 @@ void e300_impl::_setup_radio(const size_t dspno) // create RF frontend interfacing //////////////////////////////////////////////////////////////////// static const std::vector<direction_t> dirs = boost::assign::list_of(RX_DIRECTION)(TX_DIRECTION); - BOOST_FOREACH(direction_t dir, dirs) { + for(direction_t dir: dirs) { const std::string x = (dir == RX_DIRECTION) ? "rx" : "tx"; const std::string key = boost::to_upper_copy(x) + std::string(((dspno == FE0)? "1" : "2")); const fs_path rf_fe_path diff --git a/host/lib/usrp/e300/e300_impl.hpp b/host/lib/usrp/e300/e300_impl.hpp index 50d78fdd4..cc2e39e23 100644 --- a/host/lib/usrp/e300/e300_impl.hpp +++ b/host/lib/usrp/e300/e300_impl.hpp @@ -47,6 +47,7 @@ #include "e300_i2c.hpp" #include "e300_eeprom_manager.hpp" #include "e300_sensor_manager.hpp" +#include <atomic> /* if we don't compile with gpsd support, don't bother */ #ifdef E300_GPSD @@ -288,7 +289,7 @@ private: // members uhd::device_addr_t _device_addr; xport_t _xport_path; e300_fifo_interface::sptr _fifo_iface; - size_t _sid_framer; + std::atomic<size_t> _sid_framer; radio_perifs_t _radio_perifs[2]; double _tick_rate; ad9361_ctrl::sptr _codec_ctrl; diff --git a/host/lib/usrp/e300/e300_io_impl.cpp b/host/lib/usrp/e300/e300_io_impl.cpp index 2514b7f40..4490afa21 100644 --- a/host/lib/usrp/e300/e300_io_impl.cpp +++ b/host/lib/usrp/e300/e300_io_impl.cpp @@ -26,7 +26,6 @@ #include <boost/bind.hpp> #include <uhd/utils/tasks.hpp> #include <uhd/utils/log.hpp> -#include <boost/foreach.hpp> #include <boost/make_shared.hpp> using namespace uhd; @@ -43,7 +42,7 @@ static const uint32_t HW_SEQ_NUM_MASK = 0xfff; void e300_impl::_check_tick_rate_with_current_streamers(const double rate) { size_t max_tx_chan_count = 0, max_rx_chan_count = 0; - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { { boost::shared_ptr<sph::recv_packet_streamer> rx_streamer = @@ -73,7 +72,7 @@ void e300_impl::_update_tick_rate(const double rate) { _check_tick_rate_with_current_streamers(rate); - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { boost::shared_ptr<sph::recv_packet_streamer> my_streamer = boost::dynamic_pointer_cast<sph::recv_packet_streamer>(perif.rx_streamer.lock()); @@ -81,7 +80,7 @@ void e300_impl::_update_tick_rate(const double rate) my_streamer->set_tick_rate(rate); perif.framer->set_tick_rate(_tick_rate); } - BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) + for(radio_perifs_t &perif: _radio_perifs) { boost::shared_ptr<sph::send_packet_streamer> my_streamer = boost::dynamic_pointer_cast<sph::send_packet_streamer>(perif.tx_streamer.lock()); @@ -336,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; } @@ -483,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()); @@ -591,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"; |