aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/bts_trx.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-09-30 14:43:09 +0200
committerlaforge <laforge@osmocom.org>2020-10-15 05:55:36 +0000
commitd9d105c1f73713b1363849554d5d87d36d4ae7b6 (patch)
treed0681eb7183221c939015a3cce6b5a1be8663351 /src/osmo-bsc/bts_trx.c
parent95486f248a37e66d6ae0baa1fd33e44317cce3ba (diff)
Introduce NM RadioCarrier FSM
Diffstat (limited to 'src/osmo-bsc/bts_trx.c')
-rw-r--r--src/osmo-bsc/bts_trx.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/osmo-bsc/bts_trx.c b/src/osmo-bsc/bts_trx.c
index c01444a0c..5f21b497c 100644
--- a/src/osmo-bsc/bts_trx.c
+++ b/src/osmo-bsc/bts_trx.c
@@ -38,6 +38,10 @@ static int gsm_bts_trx_talloc_destructor(struct gsm_bts_trx *trx)
osmo_fsm_inst_free(trx->bb_transc.mo.fi);
trx->bb_transc.mo.fi = NULL;
}
+ if (trx->mo.fi) {
+ osmo_fsm_inst_free(trx->mo.fi);
+ trx->mo.fi = NULL;
+ }
return 0;
}
@@ -54,6 +58,9 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
trx->bts = bts;
trx->nr = bts->num_trx++;
+ trx->mo.fi = osmo_fsm_inst_alloc(&nm_rcarrier_fsm, trx, trx,
+ LOGL_INFO, NULL);
+ osmo_fsm_inst_update_id_f(trx->mo.fi, "bts%d-trx%d", bts->nr, trx->nr);
gsm_mo_init(&trx->mo, bts, NM_OC_RADIO_CARRIER,
bts->nr, trx->nr, 0xff);
@@ -164,10 +171,9 @@ void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason)
{
uint8_t new_state = locked ? NM_STATE_LOCKED : NM_STATE_UNLOCKED;
-
+ /* State will be sent when BTS connects. */
if (!trx->bts || !trx->bts->oml_link) {
- /* Set initial state which will be sent when BTS connects. */
- trx->mo.nm_state.administrative = new_state;
+ trx->mo.force_rf_lock = locked;
return;
}
@@ -175,9 +181,7 @@ void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason)
get_value_string(abis_nm_adm_state_names, trx->mo.nm_state.administrative),
get_value_string(abis_nm_adm_state_names, new_state), reason);
- abis_nm_chg_adm_state(trx->bts, NM_OC_RADIO_CARRIER,
- trx->bts->bts_nr, trx->nr, 0xff,
- new_state);
+ osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_FORCE_LOCK, (void*)(intptr_t)locked);
}
bool trx_is_usable(const struct gsm_bts_trx *trx)