aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-litecell15/l1_if.c
diff options
context:
space:
mode:
authorKeith <keith@rhizomatica.org>2020-03-31 21:54:58 -0500
committerKeith <keith@rhizomatica.org>2020-03-31 22:06:37 -0500
commit9192c6c6c2cdea376aa512c88b14c724af36cea7 (patch)
treeec293f759677d376d7a8e91d97b34a6b22a13c78 /src/osmo-bts-litecell15/l1_if.c
parentae4d85d891c6fde179f16db7eed0b6e3fa468705 (diff)
Merging parts of commit 653e974fec00414ba85baf258ccc46ea778a53bdkeith/lc15_merge
from branch nrw/litecell15 Original Author: Minh-Quang Nguyen <minh-quang.nguyen@nutaq.com> LC15: Implementation of LC15 specific features Made some modifications to this commit based on d8cd756da48bcff9f9caf9e64fc0af047a165b60 Get rid of 'struct gsm_bts_role_bts' Only compile tested. This is just to get a start on this branch. I have not yet looked at all other commits in the nuran branch that may be related. This one however, does seem to be important as it implements a larger cell radius than is currently possible with osmo master. Change-Id: I79416faaa3ba328c9c2dabcd695a1b880fe666da
Diffstat (limited to 'src/osmo-bts-litecell15/l1_if.c')
-rw-r--r--src/osmo-bts-litecell15/l1_if.c110
1 files changed, 104 insertions, 6 deletions
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index abf48bcd..dff5ed18 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1263,8 +1263,10 @@ static int activate_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp,
LOGP(DL1C, LOGL_FATAL, "RF-ACT.conf with status %s\n",
get_value_string(lc15bts_l1status_names, status));
bts_shutdown(trx->bts, "RF-ACT failure");
- } else
- bts_update_status(BTS_STATUS_RF_ACTIVE, 1);
+ } else {
+ if(trx->bts->lc15.led_ctrl_mode == LC15_LED_CONTROL_BTS)
+ bts_update_status(BTS_STATUS_RF_ACTIVE, 1);
+ }
/* signal availability */
oml_mo_state_chg(&trx->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OK);
@@ -1275,7 +1277,8 @@ static int activate_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp,
for (i = 0; i < ARRAY_SIZE(trx->ts); i++)
oml_mo_state_chg(&trx->ts[i].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
} else {
- bts_update_status(BTS_STATUS_RF_ACTIVE, 0);
+ if(trx->bts->lc15.led_ctrl_mode == LC15_LED_CONTROL_BTS)
+ bts_update_status(BTS_STATUS_RF_ACTIVE, 0);
oml_mo_state_chg(&trx->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
oml_mo_state_chg(&trx->bb_transc.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
}
@@ -1290,17 +1293,27 @@ int l1if_activate_rf(struct lc15l1_hdl *hdl, int on)
{
struct msgb *msg = sysp_msgb_alloc();
Litecell15_Prim_t *sysp = msgb_sysprim(msg);
+ struct phy_instance *pinst = hdl->phy_inst;
if (on) {
sysp->id = Litecell15_PrimId_ActivateRfReq;
sysp->u.activateRfReq.msgq.u8UseTchMsgq = 0;
sysp->u.activateRfReq.msgq.u8UsePdtchMsgq = pcu_direct;
- sysp->u.activateRfReq.u8UnusedTsMode = 0;
+ sysp->u.activateRfReq.u8UnusedTsMode = pinst->u.lc15.pedestal_mode;
sysp->u.activateRfReq.u8McCorrMode = 0;
+ /* diversity mode: 0: SISO-A, 1: SISO-B, 2: MRC */
+ sysp->u.activateRfReq.u8DiversityMode = pinst->u.lc15.diversity_mode;
+
/* maximum cell size in quarter-bits, 90 == 12.456 km */
- sysp->u.activateRfReq.u8MaxCellSize = 90;
+ sysp->u.activateRfReq.u8MaxCellSize = pinst->u.lc15.max_cell_size;
+
+ /* auto tx power adjustment mode 0:none, 1: automatic*/
+ sysp->u.activateRfReq.autoPowerAdjust.u8EnAutoPowerAdjust = pinst->u.lc15.tx_pwr_adj_mode;
+
+ /* PSK modulation scheme maximum power level */
+ sysp->u.activateRfReq.autoPowerAdjust.u8PowerReduction8Psk = pinst->u.lc15.tx_pwr_red_8psk;
} else {
sysp->id = Litecell15_PrimId_DeactivateRfReq;
}
@@ -1353,7 +1366,8 @@ static int mute_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp,
LOGP(DL1C, LOGL_INFO, "Rx RF-MUTE.conf with status=%s\n",
get_value_string(lc15bts_l1status_names, status));
- bts_update_status(BTS_STATUS_RF_MUTE, fl1h->last_rf_mute[0]);
+ if(trx->bts->lc15.led_ctrl_mode == LC15_LED_CONTROL_BTS)
+ bts_update_status(BTS_STATUS_RF_MUTE, fl1h->last_rf_mute[0]);
oml_mo_rf_lock_chg(&trx->mo, fl1h->last_rf_mute, 1);
osmo_static_assert(
@@ -1589,6 +1603,53 @@ int l1if_close(struct lc15l1_hdl *fl1h)
return 0;
}
+static void dsp_alive_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, void *data)
+{
+ Litecell15_Prim_t *sysp = msgb_sysprim(resp);
+ Litecell15_IsAliveCnf_t *sac = &sysp->u.IsAliveCnf;
+ struct lc15l1_hdl *fl1h = trx_lc15l1_hdl(trx);
+
+ fl1h->hw_alive.dsp_alive_cnt++;
+ LOGP(DL1C, LOGL_NOTICE, "Rx SYS prim %s, status=%d (%d)\n",
+ get_value_string(lc15bts_sysprim_names, sysp->id), sac->status, trx->nr);
+
+ msgb_free(resp);
+}
+
+static int dsp_alive_timer_cb(void *data)
+{
+ struct lc15l1_hdl *fl1h = data;
+ struct gsm_bts_trx *trx = fl1h->phy_inst->trx;
+ struct msgb *msg = sysp_msgb_alloc();
+ int rc;
+
+ Litecell15_Prim_t *sys_prim = msgb_sysprim(msg);
+ sys_prim->id = Litecell15_PrimId_IsAliveReq;
+
+ if (fl1h->hw_alive.dsp_alive_cnt == 0) {
+
+ LOGP(DL1C, LOGL_ERROR, "Timeout waiting for SYS prim %s primitive (%d)\n",
+ get_value_string(lc15bts_sysprim_names, sys_prim->id + 1), trx->nr);
+
+ exit(23);
+ }
+
+ LOGP(DL1C, LOGL_NOTICE, "Tx SYS prim %s (%d)\n",
+ get_value_string(lc15bts_sysprim_names, sys_prim->id), trx->nr);
+
+ rc = l1if_req_compl(fl1h, msg, dsp_alive_compl_cb, NULL);
+ if (rc < 0) {
+ LOGP(DL1C, LOGL_FATAL, "Failed to send %s primitive\n", get_value_string(lc15bts_sysprim_names, sys_prim->id));
+ return -EIO;
+ }
+
+ /* restart timer */
+ fl1h->hw_alive.dsp_alive_cnt = 0;
+ osmo_timer_schedule(&fl1h->hw_alive.dsp_alive_timer, fl1h->hw_alive.dsp_alive_period, 0);
+
+ return 0;
+}
+
int bts_model_phy_link_open(struct phy_link *plink)
{
struct phy_instance *pinst = phy_instance_by_num(plink, 0);
@@ -1608,6 +1669,24 @@ int bts_model_phy_link_open(struct phy_link *plink)
return -EIO;
}
+ /* Set default PHY parameters */
+ if (!pinst->u.lc15.max_cell_size)
+ pinst->u.lc15.max_cell_size = LC15_BTS_MAX_CELL_SIZE_DEFAULT;
+
+ if (!pinst->u.lc15.diversity_mode)
+ pinst->u.lc15.diversity_mode = LC15_BTS_DIVERSITY_MODE_DEFAULT;
+
+ if (!pinst->u.lc15.pedestal_mode)
+ pinst->u.lc15.pedestal_mode = LC15_BTS_PEDESTAL_MODE_DEFAULT;
+
+ if (!pinst->u.lc15.dsp_alive_period)
+ pinst->u.lc15.dsp_alive_period = LC15_BTS_DSP_ALIVE_TMR_DEFAULT;
+
+ if (!pinst->u.lc15.tx_pwr_adj_mode)
+ pinst->u.lc15.tx_pwr_adj_mode = LC15_BTS_TX_PWR_ADJ_DEFAULT;
+
+ if (!pinst->u.lc15.tx_pwr_red_8psk)
+ pinst->u.lc15.tx_pwr_red_8psk = LC15_BTS_TX_RED_PWR_8PSK_DEFAULT;
struct lc15l1_hdl *fl1h = pinst->u.lc15.hdl;
fl1h->dsp_trace_f = dsp_trace;
@@ -1616,5 +1695,24 @@ int bts_model_phy_link_open(struct phy_link *plink)
phy_link_state_set(plink, PHY_LINK_CONNECTED);
+ /* Send first IS_ALIVE primitive */
+ struct msgb *msg = sysp_msgb_alloc();
+ int rc;
+
+ Litecell15_Prim_t *sys_prim = msgb_sysprim(msg);
+ sys_prim->id = Litecell15_PrimId_IsAliveReq;
+
+ rc = l1if_req_compl(fl1h, msg, dsp_alive_compl_cb, NULL);
+ if (rc < 0) {
+ LOGP(DL1C, LOGL_FATAL, "Failed to send %s primitive\n", get_value_string(lc15bts_sysprim_names, sys_prim->id));
+ return -EIO;
+ }
+
+ /* initialize DSP heart beat alive timer */
+ fl1h->hw_alive.dsp_alive_timer.cb = dsp_alive_timer_cb;
+ fl1h->hw_alive.dsp_alive_timer.data = fl1h;
+ fl1h->hw_alive.dsp_alive_cnt = 0;
+ fl1h->hw_alive.dsp_alive_period = pinst->u.lc15.dsp_alive_period;
+ osmo_timer_schedule(&fl1h->hw_alive.dsp_alive_timer, fl1h->hw_alive.dsp_alive_period, 0);
return 0;
}