<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/9704">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">octphy: add support for 16x oversampling mode<br><br>The latest octphy firmware release (octsdr-2g-02.11.00-B1927-alpha),<br>introduces a 16X oversampling option which is not yet supported in<br>osmo-bts.<br><br>- Add oversampling flag in phy_link.h<br>- Add VTY commands to enable/disable oversampling<br>- Add phy messages to enable/disable oversampling<br>- Add conditional compilation to preserve support for legacy<br>  header files and firmware<br><br>Change-Id: Ib78f92bfe03ff20aa0a257763c90844fb7b87cf0<br>Related: SYS#4257<br>Patch-by: Octasic inc.<br>---<br>M configure.ac<br>M include/osmo-bts/phy_link.h<br>M src/osmo-bts-octphy/l1_oml.c<br>M src/osmo-bts-octphy/octphy_vty.c<br>4 files changed, 86 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/04/9704/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/configure.ac b/configure.ac</span><br><span>index 6456f8a..b364e4d 100644</span><br><span>--- a/configure.ac</span><br><span>+++ b/configure.ac</span><br><span>@@ -250,6 +250,13 @@</span><br><span>                   [],</span><br><span>                  [#include <octphy/octvc1/hw/octvc1_hw_api.h>])</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+      AC_CHECK_MEMBER([tOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CMD.ulOversample16xEnableFlag],</span><br><span style="color: hsl(120, 100%, 40%);">+                 AC_DEFINE([OCTPHY_USE_16X_OVERSAMPLING],</span><br><span style="color: hsl(120, 100%, 40%);">+                      [1],</span><br><span style="color: hsl(120, 100%, 40%);">+                  [Define to 1 if your octphy header files support 16x oversampling]),</span><br><span style="color: hsl(120, 100%, 40%);">+                  [],</span><br><span style="color: hsl(120, 100%, 40%);">+                   [#include <octphy/octvc1/gsm/octvc1_gsm_api.h>])</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>     CPPFLAGS=$oldCPPFLAGS</span><br><span> fi</span><br><span> </span><br><span>diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h</span><br><span>index 0ffc58e..2295b27 100644</span><br><span>--- a/include/osmo-bts/phy_link.h</span><br><span>+++ b/include/osmo-bts/phy_link.h</span><br><span>@@ -74,6 +74,7 @@</span><br><span>                         uint32_t rx_gain_db;</span><br><span>                         bool tx_atten_flag;</span><br><span>                  uint32_t tx_atten_db;</span><br><span style="color: hsl(120, 100%, 40%);">+                 uint32_t over_sample_16x;</span><br><span> #if OCTPHY_MULTI_TRX == 1</span><br><span>                       /* arfcn used by TRX with id 0 */</span><br><span>                    uint16_t center_arfcn;</span><br><span>diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c</span><br><span>index 018a4f9..337b53c 100644</span><br><span>--- a/src/osmo-bts-octphy/l1_oml.c</span><br><span>+++ b/src/osmo-bts-octphy/l1_oml.c</span><br><span>@@ -1375,6 +1375,53 @@</span><br><span>         return l1if_req_compl(fl1h, msg, trx_open_compl_cb, NULL);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#if OCTPHY_USE_16X_OVERSAMPLING == 1</span><br><span style="color: hsl(120, 100%, 40%);">+static int over_sample_16x_modif_compl_cb(struct octphy_hdl *fl1,</span><br><span style="color: hsl(120, 100%, 40%);">+                                    struct msgb *resp, void *data)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   tOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_RSP *mcr =</span><br><span style="color: hsl(120, 100%, 40%);">+           (tOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_RSP*) resp->l2h;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* in a completion call-back, we take msgb ownership and must</span><br><span style="color: hsl(120, 100%, 40%);">+  * release it before returning */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   mOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_RSP_SWAP(mcr);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ LOGP(DL1C, LOGL_INFO, "Rx OVER-SAMPLE-16x-MODIFY.conf\n");</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        msgb_free(resp);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static int l1if_over_sample_16x_modif(struct gsm_bts_trx *trx)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     struct phy_instance *pinst = trx_phy_instance(trx);</span><br><span style="color: hsl(120, 100%, 40%);">+   struct phy_link *plink = pinst->phy_link;</span><br><span style="color: hsl(120, 100%, 40%);">+  struct octphy_hdl *fl1h = pinst->phy_link->u.octphy.hdl;</span><br><span style="color: hsl(120, 100%, 40%);">+        struct msgb *msg = l1p_msgb_alloc();</span><br><span style="color: hsl(120, 100%, 40%);">+  tOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CMD *mc;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       mc = (tOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CMD*) msgb_put(msg,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                          sizeof</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                        (*mc));</span><br><span style="color: hsl(120, 100%, 40%);">+     mOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CMD_DEF(mc);</span><br><span style="color: hsl(120, 100%, 40%);">+     l1if_fill_msg_hdr(&mc->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND,</span><br><span style="color: hsl(120, 100%, 40%);">+                      cOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CID);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        if (plink->u.octphy.over_sample_16x == 1)</span><br><span style="color: hsl(120, 100%, 40%);">+          mc->ulOversample16xEnableFlag = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ else</span><br><span style="color: hsl(120, 100%, 40%);">+          mc->ulOversample16xEnableFlag = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       mOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CMD_SWAP(mc);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  LOGP(DL1C, LOGL_INFO, "Tx OVER-SAMPLE-16x-MODIF.req\n");</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  return l1if_req_compl(fl1h, msg, over_sample_16x_modif_compl_cb, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> uint32_t trx_get_hlayer1(struct gsm_bts_trx * trx)</span><br><span> {</span><br><span>         return 0;</span><br><span>@@ -1393,6 +1440,10 @@</span><br><span>   l1if_check_app_version(trx);</span><br><span>         l1if_check_app_sys_version(trx);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#if OCTPHY_USE_16X_OVERSAMPLING == 1</span><br><span style="color: hsl(120, 100%, 40%);">+    l1if_over_sample_16x_modif(trx);</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>   return l1if_trx_open(trx);</span><br><span> }</span><br><span> </span><br><span>diff --git a/src/osmo-bts-octphy/octphy_vty.c b/src/osmo-bts-octphy/octphy_vty.c</span><br><span>index e5e8eba..1c81a4b 100644</span><br><span>--- a/src/osmo-bts-octphy/octphy_vty.c</span><br><span>+++ b/src/osmo-bts-octphy/octphy_vty.c</span><br><span>@@ -195,6 +195,26 @@</span><br><span>      return CMD_SUCCESS;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#if OCTPHY_USE_16X_OVERSAMPLING == 1</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN(cfg_phy_over_sample_16x, cfg_phy_over_sample_16x_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+      "octphy over-sample-16x <0-1>",</span><br><span style="color: hsl(120, 100%, 40%);">+      OCT_STR "Configure 16x over sampling rate for this TRX\n"</span><br><span style="color: hsl(120, 100%, 40%);">+      "Over Sampling Rate\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct phy_link *plink = vty->index;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     if (plink->state != PHY_LINK_SHUTDOWN) {</span><br><span style="color: hsl(120, 100%, 40%);">+           vty_out(vty, "Can only reconfigure a PHY link that is down%s",</span><br><span style="color: hsl(120, 100%, 40%);">+                      VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+         return CMD_WARNING;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   plink->u.octphy.over_sample_16x = atoi(argv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> void show_rf_port_stats_cb(struct msgb *resp, void *data)</span><br><span> {</span><br><span>   struct vty *vty = (struct vty*) data;</span><br><span>@@ -370,6 +390,10 @@</span><br><span>         vty_out(vty, " octphy rx-ant-id %u%s", plink->u.octphy.rx_ant_id,</span><br><span>               VTY_NEWLINE);</span><br><span> #endif</span><br><span style="color: hsl(120, 100%, 40%);">+#if OCTPHY_USE_16X_OVERSAMPLING == 1</span><br><span style="color: hsl(120, 100%, 40%);">+ vty_out(vty, " octphy over-sample-16x %u%s", plink->u.octphy.over_sample_16x,</span><br><span style="color: hsl(120, 100%, 40%);">+            VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> }</span><br><span> </span><br><span> void bts_model_config_write_phy_inst(struct vty *vty, struct phy_instance *pinst)</span><br><span>@@ -423,7 +447,9 @@</span><br><span> #endif</span><br><span>  install_element(PHY_NODE, &cfg_phy_rx_gain_db_cmd);</span><br><span>      install_element(PHY_NODE, &cfg_phy_tx_atten_db_cmd);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+#if OCTPHY_USE_16X_OVERSAMPLING == 1</span><br><span style="color: hsl(120, 100%, 40%);">+        install_element(PHY_NODE, &cfg_phy_over_sample_16x_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span>         install_element_ve(&show_rf_port_stats_cmd);</span><br><span>     install_element_ve(&show_clk_sync_stats_cmd);</span><br><span>    install_element_ve(&show_sys_info_cmd);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/9704">change 9704</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/9704"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ib78f92bfe03ff20aa0a257763c90844fb7b87cf0 </div>
<div style="display:none"> Gerrit-Change-Number: 9704 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>