diff options
Diffstat (limited to 'host/lib/usrp/usrp2/io_impl.cpp')
-rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 224519944..992d70835 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -23,7 +23,7 @@ #include "usrp2_regs.hpp" #include "fw_common.h" #include <uhd/utils/log.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/utils/tasks.hpp> #include <uhd/exception.hpp> #include <uhd/utils/byteswap.hpp> @@ -209,7 +209,7 @@ void usrp2_impl::io_impl::recv_pirate_loop( fc_mon.update_fc_condition(uhd::ntohx(fc_word32)); continue; } - //else UHD_MSG(often) << "metadata.event_code " << metadata.event_code << std::endl; + //else UHD_LOGGER_DEBUG("USRP2") << "metadata.event_code " << metadata.event_code; async_msg_fifo.push_with_pop_on_full(metadata); standard_async_msg_prints(metadata); @@ -218,7 +218,7 @@ void usrp2_impl::io_impl::recv_pirate_loop( //TODO unknown received packet, may want to print error... } }catch(const std::exception &e){ - UHD_MSG(error) << "Error in recv pirate loop: " << e.what() << std::endl; + UHD_LOGGER_ERROR("USRP2") << "Error in recv pirate loop: " << e.what() ; } } } @@ -231,7 +231,7 @@ void usrp2_impl::io_init(void){ _io_impl = UHD_PIMPL_MAKE(io_impl, ()); //init first so we dont have an access race - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ //init the tx xport and flow control monitor _io_impl->tx_xports.push_back(_mbc[mb].tx_dsp_xport); _io_impl->fc_mons.push_back(flow_control_monitor::sptr(new flow_control_monitor( @@ -241,14 +241,14 @@ void usrp2_impl::io_init(void){ } //allocate streamer weak ptrs containers - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ _mbc[mb].rx_streamers.resize(_mbc[mb].rx_dsps.size()); _mbc[mb].tx_streamers.resize(1/*known to be 1 dsp*/); } //create a new pirate thread for each zc if (yarr!!) size_t index = 0; - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ //spawn a new pirate to plunder the recv booty _io_impl->pirate_tasks.push_back(task::make(boost::bind( &usrp2_impl::io_impl::recv_pirate_loop, _io_impl.get(), @@ -261,7 +261,7 @@ void usrp2_impl::update_tick_rate(const double rate){ _io_impl->tick_rate = rate; //shadow for async msg //update the tick rate on all existing streamers -> thread safe - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ for (size_t i = 0; i < _mbc[mb].rx_streamers.size(); i++){ boost::shared_ptr<sph::recv_packet_streamer> my_streamer = boost::dynamic_pointer_cast<sph::recv_packet_streamer>(_mbc[mb].rx_streamers[i].lock()); @@ -298,15 +298,15 @@ void usrp2_impl::update_tx_samp_rate(const std::string &mb, const size_t dsp, co } void usrp2_impl::update_rates(void){ - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ fs_path root = "/mboards/" + mb; _tree->access<double>(root / "tick_rate").update(); //and now that the tick rate is set, init the host rates to something - BOOST_FOREACH(const std::string &name, _tree->list(root / "rx_dsps")){ + for(const std::string &name: _tree->list(root / "rx_dsps")){ _tree->access<double>(root / "rx_dsps" / name / "rate" / "value").update(); } - BOOST_FOREACH(const std::string &name, _tree->list(root / "tx_dsps")){ + for(const std::string &name: _tree->list(root / "tx_dsps")){ _tree->access<double>(root / "tx_dsps" / name / "rate" / "value").update(); } } @@ -330,7 +330,7 @@ void usrp2_impl::update_rx_subdev_spec(const std::string &which_mb, const subdev //compute the new occupancy and resize _mbc[which_mb].rx_chan_occ = spec.size(); size_t nchan = 0; - BOOST_FOREACH(const std::string &mb, _mbc.keys()) nchan += _mbc[mb].rx_chan_occ; + for(const std::string &mb: _mbc.keys()) nchan += _mbc[mb].rx_chan_occ; } void usrp2_impl::update_tx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec){ @@ -346,7 +346,7 @@ void usrp2_impl::update_tx_subdev_spec(const std::string &which_mb, const subdev //compute the new occupancy and resize _mbc[which_mb].tx_chan_occ = spec.size(); size_t nchan = 0; - BOOST_FOREACH(const std::string &mb, _mbc.keys()) nchan += _mbc[mb].tx_chan_occ; + for(const std::string &mb: _mbc.keys()) nchan += _mbc[mb].tx_chan_occ; } /*********************************************************************** @@ -375,10 +375,10 @@ void usrp2_impl::program_stream_dest( //user has provided an alternative address and port for destination if (args.args.has_key("addr") and args.args.has_key("port")){ - UHD_MSG(status) << boost::format( - "Programming streaming destination for custom address.\n" - "IPv4 Address: %s, UDP Port: %s\n" - ) % args.args["addr"] % args.args["port"] << std::endl; + UHD_LOGGER_INFO("USRP2") << boost::format( + "Programming streaming destination for custom address. " + "IPv4 Address: %s, UDP Port: %s" + ) % args.args["addr"] % args.args["port"]; asio::io_service io_service; asio::ip::udp::resolver resolver(io_service); @@ -388,7 +388,7 @@ void usrp2_impl::program_stream_dest( stream_ctrl.udp_port = uhd::htonx(uint32_t(endpoint.port())); for (size_t i = 0; i < 3; i++){ - UHD_MSG(status) << "ARP attempt " << i << std::endl; + UHD_LOGGER_INFO("USRP2") << "ARP attempt " << i; managed_send_buffer::sptr send_buff = xport->get_send_buff(); std::memcpy(send_buff->cast<void *>(), &stream_ctrl, sizeof(stream_ctrl)); send_buff->commit(sizeof(stream_ctrl)); @@ -398,7 +398,7 @@ void usrp2_impl::program_stream_dest( if (recv_buff and recv_buff->size() >= sizeof(uint32_t)){ const uint32_t result = uhd::ntohx(recv_buff->cast<const uint32_t *>()[0]); if (result == 0){ - UHD_MSG(status) << "Success! " << std::endl; + UHD_LOGGER_INFO("USRP2") << "Success! "; return; } } @@ -454,7 +454,7 @@ rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args_){ for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){ const size_t chan = args.channels[chan_i]; size_t num_chan_so_far = 0; - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ num_chan_so_far += _mbc[mb].rx_chan_occ; if (chan < num_chan_so_far){ const size_t dsp = chan + _mbc[mb].rx_chan_occ - num_chan_so_far; @@ -524,7 +524,7 @@ tx_streamer::sptr usrp2_impl::get_tx_stream(const uhd::stream_args_t &args_){ const size_t chan = args.channels[chan_i]; size_t num_chan_so_far = 0; size_t abs = 0; - BOOST_FOREACH(const std::string &mb, _mbc.keys()){ + for(const std::string &mb: _mbc.keys()){ num_chan_so_far += _mbc[mb].tx_chan_occ; if (chan < num_chan_so_far){ const size_t dsp = chan + _mbc[mb].tx_chan_occ - num_chan_so_far; |