<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmocom-bb/+/16663">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">layer23: Identify AGCH from PCH on tx of GSMTAP downlink messages<br><br>Some bits are taken from osmo-bts l1sap.c<br><br>Change-Id: I0adab003a4060c9cef730e0432859659c51bd087<br>---<br>M src/host/layer23/src/common/l1ctl.c<br>1 file changed, 46 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/63/16663/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c</span><br><span>index 9664561..014e4f8 100644</span><br><span>--- a/src/host/layer23/src/common/l1ctl.c</span><br><span>+++ b/src/host/layer23/src/common/l1ctl.c</span><br><span>@@ -50,6 +50,51 @@</span><br><span> </span><br><span> extern struct gsmtap_inst *gsmtap_inst;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define CB_FCCH             -1</span><br><span style="color: hsl(120, 100%, 40%);">+#define CB_SCH              -2</span><br><span style="color: hsl(120, 100%, 40%);">+#define CB_BCCH             -3</span><br><span style="color: hsl(120, 100%, 40%);">+#define CB_IDLE             -4</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* according to TS 05.02 Clause 7 Table 3 of 9 an Figure 8a */</span><br><span style="color: hsl(120, 100%, 40%);">+static const int ccch_block_table[51] = {</span><br><span style="color: hsl(120, 100%, 40%);">+       CB_FCCH, CB_SCH,/* 0..1 */</span><br><span style="color: hsl(120, 100%, 40%);">+    CB_BCCH, CB_BCCH, CB_BCCH, CB_BCCH,     /* 2..5: BCCH */</span><br><span style="color: hsl(120, 100%, 40%);">+      0, 0, 0, 0,     /* 6..9: B0 */</span><br><span style="color: hsl(120, 100%, 40%);">+        CB_FCCH, CB_SCH,/* 10..11 */</span><br><span style="color: hsl(120, 100%, 40%);">+  1, 1, 1, 1,     /* 12..15: B1 */</span><br><span style="color: hsl(120, 100%, 40%);">+      2, 2, 2, 2,     /* 16..19: B2 */</span><br><span style="color: hsl(120, 100%, 40%);">+      CB_FCCH, CB_SCH,/* 20..21 */</span><br><span style="color: hsl(120, 100%, 40%);">+  3, 3, 3, 3,     /* 22..25: B3 */</span><br><span style="color: hsl(120, 100%, 40%);">+      4, 4, 4, 4,     /* 26..29: B4 */</span><br><span style="color: hsl(120, 100%, 40%);">+      CB_FCCH, CB_SCH,/* 30..31 */</span><br><span style="color: hsl(120, 100%, 40%);">+  5, 5, 5, 5,     /* 32..35: B5 */</span><br><span style="color: hsl(120, 100%, 40%);">+      6, 6, 6, 6,     /* 36..39: B6 */</span><br><span style="color: hsl(120, 100%, 40%);">+      CB_FCCH, CB_SCH,/* 40..41 */</span><br><span style="color: hsl(120, 100%, 40%);">+  7, 7, 7, 7,     /* 42..45: B7 */</span><br><span style="color: hsl(120, 100%, 40%);">+      8, 8, 8, 8,     /* 46..49: B8 */</span><br><span style="color: hsl(120, 100%, 40%);">+      -4              /* 50: Idle */</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* determine the CCCH block number based on the frame number */</span><br><span style="color: hsl(120, 100%, 40%);">+static unsigned int fn2ccch_block(uint32_t fn)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      int rc = ccch_block_table[fn%51];</span><br><span style="color: hsl(120, 100%, 40%);">+     /* if FN is negative, we were called for something that's not CCCH! */</span><br><span style="color: hsl(120, 100%, 40%);">+    OSMO_ASSERT(rc >= 0);</span><br><span style="color: hsl(120, 100%, 40%);">+      return rc;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static uint8_t chantype_rsl2gsmtap_ext(uint8_t rsl_chantype, uint8_t link_id, uint32_t fn, uint8_t num_agch)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t ret = chantype_rsl2gsmtap(rsl_chantype, link_id);</span><br><span style="color: hsl(120, 100%, 40%);">+     if (ret != GSMTAP_CHANNEL_PCH)</span><br><span style="color: hsl(120, 100%, 40%);">+                return ret;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (fn2ccch_block(fn) >= num_agch)</span><br><span style="color: hsl(120, 100%, 40%);">+                 return GSMTAP_CHANNEL_PCH;</span><br><span style="color: hsl(120, 100%, 40%);">+    return GSMTAP_CHANNEL_AGCH;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static struct msgb *osmo_l1_alloc(uint8_t msg_type)</span><br><span> {</span><br><span>         struct l1ctl_hdr *l1h;</span><br><span>@@ -230,7 +275,7 @@</span><br><span>         }</span><br><span> </span><br><span>        /* send CCCH data via GSMTAP */</span><br><span style="color: hsl(0, 100%, 40%);">- gsmtap_chan_type = chantype_rsl2gsmtap(chan_type, dl->link_id);</span><br><span style="color: hsl(120, 100%, 40%);">+    gsmtap_chan_type = chantype_rsl2gsmtap_ext(chan_type, dl->link_id, tm.fn, ms->cellsel.si->bs_ag_blks_res);</span><br><span>  gsmtap_send(gsmtap_inst, ntohs(dl->band_arfcn), chan_ts,</span><br><span>              gsmtap_chan_type, chan_ss, tm.fn, dl->rx_level-110,</span><br><span>               dl->snr, ccch->data, sizeof(ccch->data));</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmocom-bb/+/16663">change 16663</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/osmocom-bb/+/16663"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmocom-bb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I0adab003a4060c9cef730e0432859659c51bd087 </div>
<div style="display:none"> Gerrit-Change-Number: 16663 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>