[MERGED] osmo-bts[master]: octphy: remap frame number in MEAS_IND

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jul 10 16:21:08 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: octphy: remap frame number in MEAS_IND
......................................................................


octphy: remap frame number in MEAS_IND

The octasic phy stamps the SACCH channel that carries the
measurmenet indication with the frame number of the last
SACCH that falls within the measurement period.

The higher layers expect the frame number to be aligned
to the SACCH channel after, which marks also the beginning
of the next measurement period.

Make the octphy code compatible to the higher layers by
remapping the measurement indication frame number.

Change-Id: I8ecb27c018bf4ad5151878a6ad34026fd0f801a1
---
M src/osmo-bts-octphy/l1_if.c
1 file changed, 52 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index 740d808..20a84f8 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -774,6 +774,57 @@
  * handling of messages coming up from PHY
  ***********************************************************************/
 
+/* When the measurement indication is received from the phy, the phy will
+ * automatically stamp it with the frame number that matches the frame
+ * number of the SACCH channel that marks the end of the measurement
+ * period. (e.g. fn%104=90, on a TCH/H, TS0). However, the upper layers
+ * expect the frame number to be aligned to the next SACCH frame after,
+ * after the end of the measurement period that has just passed. (e.g.
+ * (fn%104=10, on a TCH/H, TS0). The following function remaps the frame
+ * number in order to match the higher layers expectations.
+ * See also: 3GPP TS 05.02 Clause 7 Table 1 of 9  Mapping of logical channels
+ * onto physical channels (see subclauses 6.3, 6.4, 6.5) */
+static uint32_t translate_tch_meas_rep_fn104_reverse(uint32_t fn)
+{
+	uint8_t new_fn_mod;
+	uint8_t fn_mod;
+
+	fn_mod = fn % 104;
+
+	switch (fn_mod) {
+	case 103:
+		new_fn_mod = 25;
+		break;
+	case 12:
+		new_fn_mod = 38;
+		break;
+	case 25:
+		new_fn_mod = 51;
+		break;
+	case 38:
+		new_fn_mod = 64;
+		break;
+	case 51:
+		new_fn_mod = 77;
+		break;
+	case 64:
+		new_fn_mod = 90;
+		break;
+	case 77:
+		new_fn_mod = 103;
+		break;
+	case 90:
+		new_fn_mod = 12;
+		break;
+	default:
+		/* No translation for frame numbers
+		 * fall out of the raster */
+		new_fn_mod = fn_mod;
+	}
+
+	return (fn - fn_mod) + new_fn_mod;
+}
+
 static void process_meas_res(struct gsm_bts_trx *trx, uint8_t chan_nr,
 			     uint32_t fn, uint32_t data_len,
 			     tOCTVC1_GSM_MEASUREMENT_INFO * m)
@@ -812,7 +863,7 @@
 	l1sap.u.info.u.meas_ind.inv_rssi = (uint8_t) ((m->sRSSIDbm >> 8) * -1);
 
 	/* copy logical frame number to MEAS IND data structure */
-	l1sap.u.info.u.meas_ind.fn = fn;
+	l1sap.u.info.u.meas_ind.fn = translate_tch_meas_rep_fn104_reverse(fn);
 
 	/* l1sap wants to take msgb ownership.  However, as there is no
 	 * msg, it will msgb_free(l1sap.oph.msg == NULL) */

-- 
To view, visit https://gerrit.osmocom.org/3118
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8ecb27c018bf4ad5151878a6ad34026fd0f801a1
Gerrit-PatchSet: 5
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list