diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-06-29 10:36:07 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-06-29 10:36:07 +0200 |
commit | 6818881d72cdde04eca4b1923a805190acde493c (patch) | |
tree | 02a808116ca27e88637e8880a02261b69138fbe3 /src/osmo-bts-sysmo/l1_if.c | |
parent | c5e01c8bd463e42ea3bbe4142941f43c548f14c7 (diff) |
implement baseic uplink measurement processing + reporting
* gather measurements from each PH-DATA.ind
* check every TDMA frame about meas period expiration
* compute averages after period expired
* put MS DL MEAS REP into RSL MEAS RES messages, include UL meas
bugs:
* L3 INFO content seems to have some offset
* is_sub is not set anywhere
* measurement periods might have up/downlink offset
Diffstat (limited to 'src/osmo-bts-sysmo/l1_if.c')
-rw-r--r-- | src/osmo-bts-sysmo/l1_if.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index c01919fe..fd09ed9b 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -39,6 +39,7 @@ #include <osmo-bts/bts.h> #include <osmo-bts/gsm_data.h> #include <osmo-bts/paging.h> +#include <osmo-bts/measurement.h> #include <sysmocom/femtobts/femtobts.h> #include <sysmocom/femtobts/gsml1prim.h> @@ -326,6 +327,10 @@ static int handle_mph_time_ind(struct femtol1_hdl *fl1, /* Update our data structures with the current GSM time */ gsm_fn2gsmtime(&fl1->gsm_time, time_ind->u32Fn); + /* check if the measurement period of some lchan has ended + * and pre-compute the respective measurement */ + trx_meas_check_compute(fl1->priv, time_ind->u32Fn -1); + return 0; } @@ -357,13 +362,31 @@ static void dump_meas_res(GsmL1_MeasParam_t *m) m->fBer, m->i16BurstTiming); } +static int process_meas_res(struct gsm_lchan *lchan, GsmL1_MeasParam_t *m) +{ + struct bts_ul_meas ulm; + + ulm.ta_offs_qbits = m->i16BurstTiming; + ulm.ber10k = (unsigned int) (m->fBer * 100); + ulm.inv_rssi = (uint8_t) (m->fRssi * -1); + + return lchan_new_ul_meas(lchan, &ulm); +} + static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_ind) { struct osmo_phsap_prim pp; struct gsm_lchan *lchan; struct lapdm_entity *le; struct msgb *msg; - uint8_t lapdm_sapi = 0; + + lchan = l1if_hLayer2_to_lchan(fl1->priv, data_ind->hLayer2); + if (!lchan) { + LOGP(DL1C, LOGL_ERROR, "unable to resolve lchan by hLayer2\n"); + return -ENODEV; + } + + process_meas_res(lchan, &data_ind->measParam); if (data_ind->measParam.fLinkQuality < MIN_QUAL_NORM) return 0; @@ -371,10 +394,12 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_i DEBUGP(DL1C, "Rx PH-DATA.ind (hLayer2 = 0x%08x)", data_ind->hLayer2); dump_meas_res(&data_ind->measParam); - lchan = l1if_hLayer2_to_lchan(fl1->priv, data_ind->hLayer2); - if (!lchan) { - LOGP(DL1C, LOGL_ERROR, "unable to resolve lchan by hLayer2\n"); - return -ENODEV; + /* save the SACCH L1 header in the lchan struct for RSL MEAS RES */ + if (data_ind->sapi == GsmL1_Sapi_Sacch && + data_ind->msgUnitParam.u8Size >= 2) { + lchan->meas.l1_info[0] = data_ind->msgUnitParam.u8Buffer[0]; + lchan->meas.l1_info[1] = data_ind->msgUnitParam.u8Buffer[1]; + lchan->meas.flags |= LC_UL_M_F_L1_VALID; } le = le_by_l1_sapi(&lchan->lapdm_ch, data_ind->sapi); |