Change in libosmocore[master]: coding: fix bit ordering in 11-bit RACH coding functions

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

fixeria gerrit-no-reply at lists.osmocom.org
Tue Mar 31 17:56:52 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/17693 )


Change subject: coding: fix bit ordering in 11-bit RACH coding functions
......................................................................

coding: fix bit ordering in 11-bit RACH coding functions

According to 3GPP TS 44.060, figure 7.4a.b, the format of 11-bit
RACH uplink / Uplink access burst block is as defined follows:

  <---------------------------------------------------

      8     7     6     5     4     3     2     1
  +--------------------------------------------------+
  |  11 bit RACH uplink / Uplink access burst block  | OCT1
  +--------------------------------------------------+
                                 |                   | OCT2
                                 +-------------------+

As was (correctly) assumed in [1], the bit ordering in 11-bit RACH
coding functions is wrong. The problem is that neither of generic
functions from bit16gen.h can be used to load / store the RA11
value (regardless of the endianness), because they assume that
the payload is 16 bit long.

With this patch applied, RA11 values from [1] look correct:

  < EGPRS Packet channel request message content > ::=
    < Signalling : 110011  < RandomBits : 00111 > > |
    < Signalling : 110011  < RandomBits : 00110 > > |
    < Signalling : 110011  < RandomBits : 01111 > > |
    < Signalling : 110011  < RandomBits : 01100 > > |
    < Signalling : 110011  < RandomBits : 00111 > > |
    < Signalling : 110011  < RandomBits : 10110 > > ;

[1] Id80e471d252b9416217b56f4c8c0a8f5f1289fee

Change-Id: I43d30611dd69f77f2b3b46f4b56056a8891d3c24
---
M src/coding/gsm0503_coding.c
M tests/coding/coding_test.ok
2 files changed, 9 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/93/17693/1

diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c
index 163ce21..8480240 100644
--- a/src/coding/gsm0503_coding.c
+++ b/src/coding/gsm0503_coding.c
@@ -2879,7 +2879,7 @@
 
 	osmo_ubit2pbit_ext(ra, 0, conv, 0, nbits, 1);
 
-	return is_11bit ? osmo_load16le(ra) : ra[0];
+	return is_11bit ? ((ra[0] << 3) | (ra[1] & 0x07)) : ra[0];
 }
 
 /*! Decode the Extended (11-bit) RACH according to 3GPP TS 45.003
@@ -2974,7 +2974,8 @@
 	uint8_t ra[2] = { 0 }, nbits = 8;
 
 	if (is_11bit) {
-		osmo_store16le(ra11, ra);
+		ra[0] = (uint8_t) (ra11 >> 3);
+		ra[1] = (uint8_t) (ra11 & 0x07);
 		nbits = 11;
 	} else
 		ra[0] = (uint8_t)ra11;
diff --git a/tests/coding/coding_test.ok b/tests/coding/coding_test.ok
index 496ce89..3a4fbf2 100644
--- a/tests/coding/coding_test.ok
+++ b/tests/coding/coding_test.ok
@@ -40,12 +40,12 @@
 Decoded: 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 
 xcch_decode: n_errors=60 n_bits_total=456 ber=0.13
 
-Decoded RA11: 0x7cc
-Decoded RA11: 0x6cc
-Decoded RA11: 0x7cd
-Decoded RA11: 0x4cd
-Decoded RA11: 0x7cc
-Decoded RA11: 0x6ce
+Decoded RA11: 0x667
+Decoded RA11: 0x666
+Decoded RA11: 0x66f
+Decoded RA11: 0x66c
+Decoded RA11: 0x667
+Decoded RA11: 0x676
 
 Encoding: 03 03 01 00 
 U-Bits: 111001110011000011100111001100001101001111000000000011010000011010110111111100

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I43d30611dd69f77f2b3b46f4b56056a8891d3c24
Gerrit-Change-Number: 17693
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/20200331/8e1d4767/attachment.htm>


More information about the gerrit-log mailing list