<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/17709">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">l1if: fix pcu_rx_rach_ind(): properly pack 8-bit and 11-bit RA<br><br>According to 3GPP TS 44.004, section 7.4a, two alternative RACH<br>block formats are specified: 8 bit (1 octet) and 11 bit. The<br>bit order is LSB (right to left), byte order is MSB.<br><br>In PCUIF RACH.ind structure (see gsm_pcu_if_rach_ind) we use<br>a field of type uint16_t to store RA values regardles of the<br>block format. Thus when packing it to bytes, we cannot just<br>cast uint16_t* to uint8_t*, we need to do some bit shifting.<br><br>Change-Id: I08a0a908f855b0d8a002df732e02781126d27dfb<br>---<br>M src/pcu_l1_if.cpp<br>1 file changed, 8 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/09/17709/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp</span><br><span>index a5d5662..906ed83 100644</span><br><span>--- a/src/pcu_l1_if.cpp</span><br><span>+++ b/src/pcu_l1_if.cpp</span><br><span>@@ -439,6 +439,7 @@</span><br><span> {</span><br><span>      BTS *bts = BTS::main_bts(); /* FIXME: resolve BTS by number */</span><br><span>       int current_fn = bts->current_frame_number();</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t ra_buf[2];</span><br><span>   int rc = 0;</span><br><span> </span><br><span>      LOGP(DL1IF, LOGL_INFO, "RACH request received: sapi=%d "</span><br><span>@@ -446,9 +447,15 @@</span><br><span>            rach_ind->ra, rach_ind->fn, current_fn, rach_ind->is_11bit);</span><br><span> </span><br><span> #define send_gsmtap_ra(category, chan) do { \</span><br><span style="color: hsl(120, 100%, 40%);">+    if (rach_ind->is_11bit) { \</span><br><span style="color: hsl(120, 100%, 40%);">+                ra_buf[0] = (uint8_t) (rach_ind->ra >> 3); \</span><br><span style="color: hsl(120, 100%, 40%);">+         ra_buf[1] = (uint8_t) (rach_ind->ra & 0x07); \</span><br><span style="color: hsl(120, 100%, 40%);">+ } else { \</span><br><span style="color: hsl(120, 100%, 40%);">+            ra_buf[0] = (uint8_t) (rach_ind->ra & 0xff); \</span><br><span style="color: hsl(120, 100%, 40%);">+ } \</span><br><span>  bts->send_gsmtap(category, true, rach_ind->trx_nr, rach_ind->ts_nr, \</span><br><span>                        chan, bts->rfn_to_fn(rach_ind->fn), \</span><br><span style="color: hsl(0, 100%, 40%);">-                     (uint8_t*)&rach_ind->ra, rach_ind->is_11bit ? 2 : 1); \</span><br><span style="color: hsl(120, 100%, 40%);">+                     ra_buf, rach_ind->is_11bit ? 2 : 1); \</span><br><span> } while (0)</span><br><span> </span><br><span>        switch (rach_ind->sapi) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/17709">change 17709</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-pcu/+/17709"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I08a0a908f855b0d8a002df732e02781126d27dfb </div>
<div style="display:none"> Gerrit-Change-Number: 17709 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>