diff options
Diffstat (limited to 'host/lib/usrp/usrp_e100/io_impl.cpp')
-rw-r--r-- | host/lib/usrp/usrp_e100/io_impl.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/host/lib/usrp/usrp_e100/io_impl.cpp b/host/lib/usrp/usrp_e100/io_impl.cpp index 40b8a2393..aa6e7c485 100644 --- a/host/lib/usrp/usrp_e100/io_impl.cpp +++ b/host/lib/usrp/usrp_e100/io_impl.cpp @@ -17,6 +17,8 @@ #include "usrp_e100_impl.hpp" #include "usrp_e100_regs.hpp" +#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <uhd/usrp/dsp_utils.hpp> #include <uhd/utils/thread_priority.hpp> #include <uhd/transport/bounded_buffer.hpp> @@ -25,7 +27,7 @@ #include <boost/format.hpp> #include <boost/thread/thread.hpp> #include <boost/thread/barrier.hpp> -#include <iostream> +#include <sstream> using namespace uhd; using namespace uhd::usrp; @@ -37,7 +39,7 @@ using namespace uhd::transport; static const size_t rx_data_inline_sid = 1; static const size_t tx_async_report_sid = 2; static const int underflow_flags = async_metadata_t::EVENT_CODE_UNDERFLOW | async_metadata_t::EVENT_CODE_UNDERFLOW_IN_PACKET; -static const bool recv_debug = false; +#define fp_recv_debug false /*********************************************************************** * io impl details (internal to this file) @@ -116,12 +118,14 @@ void usrp_e100_impl::io_impl::recv_pirate_loop( managed_recv_buffer::sptr buff = this->data_xport->get_recv_buff(); if (not buff.get()) continue; //ignore timeout/error buffers - if (recv_debug){ - std::cout << "len " << buff->size() << std::endl; + if (fp_recv_debug){ + std::ostringstream ss; + ss << "len " << buff->size() << std::endl; for (size_t i = 0; i < 9; i++){ - std::cout << boost::format(" 0x%08x") % buff->cast<const boost::uint32_t *>()[i] << std::endl; + ss << boost::format(" 0x%08x") % buff->cast<const boost::uint32_t *>()[i] << std::endl; } - std::cout << std::endl << std::endl; + ss << std::endl << std::endl; + UHD_LOGV(always) << ss.str(); } try{ @@ -133,7 +137,7 @@ void usrp_e100_impl::io_impl::recv_pirate_loop( //handle an rx data packet or inline message if (if_packet_info.sid == rx_data_inline_sid){ - if (recv_debug) std::cout << "this is rx_data_inline_sid\n"; + if (fp_recv_debug) UHD_LOGV(always) << "this is rx_data_inline_sid\n"; //same number of frames as the data transport -> always immediate recv_pirate_booty.push_with_wait(buff); continue; @@ -141,7 +145,7 @@ void usrp_e100_impl::io_impl::recv_pirate_loop( //handle a tx async report message if (if_packet_info.sid == tx_async_report_sid and if_packet_info.packet_type != vrt::if_packet_info_t::PACKET_TYPE_DATA){ - if (recv_debug) std::cout << "this is tx_async_report_sid\n"; + if (fp_recv_debug) UHD_LOGV(always) << "this is tx_async_report_sid\n"; //fill in the async metadata async_metadata_t metadata; @@ -153,15 +157,15 @@ void usrp_e100_impl::io_impl::recv_pirate_loop( metadata.event_code = vrt_packet_handler::get_context_code<async_metadata_t::event_code_t>(vrt_hdr, if_packet_info); //print the famous U, and push the metadata into the message queue - if (metadata.event_code & underflow_flags) std::cerr << "U" << std::flush; + if (metadata.event_code & underflow_flags) UHD_MSG(fastpath) << "U"; async_msg_fifo.push_with_pop_on_full(metadata); continue; } - if (recv_debug) std::cout << "this is unknown packet\n"; + if (fp_recv_debug) UHD_LOGV(always) << "this is unknown packet\n"; }catch(const std::exception &e){ - std::cerr << "Error (usrp-e recv pirate loop): " << e.what() << std::endl; + UHD_MSG(error) << "Error (usrp-e recv pirate loop): " << e.what() << std::endl; } } } @@ -219,7 +223,7 @@ void usrp_e100_impl::issue_stream_cmd(const stream_cmd_t &stream_cmd){ } void usrp_e100_impl::handle_overrun(size_t){ - std::cerr << "O"; //the famous OOOOOOOOOOO + UHD_MSG(fastpath) << "O"; //the famous OOOOOOOOOOO if (_io_impl->continuous_streaming){ this->issue_stream_cmd(stream_cmd_t::STREAM_MODE_START_CONTINUOUS); } |