Change in osmo-pcu[master]: encoding: Encode TA as unsigned and check validty against GSM48_TA_IN...

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

pespin gerrit-no-reply at lists.osmocom.org
Tue Jul 7 15:24:45 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/19176 )


Change subject: encoding: Encode TA as unsigned and check validty against GSM48_TA_INVALID
......................................................................

encoding: Encode TA as unsigned and check validty against GSM48_TA_INVALID

According to 3GPP TS 44.018 sec 10.5.2.40, Timing Advance value is 8 bit
and range is 0-63 (0-219 on GSM400). unsigned value (uint8_t) is used
everywhere else, so avoid using a signed one here, and simply check for
GSM48_TA_INVALID here.ch we use everywhere else to initialize when the
value is not known. Ideally we should check for value based on band.

Change-Id: I82b13561d0fe5ebafb5c3a8b9a501045c29809bc
---
M src/encoding.cpp
1 file changed, 5 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/76/19176/1

diff --git a/src/encoding.cpp b/src/encoding.cpp
index 89cc5f2..92944f0 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -142,9 +142,9 @@
 }
 
 /* { 0 | 1 < TIMING_ADVANCE_VALUE : bit (6) > } */
-static inline void write_ta(bitvec *dest, unsigned& wp, int8_t ta)
+static inline void write_ta(bitvec *dest, unsigned& wp, uint8_t ta)
 {
-	if (ta < 0) /* No TIMING_ADVANCE_VALUE: */
+	if (ta >= GSM48_TA_INVALID) /* No TIMING_ADVANCE_VALUE: */
 		bitvec_write_field(dest, &wp, 0, 1);
 	else { /* TIMING_ADVANCE_VALUE: */
 		bitvec_write_field(dest, &wp, 1, 1);
@@ -174,7 +174,7 @@
            < TIMING_ADVANCE_TIMESLOT_NUMBER : bit (3) > }
  */
 static inline void write_ta_ie(bitvec *dest, unsigned& wp,
-			       int8_t ta, int8_t tai, uint8_t ts)
+			       uint8_t ta, int8_t tai, uint8_t ts)
 {
 	write_ta(dest, wp, ta);
 	if (write_tai(dest, wp, tai)) /* TIMING_ADVANCE_TIMESLOT_NUMBER: */
@@ -580,7 +580,7 @@
 		bitvec_write_field(dest, &wp,0x0,1); // Message escape
 		bitvec_write_field(dest, &wp, mcs_chan_code(tbf->current_cs()), 2); // CHANNEL_CODING_COMMAND
 		bitvec_write_field(dest, &wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING
-		write_ta_ie(dest, wp,tbf->ta(), ta_idx, ta_ts);
+		write_ta_ie(dest, wp, tbf->ta(), ta_idx, ta_ts);
 	} else { /* EPGRS */
 		bitvec_write_field(dest, &wp,0x1,1); // Message escape
 		bitvec_write_field(dest, &wp,0x0,2); // EGPRS message contents
@@ -594,7 +594,7 @@
 		bitvec_write_field(dest, &wp,0x0,1); // No ARAC RETRANSMISSION REQUEST
 		bitvec_write_field(dest, &wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING
 		bitvec_write_field(dest, &wp,0x0,1); // No BEP_PERIOD2
-		write_ta_ie(dest, wp,tbf->ta(), ta_idx, ta_ts);
+		write_ta_ie(dest, wp, tbf->ta(), ta_idx, ta_ts);
 		bitvec_write_field(dest, &wp,0x0,1); // No Packet Extended Timing Advance
 	}
 

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I82b13561d0fe5ebafb5c3a8b9a501045c29809bc
Gerrit-Change-Number: 19176
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200707/55a3ce92/attachment.htm>


More information about the gerrit-log mailing list