Skip to content

Commit

Permalink
Fix uhd/utils/msg.hpp missing in newer UHD
Browse files Browse the repository at this point in the history
  • Loading branch information
chemeris committed Oct 31, 2019
1 parent 6c9567c commit 828c811
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 19 deletions.
7 changes: 7 additions & 0 deletions host/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
########################################################################
Expand Down
2 changes: 1 addition & 1 deletion host/cores/apply_corrections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
8 changes: 4 additions & 4 deletions host/cores/async_packet_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{

Expand Down Expand Up @@ -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");}
}


Expand Down
2 changes: 1 addition & 1 deletion host/cores/rx_dsp_core_200.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions host/cores/super_recv_packet_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -559,7 +559,7 @@ class recv_packet_handler{
rx_metadata_t metadata = curr_info.metadata;
_props[index].handle_overflow();
curr_info.metadata = metadata;
UHD_MSG(fastpath) << "O";
UHD_LOG_FASTPATH("O");
}
return;

Expand All @@ -576,7 +576,7 @@ class recv_packet_handler{
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;

}
Expand Down
2 changes: 1 addition & 1 deletion host/cores/super_send_packet_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion host/cores/tx_dsp_core_200.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion host/lms6002d_ctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion host/power_amp.cpp
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
2 changes: 1 addition & 1 deletion host/umtrx_fifo_ctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion host/umtrx_find.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion host/umtrx_iface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion host/umtrx_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
24 changes: 24 additions & 0 deletions host/umtrx_log_adapter.hpp
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion host/umtrx_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion host/utils/usrp_cal_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 828c811

Please sign in to comment.