<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/21185">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">WIP: l1sap: add repeated uplink SACCH<br><br>3GPP TS 44.006, section 11 describes a method how the uplink<br>SACCH transmission can be repeated to increase transmission<br>reliability.<br><br>Change-Id: I7e4cc33cc010866e41e3b594351a7f7bf93e08ac<br>Related: OS#4795, SYS#5114<br>---<br>M include/osmo-bts/gsm_data.h<br>M include/osmo-bts/scheduler.h<br>M src/common/l1sap.c<br>M src/osmo-bts-trx/sched_lchan_xcch.c<br>4 files changed, 55 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/85/21185/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h</span><br><span>index ff6878d..4e925af 100644</span><br><span>--- a/include/osmo-bts/gsm_data.h</span><br><span>+++ b/include/osmo-bts/gsm_data.h</span><br><span>@@ -310,6 +310,7 @@</span><br><span>    struct osmo_ecu_state *ecu_state;</span><br><span> </span><br><span>        struct abis_rsl_osmo_rep_acch_cap repeated_acch_capability;</span><br><span style="color: hsl(120, 100%, 40%);">+   bool repeated_ul_sacch_active;</span><br><span> };</span><br><span> </span><br><span> static inline uint8_t lchan_get_ta(const struct gsm_lchan *lchan)</span><br><span>diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h</span><br><span>index 6bb0b9b..6f05756 100644</span><br><span>--- a/include/osmo-bts/scheduler.h</span><br><span>+++ b/include/osmo-bts/scheduler.h</span><br><span>@@ -87,6 +87,7 @@</span><br><span>       ubit_t                  *dl_bursts;     /* burst buffer for TX */</span><br><span>    enum trx_burst_type     dl_burst_type;  /* GMSK or 8PSK burst type */</span><br><span>        sbit_t                  *ul_bursts;     /* burst buffer for RX */</span><br><span style="color: hsl(120, 100%, 40%);">+     sbit_t                  *ul_bursts_prev;/* previous burst buffer for RX (repeated SACCH) */</span><br><span>  uint32_t                ul_first_fn;    /* fn of first burst */</span><br><span>      uint8_t                 ul_mask;        /* mask of received bursts */</span><br><span> </span><br><span>diff --git a/src/common/l1sap.c b/src/common/l1sap.c</span><br><span>index 142a3c8..f63aff9 100644</span><br><span>--- a/src/common/l1sap.c</span><br><span>+++ b/src/common/l1sap.c</span><br><span>@@ -1080,6 +1080,8 @@</span><br><span>                       p = msgb_put(msg, GSM_MACBLOCK_LEN);</span><br><span>                         /* L1-header, if not set/modified by layer 1 */</span><br><span>                      p[0] = lchan->ms_power_ctrl.current;</span><br><span style="color: hsl(120, 100%, 40%);">+                       if (lchan->repeated_acch_capability.ul_sacch && lchan->repeated_ul_sacch_active)</span><br><span style="color: hsl(120, 100%, 40%);">+                                p[0] |= 0x40; /* See also: 3GPP TS 44.004, section 7.1 */</span><br><span>                    p[1] = lchan->rqd_ta;</span><br><span>                     le = &lchan->lapdm_ch.lapdm_acch;</span><br><span>                     if (lchan->repeated_acch_capability.dl_sacch)</span><br><span>diff --git a/src/osmo-bts-trx/sched_lchan_xcch.c b/src/osmo-bts-trx/sched_lchan_xcch.c</span><br><span>index b96bc0b..2e4993e 100644</span><br><span>--- a/src/osmo-bts-trx/sched_lchan_xcch.c</span><br><span>+++ b/src/osmo-bts-trx/sched_lchan_xcch.c</span><br><span>@@ -34,6 +34,24 @@</span><br><span> </span><br><span> #include <sched_utils.h></span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Add two arrays of sbits */</span><br><span style="color: hsl(120, 100%, 40%);">+static void add_sbits(sbit_t *current, const sbit_t *previous)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    unsigned int i;</span><br><span style="color: hsl(120, 100%, 40%);">+       int result;</span><br><span style="color: hsl(120, 100%, 40%);">+   for (i = 0; i < 464; i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+                result = *current + *previous;</span><br><span style="color: hsl(120, 100%, 40%);">+                if (result > 127)</span><br><span style="color: hsl(120, 100%, 40%);">+                  result = 127;</span><br><span style="color: hsl(120, 100%, 40%);">+         else if (result < -127)</span><br><span style="color: hsl(120, 100%, 40%);">+                    result = -127;</span><br><span style="color: hsl(120, 100%, 40%);">+                *current = (sbit_t) result;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+         current++;</span><br><span style="color: hsl(120, 100%, 40%);">+            previous++;</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%);">+</span><br><span> /*! \brief a single (SDCCH/SACCH) burst was received by the PHY, process it */</span><br><span> int rx_data_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,</span><br><span>                uint8_t bid, const struct trx_ul_burst_ind *bi)</span><br><span>@@ -49,6 +67,11 @@</span><br><span>  int n_bits_total = 0;</span><br><span>        uint16_t ber10k;</span><br><span>     int rc;</span><br><span style="color: hsl(120, 100%, 40%);">+       struct gsm_lchan *lchan = chan_state->lchan;</span><br><span style="color: hsl(120, 100%, 40%);">+       bool is_sacch = false;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      if (chan == TRXC_SACCHTF || chan == TRXC_SACCHTH_0 || chan ==TRXC_SACCHTH_1)</span><br><span style="color: hsl(120, 100%, 40%);">+          is_sacch = true;</span><br><span> </span><br><span>         /* If handover RACH detection is turned on, treat this burst as an Access Burst.</span><br><span>      * Handle NOPE.ind as usually to ensure proper Uplink measurement reporting. */</span><br><span>@@ -65,6 +88,14 @@</span><br><span>                         return -ENOMEM;</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* UL-SACCH requires additional memory to keep a copy of each previous</span><br><span style="color: hsl(120, 100%, 40%);">+         * burst set. */</span><br><span style="color: hsl(120, 100%, 40%);">+      if (is_sacch && !chan_state->ul_bursts_prev) {</span><br><span style="color: hsl(120, 100%, 40%);">+             chan_state->ul_bursts_prev = talloc_zero_size(tall_bts_ctx, 464);</span><br><span style="color: hsl(120, 100%, 40%);">+          if (!*chan_state->ul_bursts_prev)</span><br><span style="color: hsl(120, 100%, 40%);">+                  return -ENOMEM;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  /* clear burst & store frame number of first burst */</span><br><span>    if (bid == 0) {</span><br><span>              memset(*bursts_p, 0, 464);</span><br><span>@@ -115,9 +146,29 @@</span><br><span>                    "Received bad data (%u/%u)\n",</span><br><span>                     bi->fn % l1ts->mf_period, l1ts->mf_period);</span><br><span>                 l2_len = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+         /* When SACCH Repetition is active, we may try to decode the</span><br><span style="color: hsl(120, 100%, 40%);">+           * current SACCH block by including the information from the</span><br><span style="color: hsl(120, 100%, 40%);">+           * information from the previous SACCH block. See also:</span><br><span style="color: hsl(120, 100%, 40%);">+                * 3GPP TS 44.006, section 11.2 */</span><br><span style="color: hsl(120, 100%, 40%);">+            if (is_sacch && lchan->repeated_ul_sacch_active) {</span><br><span style="color: hsl(120, 100%, 40%);">+                 add_sbits(*bursts_p, chan_state->ul_bursts_prev);</span><br><span style="color: hsl(120, 100%, 40%);">+                  rc = gsm0503_xcch_decode(l2, *bursts_p, &n_errors, &n_bits_total);</span><br><span style="color: hsl(120, 100%, 40%);">+                    if (rc) {</span><br><span style="color: hsl(120, 100%, 40%);">+                             LOGL1S(DL1P, LOGL_NOTICE, l1t, bi->tn, chan, bi->fn,</span><br><span style="color: hsl(120, 100%, 40%);">+                                   "Combining current SACCH block with previous SACCH block also yields bad data (%u/%u)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                                   bi->fn % l1ts->mf_period, l1ts->mf_period);</span><br><span style="color: hsl(120, 100%, 40%);">+                           l2_len = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+                   } else</span><br><span style="color: hsl(120, 100%, 40%);">+                                l2_len = GSM_MACBLOCK_LEN;</span><br><span style="color: hsl(120, 100%, 40%);">+            }</span><br><span>    } else</span><br><span>               l2_len = GSM_MACBLOCK_LEN;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+        /* Keep a copy to ease decoding in the next repetition pass */</span><br><span style="color: hsl(120, 100%, 40%);">+        if (is_sacch && lchan->repeated_ul_sacch_active)</span><br><span style="color: hsl(120, 100%, 40%);">+           memcpy(chan_state->ul_bursts_prev, *bursts_p, 464);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>     ber10k = compute_ber10k(n_bits_total, n_errors);</span><br><span>     return _sched_compose_ph_data_ind(l1t, bi->tn, *first_fn,</span><br><span>                                           chan, l2, l2_len,</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/21185">change 21185</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-bts/+/21185"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I7e4cc33cc010866e41e3b594351a7f7bf93e08ac </div>
<div style="display:none"> Gerrit-Change-Number: 21185 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>