diff options
author | Max <msuraev@sysmocom.de> | 2017-03-07 17:30:35 +0100 |
---|---|---|
committer | Max <msuraev@sysmocom.de> | 2017-04-26 12:42:09 +0200 |
commit | b4bf603c9866cf8ed7c59b812fc84b3138bb4dda (patch) | |
tree | e4ad59d3434a2909c21062f9544845124a3aad10 /src/common/l1sap.c | |
parent | 25742a5929edecc545a4fc254f678cc834f8c3b3 (diff) |
Add MS TO to RSL measurements
Add optional MS timing offset (3GPP TS 45.010 § 1.2) to RSL MEASUREMENT
RESULT (3GPP TS 48.058 § 8.4.8). The value is calculated either directly
from corresponding BTS measurement or from 3GPP TS 48.058 § 9.3.17
Access Delay (for known TA) and is invalidated after RSL report is sent
until new measurement indication or RACH is received.
Change-Id: I4dfe5c48834a083e757d5de3236a02e15a238b28
Related: OS#1574
Diffstat (limited to 'src/common/l1sap.c')
-rw-r--r-- | src/common/l1sap.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 35920967..57a858ce 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -431,6 +431,27 @@ static int l1sap_info_time_ind(struct gsm_bts *bts, return 0; } + +static inline void set_ms_to_data(struct gsm_lchan *lchan, int16_t data, bool set_ms_to) +{ + if (!lchan) + return; + + if (data + 63 > 255) { /* According to 3GPP TS 48.058 §9.3.37 Timing Offset field cannot exceed 255 */ + LOGP(DL1P, LOGL_ERROR, "Attempting to set invalid Timing Offset value %d (MS TO = %u)!\n", + data, set_ms_to); + return; + } + + if (set_ms_to) { + lchan->ms_t_offs = data + 63; + lchan->p_offs = -1; + } else { + lchan->p_offs = data + 63; + lchan->ms_t_offs = -1; + } +} + /* measurement information received from bts model */ static int l1sap_info_meas_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap, @@ -456,6 +477,9 @@ static int l1sap_info_meas_ind(struct gsm_bts_trx *trx, ulm.ber10k = info_meas_ind->ber10k; ulm.inv_rssi = info_meas_ind->inv_rssi; + /* we assume that symbol period is 1 bit: */ + set_ms_to_data(lchan, info_meas_ind->ta_offs_qbits / 4, true); + lchan_new_ul_meas(lchan, &ulm); return 0; @@ -1021,6 +1045,9 @@ static int l1sap_ph_rach_ind(struct gsm_bts_trx *trx, return 0; } + /* According to 3GPP TS 48.058 § 9.3.17 Access Delay is expressed same way as TA (number of symbols) */ + set_ms_to_data(get_lchan_by_chan_nr(trx, rach_ind->chan_nr), acc_delay, false); + /* check for handover rach */ if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) return l1sap_handover_rach(trx, l1sap, rach_ind); |