Change in osmo-bts[master]: octphy: add support for 16x oversampling mode

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Jun 28 16:00:51 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9704 )

Change subject: octphy: add support for 16x oversampling mode
......................................................................

octphy: add support for 16x oversampling mode

The latest octphy firmware release (octsdr-2g-02.11.00-B1927-alpha),
introduces a 16X oversampling option which is not yet supported in
osmo-bts.

- Add oversampling flag in phy_link.h
- Add VTY commands to enable/disable oversampling
- Add phy messages to enable/disable oversampling
- Add conditional compilation to preserve support for legacy
  header files and firmware

Change-Id: Ib78f92bfe03ff20aa0a257763c90844fb7b87cf0
Related: SYS#4257
Patch-by: Octasic inc.
---
M configure.ac
M include/osmo-bts/phy_link.h
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-octphy/l1_oml.c
M src/osmo-bts-octphy/octphy_vty.c
5 files changed, 94 insertions(+), 1 deletion(-)

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



diff --git a/configure.ac b/configure.ac
index 6456f8a..b364e4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -250,6 +250,13 @@
 			[],
 			[#include <octphy/octvc1/hw/octvc1_hw_api.h>])
 
+	AC_CHECK_MEMBER([tOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CMD.ulOversample16xEnableFlag],
+			AC_DEFINE([OCTPHY_USE_16X_OVERSAMPLING],
+			[1],
+			[Define to 1 if your octphy header files support 16x oversampling]),
+			[],
+			[#include <octphy/octvc1/gsm/octvc1_gsm_api.h>])
+
 	CPPFLAGS=$oldCPPFLAGS
 fi
 
diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
index 0ffc58e..36e34e1 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -74,6 +74,7 @@
 			uint32_t rx_gain_db;
 			bool tx_atten_flag;
 			uint32_t tx_atten_db;
+			bool over_sample_16x;
 #if OCTPHY_MULTI_TRX == 1
 			/* arfcn used by TRX with id 0 */
 			uint16_t center_arfcn;
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index f178029..91ef07b 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1659,6 +1659,7 @@
 	plink->u.octphy.rf_port_index = 0;
 	plink->u.octphy.rx_gain_db = 70;
 	plink->u.octphy.tx_atten_db = 0;
+	plink->u.octphy.over_sample_16x = true;
 }
 
 void bts_model_phy_instance_set_defaults(struct phy_instance *pinst)
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 018a4f9..7f4c0cd 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1375,6 +1375,57 @@
 	return l1if_req_compl(fl1h, msg, trx_open_compl_cb, NULL);
 }
 
+#if OCTPHY_USE_16X_OVERSAMPLING == 1
+static int over_sample_16x_modif_compl_cb(struct octphy_hdl *fl1,
+					  struct msgb *resp, void *data)
+{
+	tOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_RSP *mcr =
+	    (tOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_RSP*) resp->l2h;
+
+	/* in a completion call-back, we take msgb ownership and must
+	 * release it before returning */
+
+	mOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_RSP_SWAP(mcr);
+
+	LOGP(DL1C, LOGL_INFO, "Rx OVER-SAMPLE-16x-MODIFY.conf\n");
+
+	msgb_free(resp);
+
+	return 0;
+}
+
+static int l1if_over_sample_16x_modif(struct gsm_bts_trx *trx)
+{
+	/* NOTE: The 16x oversampling mode should always be enabled. Single-
+	 * TRX operation will work with standard 4x oversampling, but multi-
+	 * TRX requires 16x oversampling */
+
+	struct phy_instance *pinst = trx_phy_instance(trx);
+	struct phy_link *plink = pinst->phy_link;
+	struct octphy_hdl *fl1h = pinst->phy_link->u.octphy.hdl;
+	struct msgb *msg = l1p_msgb_alloc();
+	tOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CMD *mc;
+
+	mc = (tOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CMD*) msgb_put(msg,
+									  sizeof
+									  (*mc));
+	mOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CMD_DEF(mc);
+	l1if_fill_msg_hdr(&mc->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND,
+			  cOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CID);
+
+	if (plink->u.octphy.over_sample_16x == true)
+		mc->ulOversample16xEnableFlag = 1;
+	else
+		mc->ulOversample16xEnableFlag = 0;
+
+	mOCTVC1_GSM_MSG_OVERSAMPLE_SELECT_16X_MODIFY_CMD_SWAP(mc);
+
+	LOGP(DL1C, LOGL_INFO, "Tx OVER-SAMPLE-16x-MODIF.req\n");
+
+	return l1if_req_compl(fl1h, msg, over_sample_16x_modif_compl_cb, 0);
+}
+#endif
+
 uint32_t trx_get_hlayer1(struct gsm_bts_trx * trx)
 {
 	return 0;
@@ -1393,6 +1444,10 @@
 	l1if_check_app_version(trx);
 	l1if_check_app_sys_version(trx);
 
+#if OCTPHY_USE_16X_OVERSAMPLING == 1
+	l1if_over_sample_16x_modif(trx);
+#endif
+
 	return l1if_trx_open(trx);
 }
 
diff --git a/src/osmo-bts-octphy/octphy_vty.c b/src/osmo-bts-octphy/octphy_vty.c
index e5e8eba..d250a95 100644
--- a/src/osmo-bts-octphy/octphy_vty.c
+++ b/src/osmo-bts-octphy/octphy_vty.c
@@ -195,6 +195,29 @@
 	return CMD_SUCCESS;
 }
 
+#if OCTPHY_USE_16X_OVERSAMPLING == 1
+DEFUN(cfg_phy_over_sample_16x, cfg_phy_over_sample_16x_cmd,
+      "octphy over-sample-16x <0-1>",
+      OCT_STR "Configure 16x over sampling rate for this TRX (restart required)\n"
+      "Over Sampling Rate\n")
+{
+	struct phy_link *plink = vty->index;
+
+	if (plink->state != PHY_LINK_SHUTDOWN) {
+		vty_out(vty, "Can only reconfigure a PHY link that is down%s",
+			VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	if(atoi(argv[0]))
+		plink->u.octphy.over_sample_16x = true;
+	else
+		plink->u.octphy.over_sample_16x = false;
+
+	return CMD_SUCCESS;
+}
+#endif
+
 void show_rf_port_stats_cb(struct msgb *resp, void *data)
 {
 	struct vty *vty = (struct vty*) data;
@@ -370,6 +393,10 @@
 	vty_out(vty, " octphy rx-ant-id %u%s", plink->u.octphy.rx_ant_id,
 		VTY_NEWLINE);
 #endif
+#if OCTPHY_USE_16X_OVERSAMPLING == 1
+	vty_out(vty, " octphy over-sample-16x %u%s", plink->u.octphy.over_sample_16x,
+		VTY_NEWLINE);
+#endif
 }
 
 void bts_model_config_write_phy_inst(struct vty *vty, struct phy_instance *pinst)
@@ -423,7 +450,9 @@
 #endif
 	install_element(PHY_NODE, &cfg_phy_rx_gain_db_cmd);
 	install_element(PHY_NODE, &cfg_phy_tx_atten_db_cmd);
-
+#if OCTPHY_USE_16X_OVERSAMPLING == 1
+	install_element(PHY_NODE, &cfg_phy_over_sample_16x_cmd);
+#endif
 	install_element_ve(&show_rf_port_stats_cmd);
 	install_element_ve(&show_clk_sync_stats_cmd);
 	install_element_ve(&show_sys_info_cmd);

-- 
To view, visit https://gerrit.osmocom.org/9704
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib78f92bfe03ff20aa0a257763c90844fb7b87cf0
Gerrit-Change-Number: 9704
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-CC: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180628/16e8189b/attachment.htm>


More information about the gerrit-log mailing list