Change in ...osmo-trx[master]: fixup: trxd_hdr_v1_specific: fix MTS encoding

fixeria gerrit-no-reply at lists.osmocom.org
Mon Jul 15 18:09:17 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/14783


Change subject: fixup: trxd_hdr_v1_specific: fix MTS encoding
......................................................................

fixup: trxd_hdr_v1_specific: fix MTS encoding

Somehow having the union causes overflows between the bit-fields
of the MTS (Modulation and Training Sequence). I could not figure
out why and how is that possible.

  gdb-peda$ p *v1
  $0 = {
    mts = 0x0,
    tsc = 0x0,
    modulation = 0x0,
    idle = 0x0,
    ci = 0x0
  }

  gdb-peda$ set v1->tsc = 7

  gdb-peda$ p *v1
  $0 = {
    mts = 0x7,
    tsc = 0x7,
    modulation = 0x7, // WTF?!?
    idle = 0x0,
    ci = 0x0
  }

Getting rid of that union fixes the problem.

Change-Id: I9c0b7eef1464524e93fe0945acbdbf3d557c5664
---
M Transceiver52M/proto_trxd.h
1 file changed, 6 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/83/14783/1

diff --git a/Transceiver52M/proto_trxd.h b/Transceiver52M/proto_trxd.h
index a047be4..7eb5dac 100644
--- a/Transceiver52M/proto_trxd.h
+++ b/Transceiver52M/proto_trxd.h
@@ -74,18 +74,15 @@
 #define TRXD_MODULATION_32QAM(ts_set) (0b1010 | (ts_set & 0b0001))
 
 struct trxd_hdr_v1_specific {
-	union {
-		uint8_t mts;
 #if OSMO_IS_LITTLE_ENDIAN
-		uint8_t tsc:3,
-			modulation:4,
-			idle:1;
+	uint8_t tsc:3,
+		modulation:4,
+		idle:1;
 #elif OSMO_IS_BIG_ENDIAN
-		uint8_t idle:1,
-			modulation:4,
-			tsc:3;
+	uint8_t idle:1,
+		modulation:4,
+		tsc:3;
 #endif
-	};
 	int16_t ci;  /* big endian, in centiBels */
 } __attribute__ ((packed));
 

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

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I9c0b7eef1464524e93fe0945acbdbf3d557c5664
Gerrit-Change-Number: 14783
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190715/d1c93e0b/attachment.html>


More information about the gerrit-log mailing list