[PATCH] osmo-bts[master]: octphy: add conditional compilation to support latest octasi...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Thu Mar 2 17:01:28 UTC 2017


Review at  https://gerrit.osmocom.org/1964

octphy: add conditional compilation to support latest octasic header release

With octasics latest release (octsdr-2g-02.07.01-B1351-beta), some struct
members are moved or renamed. This patch adds ifdef-logic and configure
checks to restore compatibilty.

Change-Id: I73287983e8bed8bf64b2ab87e6b810c2c59ea6fd
---
M configure.ac
M src/osmo-bts-octphy/octphy_hw_api.c
M src/osmo-bts-octphy/octphy_vty.c
3 files changed, 74 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/64/1964/1

diff --git a/configure.ac b/configure.ac
index 001e10e..cbfbf12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,10 +72,46 @@
 if test "$enable_octphy" = "yes" ; then
 	oldCPPFLAGS=$CPPFLAGS
 	CPPFLAGS="$CPPFLAGS -I$OCTSDR2G_INCDIR -I$srcdir/include $LIBOSMOCORE_CFLAGS"
+
 	AC_CHECK_HEADER([octphy/octvc1/gsm/octvc1_gsm_default.h],[],
 			[AC_MSG_ERROR([octphy/octvc1/gsm/octvc1_gsm_default.h can not be found in $octsdr2g_incdir])],
 			[#include <octphy/octvc1/gsm/octvc1_gsm_default.h>])
-	AC_CHECK_MEMBER([tOCTVC1_GSM_TRX_CONFIG.usCentreArfcn], AC_DEFINE([OCTPHY_MULTI_TRX], [1], [Define to 1 if your octphy header files support multi-trx]), [], [#include <octphy/octvc1/gsm/octvc1_gsm_api.h>])
+
+	AC_CHECK_MEMBER([tOCTVC1_GSM_TRX_CONFIG.usCentreArfcn],
+			AC_DEFINE([OCTPHY_MULTI_TRX],
+			[1],
+			[Define to 1 if your octphy header files support multi-trx]),
+			[],
+			[#include <octphy/octvc1/gsm/octvc1_gsm_api.h>])
+
+	AC_CHECK_MEMBER([tOCTVC1_HW_RF_PORT_RX_STATS.Frequency],
+			AC_DEFINE([OCTPHY_USE_FREQUENCY],
+			[1],
+			[Define to 1 if your octphy header files support tOCTVC1_RADIO_FREQUENCY_VALUE type]),
+			[],
+			[#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+	AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulSyncLossCnt],
+			AC_DEFINE([OCTPHY_USE_SYNC_LOSS_CNT],
+			[1],
+			[Define to 1 if your octphy header files renamed ulSyncLosseCnt to ulSyncLossCnt]),
+			[],
+			[#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+	AC_CHECK_MEMBER([tOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_TX_CONFIG_RSP.TxConfig],
+			AC_DEFINE([OCTPHY_USE_TX_CONFIG],
+			[1],
+			[Define to 1 if your octphy header files support tOCTVC1_HW_RF_PORT_ANTENNA_TX_CONFIG type]),
+			[],
+			[#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+	AC_CHECK_MEMBER([tOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_RX_CONFIG_RSP.RxConfig],
+			AC_DEFINE([OCTPHY_USE_RX_CONFIG],
+			[1],
+			[Define to 1 if your octphy header files support tOCTVC1_HW_RF_PORT_ANTENNA_RX_CONFIG type]),
+			[],
+			[#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
 	CPPFLAGS=$oldCPPFLAGS
 fi
 
diff --git a/src/osmo-bts-octphy/octphy_hw_api.c b/src/osmo-bts-octphy/octphy_hw_api.c
index 6666f77..322f884 100644
--- a/src/osmo-bts-octphy/octphy_hw_api.c
+++ b/src/osmo-bts-octphy/octphy_hw_api.c
@@ -125,11 +125,19 @@
 		psr->RxStats.ulRxByteCnt, psr->RxStats.ulRxOverflowCnt,
 		psr->RxStats.ulRxAverageBytePerSecond,
 		psr->RxStats.ulRxAveragePeriodUs,
+#if OCTPHY_USE_FREQUENCY == 1
+		psr->RxStats.Frequency.ulValue,
+#else
 		psr->RxStats.ulFrequencyKhz,
+#endif
 		psr->TxStats.ulTxByteCnt, psr->TxStats.ulTxUnderflowCnt,
 		psr->TxStats.ulTxAverageBytePerSecond,
 		psr->TxStats.ulTxAveragePeriodUs,
+#if OCTPHY_USE_FREQUENCY == 1
+		psr->TxStats.Frequency.ulValue);
+#else
 		psr->TxStats.ulFrequencyKhz);
+#endif
 
 	get_cb_data = (struct octphy_hw_get_cb_data*) data;
 	get_cb_data->cb(resp,get_cb_data->data);
@@ -177,10 +185,15 @@
 	LOGP(DL1C, LOGL_INFO, "ANT-RX-CONFIG.resp(Port=%u, Ant=%u): %s, "
 		"Gain %d dB, GainCtrlMode=%s\n",
 		arc->ulPortIndex,  arc->ulAntennaIndex,
+#ifdef OCTPHY_USE_RX_CONFIG
+		arc->RxConfig.ulEnableFlag ? "Enabled" : "Disabled",
+		arc->RxConfig.lRxGaindB/512,
+		get_value_string(rx_gain_mode_vals, arc->RxConfig.ulRxGainMode));
+#else
 		arc->ulEnableFlag ? "Enabled" : "Disabled",
 		arc->lRxGaindB/512,
 		get_value_string(rx_gain_mode_vals, arc->ulRxGainMode));
-
+#endif
 	msgb_free(resp);
 	return 0;
 }
@@ -219,9 +232,14 @@
 	LOGP(DL1C, LOGL_INFO, "ANT-TX-CONFIG.resp(Port=%u, Ant=%u): %s, "
 		"Gain %d dB\n",
 		atc->ulPortIndex, atc->ulAntennaIndex,
+#ifdef OCTPHY_USE_TX_CONFIG
+		atc->TxConfig.ulEnableFlag? "Enabled" : "Disabled",
+		atc->TxConfig.lTxGaindB/512);
+#else
 		atc->ulEnableFlag ? "Enabled" : "Disabled",
 		atc->lTxGaindB/512);
 
+#endif
 	msgb_free(resp);
 	return 0;
 }
@@ -326,7 +344,12 @@
 		get_value_string(clocksync_state_vals, csr->ulState),
 	       	csr->lClockError, csr->lDroppedCycles, csr->ulPllFreqHz,
 		csr->ulPllFractionalFreqHz, csr->ulSlipCnt,
-		csr->ulSyncLosseCnt, csr->ulSourceState, csr->ulDacValue);
+#if OCTPHY_USE_SYNC_LOSS_CNT == 1
+		csr->ulSyncLossCnt,
+#else
+		csr->ulSyncLosseCnt,
+#endif
+		csr->ulSourceState, csr->ulDacValue);
 
 	get_cb_data = (struct octphy_hw_get_cb_data*) data;
 	get_cb_data->cb(resp,get_cb_data->data);
diff --git a/src/osmo-bts-octphy/octphy_vty.c b/src/osmo-bts-octphy/octphy_vty.c
index bc4acd6..370aff6 100644
--- a/src/osmo-bts-octphy/octphy_vty.c
+++ b/src/osmo-bts-octphy/octphy_vty.c
@@ -187,7 +187,11 @@
 		VTY_NEWLINE);
 	vty_out(vty, "Rx Period=%u%s", psr->RxStats.ulRxAveragePeriodUs,
 		VTY_NEWLINE);
+#if OCTPHY_USE_FREQUENCY == 1
+	vty_out(vty, "Rx Freq=%u%s", psr->RxStats.Frequency.ulValue, VTY_NEWLINE);
+#else
 	vty_out(vty, "Rx Freq=%u%s", psr->RxStats.ulFrequencyKhz, VTY_NEWLINE);
+#endif
 	vty_out(vty, "Tx Bytes=%u%s", psr->TxStats.ulTxByteCnt, VTY_NEWLINE);
 	vty_out(vty, "Tx Underflow=%u%s", psr->TxStats.ulTxUnderflowCnt,
 		VTY_NEWLINE);
@@ -195,7 +199,11 @@
 		VTY_NEWLINE);
 	vty_out(vty, "Tx Period=%u%s", psr->TxStats.ulTxAveragePeriodUs,
 		VTY_NEWLINE);
+#if OCTPHY_USE_FREQUENCY == 1
+	vty_out(vty, "Tx Freq=%u%s", psr->TxStats.Frequency.ulValue, VTY_NEWLINE);
+#else
 	vty_out(vty, "Tx Freq=%u%s", psr->TxStats.ulFrequencyKhz, VTY_NEWLINE);
+#endif
 }
 
 DEFUN(show_rf_port_stats, show_rf_port_stats_cmd,
@@ -243,7 +251,11 @@
 	vty_out(vty, "PllFreqHz=%u%s", csr->ulPllFreqHz, VTY_NEWLINE);
 	vty_out(vty, "PllFract=%u%s", csr->ulPllFractionalFreqHz, VTY_NEWLINE);
 	vty_out(vty, "SlipCnt=%u%s", csr->ulSlipCnt, VTY_NEWLINE);
+#if OCTPHY_USE_SYNC_LOSS_CNT == 1
+	vty_out(vty, "SyncLosses=%u%s", csr->ulSyncLossCnt, VTY_NEWLINE);
+#else
 	vty_out(vty, "SyncLosses=%u%s", csr->ulSyncLosseCnt, VTY_NEWLINE);
+#endif
 	vty_out(vty, "SourceState=%u%s", csr->ulSourceState, VTY_NEWLINE);
 	vty_out(vty, "DacValue=%u%s", csr->ulDacValue, VTY_NEWLINE);
 }

-- 
To view, visit https://gerrit.osmocom.org/1964
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73287983e8bed8bf64b2ab87e6b810c2c59ea6fd
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list