uhd: Add support for UHD-3.11 logging control

The logging API changes in UHD-3.11, which causes build failure if
not properly handled.

Change-Id: I223ebb9fae3f4061e0cb37c05263c1b569e8f628
This commit is contained in:
Tom Tsou 2017-03-07 14:16:46 -08:00
parent 2dee3e996e
commit 72bf762b42
2 changed files with 16 additions and 7 deletions

View File

@ -28,12 +28,15 @@
#include <uhd/property_tree.hpp>
#include <uhd/usrp/multi_usrp.hpp>
#include <uhd/utils/thread_priority.hpp>
#include <uhd/utils/msg.hpp>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef USE_UHD_3_11
#include <uhd/utils/msg.hpp>
#endif
#define B2XX_CLK_RT 26e6
#define B2XX_MCBTS_CLK_RT 3.2e6
#define E1XX_CLK_RT 52e6
@ -84,7 +87,7 @@ struct uhd_dev_offset {
/*
* USRP version dependent device timings
*/
#ifdef USE_UHD_3_9
#if defined(USE_UHD_3_9) || defined(USE_UHD_3_11)
#define B2XX_TIMING_1SPS 1.7153e-4
#define B2XX_TIMING_4SPS 1.1696e-4
#define B2XX_TIMING_4_4SPS 6.18462e-5
@ -383,7 +386,8 @@ void *async_event_loop(uhd_device *dev)
return NULL;
}
/*
#ifndef USE_UHD_3_11
/*
Catch and drop underrun 'U' and overrun 'O' messages from stdout
since we already report using the logging facility. Direct
everything else appropriately.
@ -404,6 +408,7 @@ void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg)
break;
}
}
#endif
static void thread_enable_cancel(bool cancel)
{
@ -995,9 +1000,10 @@ bool uhd_device::start()
return false;
}
#ifndef USE_UHD_3_11
// Register msg handler
uhd::msg::register_handler(&uhd_msg_handler);
#endif
// Start asynchronous event (underrun check) loop
async_event_thrd = new Thread();
async_event_thrd->start((void * (*)(void*))async_event_loop, (void*)this);

View File

@ -97,9 +97,12 @@ AS_IF([test "x$with_usrp1" = "xyes"], [
])
AS_IF([test "x$with_usrp1" != "xyes"],[
PKG_CHECK_MODULES(UHD, uhd >= 003.009,
[AC_DEFINE(USE_UHD_3_9, 1, UHD version 3.9.0 or higher)],
[PKG_CHECK_MODULES(UHD, uhd >= 003.005.004)]
PKG_CHECK_MODULES(UHD, uhd >= 003.011,
[AC_DEFINE(USE_UHD_3_11, 1, UHD version 3.11.0 or higher)],
[PKG_CHECK_MODULES(UHD, uhd >= 003.009,
[AC_DEFINE(USE_UHD_3_9, 1, UHD version 3.9.0 or higher)],
[PKG_CHECK_MODULES(UHD, uhd >= 003.005)]
)]
)
AC_DEFINE(USE_UHD, 1, All UHD versions)
PKG_CHECK_MODULES(FFTWF, fftw3f)