aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/oml.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-02-27 09:41:30 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-02-27 10:31:30 +0100
commit305d8314bce8f10d9c42aa8e19ccd7960fc5f194 (patch)
treeffd65c5aba632115bee436e44a47c6882a487cb8 /src/osmo-bts-sysmo/oml.c
parentdc9148d0351878a79d689a9c6f60aff21b9d5b81 (diff)
parent5e46e4b4880f01eed508d49b66d96c1f7475ab89 (diff)
Merge branch 'zecke/request-queuing'
* Simplify the callback signature. The trx is now the first argument. * Embed the calibration data into the femtol1_hdl. Tests: * All commits are compile tested * All commits bring up the radio (without using calibration data) * Calibration data loading has been tested with the merge * All commits allow a IMSI Attach and a MO Call (to an invalid unknown number). All channels are freed after this. It has been tested with the E71.
Diffstat (limited to 'src/osmo-bts-sysmo/oml.c')
-rw-r--r--src/osmo-bts-sysmo/oml.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index ce1a94e7..bf4fe158 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -179,9 +179,8 @@ static int compl_cb_send_oml_msg(struct msgb *l1_msg, void *data)
int lchan_activate(struct gsm_lchan *lchan);
-static int opstart_compl_cb(struct msgb *l1_msg, void *data)
+static int opstart_compl(struct gsm_abis_mo *mo, struct msgb *l1_msg)
{
- struct gsm_abis_mo *mo = data;
GsmL1_Prim_t *l1p = msgb_l1prim(l1_msg);
GsmL1_Status_t status = prim_status(l1p);
@@ -208,10 +207,19 @@ static int opstart_compl_cb(struct msgb *l1_msg, void *data)
return oml_mo_opstart_ack(mo);
}
-static int trx_init_compl_cb(struct msgb *l1_msg, void *data)
+static int opstart_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg)
{
- struct femtol1_hdl *fl1h = data;
- struct gsm_bts_trx *trx = fl1h->priv;
+ struct gsm_abis_mo *mo;
+ GsmL1_Prim_t *l1p = msgb_l1prim(l1_msg);
+ GsmL1_MphConnectCnf_t *cnf = &l1p->u.mphConnectCnf;
+
+ mo = &trx->ts[cnf->u8Tn].mo;
+ return opstart_compl(mo, l1_msg);
+}
+
+static int trx_init_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg)
+{
+ struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx);
GsmL1_Prim_t *l1p = msgb_l1prim(l1_msg);
GsmL1_MphInitCnf_t *ic = &l1p->u.mphInitCnf;
@@ -228,7 +236,7 @@ static int trx_init_compl_cb(struct msgb *l1_msg, void *data)
fl1h->hLayer1 = ic->hLayer1;
- return opstart_compl_cb(l1_msg, &trx->mo);
+ return opstart_compl(&trx->mo, l1_msg);
}
int gsm_abis_mo_check_attr(const struct gsm_abis_mo *mo, const uint8_t *attr_ids,
@@ -286,7 +294,7 @@ static int trx_init(struct gsm_bts_trx *trx)
dev_par->fRxPowerLevel, dev_par->fTxPowerLevel);
/* send MPH-INIT-REQ, wait for MPH-INIT-CNF */
- return l1if_gsm_req_compl(fl1h, msg, trx_init_compl_cb, fl1h);
+ return l1if_gsm_req_compl(fl1h, msg, trx_init_compl_cb);
}
uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx)
@@ -296,7 +304,7 @@ uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx)
return fl1h->hLayer1;
}
-static int trx_close_compl_cb(struct msgb *l1_msg, void *data)
+static int trx_close_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg)
{
msgb_free(l1_msg);
return 0;
@@ -311,7 +319,7 @@ static int trx_close(struct gsm_bts_trx *trx)
prim_init(msgb_l1prim(msg), GsmL1_PrimId_MphCloseReq, fl1h);
LOGP(DL1C, LOGL_NOTICE, "Close TRX %u\n", trx->nr);
- return l1if_gsm_req_compl(fl1h, msg, trx_close_compl_cb, fl1h);
+ return l1if_gsm_req_compl(fl1h, msg, trx_close_compl_cb);
}
static int ts_connect(struct gsm_bts_trx_ts *ts)
@@ -324,7 +332,7 @@ static int ts_connect(struct gsm_bts_trx_ts *ts)
cr->u8Tn = ts->nr;
cr->logChComb = pchan_to_logChComb[ts->pchan];
- return l1if_gsm_req_compl(fl1h, msg, opstart_compl_cb, &ts->mo);
+ return l1if_gsm_req_compl(fl1h, msg, opstart_compl_cb);
}
GsmL1_Sapi_t lchan_to_GsmL1_Sapi_t(const struct gsm_lchan *lchan)
@@ -444,10 +452,9 @@ static const struct lchan_sapis sapis_for_lchan[_GSM_LCHAN_MAX] = {
},
};
-static int lchan_act_compl_cb(struct msgb *l1_msg, void *data)
+static int lchan_act_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg)
{
struct gsm_time *time;
- struct gsm_bts_trx *trx = data;
struct gsm_lchan *lchan;
GsmL1_Prim_t *l1p = msgb_l1prim(l1_msg);
GsmL1_MphActivateCnf_t *ic = &l1p->u.mphActivateCnf;
@@ -706,7 +713,7 @@ static int mph_send_activate_req(struct gsm_lchan *lchan, int sapi, int dir)
get_value_string(femtobts_dir_names, act_req->dir));
/* send the primitive for all GsmL1_Sapi_* that match the LCHAN */
- return l1if_gsm_req_compl(fl1h, msg, lchan_act_compl_cb, lchan->ts->trx);
+ return l1if_gsm_req_compl(fl1h, msg, lchan_act_compl_cb);
}
int lchan_activate(struct gsm_lchan *lchan)
@@ -777,9 +784,8 @@ static void dump_lch_par(int logl, GsmL1_LogChParam_t *lch_par, GsmL1_Sapi_t sap
LOGPC(DL1C, logl, ")\n");
}
-static int chmod_modif_compl_cb(struct msgb *l1_msg, void *data)
+static int chmod_modif_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg)
{
- struct gsm_bts_trx *trx = data;
struct gsm_lchan *lchan;
GsmL1_Prim_t *l1p = msgb_l1prim(l1_msg);
GsmL1_MphConfigCnf_t *cc = &l1p->u.mphConfigCnf;
@@ -868,7 +874,7 @@ static int tx_confreq_logchpar(struct gsm_lchan *lchan, uint8_t direction)
&conf_req->cfgParams.setLogChParams.logChParams,
conf_req->cfgParams.setLogChParams.sapi);
- return l1if_gsm_req_compl(fl1h, msg, chmod_modif_compl_cb, lchan->ts->trx);
+ return l1if_gsm_req_compl(fl1h, msg, chmod_modif_compl_cb);
}
int l1if_set_txpower(struct femtol1_hdl *fl1h, float tx_power)
@@ -880,7 +886,7 @@ int l1if_set_txpower(struct femtol1_hdl *fl1h, float tx_power)
conf_req->cfgParamId = GsmL1_ConfigParamId_SetTxPowerLevel;
conf_req->cfgParams.setTxPowerLevel.fTxPowerLevel = tx_power;
- return l1if_gsm_req_compl(fl1h, msg, NULL, NULL);
+ return l1if_gsm_req_compl(fl1h, msg, NULL);
}
const enum GsmL1_CipherId_t rsl2l1_ciph[] = {
@@ -923,7 +929,7 @@ int l1if_set_ciphering(struct femtol1_hdl *fl1h,
memcpy(cfgr->cfgParams.setCipheringParams.u8Kc,
lchan->encr.key, lchan->encr.key_len);
- return l1if_gsm_req_compl(fl1h, msg, chmod_modif_compl_cb, lchan->ts->trx);
+ return l1if_gsm_req_compl(fl1h, msg, chmod_modif_compl_cb);
}
@@ -940,9 +946,8 @@ int bts_model_rsl_mode_modify(struct gsm_lchan *lchan)
return 0;
}
-static int lchan_deact_compl_cb(struct msgb *l1_msg, void *data)
+static int lchan_deact_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg)
{
- struct gsm_bts_trx *trx = data;
struct gsm_lchan *lchan;
GsmL1_Prim_t *l1p = msgb_l1prim(l1_msg);
GsmL1_MphDeactivateCnf_t *ic = &l1p->u.mphDeactivateCnf;
@@ -1024,7 +1029,7 @@ int lchan_deactivate(struct gsm_lchan *lchan)
osmo_timer_del(&fl1h->alive_timer);
/* send the primitive for all GsmL1_Sapi_* that match the LCHAN */
- l1if_gsm_req_compl(fl1h, msg, lchan_deact_compl_cb, lchan->ts->trx);
+ l1if_gsm_req_compl(fl1h, msg, lchan_deact_compl_cb);
}
lchan_set_state(lchan, LCHAN_S_REL_REQ);
@@ -1053,7 +1058,7 @@ static int lchan_deactivate_sacch(struct gsm_lchan *lchan)
get_value_string(femtobts_dir_names, deact_req->dir));
/* send the primitive for all GsmL1_Sapi_* that match the LCHAN */
- return l1if_gsm_req_compl(fl1h, msg, lchan_deact_compl_cb, lchan->ts->trx);
+ return l1if_gsm_req_compl(fl1h, msg, lchan_deact_compl_cb);
}