aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1/usrp1_iface.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-05-04 19:53:01 -0700
committerJosh Blum <josh@joshknows.com>2011-05-04 19:53:01 -0700
commit09be0518cee887878f3b070adea25eccc4c06e60 (patch)
treed25df33a4860116d51fd5ac49753739397948353 /host/lib/usrp/usrp1/usrp1_iface.cpp
parent805da3ef3d5b04dfa39587c531a3415b09d2ea5b (diff)
downloaduhd-09be0518cee887878f3b070adea25eccc4c06e60.tar.gz
uhd-09be0518cee887878f3b070adea25eccc4c06e60.tar.bz2
uhd-09be0518cee887878f3b070adea25eccc4c06e60.zip
uhd: removed more iostream stuff from usrp* implementations
Diffstat (limited to 'host/lib/usrp/usrp1/usrp1_iface.cpp')
-rw-r--r--host/lib/usrp/usrp1/usrp1_iface.cpp23
1 files changed, 10 insertions, 13 deletions
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 <uhd/utils/log.hpp>
#include <uhd/exception.hpp>
#include <uhd/utils/byteswap.hpp>
#include <boost/format.hpp>
#include <stdexcept>
-#include <iostream>
#include <iomanip>
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);
}