<p>laforge <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmocom-bb/+/14690">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">trx_toolkit/gsm_shared.py: introduce a new enum TrainingSeqGMSK<br><br>Training Sequences are defined in 3GPP TS 45.002, and used by the<br>transceiver for detecting bursts. This change introduces an enum<br>with training sequences for GMSK for Access and Normal bursts.<br><br>This enumeration is needed for the follow-up changes that implement<br>TRXD header version 1 support, and can now be used by RandBurstGen.<br><br>Change-Id: If3bf102019ef53d6ee9ad230ef98bb45845b5af5<br>---<br>M src/target/trx_toolkit/gsm_shared.py<br>1 file changed, 78 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/target/trx_toolkit/gsm_shared.py b/src/target/trx_toolkit/gsm_shared.py</span><br><span>index d2f8278..d76978e 100644</span><br><span>--- a/src/target/trx_toolkit/gsm_shared.py</span><br><span>+++ b/src/target/trx_toolkit/gsm_shared.py</span><br><span>@@ -4,7 +4,7 @@</span><br><span> # TRX Toolkit</span><br><span> # Common GSM constants</span><br><span> #</span><br><span style="color: hsl(0, 100%, 40%);">-# (C) 2018 by Vadim Yanitskiy <axilirator@gmail.com></span><br><span style="color: hsl(120, 100%, 40%);">+# (C) 2018-2019 by Vadim Yanitskiy <axilirator@gmail.com></span><br><span> #</span><br><span> # All Rights Reserved</span><br><span> #</span><br><span>@@ -22,6 +22,8 @@</span><br><span> # with this program; if not, write to the Free Software Foundation, Inc.,</span><br><span> # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+from enum import Enum</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> # TDMA definitions</span><br><span> GSM_SUPERFRAME = 26 * 51</span><br><span> GSM_HYPERFRAME = 2048 * GSM_SUPERFRAME</span><br><span>@@ -29,3 +31,78 @@</span><br><span> # Burst length</span><br><span> GSM_BURST_LEN = 148</span><br><span> EDGE_BURST_LEN = GSM_BURST_LEN * 3</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+class BurstType(Enum):</span><br><span style="color: hsl(120, 100%, 40%);">+       """ Burst types defined in 3GPP TS 45.002 """</span><br><span style="color: hsl(120, 100%, 40%);">+   DUMMY   = ("DB") # Dummy burst (5.2.6)</span><br><span style="color: hsl(120, 100%, 40%);">+      SYNC    = ("SB") # Synchronization Burst (5.2.5)</span><br><span style="color: hsl(120, 100%, 40%);">+    FREQ    = ("FB") # Frequency correction Burst (5.2.4)</span><br><span style="color: hsl(120, 100%, 40%);">+       ACCESS  = ("AB") # Access Burst (5.2.7)</span><br><span style="color: hsl(120, 100%, 40%);">+     NORMAL  = ("NB") # Normal Burst (5.2.3)</span><br><span style="color: hsl(120, 100%, 40%);">+     # HSR   = ("HB") # Higher symbol rate burst (5.2.3a)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+class TrainingSeqGMSK(Enum):</span><br><span style="color: hsl(120, 100%, 40%);">+        """ Training Sequences defined in 3GPP TS 45.002 """</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  # Training Sequences for Access Burst (table 5.2.7-3)</span><br><span style="color: hsl(120, 100%, 40%);">+ AB_TS0 = (0, BurstType.ACCESS, "01001011011111111001100110101010001111000")</span><br><span style="color: hsl(120, 100%, 40%);">+ AB_TS1 = (1, BurstType.ACCESS, "01010100111110001000011000101111001001101")</span><br><span style="color: hsl(120, 100%, 40%);">+ AB_TS2 = (2, BurstType.ACCESS, "11101111001001110101011000001101101110111")</span><br><span style="color: hsl(120, 100%, 40%);">+ AB_TS4 = (4, BurstType.ACCESS, "11001001110001001110000000001101010110010")</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       # Training Sequences for Access Burst (table 5.2.7-4)</span><br><span style="color: hsl(120, 100%, 40%);">+ AB_TS3 = (3, BurstType.ACCESS, "10001000111010111011010000010000101100010")</span><br><span style="color: hsl(120, 100%, 40%);">+ AB_TS5 = (5, BurstType.ACCESS, "01010000111111110101110101101100110010100")</span><br><span style="color: hsl(120, 100%, 40%);">+ AB_TS6 = (6, BurstType.ACCESS, "01011110011101011110110100010011000010111")</span><br><span style="color: hsl(120, 100%, 40%);">+ AB_TS7 = (7, BurstType.ACCESS, "01000010110000011101001010111011100010000")</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       # Training Sequences for Synchronization Burst (table 5.2.5-3)</span><br><span style="color: hsl(120, 100%, 40%);">+        SB_TS0 = (0, BurstType.SYNC, "1011100101100010000001000000111100101101010001010111011000011011")</span><br><span style="color: hsl(120, 100%, 40%);">+    SB_TS1 = (1, BurstType.SYNC, "1110111001101011001010000011111011110100011111101100101100010101")</span><br><span style="color: hsl(120, 100%, 40%);">+    SB_TS2 = (2, BurstType.SYNC, "1110110000110111010100010101101001111000000100000010001101001110")</span><br><span style="color: hsl(120, 100%, 40%);">+    SB_TS3 = (3, BurstType.SYNC, "1011101000111101110101101111010010001011010000001000111010011000")</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  # Training Sequences for Normal Burst (table 5.2.3a, TSC set 1)</span><br><span style="color: hsl(120, 100%, 40%);">+       NB_TS0 = (0, BurstType.NORMAL, "00100101110000100010010111")</span><br><span style="color: hsl(120, 100%, 40%);">+        NB_TS1 = (1, BurstType.NORMAL, "00101101110111100010110111")</span><br><span style="color: hsl(120, 100%, 40%);">+        NB_TS2 = (2, BurstType.NORMAL, "01000011101110100100001110")</span><br><span style="color: hsl(120, 100%, 40%);">+        NB_TS3 = (3, BurstType.NORMAL, "01000111101101000100011110")</span><br><span style="color: hsl(120, 100%, 40%);">+        NB_TS4 = (4, BurstType.NORMAL, "00011010111001000001101011")</span><br><span style="color: hsl(120, 100%, 40%);">+        NB_TS5 = (5, BurstType.NORMAL, "01001110101100000100111010")</span><br><span style="color: hsl(120, 100%, 40%);">+        NB_TS6 = (6, BurstType.NORMAL, "10100111110110001010011111")</span><br><span style="color: hsl(120, 100%, 40%);">+        NB_TS7 = (7, BurstType.NORMAL, "11101111000100101110111100")</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      # TODO: more TSC sets from tables 5.2.3b-d</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  def __init__(self, tsc, bt, seq_str, tsc_set = 0):</span><br><span style="color: hsl(120, 100%, 40%);">+            # Training Sequence Code</span><br><span style="color: hsl(120, 100%, 40%);">+              self.tsc = tsc</span><br><span style="color: hsl(120, 100%, 40%);">+                # Burst type</span><br><span style="color: hsl(120, 100%, 40%);">+          self.bt = bt</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                # Training Sequence Code set</span><br><span style="color: hsl(120, 100%, 40%);">+          # NOTE: unlike the specs. we count from zero</span><br><span style="color: hsl(120, 100%, 40%);">+          self.tsc_set = tsc_set</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+              # Generate Training Sequence bits</span><br><span style="color: hsl(120, 100%, 40%);">+             self.seq = [int(x) for x in seq_str]</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        @classmethod</span><br><span style="color: hsl(120, 100%, 40%);">+  def pick(self, burst):</span><br><span style="color: hsl(120, 100%, 40%);">+                # Normal burst TS (26 bits)</span><br><span style="color: hsl(120, 100%, 40%);">+           nb_seq = burst[3 + 57 + 1:][:26]</span><br><span style="color: hsl(120, 100%, 40%);">+              # Access burst TS (41 bits)</span><br><span style="color: hsl(120, 100%, 40%);">+           ab_seq = burst[8:][:41]</span><br><span style="color: hsl(120, 100%, 40%);">+               # Sync Burst TS (64 bits)</span><br><span style="color: hsl(120, 100%, 40%);">+             sb_seq = burst[3 + 39:][:64]</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                for ts in list(self):</span><br><span style="color: hsl(120, 100%, 40%);">+                 # Ugly Python way of writing 'switch' statement</span><br><span style="color: hsl(120, 100%, 40%);">+                       if ts.bt is BurstType.NORMAL and ts.seq == nb_seq:</span><br><span style="color: hsl(120, 100%, 40%);">+                            return ts</span><br><span style="color: hsl(120, 100%, 40%);">+                     elif ts.bt is BurstType.ACCESS and ts.seq == ab_seq:</span><br><span style="color: hsl(120, 100%, 40%);">+                          return ts</span><br><span style="color: hsl(120, 100%, 40%);">+                     elif ts.bt is BurstType.SYNC and ts.seq == sb_seq:</span><br><span style="color: hsl(120, 100%, 40%);">+                            return ts</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           return None</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmocom-bb/+/14690">change 14690</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/+/14690"/><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: If3bf102019ef53d6ee9ad230ef98bb45845b5af5 </div>
<div style="display:none"> Gerrit-Change-Number: 14690 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>