Fix uhd/utils/msg.hpp missing in newer UHD

This commit is contained in:
Alexander Chemeris
2019-10-30 23:44:39 +03:00
parent 6c9567c46f
commit 828c811f79
16 changed files with 50 additions and 19 deletions

View File

@@ -77,6 +77,13 @@ list(APPEND UMTRX_LIBRARIES ${UHD_LIBRARIES})
MESSAGE(STATUS "UHD include directories: ${UHD_INCLUDE_DIRS}")
MESSAGE(STATUS "UHD libraries: ${UHD_LIBRARIES}")
if (EXISTS "${UHD_INCLUDE_DIRS}/uhd/utils/msg.hpp")
add_definitions(-DUHD_HAS_MSG_HPP)
message(STATUS " use msg.hpp for logging")
else()
message(STATUS " use log.hpp for logging")
endif()
########################################################################
# Setup Boost
########################################################################

View File

@@ -18,7 +18,7 @@
#include "apply_corrections.hpp"
#include <uhd/usrp/dboard_eeprom.hpp>
#include <uhd/utils/paths.hpp>
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/utils/csv.hpp>
#include <uhd/types/dict.hpp>
#include <boost/filesystem.hpp>

View File

@@ -22,7 +22,7 @@
#include <uhd/transport/vrt_if_packet.hpp>
#include <uhd/types/metadata.hpp>
#include <uhd/utils/byteswap.hpp>
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
namespace uhd{ namespace usrp{
@@ -55,14 +55,14 @@ namespace uhd{ namespace usrp{
if (metadata.event_code &
( async_metadata_t::EVENT_CODE_UNDERFLOW
| async_metadata_t::EVENT_CODE_UNDERFLOW_IN_PACKET)
) UHD_MSG(fastpath) << "U";
) {UHD_LOG_FASTPATH("U");}
else if (metadata.event_code &
( async_metadata_t::EVENT_CODE_SEQ_ERROR
| async_metadata_t::EVENT_CODE_SEQ_ERROR_IN_BURST)
) UHD_MSG(fastpath) << "S";
) {UHD_LOG_FASTPATH("S");}
else if (metadata.event_code &
async_metadata_t::EVENT_CODE_TIME_ERROR
) UHD_MSG(fastpath) << "L";
) {UHD_LOG_FASTPATH("L");}
}

View File

@@ -18,7 +18,7 @@
#include "rx_dsp_core_200.hpp"
#include <uhd/types/dict.hpp>
#include <uhd/exception.hpp>
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/utils/safe_call.hpp>
#include <uhd/utils/algorithm.hpp>
#include <boost/assign/list_of.hpp>

View File

@@ -22,7 +22,7 @@
#include <uhd/exception.hpp>
#include <uhd/convert.hpp>
#include <uhd/stream.hpp>
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/utils/tasks.hpp>
#include <uhd/utils/atomic.hpp>
#include <uhd/utils/byteswap.hpp>
@@ -559,7 +559,7 @@ private:
rx_metadata_t metadata = curr_info.metadata;
_props[index].handle_overflow();
curr_info.metadata = metadata;
UHD_MSG(fastpath) << "O";
UHD_LOG_FASTPATH("O");
}
return;
@@ -576,7 +576,7 @@ private:
prev_info[index].ifpi.num_payload_words32*sizeof(boost::uint32_t)/_bytes_per_otw_item, _samp_rate);
curr_info.metadata.out_of_sequence = true;
curr_info.metadata.error_code = rx_metadata_t::ERROR_CODE_OVERFLOW;
UHD_MSG(fastpath) << "D";
UHD_LOG_FASTPATH("D");
return;
}

View File

@@ -22,7 +22,7 @@
#include <uhd/exception.hpp>
#include <uhd/convert.hpp>
#include <uhd/stream.hpp>
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/utils/tasks.hpp>
#include <uhd/utils/atomic.hpp>
#include <uhd/utils/byteswap.hpp>

View File

@@ -18,7 +18,7 @@
#include "tx_dsp_core_200.hpp"
#include <uhd/types/dict.hpp>
#include <uhd/exception.hpp>
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/utils/algorithm.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/math/special_functions/round.hpp>

View File

@@ -10,7 +10,7 @@
#include <uhd/utils/static.hpp>
#include <uhd/utils/assert_has.hpp>
#include <uhd/utils/algorithm.hpp>
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/types/ranges.hpp>
#include <uhd/types/sensors.hpp>
#include <uhd/types/dict.hpp>

View File

@@ -1,5 +1,5 @@
#include "power_amp.hpp"
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/exception.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/foreach.hpp>

View File

@@ -17,7 +17,7 @@
#include "umtrx_regs.hpp"
#include <uhd/exception.hpp>
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/utils/safe_call.hpp>
#include <uhd/transport/vrt_if_packet.hpp>
#include "umtrx_fifo_ctrl.hpp"

View File

@@ -17,7 +17,7 @@
#include "usrp2/fw_common.h"
#include "umtrx_iface.hpp"
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/utils/log.hpp>
#include <uhd/utils/byteswap.hpp>
#include <uhd/types/device_addr.hpp>

View File

@@ -20,7 +20,7 @@
#include "umtrx_impl.hpp"
#include "umtrx_iface.hpp"
#include <uhd/exception.hpp>
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include "missing/platform.hpp"
#include <uhd/utils/tasks.hpp>
#include <uhd/utils/safe_call.hpp>

View File

@@ -18,9 +18,9 @@
#include "umtrx_impl.hpp"
#include "umtrx_regs.hpp"
#include "umtrx_version.hpp"
#include "umtrx_log_adapter.hpp"
#include "cores/apply_corrections.hpp"
#include <uhd/utils/log.hpp>
#include <uhd/utils/msg.hpp>
#include <boost/bind.hpp>
#include <boost/thread.hpp> //sleep
#include <boost/assign/list_of.hpp>

View File

@@ -0,0 +1,24 @@
#ifndef UMTRX_LOG_ADAPTER_HPP
#define UMTRX_LOG_ADAPTER_HPP
#ifdef UHD_HAS_MSG_HPP
#include <uhd/utils/msg.hpp>
#define UHD_LOG_FASTPATH(message) UHD_MSG(fastpath) << (message)
#else // UHD_HAS_MSG_HPP
#include <uhd/utils/log.hpp>
enum {
_uhd_log_level_status,
_uhd_log_level_warning,
_uhd_log_level_error
};
#define UHD_MSG(severity) ((_uhd_log_level_##severity==_uhd_log_level_status)?UHD_LOGGER_INFO("UmTRX"): \
(_uhd_log_level_##severity==_uhd_log_level_warning)?UHD_LOGGER_WARNING("UmTRX"): \
UHD_LOGGER_ERROR("UmTRX"))
#endif // UHD_HAS_MSG_HPP
#endif // UMTRX_LOG_ADAPTER_HPP

View File

@@ -16,7 +16,7 @@
//
#include "umtrx_impl.hpp"
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/types/sensors.hpp>
#include <uhd/types/ranges.hpp>
#include <boost/asio.hpp>

View File

@@ -18,7 +18,7 @@
#include <uhd/utils/paths.hpp>
#include <uhd/utils/thread_priority.hpp>
#include <uhd/utils/algorithm.hpp>
#include <uhd/utils/msg.hpp>
#include "umtrx_log_adapter.hpp"
#include <uhd/property_tree.hpp>
#include <uhd/usrp/multi_usrp.hpp>
#include <uhd/usrp/dboard_eeprom.hpp>