diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2020-03-31 19:40:09 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2020-04-01 01:09:31 +0700 |
commit | 9e713f382897fe341ada39bf6a0a4d6027d1f26d (patch) | |
tree | 5f9c402a97c31247f5926b3a6cece20d11be6514 /src | |
parent | 41ce6753bc0e5ed449df9906ba181aa2b3602e93 (diff) |
coding: fix bit ordering in 11-bit RACH coding functions
According to 3GPP TS 44.004, 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
Related: OS#1548
Diffstat (limited to 'src')
-rw-r--r-- | src/coding/gsm0503_coding.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index 163ce21a..8480240d 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -2879,7 +2879,7 @@ static inline int16_t rach_decode_ber(const sbit_t *burst, uint8_t bsic, bool is 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 @@ int gsm0503_rach_ext_encode(ubit_t *burst, uint16_t ra11, uint8_t bsic, bool is_ 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; |