aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-12-14 13:30:01 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2018-12-14 13:30:07 +0100
commit03b11620d9314465f8482ff234b78441496111a0 (patch)
treeac05d7a02914eaef9bc69e8e84d362b77492290f
parent25185886f015201c97956ca9f400aa2bdbbeec27 (diff)
lms: Fix build against LimeSuite > 18.10
LimeSuite dc124e4e2ed9b549b142410af172f0592f9f0c23 > 18.10 broke API compatibility. OS#3729 Change-Id: Idf500a5b39a857233f728c6a4316c00a99374556
-rw-r--r--Transceiver52M/device/lms/LMSDevice.cpp22
-rw-r--r--configure.ac14
2 files changed, 34 insertions, 2 deletions
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index 270bd4a..b004308 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -41,6 +41,24 @@ constexpr double LMSDevice::masterClockRate;
#define LMS_MIN_BW_SUPPORTED 2.5e6 /* 2.5mHz, minimum supported by LMS */
#define LMS_CALIBRATE_BW_HZ OSMO_MAX(GSM_CARRIER_BW, LMS_MIN_BW_SUPPORTED)
+static int compat_LMS_VCTCXORead(lms_device_t *dev, uint16_t *val, bool memory)
+{
+#if HAVE_LMS_VCTCXO_EEPROM_SAVING
+ return LMS_VCTCXORead(dev, val, memory);
+#else
+ return LMS_VCTCXORead(dev, val);
+#endif
+}
+
+static int compat_LMS_VCTCXOWrite(lms_device_t *dev, uint16_t val, bool memory)
+{
+#if HAVE_LMS_VCTCXO_EEPROM_SAVING
+ return LMS_VCTCXOWrite(dev, val, memory);
+#else
+ return LMS_VCTCXOWrite(dev, val);
+#endif
+}
+
LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset,
const std::vector<std::string>& tx_paths,
const std::vector<std::string>& rx_paths):
@@ -195,10 +213,10 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
case REF_INTERNAL:
LOGC(DDEV, INFO) << "Setting Internal clock reference";
/* Ugly API: Selecting clock source implicit by writing to VCTCXO DAC ?!? */
- if (LMS_VCTCXORead(m_lms_dev, &dac_val) < 0)
+ if (compat_LMS_VCTCXORead(m_lms_dev, &dac_val, false) < 0)
goto out_close;
LOGC(DDEV, INFO) << "Setting VCTCXO to " << dac_val;
- if (LMS_VCTCXOWrite(m_lms_dev, dac_val) < 0)
+ if (compat_LMS_VCTCXOWrite(m_lms_dev, dac_val, false) < 0)
goto out_close;
break;
case REF_EXTERNAL:
diff --git a/configure.ac b/configure.ac
index 2e036ba..37b70fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -160,6 +160,20 @@ AS_IF([test "x$with_usrp1" = "xyes"], [
AS_IF([test "x$with_lms" = "xyes"], [
PKG_CHECK_MODULES(LMS, LimeSuite)
+
+ # LimeSuite dc124e4e2ed9b549b142410af172f0592f9f0c23 > 18.10 broke API compatibility:
+ _cflags_save=$CFLAGS
+ CFLAGS="$CFLAGS $LMS_CFLAGS"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <lime/LimeSuite.h>]],
+ [[LMS_VCTCXOWrite(NULL, 0, false); LMS_VCTCXORead(NULL, 0, false);]]
+ )],
+ [AC_DEFINE([HAVE_LMS_VCTCXO_EEPROM_SAVING], [1],
+ [LMS_VCTCXO* requires memory parameter])],
+ [AC_DEFINE([HAVE_LMS_VCTCXO_EEPROM_SAVING], [0],
+ [LMS_VCTCXO* has no memory parameter])])
+ CFLAGS=$_cflags_save
])
AS_IF([test "x$with_uhd" != "xno"],[