<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/24419">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">rsl: make rsl_dec_chan_nr() more readable, use RSL_CHAN_NR_MASK<br><br>Change-Id: I1650e3b02e79461e42499268fa8ed30bff667489<br>---<br>M src/gsm/rsl.c<br>1 file changed, 23 insertions(+), 31 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/19/24419/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gsm/rsl.c b/src/gsm/rsl.c</span><br><span>index 8d34543..706fb54 100644</span><br><span>--- a/src/gsm/rsl.c</span><br><span>+++ b/src/gsm/rsl.c</span><br><span>@@ -187,38 +187,30 @@</span><br><span> {</span><br><span> *timeslot = chan_nr & 0x7;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if ((chan_nr & 0xf8) == RSL_CHAN_Bm_ACCHs) {</span><br><span style="color: hsl(0, 100%, 40%);">- *type = RSL_CHAN_Bm_ACCHs;</span><br><span style="color: hsl(120, 100%, 40%);">+ switch (chan_nr & RSL_CHAN_NR_MASK) {</span><br><span style="color: hsl(120, 100%, 40%);">+ case RSL_CHAN_Bm_ACCHs:</span><br><span style="color: hsl(120, 100%, 40%);">+ case RSL_CHAN_BCCH:</span><br><span style="color: hsl(120, 100%, 40%);">+ case RSL_CHAN_RACH:</span><br><span style="color: hsl(120, 100%, 40%);">+ case RSL_CHAN_PCH_AGCH:</span><br><span style="color: hsl(120, 100%, 40%);">+ case RSL_CHAN_OSMO_PDCH:</span><br><span style="color: hsl(120, 100%, 40%);">+ case RSL_CHAN_OSMO_CBCH4:</span><br><span style="color: hsl(120, 100%, 40%);">+ case RSL_CHAN_OSMO_CBCH8:</span><br><span style="color: hsl(120, 100%, 40%);">+ *type = chan_nr & RSL_CHAN_NR_MASK;</span><br><span> *subch = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((chan_nr & 0xf0) == RSL_CHAN_Lm_ACCHs) {</span><br><span style="color: hsl(0, 100%, 40%);">- *type = RSL_CHAN_Lm_ACCHs;</span><br><span style="color: hsl(0, 100%, 40%);">- *subch = (chan_nr >> 3) & 0x1;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((chan_nr & 0xe0) == RSL_CHAN_SDCCH4_ACCH) {</span><br><span style="color: hsl(0, 100%, 40%);">- *type = RSL_CHAN_SDCCH4_ACCH;</span><br><span style="color: hsl(0, 100%, 40%);">- *subch = (chan_nr >> 3) & 0x3;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((chan_nr & 0xc0) == RSL_CHAN_SDCCH8_ACCH) {</span><br><span style="color: hsl(0, 100%, 40%);">- *type = RSL_CHAN_SDCCH8_ACCH;</span><br><span style="color: hsl(0, 100%, 40%);">- *subch = (chan_nr >> 3) & 0x7;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((chan_nr & 0xf8) == RSL_CHAN_BCCH) {</span><br><span style="color: hsl(0, 100%, 40%);">- *type = RSL_CHAN_BCCH;</span><br><span style="color: hsl(0, 100%, 40%);">- *subch = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((chan_nr & 0xf8) == RSL_CHAN_RACH) {</span><br><span style="color: hsl(0, 100%, 40%);">- *type = RSL_CHAN_RACH;</span><br><span style="color: hsl(0, 100%, 40%);">- *subch = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((chan_nr & 0xf8) == RSL_CHAN_PCH_AGCH) {</span><br><span style="color: hsl(0, 100%, 40%);">- *type = RSL_CHAN_PCH_AGCH;</span><br><span style="color: hsl(0, 100%, 40%);">- *subch = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((chan_nr & 0xf8) == RSL_CHAN_OSMO_PDCH) {</span><br><span style="color: hsl(0, 100%, 40%);">- *type = RSL_CHAN_OSMO_PDCH;</span><br><span style="color: hsl(0, 100%, 40%);">- *subch = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((chan_nr & 0xf8) == RSL_CHAN_OSMO_CBCH4) {</span><br><span style="color: hsl(0, 100%, 40%);">- *type = RSL_CHAN_OSMO_CBCH4;</span><br><span style="color: hsl(0, 100%, 40%);">- *subch = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((chan_nr & 0xf8) == RSL_CHAN_OSMO_CBCH8) {</span><br><span style="color: hsl(0, 100%, 40%);">- *type = RSL_CHAN_OSMO_CBCH8;</span><br><span style="color: hsl(0, 100%, 40%);">- *subch = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else</span><br><span style="color: hsl(0, 100%, 40%);">- return -EINVAL;</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ default:</span><br><span style="color: hsl(120, 100%, 40%);">+ if ((chan_nr & 0xf0) == RSL_CHAN_Lm_ACCHs) {</span><br><span style="color: hsl(120, 100%, 40%);">+ *type = RSL_CHAN_Lm_ACCHs;</span><br><span style="color: hsl(120, 100%, 40%);">+ *subch = (chan_nr >> 3) & 0x1;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if ((chan_nr & 0xe0) == RSL_CHAN_SDCCH4_ACCH) {</span><br><span style="color: hsl(120, 100%, 40%);">+ *type = RSL_CHAN_SDCCH4_ACCH;</span><br><span style="color: hsl(120, 100%, 40%);">+ *subch = (chan_nr >> 3) & 0x3;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if ((chan_nr & 0xc0) == RSL_CHAN_SDCCH8_ACCH) {</span><br><span style="color: hsl(120, 100%, 40%);">+ *type = RSL_CHAN_SDCCH8_ACCH;</span><br><span style="color: hsl(120, 100%, 40%);">+ *subch = (chan_nr >> 3) & 0x7;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else</span><br><span style="color: hsl(120, 100%, 40%);">+ return -EINVAL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> return 0;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/24419">change 24419</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/libosmocore/+/24419"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I1650e3b02e79461e42499268fa8ed30bff667489 </div>
<div style="display:none"> Gerrit-Change-Number: 24419 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>