aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2014-03-04 15:03:59 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-03-10 14:00:21 +0100
commitb26b8fc77692e851469f3e27b9aeaeff233ffd2e (patch)
treefa691e4730fb258e7872f85f5c126d9ce6d4e7b0
parent9c4a52444459819af9d72bb6a82954b8b06ff0ef (diff)
sysmobts: Do a RF mute at initialization when the RC is locked
Currently a locked cell is actively broadcasting when it is being bootstrapped after the lock. This patch adds an initial update of the RF mute state when the TRX is initialized. Ticket: OW#1131 Sponsored-by: On-Waves ehf
-rw-r--r--src/osmo-bts-sysmo/l1_if.c4
-rw-r--r--src/osmo-bts-sysmo/l1_if.h2
-rw-r--r--src/osmo-bts-sysmo/oml.c37
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 bdd06f0..66e07bf 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -1200,7 +1200,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);
@@ -1219,7 +1219,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 d659841..aa893df 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 056ef5d..596680f 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -27,6 +27,7 @@
#include <sysmocom/femtobts/gsml1prim.h>
#include <sysmocom/femtobts/gsml1const.h>
#include <sysmocom/femtobts/gsml1types.h>
+#include <sysmocom/femtobts/superfemto.h>
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/logging.h>
@@ -70,6 +71,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;
@@ -223,6 +226,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);
@@ -242,6 +265,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);
}
@@ -328,7 +357,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];
@@ -337,7 +366,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],
@@ -1549,10 +1578,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;