From ea2a5c6e6756ec228d87c787e80c4921b1ca763e Mon Sep 17 00:00:00 2001 From: Ashish Chaudhari Date: Thu, 15 Jun 2017 15:40:09 -0700 Subject: x300: Added location info to FW ctrl error messages --- host/lib/usrp/x300/x300_fw_ctrl.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/x300/x300_fw_ctrl.cpp b/host/lib/usrp/x300/x300_fw_ctrl.cpp index 5ff40c966..38b7eb139 100644 --- a/host/lib/usrp/x300/x300_fw_ctrl.cpp +++ b/host/lib/usrp/x300/x300_fw_ctrl.cpp @@ -28,6 +28,7 @@ #include "x300_regs.hpp" #include #include +#include using namespace uhd; using namespace uhd::niusrprio; @@ -60,7 +61,7 @@ public: catch(const uhd::io_error &ex) { std::string error_msg = str(boost::format( - "x300 fw communication failure #%u\n%s") % i % ex.what()); + "%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,7 +81,7 @@ public: catch(const uhd::io_error &ex) { std::string error_msg = str(boost::format( - "x300 fw communication failure #%u\n%s") % i % ex.what()); + "%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 +95,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 +184,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 +297,11 @@ protected: __peek32(0); } + virtual std::string __loc_info(void) + { + return boost::lexical_cast(_drv_proxy->get_interface_num()); + } + private: niriok_proxy::sptr _drv_proxy; static const uint32_t READ_TIMEOUT_IN_MS = 100; -- cgit v1.2.3