Attention is currently required from: lynxis lazus.
laforge has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39017?usp=email )
Change subject: SGSN_Tests: rework TC_sgsn_context_req_out to actual function
......................................................................
Patch Set 3: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39017?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I0666a518aed57c2594653ab6b0f801c4193fd2f3
Gerrit-Change-Number: 39017
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Comment-Date: Mon, 10 Feb 2025 19:28:34 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: osmith.
fixeria has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/libosmocore/+/39418?usp=email )
Change subject: utils/osmo-install-dbg-pkgs: new script
......................................................................
Patch Set 2: Code-Review+1
(2 comments)
File utils/osmo-install-dbg-pkgs.py:
https://gerrit.osmocom.org/c/libosmocore/+/39418/comment/3c02a66d_6896e0e6?… :
PS2, Line 64: package.startswith("osmo-") or package.startswith("libosmo"):
This would not match packages like `libasn1c`, `libgtpnl`, `libsmpp34`, `gapk`.
https://gerrit.osmocom.org/c/libosmocore/+/39418/comment/7ea75d80_f7c74880?… :
PS2, Line 142: main()
`if __name__ == '__main__':`?
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39418?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I903cef0a3e358701d14dcf1980fe0f8d5d5b4d62
Gerrit-Change-Number: 39418
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 10 Feb 2025 18:01:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: csaba.sipos, laforge.
pespin has posted comments on this change by csaba.sipos. ( https://gerrit.osmocom.org/c/osmo-bsc/+/39416?usp=email )
Change subject: nokia_site: Add object_identity, object_state and object_identity_state attributes
......................................................................
Patch Set 21:
(1 comment)
File src/osmo-bsc/bts_nokia_site.c:
https://gerrit.osmocom.org/c/osmo-bsc/+/39416/comment/4378a375_ac456d6b?usp… :
PS21, Line 1860: !FIND_ELEM(noh->data, len_data, NOKIA_EI_OBJ_STATE, &object_state, sizeof(object_state))) {
> Sounds like you are using a different indentation config, ie 1 tab = 4 spaces vs 1 tab = 8 spaces. […]
BTW, FYI, in general in if the column doesn't fit exactly at the tab boundary, you need to add some space chars to move the code a bit more to the right.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/39416?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Id9f819b0649ba3c247db72d7d738e49c72388dc3
Gerrit-Change-Number: 39416
Gerrit-PatchSet: 21
Gerrit-Owner: csaba.sipos <metro4(a)freemail.hu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: domi <domi(a)tomcsanyi.net>
Gerrit-Attention: csaba.sipos <metro4(a)freemail.hu>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Mon, 10 Feb 2025 17:49:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: csaba.sipos <metro4(a)freemail.hu>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: csaba.sipos, laforge.
pespin has posted comments on this change by csaba.sipos. ( https://gerrit.osmocom.org/c/osmo-bsc/+/39416?usp=email )
Change subject: nokia_site: Add object_identity, object_state and object_identity_state attributes
......................................................................
Patch Set 21:
(2 comments)
File src/osmo-bsc/bts_nokia_site.c:
https://gerrit.osmocom.org/c/osmo-bsc/+/39416/comment/4a82870c_6f4e54a2?usp… :
PS21, Line 1828: get_object_identity_string(object_id_state[4]),
> Wrong how? Previously it was said that the indentation has to be moved to the (, and that is what I […]
Well, it can clearly be seen in here that's not the case. See how it is not aligned to the "(" char above.
https://gerrit.osmocom.org/c/osmo-bsc/+/39416/comment/cb2bd99f_bc91a55f?usp… :
PS21, Line 1860: !FIND_ELEM(noh->data, len_data, NOKIA_EI_OBJ_STATE, &object_state, sizeof(object_state))) {
> On my end they are exactly like that. […]
Sounds like you are using a different indentation config, ie 1 tab = 4 spaces vs 1 tab = 8 spaces. Have a look at your notepad++ and change it.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/39416?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Id9f819b0649ba3c247db72d7d738e49c72388dc3
Gerrit-Change-Number: 39416
Gerrit-PatchSet: 21
Gerrit-Owner: csaba.sipos <metro4(a)freemail.hu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: domi <domi(a)tomcsanyi.net>
Gerrit-Attention: csaba.sipos <metro4(a)freemail.hu>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Mon, 10 Feb 2025 17:48:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: csaba.sipos <metro4(a)freemail.hu>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
falconia has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/39494?usp=email )
Change subject: trau: implement TFO frame decoding functions
......................................................................
trau: implement TFO frame decoding functions
TFO frames of 3GPP TS 28.062 are slightly modified TRAU-UL frames,
and thus require slightly modified encoding and decoding functions.
Adding TFO frame encoding and decoding functions to libosmotrau
will allow TFO applications (sw implementations of a TFO-capable
speech transcoder) to reuse those parts of TRAU frame encoding and
decoding that are common between regular TRAU frames and TFO.
Change-Id: Ia095598622645068d62301bc4bf7de9f68065e84
---
M include/osmocom/trau/trau_frame.h
M src/trau/trau_frame.c
2 files changed, 116 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmocom/trau/trau_frame.h b/include/osmocom/trau/trau_frame.h
index 5f1d708..8bdeb73 100644
--- a/include/osmocom/trau/trau_frame.h
+++ b/include/osmocom/trau/trau_frame.h
@@ -148,4 +148,11 @@
/*! Determine the time alignment in us requested by CCU in a UL frame */
int osmo_trau_frame_dl_ta_us(const struct osmo_trau_frame *fr);
+/* TFO frames are slightly modified TRAU-UL frames, and thus require slightly
+ * modified encoding and decoding functions. */
+
+int osmo_trau_frame_decode_tfo_16k(struct osmo_trau_frame *fr, const ubit_t *bits);
+int osmo_trau_frame_decode_tfo_hr1(struct osmo_trau_frame *fr, const ubit_t *bits);
+int osmo_trau_frame_decode_tfo_amr_8k(struct osmo_trau_frame *fr, const ubit_t *bits);
+
/* }@ */
diff --git a/src/trau/trau_frame.c b/src/trau/trau_frame.c
index 21e4f00..df4404d 100644
--- a/src/trau/trau_frame.c
+++ b/src/trau/trau_frame.c
@@ -1379,6 +1379,49 @@
}
}
+/*! Decode/parse a 16k TFO frame from unpacked bits to decoded format.
+ * \param[out] fr caller-allocated output data structure
+ * \param[in] bits unpacked bits containing raw TFO frame; must be aligned
+ * \returns 0 in case of success; negative on error
+ *
+ * TFO applications that need to decode TFO frames of TS 28.062 section 5.2.1
+ * (FR/EFR) or section 5.2.2.1 (AMR_TFO_16k) should use this function instead
+ * of regular osmo_trau_frame_decode_16k() in order to get appropriately
+ * modified handling of C1..C5 frame type bits:
+ *
+ * - C5 needs to be ignored because it is EMBED bit in TFO frames;
+ * - For interoperability with other potential TFO-AMR implementations
+ * out in the world that aren't GSM AMR-FR, we need to recognize additional
+ * C1..C4 bit patterns as being AMR equivalents: see Table 5.2.2.1-2 in
+ * 3GPP TS 28.062.
+ */
+int osmo_trau_frame_decode_tfo_16k(struct osmo_trau_frame *fr, const ubit_t *bits)
+{
+ uint8_t cbits4 = get_bits(bits, 17, 4);
+ /* We don't look at bit C5 because it is EMBED bit in TFO frames */
+
+ fr->type = OSMO_TRAU_FT_NONE;
+ fr->dir = OSMO_TRAU_DIR_UL; /* TFO frames are modified TRAU-UL */
+ fr->dl_ta_usec = 0;
+
+ switch (cbits4) {
+ case TRAU_FT_FR_UP >> 1:
+ fr->type = OSMO_TRAU16_FT_FR;
+ return decode16_fr(fr, bits, fr->dir);
+ case TRAU_FT_EFR >> 1:
+ fr->type = OSMO_TRAU16_FT_EFR;
+ return decode16_fr(fr, bits, fr->dir);
+ case TRAU_FT_AMR >> 1:
+ case 0x4: /* HR_AMR */
+ case 0x6: /* UMTS_AMR_2 */
+ case 0xB: /* OHR_AMR */
+ fr->type = OSMO_TRAU16_FT_AMR;
+ return decode16_amr(fr, bits, fr->dir);
+ default:
+ return -EINVAL;
+ }
+}
+
#define TRAU8_FT_AMR_NO_SPEECH_CMI 0x10 /* 1, 0, 0, 0, 0 */
#define TRAU8_FT_AMR_NO_SPEECH_CMR 0x14 /* 1, 0, 1, 0, 0 */
#define TRAU8_FT_AMR_475_515_590 0..7
@@ -1521,4 +1564,70 @@
return -EINVAL;
}
+/*! Decode/parse an HRv1 TFO frame from unpacked bits to decoded format.
+ * \param[out] fr caller-allocated output data structure
+ * \param[in] bits 160 bits containing the lsb extracted from PCM samples;
+ * must be aligned
+ * \returns 0 in case of success; negative on error
+ *
+ * TFO applications that need to decode TFO frames of TS 28.062 section 5.3.1
+ * (GSM_HR codec) should use this function instead of regular
+ * osmo_trau_frame_decode_8k() in order to get these two behavior
+ * modifications:
+ *
+ * - The sync pattern check needs to be skipped because the sync pattern
+ * may be partially overwritten by embedded TFO messages;
+ * - C5 needs to be ignored because it is EMBED bit in TFO frames.
+ *
+ * In the case of TFO, unlike regular TRAU-UL frames on Abis/Ater, there is
+ * no need to distinguish between HRv1 and AMR-8k frames by their respective
+ * sync patterns: per TS 28.062, these two TFO frame types never occur
+ * in the same bit position in TFO-superimposed PCM speech octets.
+ * Because HRv1 is the only TFO frame type that can occur in the configuration
+ * of TS 28.062 section 5.3 (only the one lsb in each PCM speech octet is
+ * overwritten), this function skips all attempts at frame type classification:
+ * the TFO application is responsible for detecting the presence of valid
+ * TFO frames for the negotiated codec type.
+ */
+int osmo_trau_frame_decode_tfo_hr1(struct osmo_trau_frame *fr, const ubit_t *bits)
+{
+ fr->type = OSMO_TRAU8_SPEECH;
+ fr->dir = OSMO_TRAU_DIR_UL; /* TFO frames are modified TRAU-UL */
+ fr->dl_ta_usec = 0;
+ return decode8_hr(fr, bits, fr->dir);
+}
+
+/*! Decode/parse an AMR_TFO_8+8k frame from unpacked bits to decoded format.
+ * \param[out] fr caller-allocated output data structure
+ * \param[in] bits 160 bits containing the second lsb extracted from
+ * PCM samples; must be aligned
+ * \returns 0 in case of success; negative on error
+ *
+ * This function is provided for TFO applications that need to decode
+ * TFO frames of TS 28.062 section 5.2.2.2, format named AMR_TFO_8+8k.
+ * The second lsb extracted from PCM samples is the entity being decoded here.
+ * Compared to osmo_trau_frame_decode_8k(), the present function requires
+ * the direction to be TRAU-UL (as always the case in TFO) and accepts
+ * only AMR-8k frame types.
+ */
+int osmo_trau_frame_decode_tfo_amr_8k(struct osmo_trau_frame *fr, const ubit_t *bits)
+{
+ fr->type = OSMO_TRAU_FT_NONE;
+ fr->dir = OSMO_TRAU_DIR_UL; /* TFO frames are modified TRAU-UL */
+ fr->dl_ta_usec = 0;
+
+ if (is_amr_low(bits)) {
+ fr->type = OSMO_TRAU8_AMR_LOW;
+ return decode8_amr_low(fr, bits, fr->dir);
+ } else if (is_amr_67(bits)) {
+ fr->type = OSMO_TRAU8_AMR_6k7;
+ return decode8_amr_67(fr, bits, fr->dir);
+ } else if (is_amr_74(bits)) {
+ fr->type = OSMO_TRAU8_AMR_7k4;
+ return decode8_amr_74(fr, bits, fr->dir);
+ }
+
+ return -EINVAL;
+}
+
/* }@ */
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/39494?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: Ia095598622645068d62301bc4bf7de9f68065e84
Gerrit-Change-Number: 39494
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge, pespin.
csaba.sipos has posted comments on this change by csaba.sipos. ( https://gerrit.osmocom.org/c/osmo-bsc/+/39416?usp=email )
Change subject: nokia_site: Add object_identity, object_state and object_identity_state attributes
......................................................................
Patch Set 21:
(4 comments)
File src/osmo-bsc/bts_nokia_site.c:
https://gerrit.osmocom.org/c/osmo-bsc/+/39416/comment/5e9700b6_910288e5?usp… :
PS21, Line 1828: get_object_identity_string(object_id_state[4]),
> wrong indentation
Wrong how? Previously it was said that the indentation has to be moved to the (, and that is what I did.
https://gerrit.osmocom.org/c/osmo-bsc/+/39416/comment/8b27bdbd_9137ad9c?usp… :
PS21, Line 1860: !FIND_ELEM(noh->data, len_data, NOKIA_EI_OBJ_STATE, &object_state, sizeof(object_state))) {
> wrong indentation, indent it so that both "!FIND_ELEM" end up in the same column.
On my end they are exactly like that. At least in Notepad++
https://gerrit.osmocom.org/c/osmo-bsc/+/39416/comment/df9b5616_b9f4ab5d?usp… :
PS21, Line 1876: get_object_identity_string(object_identity[1]),
> wrong indentation
Same as on the first one.
https://gerrit.osmocom.org/c/osmo-bsc/+/39416/comment/81374914_e7b1673a?usp… :
PS21, Line 1884: get_object_identity_string(object_identity[1]),
> wrong indentation
Same as on the first one.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/39416?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Id9f819b0649ba3c247db72d7d738e49c72388dc3
Gerrit-Change-Number: 39416
Gerrit-PatchSet: 21
Gerrit-Owner: csaba.sipos <metro4(a)freemail.hu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: domi <domi(a)tomcsanyi.net>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 10 Feb 2025 17:12:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
falconia has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/39495?usp=email )
Change subject: trau: implement TFO frame encoding function
......................................................................
trau: implement TFO frame encoding function
Most differences between regular TRAU frames of TS 48.060 & 48.061
and TFO frames of TS 28.062 matter only in the frame decoding
direction. In the encoding direction, regular osmo_trau_frame_encode()
would have been sufficient for both frame types if it weren't for
the quirk of setting C1..C5 bits. osmo_trau_frame_encode() sets
these bits per its own mind for most frame types, ignoring the bits
passed by the user in fr->c_bits[]. This API behavior cannot be
changed without breaking existing users, but it is bad for TFO.
Solution: implement new osmo_trau_frame_encode_tfo() function
for TFO applications. As an additional benefit, the output buffer
space requirement is reduced because there is no possibility of
output frame extension for timing alignment.
Change-Id: I6e0ab4e5115f0aa6979ce93955b0e95b09041091
---
M include/osmocom/trau/trau_frame.h
M src/trau/trau_frame.c
2 files changed, 120 insertions(+), 37 deletions(-)
Approvals:
pespin: Looks good to me, approved
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
diff --git a/include/osmocom/trau/trau_frame.h b/include/osmocom/trau/trau_frame.h
index 8bdeb73..dd14f27 100644
--- a/include/osmocom/trau/trau_frame.h
+++ b/include/osmocom/trau/trau_frame.h
@@ -151,6 +151,8 @@
/* TFO frames are slightly modified TRAU-UL frames, and thus require slightly
* modified encoding and decoding functions. */
+int osmo_trau_frame_encode_tfo(ubit_t *bits, size_t n_bits, const struct osmo_trau_frame *fr);
+
int osmo_trau_frame_decode_tfo_16k(struct osmo_trau_frame *fr, const ubit_t *bits);
int osmo_trau_frame_decode_tfo_hr1(struct osmo_trau_frame *fr, const ubit_t *bits);
int osmo_trau_frame_decode_tfo_amr_8k(struct osmo_trau_frame *fr, const ubit_t *bits);
diff --git a/src/trau/trau_frame.c b/src/trau/trau_frame.c
index df4404d..fb98247 100644
--- a/src/trau/trau_frame.c
+++ b/src/trau/trau_frame.c
@@ -238,30 +238,34 @@
}
/* TS 08.60 Section 3.1.1 */
-static int encode16_fr(ubit_t *trau_bits, const struct osmo_trau_frame *fr)
+static int encode16_fr(ubit_t *trau_bits, const struct osmo_trau_frame *fr, bool is_tfo)
{
const ubit_t *cbits5;
int i;
int d_idx = 0;
- switch (fr->type) {
- case OSMO_TRAU16_FT_IDLE:
- if (fr->dir == OSMO_TRAU_DIR_UL)
- cbits5 = ft_idle_up_bits;
- else
- cbits5 = ft_idle_down_bits;
- break;
- case OSMO_TRAU16_FT_FR:
- if (fr->dir == OSMO_TRAU_DIR_UL)
- cbits5 = ft_fr_up_bits;
- else
- cbits5 = ft_fr_down_bits;
- break;
- case OSMO_TRAU16_FT_EFR:
- cbits5 = ft_efr_bits;
- break;
- default:
- return -EINVAL;
+ if (is_tfo) {
+ cbits5 = fr->c_bits;
+ } else {
+ switch (fr->type) {
+ case OSMO_TRAU16_FT_IDLE:
+ if (fr->dir == OSMO_TRAU_DIR_UL)
+ cbits5 = ft_idle_up_bits;
+ else
+ cbits5 = ft_idle_down_bits;
+ break;
+ case OSMO_TRAU16_FT_FR:
+ if (fr->dir == OSMO_TRAU_DIR_UL)
+ cbits5 = ft_fr_up_bits;
+ else
+ cbits5 = ft_fr_down_bits;
+ break;
+ case OSMO_TRAU16_FT_EFR:
+ cbits5 = ft_efr_bits;
+ break;
+ default:
+ return -EINVAL;
+ }
}
encode_sync16(trau_bits);
@@ -314,17 +318,21 @@
}
/* TS 08.60 Section 3.1.2 */
-static int encode16_amr(ubit_t *trau_bits, const struct osmo_trau_frame *fr)
+static int encode16_amr(ubit_t *trau_bits, const struct osmo_trau_frame *fr, bool is_tfo)
{
- const ubit_t *cbits5 = ft_amr_bits;
int i, d_idx;
encode_sync16(trau_bits);
- /* C1 .. C5 */
- memcpy(trau_bits + 17, cbits5 + 0, 5);
- /* C6 .. C15 */
- memcpy(trau_bits + 17 + 5, fr->c_bits + 5, 15 - 5);
+ if (is_tfo) {
+ /* C1 .. C15 */
+ memcpy(trau_bits + 17, fr->c_bits, 15);
+ } else {
+ /* C1 .. C5 */
+ memcpy(trau_bits + 17, ft_amr_bits, 5);
+ /* C6 .. C15 */
+ memcpy(trau_bits + 17 + 5, fr->c_bits + 5, 15 - 5);
+ }
trau_bits[32] = 1;
/* C16 .. C25 */
@@ -549,7 +557,7 @@
fr_idle_frame.c_bits[11] = 1; /* C12 (UFE), good frame */
fr_idle_frame.c_bits[15] = 1; /* C16 (SP), no DTX */
- encode16_fr(encoded_idle_frame, &fr_idle_frame);
+ encode16_fr(encoded_idle_frame, &fr_idle_frame, false);
dbits_initted = 1; /* set it to 1 to not call it again */
}
return encoded_idle_frame;
@@ -843,7 +851,7 @@
}
/* TS 08.61 Section 5.2.1.1 */
-static int encode8_hr(ubit_t *trau_bits, const struct osmo_trau_frame *fr)
+static int encode8_hr(ubit_t *trau_bits, const struct osmo_trau_frame *fr, bool is_tfo)
{
int i, d_idx = 0;
@@ -858,11 +866,15 @@
/* C1 .. C5 */
ubit_t *cbits_out = trau_bits + 1 * 8 + 1;
if (fr->dir == OSMO_TRAU_DIR_UL) {
- cbits_out[0] = 0;
- cbits_out[1] = 0;
- cbits_out[2] = 0;
- cbits_out[3] = 1;
- cbits_out[4] = 0;
+ if (is_tfo) {
+ memcpy(cbits_out, fr->c_bits, 5);
+ } else {
+ cbits_out[0] = 0;
+ cbits_out[1] = 0;
+ cbits_out[2] = 0;
+ cbits_out[3] = 1;
+ cbits_out[4] = 0;
+ }
} else {
cbits_out[0] = 0;
cbits_out[1] = 0;
@@ -1241,9 +1253,21 @@
/*! Encode a TRAU frame from its decoded representation to a sequence of unpacked bits.
* \param[out] bits caller-allocated buffer for unpacked outpud bits
- * \param[in] n_bits size of 'bits' oputput buffer in number of unpacked bits
+ * \param[in] n_bits size of 'bits' output buffer in number of unpacked bits
* \param[in] fr decoded representation of TRAU frame to be encoded
- * \return 0 number of unpacked output bits generated; negative in case of error */
+ * \return 0 number of unpacked output bits generated; negative in case of error
+ *
+ * This function exhibits a behavioral quirk which users need to be aware of:
+ * for many frame types, the first 5 bits out of user-provided fr->c_bits[]
+ * (corresponding to C1..C5) are ignored and replaced with internally supplied
+ * constant values, where the function "knows" what the correct frame type code
+ * should be. This behavioral quirk is arguably a design defect, but it cannot
+ * be changed without breaking some existing applications that rely on this
+ * behavior and skip setting those bits themselves. For TFO applications
+ * where C1..C5 may need to be modified (especially TFO-AMR where this C1..C5
+ * modification must be done before CRC computation), please use
+ * osmo_trau_frame_encode_tfo().
+ */
int osmo_trau_frame_encode(ubit_t *bits, size_t n_bits, const struct osmo_trau_frame *fr)
{
/* check for sufficient space provided by caller in output buffer */
@@ -1287,11 +1311,11 @@
switch (fr->type) {
case OSMO_TRAU16_FT_FR:
case OSMO_TRAU16_FT_EFR:
- return encode16_fr(bits, fr);
+ return encode16_fr(bits, fr, false);
case OSMO_TRAU16_FT_HR:
return encode16_hr(bits, fr);
case OSMO_TRAU16_FT_AMR:
- return encode16_amr(bits, fr);
+ return encode16_amr(bits, fr, false);
case OSMO_TRAU16_FT_OAM:
return encode16_oam(bits, fr);
case OSMO_TRAU16_FT_IDLE:
@@ -1305,7 +1329,7 @@
case OSMO_TRAU16_FT_EDATA:
return encode16_edata(bits, fr);
case OSMO_TRAU8_SPEECH:
- return encode8_hr(bits, fr);
+ return encode8_hr(bits, fr, false);
case OSMO_TRAU8_DATA:
return encode8_data(bits, fr);
case OSMO_TRAU8_OAM:
@@ -1322,6 +1346,63 @@
}
}
+/*! Encode a TFO frame from its decoded representation to a sequence of unpacked bits.
+ * \param[out] bits caller-allocated buffer for unpacked outpud bits
+ * \param[in] n_bits size of 'bits' output buffer in number of unpacked bits
+ * \param[in] fr decoded representation of TRAU frame to be encoded
+ * \return 0 number of unpacked output bits generated; negative in case of error
+ *
+ * Compared to regular osmo_trau_frame_encode(), this TFO-specific TRAU frame
+ * encoding function restricts the set of possible frame types to those that
+ * are valid for TFO, restricts the direction to TRAU-UL, reduces the output
+ * space requirement (there is no timing alignment extension) and always uses
+ * all fr->c_bits provided by the application.
+ */
+int osmo_trau_frame_encode_tfo(ubit_t *bits, size_t n_bits, const struct osmo_trau_frame *fr)
+{
+ /* TFO frames are TRAU-UL only */
+ if (fr->dir != OSMO_TRAU_DIR_UL)
+ return -EINVAL;
+
+ /* check for sufficient space provided by caller in output buffer */
+ /* there is no timing alignment in TRAU-UL direction! */
+ switch (fr->type) {
+ case OSMO_TRAU16_FT_FR:
+ case OSMO_TRAU16_FT_EFR:
+ case OSMO_TRAU16_FT_AMR:
+ if (n_bits < 1 * 40 * 8)
+ return -ENOSPC;
+ break;
+ case OSMO_TRAU8_SPEECH:
+ case OSMO_TRAU8_AMR_LOW:
+ case OSMO_TRAU8_AMR_6k7:
+ case OSMO_TRAU8_AMR_7k4:
+ if (n_bits < 1 * 20 * 8)
+ return -ENOSPC;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ switch (fr->type) {
+ case OSMO_TRAU16_FT_FR:
+ case OSMO_TRAU16_FT_EFR:
+ return encode16_fr(bits, fr, true);
+ case OSMO_TRAU16_FT_AMR:
+ return encode16_amr(bits, fr, true);
+ case OSMO_TRAU8_SPEECH:
+ return encode8_hr(bits, fr, true);
+ case OSMO_TRAU8_AMR_LOW:
+ return encode8_amr_low(bits, fr);
+ case OSMO_TRAU8_AMR_6k7:
+ return encode8_amr_67(bits, fr);
+ case OSMO_TRAU8_AMR_7k4:
+ return encode8_amr_74(bits, fr);
+ default:
+ return -EINVAL;
+ }
+}
+
/*! Decode/parse a 16k TRAU frame from unpacked bits to decoded format.
* \param[out] fr caller-allocated output data structure
* \param[in] bits unpacked bits containing raw TRAU frame; must be aligned
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/39495?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I6e0ab4e5115f0aa6979ce93955b0e95b09041091
Gerrit-Change-Number: 39495
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>