Harald Welte has submitted this change and it was merged.

Change subject: octphy: set tx/rx antenne IDs via VTY
......................................................................


octphy: set tx/rx antenne IDs via VTY

add support for the TX/RX antenna-id feature that has been
introduced with release OCTSDR-2G-02.07.00-B1314-BETA. The
user can now set individual ID numbers for the TX and for
the RX antenna.

Change-Id: I872fe3c4d7b593358a4ce2f02cf0726611b9f3aa
---
M configure.ac
M include/osmo-bts/phy_link.h
M src/osmo-bts-octphy/l1_oml.c
M src/osmo-bts-octphy/octphy_vty.c
4 files changed, 64 insertions(+), 0 deletions(-)

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



diff --git a/configure.ac b/configure.ac
index cbfbf12..a03b2dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,13 @@
                        [],
                        [#include <octphy/octvc1/hw/octvc1_hw_api.h>])
 
+       AC_CHECK_MEMBER([tOCTVC1_GSM_RF_CONFIG.ulTxAntennaId],
+                       AC_DEFINE([OCTPHY_USE_ANTENNA_ID],
+                       [1],
+                       [Define to 1 if your octphy header files support 
antenna ids in tOCTVC1_GSM_RF_CONFIG]),
+                       [],
+                       [#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 e644a91..e8fd7eb 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -53,6 +53,10 @@
 
                        /* configuration */
                        uint32_t rf_port_index;
+#if OCTPHY_USE_ANTENNA_ID == 1
+                       uint32_t rx_ant_id;
+                       uint32_t tx_ant_id;
+#endif
                        uint32_t rx_gain_db;
                        bool tx_atten_flag;
                        uint32_t tx_atten_db;
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 0cd25f2..c70b45f 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1394,6 +1394,11 @@
                oc->RfConfig.ulTxAttndB = (trx->max_power_red) << 2;
        }
 
+#if OCTPHY_USE_ANTENNA_ID == 1
+       oc->RfConfig.ulTxAntennaId = plink->u.octphy.tx_ant_id;
+       oc->RfConfig.ulRxAntennaId = plink->u.octphy.rx_ant_id;
+#endif
+
 #if OCTPHY_MULTI_TRX == 1
        LOGP(DL1C, LOGL_INFO, "Tx TRX-OPEN.req(trx=%u, rf_port=%u, arfcn=%u, "
                "center=%u, tsc=%u, rx_gain=%u, tx_atten=%u)\n",
diff --git a/src/osmo-bts-octphy/octphy_vty.c b/src/osmo-bts-octphy/octphy_vty.c
index 370aff6..fb36493 100644
--- a/src/osmo-bts-octphy/octphy_vty.c
+++ b/src/osmo-bts-octphy/octphy_vty.c
@@ -117,6 +117,42 @@
        return CMD_SUCCESS;
 }
 
+#if OCTPHY_USE_ANTENNA_ID == 1
+DEFUN(cfg_phy_rx_ant_id, cfg_phy_rx_ant_id_cmd,
+      "octphy rx-ant-id <0-1>",
+      OCT_STR "Configure the RX Antenna for this TRX\n" "RX Antenna Id\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;
+       }
+
+       plink->u.octphy.rx_ant_id = atoi(argv[0]);
+
+       return CMD_SUCCESS;
+}
+
+DEFUN(cfg_phy_tx_ant_id, cfg_phy_tx_ant_id_cmd,
+      "octphy tx-ant-id <0-1>",
+      OCT_STR "Configure the TX Antenna for this TRX\n" "TX Antenna Id\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;
+       }
+
+       plink->u.octphy.tx_ant_id = atoi(argv[0]);
+
+       return CMD_SUCCESS;
+}
+#endif
+
 DEFUN(cfg_phy_rx_gain_db, cfg_phy_rx_gain_db_cmd,
        "octphy rx-gain <0-73>",
        OCT_STR "Configure the Rx Gain in dB\n"
@@ -300,6 +336,14 @@
 
        vty_out(vty, " octphy rf-port-index %u%s", 
plink->u.octphy.rf_port_index,
                VTY_NEWLINE);
+
+#if OCTPHY_USE_ANTENNA_ID == 1
+       vty_out(vty, " octphy tx-ant-id %u%s", plink->u.octphy.tx_ant_id,
+               VTY_NEWLINE);
+
+       vty_out(vty, " octphy rx-ant-id %u%s", plink->u.octphy.rx_ant_id,
+               VTY_NEWLINE);
+#endif
 }
 
 void bts_model_config_write_phy_inst(struct vty *vty, struct phy_instance 
*pinst)
@@ -347,6 +391,10 @@
        install_element(PHY_NODE, &cfg_phy_hwaddr_cmd);
        install_element(PHY_NODE, &cfg_phy_netdev_cmd);
        install_element(PHY_NODE, &cfg_phy_rf_port_idx_cmd);
+#if OCTPHY_USE_ANTENNA_ID == 1
+       install_element(PHY_NODE, &cfg_phy_rx_ant_id_cmd);
+       install_element(PHY_NODE, &cfg_phy_tx_ant_id_cmd);
+#endif
        install_element(PHY_NODE, &cfg_phy_rx_gain_db_cmd);
        install_element(PHY_NODE, &cfg_phy_tx_atten_db_cmd);
 

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

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

Reply via email to