<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmocom-bb/+/14575">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">trx_toolkit/data_msg.py: add basic class documentation<br><br>Change-Id: I538bc96e5e24d3b7e344e4dbe2877bf60c13c720<br>Related# OS#4006<br>---<br>M src/target/trx_toolkit/data_msg.py<br>1 file changed, 79 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/75/14575/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/target/trx_toolkit/data_msg.py b/src/target/trx_toolkit/data_msg.py</span><br><span>index 6d6b76c..9ad19f6 100644</span><br><span>--- a/src/target/trx_toolkit/data_msg.py</span><br><span>+++ b/src/target/trx_toolkit/data_msg.py</span><br><span>@@ -28,6 +28,38 @@</span><br><span> from gsm_shared import *</span><br><span> </span><br><span> class DATAMSG:</span><br><span style="color: hsl(120, 100%, 40%);">+      """ TRXD (DATA) message codec (common part).</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ The DATA messages are used to carry bursts in both directions</span><br><span style="color: hsl(120, 100%, 40%);">+ between L1 and TRX. There exist two kinds of them:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    - L12TRX (L1 -> TRX) - to be transmitted bursts,</span><br><span style="color: hsl(120, 100%, 40%);">+   - TRX2L1 (TRX -> L1) - received bursts.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        Both of them have quite similar structure, and start with</span><br><span style="color: hsl(120, 100%, 40%);">+     the common fixed-size message header (no TLVs):</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%);">+      | common header | specific header | burst bits |</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%);">+  while the message specific headers and bit types are different.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     The common header is represented by this class, which is the</span><br><span style="color: hsl(120, 100%, 40%);">+  parent of both DATAMSG_L12TRX and DATAMSG_TRX2L2 (see below),</span><br><span style="color: hsl(120, 100%, 40%);">+ and has the following fields:</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%);">+          | TN (1 octet) | FN (4 octets, BE) |</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%);">+      where:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        - TN is TDMA time-slot number (1 octet), and</span><br><span style="color: hsl(120, 100%, 40%);">+          - FN is TDMA frame number (4 octets, big endian).</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>         # Common constructor</span><br><span>         def __init__(self, fn = None, tn = None, burst = None):</span><br><span>              self.burst = burst</span><br><span>@@ -186,6 +218,25 @@</span><br><span>            self.parse_burst(msg_burst)</span><br><span> </span><br><span> class DATAMSG_L12TRX(DATAMSG):</span><br><span style="color: hsl(120, 100%, 40%);">+     """ L12TRX (L1 -> TRX) message codec.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     This message represents a Downlink burst on the BTS side,</span><br><span style="color: hsl(120, 100%, 40%);">+     or an Uplink burst on the MS side, and has the following</span><br><span style="color: hsl(120, 100%, 40%);">+      message specific fixed-size header preceding the burst bits:</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%);">+          | PWR | hard-bits (1 or 0) |</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%);">+      where PWR (1 octet) is relative (to the full-scale amplitude)</span><br><span style="color: hsl(120, 100%, 40%);">+ transmit power level in dB. The absolute value is set on</span><br><span style="color: hsl(120, 100%, 40%);">+      the control interface.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      Each hard-bit (1 or 0) of the burst is represented using one</span><br><span style="color: hsl(120, 100%, 40%);">+  byte (0x01 or 0x00 respectively).</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>         # Constants</span><br><span>  HDR_LEN = 6</span><br><span>  PWR_MIN = 0x00</span><br><span>@@ -276,6 +327,34 @@</span><br><span>                return msg</span><br><span> </span><br><span> class DATAMSG_TRX2L1(DATAMSG):</span><br><span style="color: hsl(120, 100%, 40%);">+      """ TRX2L1 (TRX -> L1) message codec.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     This message represents an Uplink burst on the BTS side,</span><br><span style="color: hsl(120, 100%, 40%);">+      or a Downlink burst on the MS side, and has the following</span><br><span style="color: hsl(120, 100%, 40%);">+     message specific fixed-size header preceding the burst bits:</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%);">+   | RSSI | ToA | soft-bits (254..0) |</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%);">+       where:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        - RSSI (1 octet) - Received Signal Strength Indication</span><br><span style="color: hsl(120, 100%, 40%);">+                           encoded without the negative sign.</span><br><span style="color: hsl(120, 100%, 40%);">+         - ToA (2 octets) - Timing of Arrival in units of 1/256</span><br><span style="color: hsl(120, 100%, 40%);">+                           of symbol (big endian).</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        Unlike to be transmitted bursts, the received bursts are designated</span><br><span style="color: hsl(120, 100%, 40%);">+   using the soft-bits notation, so the receiver can indicate its</span><br><span style="color: hsl(120, 100%, 40%);">+        assurance from 0 to -127 that a given bit is 1, and from 0 to +127</span><br><span style="color: hsl(120, 100%, 40%);">+    that a given bit is 0. The Viterbi algorithm allows to approximate</span><br><span style="color: hsl(120, 100%, 40%);">+    the original sequence of hard-bits (1 or 0) using these values.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     Each soft-bit (-127..127) of the burst is encoded as an unsigned</span><br><span style="color: hsl(120, 100%, 40%);">+      value in range (254..0) respectively using the constant shift.</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>         # Constants</span><br><span>  HDR_LEN = 8</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmocom-bb/+/14575">change 14575</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/+/14575"/><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: I538bc96e5e24d3b7e344e4dbe2877bf60c13c720 </div>
<div style="display:none"> Gerrit-Change-Number: 14575 </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>