Change in osmo-bts[master]: osmo-bts-trx: move MTS parser into trx_data_parse_mts()

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/.

laforge gerrit-no-reply at lists.osmocom.org
Sat Apr 24 08:47:03 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/23828 )

Change subject: osmo-bts-trx: move MTS parser into trx_data_parse_mts()
......................................................................

osmo-bts-trx: move MTS parser into trx_data_parse_mts()

This would allow to re-use this code from the TRXDv2 parser.

Change-Id: I2de2cb2d58110452d8dedbcacfef28f85f6d67c1
Related: SYS#4895, OS#4941, OS#4006
---
M src/osmo-bts-trx/trx_if.c
1 file changed, 38 insertions(+), 27 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index bfa1514..912ab42 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -752,12 +752,45 @@
 	return TRX_UL_V0HDR_LEN;
 }
 
+/* Parser for MTS (Modulation and Training Sequence) */
+static inline int trx_data_parse_mts(struct trx_l1h *l1h,
+				     struct trx_ul_burst_ind *bi,
+				     const uint8_t mts)
+{
+	if (mts & (1 << 7)) {
+		bi->flags |= TRX_BI_F_NOPE_IND;
+		return 0;
+	}
+
+	/* | 7 6 5 4 3 2 1 0 | Bitmask / description
+	 * | . 0 0 X X . . . | GMSK, 4 TSC sets (0..3)
+	 * | . 0 1 0 X . . . | 8-PSK, 2 TSC sets (0..1) */
+	if ((mts >> 5) == 0x00) {
+		bi->mod = TRX_MOD_T_GMSK;
+		bi->tsc_set = (mts >> 3) & 0x03;
+	} else if ((mts >> 4) == 0x02) {
+		bi->mod = TRX_MOD_T_8PSK;
+		bi->tsc_set = (mts >> 3) & 0x01;
+	} else {
+		LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
+			"Rx TRXD PDU with unknown or not supported "
+			"modulation (MTS=0x%02x)\n", mts);
+		return -ENOTSUP;
+	}
+
+	/* Training Sequence Code */
+	bi->tsc = mts & 0x07;
+
+	bi->flags |= (TRX_BI_F_MOD_TYPE | TRX_BI_F_TS_INFO);
+
+	return 0;
+}
+
 /* TRXD header dissector for version 0x01 */
 static int trx_data_handle_hdr_v1(struct trx_l1h *l1h,
 				  struct trx_ul_burst_ind *bi,
 				  const uint8_t *buf, size_t buf_len)
 {
-	uint8_t mts;
 	int rc;
 
 	/* Make sure we have enough data */
@@ -777,33 +810,11 @@
 	buf_len -= rc;
 	buf += rc;
 
-	/* IDLE / NOPE frame indication */
-	if (buf[0] & (1 << 7)) {
-		bi->flags |= TRX_BI_F_NOPE_IND;
-		goto skip_mts;
-	}
+	/* MTS (Modulation and Training Sequence) */
+	rc = trx_data_parse_mts(l1h, bi, buf[0]);
+	if (rc < 0)
+		return rc;
 
-	/* Modulation info and TSC set */
-	mts = (buf[0] >> 3) & 0b1111;
-	if ((mts & 0b1100) == 0x00) {
-		bi->mod = TRX_MOD_T_GMSK;
-		bi->tsc_set = mts & 0b11;
-		bi->flags |= TRX_BI_F_MOD_TYPE;
-	} else if ((mts & 0b0100) == 0b0100) {
-		bi->mod = TRX_MOD_T_8PSK;
-		bi->tsc_set = mts & 0b1;
-		bi->flags |= TRX_BI_F_MOD_TYPE;
-	} else {
-		LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
-			"Indicated modulation 0x%02x is not supported\n", mts & 0b1110);
-		return -ENOTSUP;
-	}
-
-	/* Training Sequence Code */
-	bi->tsc = buf[0] & 0b111;
-	bi->flags |= TRX_BI_F_TS_INFO;
-
-skip_mts:
 	/* C/I: Carrier-to-Interference ratio (in centiBels) */
 	bi->ci_cb = (int16_t) osmo_load16be(buf + 1);
 	bi->flags |= TRX_BI_F_CI_CB;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/23828
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I2de2cb2d58110452d8dedbcacfef28f85f6d67c1
Gerrit-Change-Number: 23828
Gerrit-PatchSet: 5
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210424/23139f33/attachment.htm>


More information about the gerrit-log mailing list