laforge submitted this change.
trau_frame: D145_SYNC does not follow EDATA format
14.5 kbit/s data service uses a special protocol: the CCU and the
TRAU exchange D145_SYNC frames first, conveying only alignment of
320-bit TRAU frames, then switch to EDATA frames that can carry
payload. (EDATA frames don't have enough sync pattern bits to be
reliable against false alignment.)
Per TS 48.060 section 5.5.3, D145_SYNC frames are structured like
"regular" (lower rates) data frames with all payload bits set to 1,
_not_ like EDATA frames. Therefore:
* osmo_trau_frame_decode_16k() should decode D145_SYNC frames like
regular data frames, not like EDATA;
* osmo_trau_frame_encode() given OSMO_TRAU16_FT_D145_SYNC should
produce a frame with correct sync pattern and all-1 payload bits,
but with control bits up to C15 per TS 48.060 section 5.5.3.
Change-Id: I7c743996fc620227438225ffda419217881034d1
---
M src/trau/trau_frame.c
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/trau/trau_frame.c b/src/trau/trau_frame.c
index 88d0031..966c794 100644
--- a/src/trau/trau_frame.c
+++ b/src/trau/trau_frame.c
@@ -650,6 +650,22 @@
return 40 * 8;
}
+/* TS 48.060 section 5.5.3 */
+static int encode16_d145_sync(ubit_t *trau_bits, const struct osmo_trau_frame *fr)
+{
+ encode_sync16(trau_bits);
+
+ /* C1 .. C5 */
+ memcpy(trau_bits + 17, ft_d145s_bits, 5);
+ /* C6 .. C15 */
+ memcpy(trau_bits + 17 + 5, fr->c_bits + 5, 15 - 5);
+
+ /* This frame is for sync only, all data bits filled with 1s */
+ memset(trau_bits + 4 * 8, 1, (40 - 4) * 8);
+
+ return 40 * 8;
+}
+
/* TS 08.60 3.3.2 */
static int decode16_edata(struct osmo_trau_frame *fr, const ubit_t *trau_bits,
enum osmo_trau_frame_direction dir)
@@ -1285,6 +1301,7 @@
case OSMO_TRAU16_FT_DATA:
return encode16_data(bits, fr);
case OSMO_TRAU16_FT_D145_SYNC:
+ return encode16_d145_sync(bits, fr);
case OSMO_TRAU16_FT_EDATA:
return encode16_edata(bits, fr);
case OSMO_TRAU8_SPEECH:
@@ -1355,7 +1372,7 @@
return decode16_edata(fr, bits, dir);
case TRAU_FT_D145_SYNC:
fr->type = OSMO_TRAU16_FT_D145_SYNC;
- return decode16_edata(fr, bits, dir);
+ return decode16_data(fr, bits, dir);
default:
return -EINVAL;
To view, visit change 38324. To unsubscribe, or for help writing mail filters, visit settings.