Harald Welte has submitted this change and it was merged.

Change subject: octphy: integrate octasics latest header release
......................................................................


octphy: integrate octasics latest header release

At the moment osmo-bts does not compile with the latest header
file release from OCTSDR-2G-02.10.00-B1837-ALPHA as there are
struct members removed and new ones added. The changes do not
affect actual functionality in the existing code. The only
affected parts are vty functions that query status information
about the clock sync manager.

- Add detection logic in configure.ac to detect if the affected
  struct members are present

- Add conditional compiling to handle the different combinations
  of available struct members.

Change-Id: Ic38d8dc35522205c4ffab583b4e61b5ef03cdba2
Related: SYS#4139
Patch-by: Octasic inc.
---
M configure.ac
M src/osmo-bts-octphy/octphy_hw_api.c
M src/osmo-bts-octphy/octphy_hw_api.h
M src/osmo-bts-octphy/octphy_vty.c
4 files changed, 181 insertions(+), 20 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/configure.ac b/configure.ac
index 1d7379f..9767349 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,13 +152,6 @@
                        [],
                        [#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],
@@ -180,6 +173,83 @@
                        [],
                        [#include <octphy/octvc1/gsm/octvc1_gsm_api.h>])
 
+       
AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_INFO_RSP.ulClkSourceSelection],
+                       AC_DEFINE([OCTPHY_USE_CLK_SOURCE_SELECTION],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
ulClkSourceSelection in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_INFO_RSP]),
+                       [],
+                       [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+       AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.lClockError],
+                       AC_DEFINE([OCTPHY_USE_CLOCK_SYNC_MGR_STATS_CLOCK_ERROR],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
lClockError in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP]),
+                       [],
+                       [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+       
AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.lDroppedCycles],
+                       
AC_DEFINE([OCTPHY_USE_CLOCK_SYNC_MGR_STATS_DROPPED_CYCLES],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
lDroppedCycles in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP]),
+                       [],
+                       [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+       AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulPllFreqHz],
+                       AC_DEFINE([OCTPHY_USE_CLOCK_SYNC_MGR_STATS_PLL_FREQ_HZ],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
ulPllFreqHz in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP]),
+                       [],
+                       [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+       
AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulPllFractionalFreqHz],
+                       
AC_DEFINE([OCTPHY_USE_CLOCK_SYNC_MGR_STATS_PLL_FRACTIONAL_FREQ_HZ],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
ulPllFractionalFreqHz in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP]),
+                       [],
+                       [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+       AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulSlipCnt],
+                       AC_DEFINE([OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SLIP_CNT],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
ulSlipCnt in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP]),
+                       [],
+                       [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+       
AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulSyncLosseCnt],
+                       
AC_DEFINE([OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SYNC_LOSSE_CNT],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
ulSyncLosseCnt in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP]),
+                       [],
+                       [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+       AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulSyncLossCnt],
+                       
AC_DEFINE([OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SYNC_LOSS_CNT],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
ulSyncLossCnt in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP]),
+                       [],
+                       [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+       AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulSourceState],
+                       
AC_DEFINE([OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SOURCE_STATE],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
ulSourceState in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP]),
+                       [],
+                       [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+       AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulDacState],
+                       AC_DEFINE([OCTPHY_USE_CLOCK_SYNC_MGR_STATS_DAC_STATE],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
ulDacState in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP]),
+                       [],
+                       [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
+
+       
AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulDriftElapseTimeUs],
+                       
AC_DEFINE([OCTPHY_USE_CLOCK_SYNC_MGR_STATS_DRIFT_ELAPSE_TIME_US],
+                       [1],
+                       [Define to 1 if your octphy header files supports 
ulDriftElapseTimeUs in tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP]),
+                       [],
+                       [#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 91b84de..6da038b 100644
--- a/src/osmo-bts-octphy/octphy_hw_api.c
+++ b/src/osmo-bts-octphy/octphy_hw_api.c
@@ -275,6 +275,7 @@
        { 0, NULL }
 };
 
+#if OCTPHY_USE_CLK_SOURCE_SELECTION == 1
 static const struct value_string clocksync_sel_vals[] = {
        { cOCTVC1_HW_CLOCK_SYNC_MGR_SOURCE_SELECTION_ENUM_AUTOSELECT,
                "Autoselect" },
@@ -284,6 +285,7 @@
                "Host Application" },
        { 0, NULL }
 };
+#endif
 
 /* Chapter 12.15 */
 static int get_clock_sync_compl_cb(struct octphy_hdl *fl1, struct msgb *resp,
@@ -296,8 +298,14 @@
 
        LOGP(DL1C, LOGL_INFO, "CLOCK-SYNC-MGR-INFO.resp Reference=%s ",
                get_value_string(clocksync_source_vals, cir->ulClkSourceRef));
+
+#if OCTPHY_USE_CLK_SOURCE_SELECTION == 1
        LOGPC(DL1C, LOGL_INFO, "Selection=%s)\n",
                get_value_string(clocksync_sel_vals, 
cir->ulClkSourceSelection));
+#else
+       LOGPC(DL1C, LOGL_INFO, "Clock Drift= %u Us\n",
+               cir->ulMaxDriftDurationUs);
+#endif
 
        msgb_free(resp);
        return 0;
@@ -330,18 +338,45 @@
 
        mOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP_SWAP(csr);
 
-       LOGP(DL1C, LOGL_INFO, "CLOCK-SYNC-MGR-STATS.resp State=%s, "
-               "ClockError=%d DroppedCycles=%d, PllFreqHz=%u, PllFract=%u, "
-               "SlipCnt=%u SyncLosses=%u SourceState=%u, DacValue=%u\n",
-               get_value_string(clocksync_state_vals, csr->ulState),
-               csr->lClockError, csr->lDroppedCycles, csr->ulPllFreqHz,
-               csr->ulPllFractionalFreqHz, csr->ulSlipCnt,
-#if OCTPHY_USE_SYNC_LOSS_CNT == 1
-               csr->ulSyncLossCnt,
-#else
-               csr->ulSyncLosseCnt,
+       LOGP(DL1C, LOGL_INFO, "CLOCK-SYNC-MGR-STATS.resp");
+       LOGPC(DL1C, LOGL_INFO, " State=%s,",
+             get_value_string(clocksync_state_vals, csr->ulState));
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_CLOCK_ERROR == 1
+       LOGPC(DL1C, LOGL_INFO, " ClockError=%d,", csr->lClockError);
 #endif
-               csr->ulSourceState, csr->ulDacValue);
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_DROPPED_CYCLES == 1
+       LOGPC(DL1C, LOGL_INFO, " DroppedCycles=%d,", csr->lDroppedCycles);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_PLL_FREQ_HZ == 1
+       LOGPC(DL1C, LOGL_INFO, " PllFreqHz=%u,", csr->ulPllFreqHz);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_PLL_FRACTIONAL_FREQ_HZ == 1
+       LOGPC(DL1C, LOGL_INFO, " PllFract=%u,", csr->ulPllFractionalFreqHz);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SLIP_CNT == 1
+       LOGPC(DL1C, LOGL_INFO, " SlipCnt=%u,", csr->ulSlipCnt);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SYNC_LOSS_CNT == 1
+       LOGPC(DL1C, LOGL_INFO, " SyncLosses=%u,", csr->ulSyncLossCnt);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SYNC_LOSSE_CNT == 1
+       LOGPC(DL1C, LOGL_INFO, " SyncLosses=%u,", csr->ulSyncLosseCnt);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SOURCE_STATE == 1
+       LOGPC(DL1C, LOGL_INFO, " SourceState=%u,", csr->ulSourceState);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_DAC_STATE == 1
+       LOGPC(DL1C, LOGL_INFO, " CLOCK-SYNC-MGR-STATS.resp State=%s,",
+             get_value_string(clocksync_dac_vals, csr->ulDacState));
+#endif
+       LOGPC(DL1C, LOGL_INFO, " LOCK-SYNC-MGR-USR-PROCESS.resp State=%s,",
+             get_value_string(usr_process_id, csr->ulOwnerProcessUid));
+       LOGPC(DL1C, LOGL_INFO, " DacValue=%u,", csr->ulDacValue);
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_DRIFT_ELAPSE_TIME_US == 1
+       LOGPC(DL1C, LOGL_INFO, " DriftElapseTime=%u Us,",
+             csr->ulDriftElapseTimeUs);
+#endif
+       LOGPC(DL1C, LOGL_INFO, "\n");
 
        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_hw_api.h 
b/src/osmo-bts-octphy/octphy_hw_api.h
index 78b7208..625fe86 100644
--- a/src/osmo-bts-octphy/octphy_hw_api.h
+++ b/src/osmo-bts-octphy/octphy_hw_api.h
@@ -34,6 +34,36 @@
        { 0, NULL }
 };
 
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_DAC_STATE == 1
+static const struct value_string clocksync_dac_vals[] = {
+       { cOCTVC1_HW_CLOCK_SYNC_MGR_DAC_STATE_ENUM_UNUSED, "Unused" },
+       { cOCTVC1_HW_CLOCK_SYNC_MGR_DAC_STATE_ENUM_MASTER, "Master" },
+       { cOCTVC1_HW_CLOCK_SYNC_MGR_DAC_STATE_ENUM_SLAVE, "Slave" },
+       { cOCTVC1_HW_CLOCK_SYNC_MGR_DAC_STATE_ENUM_FREE_RUNNING, "Free_Run"},
+       { 0, NULL }
+};
+#endif
+
+static const struct value_string usr_process_id[] = {
+       { cOCTVC1_USER_ID_PROCESS_ENUM_INVALID, "Invalid" },
+       { cOCTVC1_USER_ID_PROCESS_ENUM_MAIN_APP, "MainApp" },
+       { cOCTVC1_USER_ID_PROCESS_ENUM_MAIN_ROUTER, "MainRouter" },
+       { cOCTVC1_USER_ID_PROCESS_ENUM_GSM_DL_0, "DL"},
+       { cOCTVC1_USER_ID_PROCESS_ENUM_GSM_ULIM_0, "ULIM" },
+       { cOCTVC1_USER_ID_PROCESS_ENUM_GSM_ULOM_0, "ULOM" },
+       { cOCTVC1_USER_ID_PROCESS_ENUM_GSM_SCHED_0, "SCHED" },
+#ifdef cOCTVC1_USER_ID_PROCESS_ENUM_GSM_DECOMB
+       { cOCTVC1_USER_ID_PROCESS_ENUM_GSM_DECOMB, "DECOMB"},
+#endif
+#ifdef cOCTVC1_USER_ID_PROCESS_ENUM_GSM_ULEQ
+       { cOCTVC1_USER_ID_PROCESS_ENUM_GSM_ULEQ, "ULEQ" },
+#endif
+#ifdef cOCTVC1_USER_ID_PROCESS_ENUM_GSM_TEST
+       { cOCTVC1_USER_ID_PROCESS_ENUM_GSM_TEST, "TEST"},
+#endif
+       { 0, NULL }
+};
+
 typedef void octphy_hw_get_cb(struct msgb *resp, void *data);
 
 struct octphy_hw_get_cb_data {
diff --git a/src/osmo-bts-octphy/octphy_vty.c b/src/osmo-bts-octphy/octphy_vty.c
index fb36493..e5e8eba 100644
--- a/src/osmo-bts-octphy/octphy_vty.c
+++ b/src/osmo-bts-octphy/octphy_vty.c
@@ -282,18 +282,44 @@
        vty_out(vty, "State=%s%s",
                get_value_string(clocksync_state_vals, csr->ulState),
                VTY_NEWLINE);
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_CLOCK_ERROR == 1
        vty_out(vty, "ClockError=%d%s", csr->lClockError, VTY_NEWLINE);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_DROPPED_CYCLES == 1
        vty_out(vty, "DroppedCycles=%d%s", csr->lDroppedCycles, VTY_NEWLINE);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_PLL_FREQ_HZ == 1
        vty_out(vty, "PllFreqHz=%u%s", csr->ulPllFreqHz, VTY_NEWLINE);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_PLL_FRACTIONAL_FREQ_HZ == 1
        vty_out(vty, "PllFract=%u%s", csr->ulPllFractionalFreqHz, VTY_NEWLINE);
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SLIP_CNT == 1
        vty_out(vty, "SlipCnt=%u%s", csr->ulSlipCnt, VTY_NEWLINE);
-#if OCTPHY_USE_SYNC_LOSS_CNT == 1
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SYNC_LOSS_CNT == 1
        vty_out(vty, "SyncLosses=%u%s", csr->ulSyncLossCnt, VTY_NEWLINE);
-#else
+#endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SYNC_LOSSE_CNT == 1
        vty_out(vty, "SyncLosses=%u%s", csr->ulSyncLosseCnt, VTY_NEWLINE);
 #endif
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_SOURCE_STATE == 1
        vty_out(vty, "SourceState=%u%s", csr->ulSourceState, VTY_NEWLINE);
+#endif
        vty_out(vty, "DacValue=%u%s", csr->ulDacValue, VTY_NEWLINE);
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_DAC_STATE == 1
+       vty_out(vty, "CLOCK-SYNC-MGR-STATS.resp State=%s%s",
+               get_value_string(clocksync_dac_vals, csr->ulDacState),
+               VTY_NEWLINE);
+#endif
+       vty_out(vty, "LOCK-SYNC-MGR-USR-PROCESS.resp State=%s%s",
+               get_value_string(usr_process_id, csr->ulOwnerProcessUid),
+               VTY_NEWLINE);
+       vty_out(vty, "DacValue=%u%s", csr->ulDacValue, VTY_NEWLINE);
+#if OCTPHY_USE_CLOCK_SYNC_MGR_STATS_DRIFT_ELAPSE_TIME_US == 1
+       vty_out(vty, "DriftElapseTime=%u Us%s", csr->ulDriftElapseTimeUs,
+               VTY_NEWLINE);
+#endif
 }
 
 DEFUN(show_clk_sync_stats, show_clk_sync_stats_cmd,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic38d8dc35522205c4ffab583b4e61b5ef03cdba2
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to