diff options
Diffstat (limited to 'host/lib/rfnoc/legacy_compat.cpp')
-rw-r--r-- | host/lib/rfnoc/legacy_compat.cpp | 59 |
1 files changed, 25 insertions, 34 deletions
diff --git a/host/lib/rfnoc/legacy_compat.cpp b/host/lib/rfnoc/legacy_compat.cpp index 7acaa898c..dc711b909 100644 --- a/host/lib/rfnoc/legacy_compat.cpp +++ b/host/lib/rfnoc/legacy_compat.cpp @@ -26,14 +26,14 @@ #include <uhd/types/stream_cmd.hpp> #include <uhd/types/direction.hpp> #include <uhd/types/ranges.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/utils/log.hpp> #include <uhd/transport/chdr.hpp> #include <uhd/usrp/multi_usrp.hpp> #include <boost/make_shared.hpp> #include <boost/assign.hpp> -#define UHD_LEGACY_LOG() UHD_LOGV(never) +#define UHD_LEGACY_LOG() UHD_LOGGER_TRACE("RFNOC") using namespace uhd::rfnoc; using uhd::usrp::subdev_spec_t; @@ -96,16 +96,6 @@ size_t calc_num_tx_chans_per_radio( ); } -double lambda_const_double(const double d) -{ - return d; -} - -uhd::meta_range_t lambda_const_meta_range(const double start, const double stop, const double step) -{ - return uhd::meta_range_t(start, stop, step); -} - /*! Recreate passed property without bound subscribers. Maintains current property value. */ template <typename T> @@ -114,6 +104,7 @@ static void recreate_property(const uhd::fs_path &path, uhd::property_tree::sptr tree->remove(path); tree->create<T>(path).set(temp); } + /************************************************************************ * Class Definition ***********************************************************************/ @@ -152,21 +143,21 @@ public: } connect_blocks(); if (args.has_key("skip_ddc")) { - UHD_LEGACY_LOG() << "[legacy_compat] Skipping DDCs by user request." << std::endl; + UHD_LEGACY_LOG() << "[legacy_compat] Skipping DDCs by user request." ; } else if (not _has_ddcs) { - UHD_MSG(warning) + UHD_LOGGER_WARNING("RFNOC") << "[legacy_compat] No DDCs detected. You will only be able to receive at the radio frontend rate." - << std::endl; + ; } if (args.has_key("skip_duc")) { - UHD_LEGACY_LOG() << "[legacy_compat] Skipping DUCs by user request." << std::endl; + UHD_LEGACY_LOG() << "[legacy_compat] Skipping DUCs by user request." ; } else if (not _has_ducs) { - UHD_MSG(warning) << "[legacy_compat] No DUCs detected. You will only be able to transmit at the radio frontend rate." << std::endl; + UHD_LOGGER_WARNING("RFNOC") << "[legacy_compat] No DUCs detected. You will only be able to transmit at the radio frontend rate." ; } if (args.has_key("skip_dram")) { - UHD_LEGACY_LOG() << "[legacy_compat] Skipping DRAM by user request." << std::endl; + UHD_LEGACY_LOG() << "[legacy_compat] Skipping DRAM by user request." ; } else if (not _has_dmafifo) { - UHD_MSG(warning) << "[legacy_compat] No DMA FIFO detected. You will only be able to transmit at slow rates." << std::endl; + UHD_LOGGER_WARNING("RFNOC") << "[legacy_compat] No DMA FIFO detected. You will only be able to transmit at slow rates." ; } for (size_t mboard = 0; mboard < _num_mboards; mboard++) { @@ -250,7 +241,7 @@ public: void issue_stream_cmd(const stream_cmd_t &stream_cmd, size_t mboard, size_t chan) { - UHD_LEGACY_LOG() << "[legacy_compat] issue_stream_cmd() " << std::endl; + UHD_LEGACY_LOG() << "[legacy_compat] issue_stream_cmd() " ; const size_t &radio_index = _rx_channel_map[mboard][chan].radio_index; const size_t &port_index = _rx_channel_map[mboard][chan].port_index; if (_has_ddcs) { @@ -268,9 +259,9 @@ public: args.otw_format = "sc16"; } _update_stream_args_for_streaming<uhd::RX_DIRECTION>(args, _rx_channel_map); - UHD_LEGACY_LOG() << "[legacy_compat] rx stream args: " << args.args.to_string() << std::endl; + UHD_LEGACY_LOG() << "[legacy_compat] rx stream args: " << args.args.to_string() ; uhd::rx_streamer::sptr streamer = _device->get_rx_stream(args); - BOOST_FOREACH(const size_t chan, args.channels) { + for(const size_t chan: args.channels) { _rx_stream_cache[chan] = streamer; } return streamer; @@ -285,9 +276,9 @@ public: args.otw_format = "sc16"; } _update_stream_args_for_streaming<uhd::TX_DIRECTION>(args, _tx_channel_map); - UHD_LEGACY_LOG() << "[legacy_compat] tx stream args: " << args.args.to_string() << std::endl; + UHD_LEGACY_LOG() << "[legacy_compat] tx stream args: " << args.args.to_string() ; uhd::tx_streamer::sptr streamer = _device->get_tx_stream(args); - BOOST_FOREACH(const size_t chan, args.channels) { + for(const size_t chan: args.channels) { _tx_stream_cache[chan] = streamer; } return streamer; @@ -341,14 +332,14 @@ public: if (_rx_stream_cache.count(chan)) { uhd::rx_streamer::sptr str_ptr = _rx_stream_cache[chan].lock(); if (str_ptr) { - BOOST_FOREACH(const rx_stream_map_type::value_type &chan_streamer_pair, _rx_stream_cache) { + for(const rx_stream_map_type::value_type &chan_streamer_pair: _rx_stream_cache) { if (chan_streamer_pair.second.lock() == str_ptr) { chans_to_change.insert(chan_streamer_pair.first); } } } } - BOOST_FOREACH(const size_t this_chan, chans_to_change) { + for(const size_t this_chan: chans_to_change) { size_t mboard, mb_chan; chan_to_mcp<uhd::RX_DIRECTION>(this_chan, _rx_channel_map, mboard, mb_chan); const size_t dsp_index = _rx_channel_map[mboard][mb_chan].radio_index; @@ -384,14 +375,14 @@ public: if (_tx_stream_cache.count(chan)) { uhd::tx_streamer::sptr str_ptr = _tx_stream_cache[chan].lock(); if (str_ptr) { - BOOST_FOREACH(const tx_stream_map_type::value_type &chan_streamer_pair, _tx_stream_cache) { + for(const tx_stream_map_type::value_type &chan_streamer_pair: _tx_stream_cache) { if (chan_streamer_pair.second.lock() == str_ptr) { chans_to_change.insert(chan_streamer_pair.first); } } } } - BOOST_FOREACH(const size_t this_chan, chans_to_change) { + for(const size_t this_chan: chans_to_change) { size_t mboard, mb_chan; chan_to_mcp<uhd::TX_DIRECTION>(this_chan, _tx_channel_map, mboard, mb_chan); const size_t dsp_index = _tx_channel_map[mboard][mb_chan].radio_index; @@ -582,7 +573,7 @@ private: // methods const size_t this_spp = get_block_ctrl<radio_ctrl>(i, RADIO_BLOCK_NAME, k)->get_arg<int>("spp"); if (this_spp != _rx_spp) { - UHD_LOG << str( + UHD_LOGGER_WARNING("RFNOC") << str( boost::format("[legacy compat] Radios have differing spp values: %s has %d, others have %d. UHD will use smaller spp value for all connections. Performance might be not optimal.") % radio_block_id.to_string() % this_spp % _rx_spp ); @@ -645,10 +636,10 @@ private: // methods ) ; _tree->create<double>(rx_dsp_base_path / "freq/value") - .set_publisher(boost::bind(&lambda_const_double, 0.0)) + .set_publisher([](){ return 0.0; }) ; _tree->create<uhd::meta_range_t>(rx_dsp_base_path / "freq/range") - .set_publisher(boost::bind(&lambda_const_meta_range, 0.0, 0.0, 0.0)) + .set_publisher([](){ return uhd::meta_range_t(0.0, 0.0, 0.0); }) ; } } @@ -678,10 +669,10 @@ private: // methods ) ; _tree->create<double>(tx_dsp_base_path / "freq/value") - .set_publisher(boost::bind(&lambda_const_double, 0.0)) + .set_publisher([](){ return 0.0; }) ; _tree->create<uhd::meta_range_t>(tx_dsp_base_path / "freq/range") - .set_publisher(boost::bind(&lambda_const_meta_range, 0.0, 0.0, 0.0)) + .set_publisher([](){ return uhd::meta_range_t(0.0, 0.0, 0.0); }) ; } } @@ -874,7 +865,7 @@ legacy_compat::sptr legacy_compat::make( if (legacy_cache.count(device.get()) and not legacy_cache.at(device.get()).expired()) { legacy_compat::sptr legacy_compat_copy = legacy_cache.at(device.get()).lock(); UHD_ASSERT_THROW(bool(legacy_compat_copy)); - UHD_LEGACY_LOG() << "[legacy_compat] Using existing legacy compat object for this device." << std::endl; + UHD_LEGACY_LOG() << "[legacy_compat] Using existing legacy compat object for this device." ; return legacy_compat_copy; } |