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
This commit is contained in:
Philipp Maier 2017-03-02 12:43:47 +01:00
parent 7a21dccec1
commit e4403464ed
3 changed files with 74 additions and 3 deletions

View File

@ -72,10 +72,46 @@ AM_CONDITIONAL(ENABLE_OCTPHY, test "x$enable_octphy" = "xyes")
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

View File

@ -125,11 +125,19 @@ static int rf_port_stats_compl_cb(struct octphy_hdl *fl1, struct msgb *resp,
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 @@ static int rf_ant_rx_compl_cb(struct octphy_hdl *fl1, struct msgb *resp,
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 @@ static int rf_ant_tx_compl_cb(struct octphy_hdl *fl1, struct msgb *resp,
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 @@ static int get_clock_sync_stats_cb(struct octphy_hdl *fl1, struct msgb *resp,
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);

View File

@ -187,7 +187,11 @@ void show_rf_port_stats_cb(struct msgb *resp, void *data)
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 @@ void show_rf_port_stats_cb(struct msgb *resp, void *data)
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 @@ void show_clk_sync_stats_cb(struct msgb *resp, void *data)
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);
}