Change in osmo-pcu[master]: l1if: fix pcu_rx_rach_ind(): properly pack 8-bit and 11-bit RA

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
Thu Apr 2 12:21:04 UTC 2020


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


Change subject: l1if: fix pcu_rx_rach_ind(): properly pack 8-bit and 11-bit RA
......................................................................

l1if: fix pcu_rx_rach_ind(): properly pack 8-bit and 11-bit RA

According to 3GPP TS 44.004, section 7.4a, two alternative RACH
block formats are specified: 8 bit (1 octet) and 11 bit. The
bit order is LSB (right to left), byte order is MSB.

In PCUIF RACH.ind structure (see gsm_pcu_if_rach_ind) we use
a field of type uint16_t to store RA values regardles of the
block format. Thus when packing it to bytes, we cannot just
cast uint16_t* to uint8_t*, we need to do some bit shifting.

Change-Id: I08a0a908f855b0d8a002df732e02781126d27dfb
---
M src/pcu_l1_if.cpp
1 file changed, 8 insertions(+), 1 deletion(-)



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

diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index a5d5662..906ed83 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -439,6 +439,7 @@
 {
 	BTS *bts = BTS::main_bts(); /* FIXME: resolve BTS by number */
 	int current_fn = bts->current_frame_number();
+	uint8_t ra_buf[2];
 	int rc = 0;
 
 	LOGP(DL1IF, LOGL_INFO, "RACH request received: sapi=%d "
@@ -446,9 +447,15 @@
 		rach_ind->ra, rach_ind->fn, current_fn, rach_ind->is_11bit);
 
 #define send_gsmtap_ra(category, chan) do { \
+	if (rach_ind->is_11bit) { \
+		ra_buf[0] = (uint8_t) (rach_ind->ra >> 3); \
+		ra_buf[1] = (uint8_t) (rach_ind->ra & 0x07); \
+	} else { \
+		ra_buf[0] = (uint8_t) (rach_ind->ra & 0xff); \
+	} \
 	bts->send_gsmtap(category, true, rach_ind->trx_nr, rach_ind->ts_nr, \
 			 chan, bts->rfn_to_fn(rach_ind->fn), \
-			 (uint8_t*)&rach_ind->ra, rach_ind->is_11bit ? 2 : 1); \
+			 ra_buf, rach_ind->is_11bit ? 2 : 1); \
 } while (0)
 
 	switch (rach_ind->sapi) {

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I08a0a908f855b0d8a002df732e02781126d27dfb
Gerrit-Change-Number: 17709
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/20200402/1a03beb3/attachment.htm>


More information about the gerrit-log mailing list