aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-oc2g
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-09-28 12:36:09 +0200
committerlaforge <laforge@osmocom.org>2020-10-20 13:45:57 +0000
commit22f59cd63ab7906684ba38e2f617497ec806cca2 (patch)
treefdf296613fcb97008f4bdd9ec03cfaf69b1419a3 /src/osmo-bts-oc2g
parent7810a917331b33b6cfab5259b5fb2df73b27b230 (diff)
Introduce NM Channel FSM
Diffstat (limited to 'src/osmo-bts-oc2g')
-rw-r--r--src/osmo-bts-oc2g/l1_if.c3
-rw-r--r--src/osmo-bts-oc2g/oml.c53
2 files changed, 29 insertions, 27 deletions
diff --git a/src/osmo-bts-oc2g/l1_if.c b/src/osmo-bts-oc2g/l1_if.c
index 4044f43d..475edd21 100644
--- a/src/osmo-bts-oc2g/l1_if.c
+++ b/src/osmo-bts-oc2g/l1_if.c
@@ -1328,9 +1328,6 @@ static int activate_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp,
/* signal availability */
osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_SW_ACT, NULL);
osmo_fsm_inst_dispatch(trx->bb_transc.mo.fi, NM_EV_SW_ACT, NULL);
-
- 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);
osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_DISABLE, NULL);
diff --git a/src/osmo-bts-oc2g/oml.c b/src/osmo-bts-oc2g/oml.c
index 2efa577b..6403a22c 100644
--- a/src/osmo-bts-oc2g/oml.c
+++ b/src/osmo-bts-oc2g/oml.c
@@ -277,38 +277,41 @@ static int opstart_compl(struct gsm_abis_mo *mo, struct msgb *l1_msg)
get_value_string(oc2gbts_l1prim_names, l1p->id),
get_value_string(oc2gbts_l1status_names, status));
msgb_free(l1_msg);
- if (mo->obj_class == NM_OC_RADIO_CARRIER)
+ switch (mo->obj_class) {
+ case NM_OC_RADIO_CARRIER:
return osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_OPSTART_NACK,
(void*)(intptr_t)NM_NACK_CANT_PERFORM);
- else
- return oml_mo_opstart_nack(mo, NM_NACK_CANT_PERFORM);
+ case NM_OC_CHANNEL:
+ return osmo_fsm_inst_dispatch(trx->ts[mo->obj_inst.ts_nr].mo.fi, NM_EV_OPSTART_NACK,
+ (void*)(intptr_t)NM_NACK_CANT_PERFORM);
+ default:
+ OSMO_ASSERT(0);
+ }
}
msgb_free(l1_msg);
-
- /* We already have a FSM for Radio Carrier, handle it there */
- if (mo->obj_class == NM_OC_RADIO_CARRIER)
+ switch (mo->obj_class) {
+ case NM_OC_RADIO_CARRIER:
return osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_OPSTART_ACK, NULL);
-
- /* Set to Operational State: Enabled */
- oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
-
- /* ugly hack to auto-activate all SAPIs for the BCCH/CCCH on TS0 */
- if (mo->obj_class == NM_OC_CHANNEL && mo->obj_inst.trx_nr == 0 &&
- mo->obj_inst.ts_nr == 0) {
- struct gsm_lchan *cbch = gsm_bts_get_cbch(mo->bts);
- DEBUGP(DL1C, "====> trying to activate lchans of BCCH\n");
- mo->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind =
- LCHAN_REL_ACT_OML;
- lchan_activate(&mo->bts->c0->ts[0].lchan[CCCH_LCHAN]);
- if (cbch) {
- cbch->rel_act_kind = LCHAN_REL_ACT_OML;
- lchan_activate(cbch);
+ case NM_OC_CHANNEL:
+ /* ugly hack to auto-activate all SAPIs for the BCCH/CCCH on TS0 */
+ if (mo->obj_inst.trx_nr == 0 &&
+ mo->obj_inst.ts_nr == 0) {
+ struct gsm_lchan *cbch = gsm_bts_get_cbch(mo->bts);
+ DEBUGP(DL1C, "====> trying to activate lchans of BCCH\n");
+ mo->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind =
+ LCHAN_REL_ACT_OML;
+ lchan_activate(&mo->bts->c0->ts[0].lchan[CCCH_LCHAN]);
+ if (cbch) {
+ cbch->rel_act_kind = LCHAN_REL_ACT_OML;
+ lchan_activate(cbch);
+ }
}
+ return osmo_fsm_inst_dispatch(trx->ts[mo->obj_inst.ts_nr].mo.fi,
+ NM_EV_OPSTART_ACK, NULL);
+ default:
+ OSMO_ASSERT(0);
}
-
- /* Send OPSTART ack */
- return oml_mo_opstart_ack(mo);
}
static int opstart_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg,
@@ -1894,6 +1897,7 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
{
struct gsm_bts_bb_trx *bb_transc;
struct gsm_bts_trx* trx;
+ struct gsm_bts_trx_ts *ts;
int rc;
switch (mo->obj_class) {
@@ -1916,6 +1920,7 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
rc = osmo_fsm_inst_dispatch(bb_transc->mo.fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_CHANNEL:
+ ts = (struct gsm_bts_trx_ts*) obj;
rc = ts_opstart(obj);
break;
case NM_OC_GPRS_NSE: