aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/l1sap.c
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-08-31 19:49:12 +0200
committerHarald Welte <laforge@gnumonks.org>2015-09-22 16:39:03 +0200
commit21b5e6318e7bfbd233fdf542a3f43588ab92282b (patch)
tree182bf10ac7858921a66485a25eacd9bf60854db8 /src/common/l1sap.c
parent4fe00da9f8f849efb86977e909870179124f384a (diff)
Add TIME (MPH_INFO) IND messages to PH-/MPH-/TCH-SAP interface
This part moves GSM time handling from osmo-bts-sysmo part to common part.
Diffstat (limited to 'src/common/l1sap.c')
-rw-r--r--src/common/l1sap.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 633a5a5b..6cb636d7 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -69,6 +69,53 @@ struct msgb *l1sap_msgb_alloc(unsigned int l2_len)
return msg;
}
+/* time information received from bts model */
+static int l1sap_info_time_ind(struct gsm_bts_trx *trx,
+ struct osmo_phsap_prim *l1sap,
+ struct info_time_ind_param *info_time_ind)
+{
+ struct gsm_bts *bts = trx->bts;
+ struct gsm_bts_role_bts *btsb = bts->role;
+
+ DEBUGP(DL1P, "MPH_INFO time ind %u\n", info_time_ind->fn);
+
+ /* Update our data structures with the current GSM time */
+ gsm_fn2gsmtime(&btsb->gsm_time, info_time_ind->fn);
+
+ /* Update time on PCU interface */
+ pcu_tx_time_ind(info_time_ind->fn);
+
+ /* check if the measurement period of some lchan has ended
+ * and pre-compute the respective measurement */
+ trx_meas_check_compute(trx, info_time_ind->fn - 1);
+
+ /* increment 'total' for every possible rach */
+ if (bts->c0->ts[0].pchan != GSM_PCHAN_CCCH_SDCCH4
+ || (info_time_ind->fn % 51) < 27)
+ btsb->load.rach.total++;
+
+ return 0;
+}
+
+/* any L1 MPH_INFO indication prim recevied from bts model */
+static int l1sap_mph_info_ind(struct gsm_bts_trx *trx,
+ struct osmo_phsap_prim *l1sap, struct mph_info_param *info)
+{
+ int rc = 0;
+
+ switch (info->type) {
+ case PRIM_INFO_TIME:
+ rc = l1sap_info_time_ind(trx, l1sap, &info->u.time_ind);
+ break;
+ default:
+ LOGP(DL1P, LOGL_NOTICE, "unknown MPH_INFO ind type %d\n",
+ info->type);
+ break;
+ }
+
+ return rc;
+}
+
/* PH-RTS-IND prim recevied from bts model */
static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx,
struct osmo_phsap_prim *l1sap, struct ph_data_param *rts_ind)
@@ -262,6 +309,9 @@ int l1sap_up(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
int rc = 0;
switch (OSMO_PRIM_HDR(&l1sap->oph)) {
+ case OSMO_PRIM(PRIM_MPH_INFO, PRIM_OP_INDICATION):
+ rc = l1sap_mph_info_ind(trx, l1sap, &l1sap->u.info);
+ break;
case OSMO_PRIM(PRIM_PH_RTS, PRIM_OP_INDICATION):
rc = l1sap_ph_rts_ind(trx, l1sap, &l1sap->u.data);
break;