diff options
Diffstat (limited to 'host/lib/usrp/x300/x300_fw_ctrl.cpp')
-rw-r--r-- | host/lib/usrp/x300/x300_fw_ctrl.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/host/lib/usrp/x300/x300_fw_ctrl.cpp b/host/lib/usrp/x300/x300_fw_ctrl.cpp index d149dadf3..b8cb2075e 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> @@ -60,8 +60,8 @@ public: catch(const uhd::io_error &ex) { 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; + "%s: x300 fw communication failure #%u\n%s") % __loc_info() % i % ex.what()); + if (errors) UHD_LOGGER_ERROR("X300") << error_msg ; if (i == num_retries) throw uhd::io_error(error_msg); } } @@ -80,8 +80,8 @@ public: catch(const uhd::io_error &ex) { 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; + "%s: x300 fw communication failure #%u\n%s") % __loc_info() % i % ex.what()); + if (errors) UHD_LOGGER_ERROR("X300") << error_msg ; if (i == num_retries) throw uhd::io_error(error_msg); } } @@ -94,6 +94,7 @@ protected: virtual void __poke32(const wb_addr_type addr, const uint32_t data) = 0; virtual uint32_t __peek32(const wb_addr_type addr) = 0; virtual void __flush() = 0; + virtual std::string __loc_info() = 0; boost::mutex reg_access; }; @@ -182,6 +183,11 @@ protected: while (udp->recv(boost::asio::buffer(buff), 0.0)){} //flush } + virtual std::string __loc_info(void) + { + return udp->get_send_addr(); + } + private: uhd::transport::udp_simple::sptr udp; size_t seq; @@ -290,6 +296,11 @@ protected: __peek32(0); } + virtual std::string __loc_info(void) + { + return std::to_string(_drv_proxy->get_interface_num()); + } + private: niriok_proxy::sptr _drv_proxy; static const uint32_t READ_TIMEOUT_IN_MS = 100; |