falconia has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/32079 )


Change subject: osmo_rtp2trau() for FR & EFR: set SP=0 in DL if the frame is a 
SID
......................................................................

osmo_rtp2trau() for FR & EFR: set SP=0 in DL if the frame is a SID

The SP bit in TRAU DL frames is supposed to be 1 for regular
speech frames and 0 for SID frames.  The previous code always set
SP=1; the present change sets this flag per the spec (TS 48.060)
using osmo_{fr,efr}_check_sid() functions from libosmocodec.

The present change does not affect TRAU UL frame generation -
correct generation of SID bits in the TRAU UL frame is still missing
and would require further work if someone wishes to use Osmocom
software to implement a new T1/E1 BTS or some other entity that
needs to generate TRAU UL frames.

Change-Id: I371f8072c0afedbd1b065efecfed3734fb6d31ab
---
M src/Makefile.am
M src/trau/trau_rtp_conv.c
2 files changed, 33 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/79/32079/1

diff --git a/src/Makefile.am b/src/Makefile.am
index 2c99150..e1a3495 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,7 +40,7 @@
                         -version-info $(TRAU_LIBVERSION) \
                         -no-undefined \
                         $(NULL)
-libosmotrau_la_LIBADD = $(COMMONLIBS) $(ORTP_LIBS)
+libosmotrau_la_LIBADD = $(COMMONLIBS) $(LIBOSMOCODEC_LIBS) $(ORTP_LIBS)
 libosmotrau_la_SOURCES = trau/osmo_ortp.c \
                         trau/trau_frame.c \
                         trau/trau_pcu_ericsson.c \
diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c
index 0fc2500..63225dc 100644
--- a/src/trau/trau_rtp_conv.c
+++ b/src/trau/trau_rtp_conv.c
@@ -269,8 +269,6 @@

        /* FR Data Bits according to TS 48.060 Section 5.5.1.1.2 */

-       /* FIXME: Generate SID frames? */
-
        /* set c-bits and t-bits */
        if (tf->dir == OSMO_TRAU_DIR_UL) {
                /* C1 .. C5: FR UL */
@@ -300,14 +298,19 @@
                        tf->c_bits[11] = 1;     /* C12: BFI */
                else
                        tf->c_bits[11] = 0;     /* C12: BFI */
+               /* FIXME: set C13 & C14 per GSM 06.31 section 6.1.1 */
                tf->c_bits[12] = 0; /* C13: SID=0 */
                tf->c_bits[13] = 0; /* C14: SID=0 */
                tf->c_bits[14] = 0; /* C15: TAF (SACCH or not) */
                tf->c_bits[15] = 1; /* C16: spare */
                tf->c_bits[16] = 0; /* C17: DTXd not applied */
        } else {
-               memset(&tf->c_bits[11], 1, 10); /* C12 .. C15: spare */
-               tf->c_bits[15] = 1; /* C16: SP=1 */
+               memset(&tf->c_bits[11], 1, 4);  /* C12 .. C15: spare */
+               if (data_len && osmo_fr_check_sid(data, data_len))
+                       tf->c_bits[15] = 0;     /* C16: SP=0 */
+               else
+                       tf->c_bits[15] = 1;     /* C16: SP=1 */
+               tf->c_bits[16] = 1; /* C17: spare */
        }
        memset(&tf->c_bits[17], 1, 4); /* C18 .. C21: spare */
        memset(&tf->t_bits[0], 1, 4);
@@ -460,7 +463,7 @@
                        tf->c_bits[11] = 1; /* C12: BFI=1 */
                else
                        tf->c_bits[11] = 0; /* C12: BFI=1 */
-               /* FIXME: Generate SID frames? */
+               /* FIXME: set C13 & C14 per GSM 06.81 section 6.1.1 */
                tf->c_bits[12] = 0; /* C13: SID=0 */
                tf->c_bits[13] = 0; /* C14: SID=0 */
                tf->c_bits[14] = 0; /* C15: TAF (SACCH) */
@@ -469,7 +472,10 @@
        } else {
                tf->c_bits[11] = 1; /* C12: UFE (good uplink) */
                memset(&tf->c_bits[12], 1, 3);  /* C13 .. C15: spare */
-               tf->c_bits[15] = 1; /* C16: SP=1 */
+               if (data_len && osmo_efr_check_sid(data, data_len))
+                       tf->c_bits[15] = 0;     /* C16: SP=0 */
+               else
+                       tf->c_bits[15] = 1;     /* C16: SP=1 */
                tf->c_bits[16] = 1; /* C17: spare */
        }
        memset(&tf->c_bits[17], 1, 4);  /* C18 .. C21: spare */

--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/32079
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I371f8072c0afedbd1b065efecfed3734fb6d31ab
Gerrit-Change-Number: 32079
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <fal...@freecalypso.org>
Gerrit-MessageType: newchange

Reply via email to