summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/codec_ctrl.cpp6
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp16
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp11
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp10
4 files changed, 21 insertions, 22 deletions
diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp
index 0fdcedf62..796888b8f 100644
--- a/host/lib/usrp/usrp2/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp2/codec_ctrl.cpp
@@ -19,12 +19,10 @@
#include "ad9777_regs.hpp"
#include "ads62p44_regs.hpp"
#include "usrp2_regs.hpp"
+#include <uhd/utils/log.hpp>
#include <uhd/exception.hpp>
#include <boost/cstdint.hpp>
#include <boost/foreach.hpp>
-#include <iostream>
-
-static const bool codec_ctrl_debug = false;
using namespace uhd;
@@ -167,7 +165,7 @@ private:
void send_ad9777_reg(boost::uint8_t addr){
boost::uint16_t reg = _ad9777_regs.get_write_reg(addr);
- if (codec_ctrl_debug) std::cout << "send_ad9777_reg: " << std::hex << reg << std::endl;
+ UHD_LOGV(always) << "send_ad9777_reg: " << std::hex << reg << std::endl;
_iface->write_spi(
SPI_SS_AD9777, spi_config_t::EDGE_RISE,
reg, 16
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index 005be7ce4..33f249599 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -18,6 +18,8 @@
#include "../../transport/vrt_packet_handler.hpp"
#include "usrp2_impl.hpp"
#include "usrp2_regs.hpp"
+#include <uhd/utils/log.hpp>
+#include <uhd/utils/msg.hpp>
#include <uhd/exception.hpp>
#include <uhd/usrp/mboard_props.hpp>
#include <uhd/utils/byteswap.hpp>
@@ -266,15 +268,15 @@ void usrp2_impl::io_impl::recv_pirate_loop(
}
//print the famous U, and push the metadata into the message queue
- if (metadata.event_code & underflow_flags) std::cerr << "U" << std::flush;
- //else std::cout << "metadata.event_code " << metadata.event_code << std::endl;
+ if (metadata.event_code & underflow_flags) UHD_MSG(fastpath) << "U";
+ //else UHD_MSG(often) << "metadata.event_code " << metadata.event_code << std::endl;
async_msg_fifo.push_with_pop_on_full(metadata);
}
else{
//TODO unknown received packet, may want to print error...
}
}catch(const std::exception &e){
- std::cerr << "Error (usrp2 recv pirate loop): " << e.what() << std::endl;
+ UHD_MSG(error) << "Error (usrp2 recv pirate loop): " << e.what() << std::endl;
}
}
}
@@ -314,13 +316,13 @@ void usrp2_impl::update_xport_channel_mapping(void){
subdev_spec_t rx_subdev_spec = _mboards[i]->get_link()[MBOARD_PROP_RX_SUBDEV_SPEC].as<subdev_spec_t>();
for (size_t j = 0; j < rx_subdev_spec.size(); j++){
_io_impl->recv_map.push_back(i*usrp2_mboard_impl::MAX_NUM_DSPS+j);
- //std::cout << "recv_map.back() " << _io_impl->recv_map.back() << std::endl;
+ UHD_LOG << "recv_map.back() " << _io_impl->recv_map.back() << std::endl;
}
subdev_spec_t tx_subdev_spec = _mboards[i]->get_link()[MBOARD_PROP_TX_SUBDEV_SPEC].as<subdev_spec_t>();
for (size_t j = 0; j < tx_subdev_spec.size(); j++){
_io_impl->send_map.push_back(i*usrp2_mboard_impl::MAX_NUM_DSPS+j);
- //std::cout << "send_map.back() " << _io_impl->send_map.back() << std::endl;
+ UHD_LOG << "send_map.back() " << _io_impl->send_map.back() << std::endl;
}
}
@@ -395,7 +397,7 @@ static UHD_INLINE void extract_packet_info(
//handle the packet count / sequence number
if ((prev_info.packet_count+1)%16 != next_info.packet_count){
- std::cerr << "O" << std::flush; //report overflow (drops in the kernel)
+ UHD_MSG(fastpath) << "O"; //report overflow (drops in the kernel)
}
time = extract_time_spec(next_info);
@@ -504,7 +506,7 @@ size_t usrp2_impl::get_max_recv_samps_per_packet(void) const{
}
void usrp2_impl::handle_overflow(size_t chan){
- std::cerr << "O" << std::flush;
+ UHD_MSG(fastpath) << "O";
ldiv_t indexes = ldiv(chan, usrp2_mboard_impl::NUM_RX_DSPS);
_mboards.at(indexes.quot)->handle_overflow(indexes.rem);
}
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index d4ae27763..daccc0865 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -18,6 +18,8 @@
#include "usrp2_impl.hpp"
#include "usrp2_regs.hpp"
#include "fw_common.h"
+#include <uhd/utils/log.hpp>
+#include <uhd/utils/msg.hpp>
#include <uhd/utils/safe_call.hpp>
#include <uhd/exception.hpp>
#include <uhd/usrp/gps_ctrl.hpp>
@@ -29,7 +31,6 @@
#include <uhd/types/sensors.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/bind.hpp>
-#include <iostream>
static const double mimo_clock_delay_usrp2_rev4 = 4.18e-9;
static const double mimo_clock_delay_usrp_n2xx = 3.55e-9;
@@ -81,19 +82,19 @@ usrp2_mboard_impl::usrp2_mboard_impl(
}
//construct transports for dsp and async errors
- std::cout << "Making transport for DSP0..." << std::endl;
+ UHD_LOG << "Making transport for DSP0..." << std::endl;
device.dsp_xports.push_back(udp_zero_copy::make(
device_addr["addr"], BOOST_STRINGIZE(USRP2_UDP_DSP0_PORT), device_addr
));
init_xport(device.dsp_xports.back());
- std::cout << "Making transport for DSP1..." << std::endl;
+ UHD_LOG << "Making transport for DSP1..." << std::endl;
device.dsp_xports.push_back(udp_zero_copy::make(
device_addr["addr"], BOOST_STRINGIZE(USRP2_UDP_DSP1_PORT), device_addr
));
init_xport(device.dsp_xports.back());
- std::cout << "Making transport for ERR0..." << std::endl;
+ UHD_LOG << "Making transport for ERR0..." << std::endl;
device.err_xports.push_back(udp_zero_copy::make(
device_addr["addr"], BOOST_STRINGIZE(USRP2_UDP_ERR0_PORT), device_addr_t()
));
@@ -141,7 +142,7 @@ usrp2_mboard_impl::usrp2_mboard_impl(
else {
_mimo_clocking_mode_is_master = (_iface->peek32(_iface->regs.status) & (1 << 8)) != 0;
}
- std::cout << boost::format("mboard%d MIMO %s") % _index %
+ UHD_MSG(status) << boost::format("mboard%d MIMO %s") % _index %
(_mimo_clocking_mode_is_master?"master":"slave") << std::endl;
//init the clock config
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 558bcab2a..4eb5508e2 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -17,6 +17,8 @@
#include "usrp2_impl.hpp"
#include "fw_common.h"
+#include <uhd/utils/log.hpp>
+#include <uhd/utils/msg.hpp>
#include <uhd/exception.hpp>
#include <uhd/transport/if_addrs.hpp>
#include <uhd/transport/udp_zero_copy.hpp>
@@ -31,7 +33,6 @@
#include <boost/bind.hpp>
#include <boost/asio/ip/address_v4.hpp>
#include <boost/asio.hpp> //used for htonl and ntohl
-#include <iostream>
#include <vector>
using namespace uhd;
@@ -102,7 +103,6 @@ static device_addrs_t usrp2_find(const device_addr_t &hint_){
const usrp2_ctrl_data_t *ctrl_data_in = reinterpret_cast<const usrp2_ctrl_data_t *>(usrp2_ctrl_data_in_mem);
while(true){
size_t len = udp_transport->recv(asio::buffer(usrp2_ctrl_data_in_mem));
- //std::cout << len << "\n";
if (len > offsetof(usrp2_ctrl_data_t, data) and ntohl(ctrl_data_in->id) == USRP2_CTRL_ID_WAZZUP_DUDE){
//make a boost asio ipv4 with the raw addr in host byte order
@@ -189,7 +189,6 @@ static mtu_result_t determine_mtu(const std::string &addr, const mtu_result_t &u
while (min_recv_mtu < max_recv_mtu){
size_t test_mtu = (max_recv_mtu/2 + min_recv_mtu/2 + 3) & ~3;
- //std::cout << "recv_mtu " << mtu.recv_mtu << std::endl;
ctrl_data->id = htonl(USRP2_CTRL_ID_HOLLER_AT_ME_BRO);
ctrl_data->proto_ver = htonl(USRP2_FW_COMPAT_NUM);
@@ -206,7 +205,6 @@ static mtu_result_t determine_mtu(const std::string &addr, const mtu_result_t &u
while (min_send_mtu < max_send_mtu){
size_t test_mtu = (max_send_mtu/2 + min_send_mtu/2 + 3) & ~3;
- //std::cout << "send_mtu " << mtu.send_mtu << std::endl;
ctrl_data->id = htonl(USRP2_CTRL_ID_HOLLER_AT_ME_BRO);
ctrl_data->proto_ver = htonl(USRP2_FW_COMPAT_NUM);
@@ -262,8 +260,8 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
device_addr["recv_frame_size"] = boost::lexical_cast<std::string>(mtu.recv_mtu);
device_addr["send_frame_size"] = boost::lexical_cast<std::string>(mtu.send_mtu);
- std::cout << boost::format("Current recv frame size: %d bytes") % mtu.recv_mtu << std::endl;
- std::cout << boost::format("Current send frame size: %d bytes") % mtu.send_mtu << std::endl;
+ UHD_MSG(status) << boost::format("Current recv frame size: %d bytes") % mtu.recv_mtu << std::endl;
+ UHD_MSG(status) << boost::format("Current send frame size: %d bytes") % mtu.send_mtu << std::endl;
}
catch(const uhd::not_implemented_error &){
//just ignore this error, makes older fw work...