From c573fc99c0ccb7d465613ddaa6b70572c26899bb Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 4 Mar 2014 09:44:40 +0100 Subject: sysmobts: Mute the cell _after_ the MphInit again The MphInit operation will undo the muting. So we need to mute directly after the init again. --- src/osmo-bts-sysmo/l1_if.c | 4 ++-- src/osmo-bts-sysmo/l1_if.h | 2 +- src/osmo-bts-sysmo/oml.c | 37 +++++++++++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index ccdd79c0..e6322922 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -1166,7 +1166,7 @@ static int mute_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp) #endif /* mute/unmute RF time slots */ -int l1if_mute_rf(struct femtol1_hdl *hdl, uint8_t mute[8]) +int l1if_mute_rf(struct femtol1_hdl *hdl, uint8_t mute[8], l1if_compl_cb *cb) { struct msgb *msg = sysp_msgb_alloc(); SuperFemto_Prim_t *sysp = msgb_sysprim(msg); @@ -1185,7 +1185,7 @@ int l1if_mute_rf(struct femtol1_hdl *hdl, uint8_t mute[8]) /* save for later use */ memcpy(hdl->last_rf_mute, mute, sizeof(hdl->last_rf_mute)); - return l1if_req_compl(hdl, msg, mute_rf_compl_cb); + return l1if_req_compl(hdl, msg, cb ? cb : mute_rf_compl_cb); #endif /* < 3.6.0 */ } diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h index d659841c..aa893df6 100644 --- a/src/osmo-bts-sysmo/l1_if.h +++ b/src/osmo-bts-sysmo/l1_if.h @@ -97,7 +97,7 @@ int l1if_reset(struct femtol1_hdl *hdl); int l1if_activate_rf(struct femtol1_hdl *hdl, int on); int l1if_set_trace_flags(struct femtol1_hdl *hdl, uint32_t flags); int l1if_set_txpower(struct femtol1_hdl *fl1h, float tx_power); -int l1if_mute_rf(struct femtol1_hdl *hdl, uint8_t mute[8]); +int l1if_mute_rf(struct femtol1_hdl *hdl, uint8_t mute[8], l1if_compl_cb *cb); struct msgb *l1p_msgb_alloc(void); struct msgb *sysp_msgb_alloc(void); diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index 11222b18..735d6455 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -69,6 +70,8 @@ static const enum GsmL1_LogChComb_t pchan_to_logChComb[_GSM_PCHAN_MAX] = { [GSM_PCHAN_UNKNOWN] = GsmL1_LogChComb_0, }; +static int trx_rf_lock(struct gsm_bts_trx *trx, int locked, l1if_compl_cb *cb); + static void *prim_init(GsmL1_Prim_t *prim, GsmL1_PrimId_t id, struct femtol1_hdl *gl1) { prim->id = id; @@ -222,6 +225,26 @@ static int opstart_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg) return opstart_compl(mo, l1_msg); } +#if SUPERFEMTO_API_VERSION >= SUPERFEMTO_API(3,6,0) +static int trx_mute_on_init_cb(struct gsm_bts_trx *trx, struct msgb *resp) +{ + SuperFemto_Prim_t *sysp = msgb_sysprim(resp); + GsmL1_Status_t status; + + status = sysp->u.muteRfCnf.status; + + if (status != GsmL1_Status_Success) { + LOGP(DL1C, LOGL_FATAL, "Rx RF-MUTE.conf status=%s\n", + get_value_string(femtobts_l1status_names, status)); + bts_shutdown(trx->bts, "RF-MUTE failure"); + } + + msgb_free(resp); + + return 0; +} +#endif + static int trx_init_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg) { struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx); @@ -241,6 +264,12 @@ static int trx_init_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg) fl1h->hLayer1 = ic->hLayer1; +#if SUPERFEMTO_API_VERSION >= SUPERFEMTO_API(3,6,0) + /* If the TRX was already locked the MphInit would have undone it */ + if (trx->mo.nm_state.administrative == NM_STATE_LOCKED) + trx_rf_lock(trx, 1, trx_mute_on_init_cb); +#endif + return opstart_compl(&trx->mo, l1_msg); } @@ -327,7 +356,7 @@ int bts_model_trx_close(struct gsm_bts_trx *trx) return l1if_gsm_req_compl(fl1h, msg, trx_close_compl_cb); } -static int trx_rf_lock(struct gsm_bts_trx *trx, int locked) +static int trx_rf_lock(struct gsm_bts_trx *trx, int locked, l1if_compl_cb *cb) { struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx); uint8_t mute[8]; @@ -336,7 +365,7 @@ static int trx_rf_lock(struct gsm_bts_trx *trx, int locked) for (i = 0; i < ARRAY_SIZE(mute); ++i) mute[i] = locked ? 1 : 0; - return l1if_mute_rf(fl1h, mute); + return l1if_mute_rf(fl1h, mute, cb); } int oml_mo_rf_lock_chg(struct gsm_abis_mo *mo, uint8_t mute_state[8], @@ -1519,10 +1548,10 @@ int bts_model_chg_adm_state(struct gsm_bts *bts, struct gsm_abis_mo *mo, mo->procedure_pending = 1; switch (adm_state) { case NM_STATE_LOCKED: - rc = trx_rf_lock(obj, 1); + rc = trx_rf_lock(obj, 1, NULL); break; case NM_STATE_UNLOCKED: - rc = trx_rf_lock(obj, 0); + rc = trx_rf_lock(obj, 0, NULL); break; default: granted = 1; -- cgit v1.2.3