diff options
Diffstat (limited to 'src/osmo-bts-octphy/l1_oml.c')
-rw-r--r-- | src/osmo-bts-octphy/l1_oml.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c index 8156c49a..f036fe95 100644 --- a/src/osmo-bts-octphy/l1_oml.c +++ b/src/osmo-bts-octphy/l1_oml.c @@ -28,6 +28,7 @@ #include <osmocom/core/talloc.h> #include <osmocom/core/utils.h> +#include <osmocom/core/fsm.h> #include <osmo-bts/gsm_data.h> #include <osmo-bts/logging.h> @@ -40,6 +41,8 @@ #include <osmo-bts/l1sap.h> #include <osmo-bts/nm_bts_sm_fsm.h> #include <osmo-bts/nm_bts_fsm.h> +#include <osmo-bts/nm_radio_carrier_fsm.h> +#include <osmo-bts/nm_bb_transc_fsm.h> #include "l1_if.h" #include "l1_oml.h" @@ -188,22 +191,15 @@ extern uint8_t rach_detected_Other_g; static int opstart_compl(struct gsm_abis_mo *mo) { struct gsm_bts_trx *trx = gsm_bts_trx_num(mo->bts, mo->obj_inst.trx_nr); - uint8_t tn; /* TODO: Send NACK in case of error! */ + /* We already have a FSM for Radio Carrier, handle it there */ + if (mo->obj_class == NM_OC_RADIO_CARRIER) + return osmo_fsm_inst_dispatch(trx->rc.fi, NM_RCARRIER_EV_OPSTART_ACK, NULL); + /* Set to Operational State: Enabled */ oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK); - if (mo->obj_class == NM_OC_RADIO_CARRIER) { - /* Mark Dependency TS as Offline (ready to be Opstarted) */ - for (tn = 0; tn < TRX_NR_TS; tn++) { - if (trx->ts[tn].mo.nm_state.operational == NM_OPSTATE_DISABLED && - trx->ts[tn].mo.nm_state.availability == NM_AVSTATE_DEPENDENCY) { - oml_mo_state_chg(&trx->ts[tn].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE); - } - } - } - /* 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 == 7) { @@ -1314,7 +1310,7 @@ static int trx_open_compl_cb(struct octphy_hdl *fl1h, struct msgb *resp, void *d msgb_free(resp); - opstart_compl(&trx->mo); + opstart_compl(&trx->rc.mo); octphy_hw_get_pcb_info(fl1h); octphy_hw_get_rf_port_info(fl1h, 0); @@ -1447,12 +1443,13 @@ uint32_t trx_get_hlayer1(const struct gsm_bts_trx *trx) static int trx_init(struct gsm_bts_trx *trx) { - if (!gsm_abis_mo_check_attr(&trx->mo, trx_rqd_attr, + if (!gsm_abis_mo_check_attr(&trx->rc.mo, trx_rqd_attr, ARRAY_SIZE(trx_rqd_attr))) { /* HACK: spec says we need to decline, but openbsc * doesn't deal with this very well */ - return oml_mo_opstart_ack(&trx->mo); - /* return oml_mo_opstart_nack(&trx->mo, NM_NACK_CANT_PERFORM); */ + return osmo_fsm_inst_dispatch(trx->rc.fi, NM_RCARRIER_EV_OPSTART_ACK, NULL); + //return osmo_fsm_inst_dispatch(trx->rc.fi, NM_RCARRIER_EV_OPSTART_NACK, + // (void*)(intptr_t)NM_NACK_CANT_PERFORM); } l1if_check_app_version(trx); @@ -1764,8 +1761,9 @@ int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg, /* callback from OML */ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj) { - int rc = -1; + struct gsm_bts_trx* trx; struct gsm_bts_trx_ts *ts; + int rc; switch (mo->obj_class) { case NM_OC_SITE_MANAGER: @@ -1775,13 +1773,17 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj) rc = osmo_fsm_inst_dispatch(bts->nm.fi, NM_BTS_EV_OPSTART_ACK, NULL); break; case NM_OC_RADIO_CARRIER: - rc = trx_init(obj); + trx = (struct gsm_bts_trx*) obj; + rc = trx_init(trx); + break; + case NM_OC_BASEB_TRANSC: + trx = (struct gsm_bts_trx *) obj; + rc = osmo_fsm_inst_dispatch(trx->bb_transc.fi, NM_BBTRANSC_EV_OPSTART_ACK, NULL); break; case NM_OC_CHANNEL: ts = (struct gsm_bts_trx_ts*) obj; rc = ts_connect_as(ts, ts->pchan, pchan_act_compl_cb, NULL); break; - case NM_OC_BASEB_TRANSC: case NM_OC_GPRS_NSE: case NM_OC_GPRS_CELL: case NM_OC_GPRS_NSVC: |