From 09be0518cee887878f3b070adea25eccc4c06e60 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 4 May 2011 19:53:01 -0700 Subject: uhd: removed more iostream stuff from usrp* implementations --- host/lib/usrp/usrp1/usrp1_iface.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'host/lib/usrp/usrp1/usrp1_iface.cpp') diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index 8f10df751..d7e8f601f 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -17,19 +17,17 @@ #include "usrp1_iface.hpp" #include "usrp_commands.h" +#include #include #include #include #include -#include #include using namespace uhd; using namespace uhd::usrp; using namespace uhd::transport; -static const bool iface_debug = false; - class usrp1_iface_impl : public usrp1_iface{ public: /******************************************************************* @@ -53,12 +51,11 @@ public: { boost::uint32_t swapped = uhd::htonx(value); - if (iface_debug) { - std::cout.fill('0'); - std::cout << "poke32("; - std::cout << std::dec << std::setw(2) << addr << ", 0x"; - std::cout << std::hex << std::setw(8) << value << ")" << std::endl; - } + UHD_LOGV(always) + << "poke32(" + << std::dec << std::setw(2) << addr << ", 0x" + << std::hex << std::setw(8) << value << ")" << std::endl + ; boost::uint8_t w_index_h = SPI_ENABLE_FPGA & 0xff; boost::uint8_t w_index_l = (SPI_FMT_MSB | SPI_FMT_HDR_1) & 0xff; @@ -129,8 +126,8 @@ public: bytes.size()); // TODO throw and catch i2c failures during eeprom read - if (iface_debug && (ret < 0)) - std::cerr << "USRP: failed i2c write: " << ret << std::endl; + if (ret < 0) + UHD_LOGV(often) << "USRP: failed i2c write: " << ret << std::endl; } byte_vector_t read_i2c(boost::uint8_t addr, size_t num_bytes) @@ -143,8 +140,8 @@ public: num_bytes); // TODO throw and catch i2c failures during eeprom read - if (iface_debug && ((ret < 0) || (unsigned)ret < (num_bytes))) { - std::cerr << "USRP: failed i2c read: " << ret << std::endl; + if (ret < 0 or (unsigned)ret < num_bytes) { + UHD_LOGV(often) << "USRP: failed i2c read: " << ret << std::endl; return byte_vector_t(num_bytes, 0xff); } -- cgit v1.2.3