lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

September 2024

  • 1 participants
  • 1983 discussions
[S] Change in ...pyosmocom[master]: test_construct: move testvectors inside unittest class
by fixeria 26 Sep '24

26 Sep '24
Attention is currently required from: dexter. fixeria has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38287?usp=email ) Change subject: test_construct: move testvectors inside unittest class ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/38287?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: python/pyosmocom Gerrit-Branch: master Gerrit-Change-Id: Ida24295091efd30406e9a354ca5854150127b3d4 Gerrit-Change-Number: 38287 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Thu, 26 Sep 2024 05:53:49 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in libosmo-abis[master]: trau_rtp_conv: use new RA2 functions for CSD
by falconia 26 Sep '24

26 Sep '24
falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/38291?usp=email ) Change subject: trau_rtp_conv: use new RA2 functions for CSD ...................................................................... trau_rtp_conv: use new RA2 functions for CSD osmo_trau2rtp() and osmo_rtp2trau() include CSD support; the RTP format in CSD modes is RFC 4040 clearmode like the interface that exists on the 64 kbit/s side of a traditional TRAU. RA2 packing and unpacking constitute required steps in these conversions - use newly factored-out functions. Change-Id: Ia157989579ced866b1e7abfc789d69ae489224e9 --- M src/trau/trau_rtp_conv.c 1 file changed, 5 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/91/38291/1 diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c index 24ea70c..f4f04d6 100644 --- a/src/trau/trau_rtp_conv.c +++ b/src/trau/trau_rtp_conv.c @@ -30,6 +30,7 @@ #include <osmocom/trau/trau_frame.h> #include <osmocom/trau/trau_rtp.h> +#include <osmocom/trau/csd_ra2.h> /* RFC4040 "clearmode" RTP payload length */ #define RFC4040_RTP_PLEN 160 @@ -1093,32 +1094,18 @@ static void trau2v110_ir8(uint8_t *out, const ubit_t *in) { ubit_t ra_bits[80]; - int i; trau2v110_bits(ra_bits, in); - - /* RA2: 1 bit per output byte */ - for (i = 0; i < 80; i++) - out[i] = 0x7F | (ra_bits[i] << 7); + osmo_csd_ra2_8k_pack(out, ra_bits, 80); } /* intermediate rate 16 kbit/s */ static void trau2v110_ir16(uint8_t *out, const ubit_t *in) { ubit_t ra_bits[80]; - int i, o; - uint8_t b; trau2v110_bits(ra_bits, in); - - /* RA2: 2 bits per output byte */ - i = 0; - for (o = 0; o < 40; o++) { - b = 0x3F; - b |= (ra_bits[i++] << 7); - b |= (ra_bits[i++] << 6); - out[o] = b; - } + osmo_csd_ra2_16k_pack(out, ra_bits, 40); } static int trau2rtp_data_fr(uint8_t *out, size_t out_len, @@ -1241,14 +1228,12 @@ size_t data_len, unsigned second_offset) { ubit_t ra_bits[80 * 2]; - int i; if (data_len != RFC4040_RTP_PLEN) goto idle_fill; /* reverse RA2 first */ - for (i = 0; i < sizeof(ra_bits); i++) - ra_bits[i] = (data[i] >> 7) & 1; + osmo_csd_ra2_8k_unpack(ra_bits, data, RFC4040_RTP_PLEN); /* enforce two properly aligned V.110 frames */ if (!check_v110_align(ra_bits)) @@ -1271,17 +1256,12 @@ size_t data_len) { ubit_t ra_bits[80 * 4]; - int i, o; if (data_len != RFC4040_RTP_PLEN) goto idle_fill; /* reverse RA2 first */ - o = 0; - for (i = 0; i < RFC4040_RTP_PLEN; i++) { - ra_bits[o++] = (data[i] >> 7) & 1; - ra_bits[o++] = (data[i] >> 6) & 1; - } + osmo_csd_ra2_16k_unpack(ra_bits, data, RFC4040_RTP_PLEN); /* enforce 4 properly aligned V.110 frames */ if (!check_v110_align(ra_bits)) -- To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/38291?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Change-Id: Ia157989579ced866b1e7abfc789d69ae489224e9 Gerrit-Change-Number: 38291 Gerrit-PatchSet: 1 Gerrit-Owner: falconia <falcon(a)freecalypso.org>
1 0
0 0
[L] Change in libosmo-abis[master]: libosmotrau: implement RAA' encoder function
by falconia 26 Sep '24

26 Sep '24
falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/38292?usp=email ) Change subject: libosmotrau: implement RAA' encoder function ...................................................................... libosmotrau: implement RAA' encoder function RAA' is the rate adaption function specific to 14.4 kbit/s CSD services. It is defined in 3GPP TS 48.020 chapter 11, and consists of transforming each user data frame of 290 bits (as it would appear at the radio channel coder interface) into a special A-TRAU frame. 64 kbit/s streams consisting of these A-TRAU frames are meant to traverse the call switching network from one mobile call leg to the other, or from a mobile call leg to an IWF. RAA' transform involves rather bewildering manipulation of payload bit content, done to prevent any possibility of false A-TRAU frame alignment in octet-oriented (no frame boundaries) 64 kbit/s transport. The complexity is such that unit tests are essential, especially unit tests that cross-check our software implementation against those made by others. Fortunately this RAA' function is included in traditional T1/E1 TRAUs, those that support CSD in 14.4 kbit/s mode and implement it according to the specs. Nokia TCSM2 in Themyscira lab includes the necessary support, and the present patch includes a unit test that verifies perfect agreement between our software implementation of RAA' encoder and the historical hw implementation in the old Nokia TRAU. Related: OS#6167 Change-Id: I11fc1529f5be88fa778c7e05cb11eef58a389d40 --- M .gitignore M include/Makefile.am A include/osmocom/trau/raa_prime.h M src/Makefile.am A src/trau/raa_prime_encode.c M tests/Makefile.am A tests/raa_prime/README.test-data A tests/raa_prime/d144-ul-input.asc A tests/raa_prime/nokia-tcsm2-atrau.hex A tests/raa_prime/test_enc.c M tests/testsuite.at 11 files changed, 396 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/92/38292/1 diff --git a/.gitignore b/.gitignore index 2bed942..2f3ba99 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ tests/subchan_demux/.dirstamp tests/subchan_demux/subchan_demux_test tests/ipa_recv/ipa_recv_test +tests/raa_prime/test_enc tests/trau_pcu_ericsson/trau_pcu_ericsson_test tests/trau_conv/trau16_to_rtp tests/trau_sync/trau_sync_test diff --git a/include/Makefile.am b/include/Makefile.am index 2832541..dc4cf2e 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -5,6 +5,7 @@ osmocom/abis/subchan_demux.h osmocom/abis/e1_input.h \ osmocom/abis/lapd.h osmocom/abis/lapd_pcap.h osmocom/abis/unixsocket_proto.h \ osmocom/trau/csd_ra2.h \ + osmocom/trau/raa_prime.h \ osmocom/trau/trau_frame.h \ osmocom/trau/trau_sync.h \ osmocom/trau/trau_pcu_ericsson.h \ diff --git a/include/osmocom/trau/raa_prime.h b/include/osmocom/trau/raa_prime.h new file mode 100644 index 0000000..43bfe4e --- /dev/null +++ b/include/osmocom/trau/raa_prime.h @@ -0,0 +1,57 @@ +/* + * This header file defines the API to the RAA' (RAA-prime) function of + * 3GPP TS 48.020 chapter 11, which is a transform applicable to + * circuit-switched data calls at air interface user rate of 14.4 kbit/s. + * RAA' converts between the "user" form of 290 bits (288 payload bits + * plus two M-bits) that appears at the radio channel coder interface + * and in E-TRAU frames on one side, and external PCM interface A-TRAU + * frames on the other side. + * + * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2024 - however, + * Mother Mychaela's contributions are NOT subject to copyright. + * No rights reserved, all rights relinquished. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include <stdint.h> +#include <osmocom/core/bits.h> + +#define OSMO_ATRAU_FRAME_BITS 320 +#define OSMO_ATRAU_RA2_OCTETS 160 + +/*! Convert one 20 ms frame of csd144 from user form to A-TRAU frame; + * the output is in the form of unpacked bits. + * + * \param[out] out_bits caller-provided buffer of size OSMO_ATRAU_FRAME_BITS + * \param[in] m_bits 2 M-bits associated with this 20 ms CSD frame + * \param[in] d_bits 288 user data bits in this 20 ms CSD frame + * \param[in] atrau_c4 value to be put into A-TRAU frame bit C4 + * \param[in] atrau_c5 value to be put into A-TRAU frame bit C5 + */ +void osmo_csd144_to_atrau_bits(ubit_t *out_bits, const ubit_t *m_bits, + const ubit_t *d_bits, ubit_t atrau_c4, + ubit_t atrau_c5); + +/*! Convert one 20 ms frame of csd144 from user form to A-TRAU frame; + * the output is the external output form with RA2 applied. + * + * \param[out] out_bytes caller-provided buffer of size OSMO_ATRAU_RA2_OCTETS + * \param[in] m_bits 2 M-bits associated with this 20 ms CSD frame + * \param[in] d_bits 288 user data bits in this 20 ms CSD frame + * \param[in] atrau_c4 value to be put into A-TRAU frame bit C4 + * \param[in] atrau_c5 value to be put into A-TRAU frame bit C5 + */ +void osmo_csd144_to_atrau_ra2(uint8_t *out_bytes, const ubit_t *m_bits, + const ubit_t *d_bits, ubit_t atrau_c4, + ubit_t atrau_c5); diff --git a/src/Makefile.am b/src/Makefile.am index 1df7f4c..6d8bc98 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -42,6 +42,7 @@ $(NULL) libosmotrau_la_LIBADD = $(COMMONLIBS) $(LIBOSMOCODEC_LIBS) $(ORTP_LIBS) libosmotrau_la_SOURCES = trau/csd_ra2.c \ + trau/raa_prime_encode.c \ trau/trau_frame.c \ trau/trau_pcu_ericsson.c \ trau/trau_sync.c \ diff --git a/src/trau/raa_prime_encode.c b/src/trau/raa_prime_encode.c new file mode 100644 index 0000000..4e98f35 --- /dev/null +++ b/src/trau/raa_prime_encode.c @@ -0,0 +1,139 @@ +/* + * This C module contains the implementation of RAA' (RAA-prime) function + * in the encoding direction, from user bits to A-TRAU frame. + * The interface is defined in <osmocom/trau/raa_prime.h>. + * + * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2024 - however, + * Mother Mychaela's contributions are NOT subject to copyright. + * No rights reserved, all rights relinquished. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <stdint.h> +#include <stdbool.h> +#include <string.h> +#include <osmocom/core/bits.h> +#include <osmocom/core/utils.h> +#include <osmocom/trau/raa_prime.h> +#include <osmocom/trau/csd_ra2.h> + +/* max possible number of Z-sequences per 36-bit subframe */ +#define MAX_ZSEQ_CNT 4 + +static bool is_z_seq(const ubit_t *d_bits) +{ + int i; + + for (i = 0; i < 8; i++) { + if (d_bits[i]) + return false; + } + return true; +} + +static unsigned find_z_seqs(const ubit_t *d_bits, uint8_t *zseq_pos) +{ + unsigned idx, count; + + count = 0; + for (idx = 0; idx <= 28; ) { + if (is_z_seq(d_bits + idx)) { + zseq_pos[count++] = idx; + idx += 8; + } else + idx++; + } + return count; +} + +static void encode_zsp(ubit_t *out_bits, uint8_t pos_0based, bool is_final) +{ + uint8_t pos_1based = pos_0based + 1; + + *out_bits++ = 1; + *out_bits++ = is_final; + *out_bits++ = (pos_1based >> 4) & 1; + *out_bits++ = (pos_1based >> 3) & 1; + *out_bits++ = (pos_1based >> 2) & 1; + *out_bits++ = (pos_1based >> 1) & 1; + *out_bits++ = (pos_1based >> 0) & 1; + *out_bits++ = 1; +} + +static void atrau_pack_subframe(ubit_t *out_bits, const ubit_t *d_bits) +{ + uint8_t zseq_pos[MAX_ZSEQ_CNT]; + unsigned zseq_count, n; + unsigned in_pos, z_pos, numd; + + zseq_count = find_z_seqs(d_bits, zseq_pos); + /* weed out the trivial case of no substitution needed */ + if (zseq_count == 0) { + out_bits[0] = 1; /* Zi bit */ + memcpy(out_bits + 1, d_bits, 36); + return; + } + /* we do need substitution: set Zi accordingly */ + *out_bits++ = 0; + in_pos = 0; + for (n = 0; n < zseq_count; n++) { + z_pos = zseq_pos[n]; + encode_zsp(out_bits, z_pos, n == zseq_count - 1); + out_bits += 8; + OSMO_ASSERT(z_pos >= in_pos); + numd = z_pos - in_pos; + memcpy(out_bits, d_bits + in_pos, numd); + out_bits += numd; + in_pos += numd + 8; + } + OSMO_ASSERT(in_pos <= 36); + numd = 36 - in_pos; + memcpy(out_bits, d_bits + in_pos, numd); +} + +void osmo_csd144_to_atrau_bits(ubit_t *out_bits, const ubit_t *m_bits, + const ubit_t *d_bits, ubit_t atrau_c4, + ubit_t atrau_c5) +{ + int subf; + + /* sync pattern: 16 zeros followed by a single one */ + memset(out_bits, 0, 16); + out_bits[16] = 1; + /* C1..C5 per TS 48.020 section 11.1 */ + out_bits[17] = 0; + out_bits[18] = 1; + out_bits[19] = 1; + out_bits[20] = atrau_c4; + out_bits[21] = atrau_c5; + /* the two M-bits are pass-through */ + out_bits[22] = m_bits[0]; + out_bits[23] = m_bits[1]; + /* done with the header, do the 8 subframes */ + out_bits += 24; + for (subf = 0; subf < 8; subf++) { + atrau_pack_subframe(out_bits, d_bits); + d_bits += 36; + out_bits += 37; + } +} + +void osmo_csd144_to_atrau_ra2(uint8_t *out_bytes, const ubit_t *m_bits, + const ubit_t *d_bits, ubit_t atrau_c4, + ubit_t atrau_c5) +{ + ubit_t atrau_bits[OSMO_ATRAU_FRAME_BITS]; + + osmo_csd144_to_atrau_bits(atrau_bits, m_bits, d_bits, atrau_c4, + atrau_c5); + osmo_csd_ra2_16k_pack(out_bytes, atrau_bits, OSMO_ATRAU_RA2_OCTETS); +} diff --git a/tests/Makefile.am b/tests/Makefile.am index e50a3b7..d50b09a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,6 +7,7 @@ ipa_proxy_test \ subchan_demux/subchan_demux_test \ ipa_recv/ipa_recv_test \ + raa_prime/test_enc \ trau_conv/trau16_to_rtp \ trau_sync/trau_sync_test \ trau_pcu_ericsson/trau_pcu_ericsson_test @@ -38,6 +39,10 @@ $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) +raa_prime_test_enc_SOURCES = raa_prime/test_enc.c +raa_prime_test_enc_LDADD = $(top_builddir)/src/libosmotrau.la \ + $(LIBOSMOCORE_LIBS) + rtp_test_rtp_test_SOURCES = rtp_test/rtp_test.c rtp_test_rtp_test_LDADD = $(top_builddir)/src/libosmotrau.la \ $(LIBOSMOCORE_LIBS) @@ -76,6 +81,7 @@ EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) \ subchan_demux/subchan_demux_test.ok \ ipa_recv/ipa_recv_test.ok \ + raa_prime/d144-ul-input.asc raa_prime/nokia-tcsm2-atrau.hex \ rtp_test/rtp_test.ok \ trau_conv/trau16_efr.in trau_conv/trau16_efr_std.ok \ trau_conv/trau16_efr_twts001.ok \ diff --git a/tests/raa_prime/README.test-data b/tests/raa_prime/README.test-data new file mode 100644 index 0000000..8f82704 --- /dev/null +++ b/tests/raa_prime/README.test-data @@ -0,0 +1,22 @@ +The two test data files presented here for unit testing of RAA' function are: + +d144-ul-input.asc + + This file is generated in Themyscira gsm-net-reveng Hg repository, + d144 subdirectory. The original hand-crafted input is a different + file in the same directory (ul-input); the present *.asc file is + the output of some helper programs maintained in the same place, + reformatted to be more directly suitable as a unit test for + libosmotrau RAA' encoding functions. + +nokia-tcsm2-atrau.hex + + This file is the A-interface output from a historical hardware TRAU + (Nokia TCSM2) whose input was the sequence of 290-bit "user" frames in + d144-ul-input.asc. It is raw E1 timeslot output that has been extracted + in perfect alignment and converted into hexadecimal representation, + with 80 hex digits per line. + +A correct RAA' encoder implementation should produce output identical to +nokia-tcsm2-atrau.hex when fed with d144-ul-input.asc, and vice-versa for +a correct RAA' decoder implementation. diff --git a/tests/raa_prime/d144-ul-input.asc b/tests/raa_prime/d144-ul-input.asc new file mode 100644 index 0000000..9f2c662 --- /dev/null +++ b/tests/raa_prime/d144-ul-input.asc @@ -0,0 +1,4 @@ +00 000000000001122345010101010080808080101010100f00f00f00f00f0000ffff807fff +01 aaaaaaaaafffffffff1abcd807ffff000ffff000f000fc0c0c0c00c0c0c0c03c0c0c0c07 +10 1007803001000000000000f0000008040201008040200008040300700a00568180222200 +11 1234567890505050503456789ab024abcdeffffff0000013670100013670101013660101 diff --git a/tests/raa_prime/nokia-tcsm2-atrau.hex b/tests/raa_prime/nokia-tcsm2-atrau.hex new file mode 100644 index 0000000..dad53a3 --- /dev/null +++ b/tests/raa_prime/nokia-tcsm2-atrau.hex @@ -0,0 +1,16 @@ +3F3F3F3F3F3F3F3FBFFFBF3F7F3F3F7FFF3FBF7FFF7F3F7FFFFFBF7FBF3F3FFF3F3FFF3F7F3F7F3F +BF3FBF3FFF7F3F7F7FBF3F3F3FBF3F3F3FBF3F3F3FBF3F3F3FBF3F7F3F3FBF3F3F3FBF3F3F3FBF3F +3F3FBF3F3F3F7FFFFF7FBF3FBF3F3F3FBF3F3F3FBF3F3F3FBFBF3FBFFFFFFFBFBF3FFFFFFFFFFFBF +FFFFFF7F3F7F7FFFFFFF7F3F7FFFFFFFFFBF7FFFFFBFFF7FFF7FFFFFFFFFFFFFFFFFFFFFFFFFFFFF +3F3F3F3F3F3F3F3FBFFFBF7FFF7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7FFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFF7FFF7FBFBF3FFF7F7F7FFFBF7FBFFFFFFFFFBFFF7FBFFFFFFFFFFFFFFF3F3F +FFFFFFFFFFFF7F3F7F7FFFFFFFFF7F7FBF3F7FFFBF3F7FFFBFFFFF7FFFFF3F3F3FFF3F3F3FFF3F3F +3FFF3F7FFFBFFFFFBF3F3F7FBF3F3F7FBF3F3F7FFFFFFF3F3F3FFF3F3F3FFF3F3F3FFF3F3F3F7FFF +3F3F3F3F3F3F3F3FBFFFBFBF7F3F7F7FBF3FFF7F3FBFBFFFFFFFFFBFFF7FBFBF3FBFFF3F7FBF7FBF +FFBFBFBFFFFFFFBFFF7F3F3F7FFF3FBF7FFF7F7F7FFFFFFFFFFF7FBFBF3F3FFFBF7F7F7FFF7F3FFF +FFFFFFBF7FFF7F3F3F7FFF3FBFBFFFBFBF7FFFFFFFFF3FFF3FBF3F3FFFBF7F7F7FFF7F3FFFFFFFFF +BFFFFF7F3F7F7FBFFFFFFF3F3FFF7F3FBFBFFF7F3F3FBF3FFF7F3F7FFFFFFF3FBFBF3FBF3FBF3FBF +3F3F3F3F3F3F3F3FBFFFBFFFBF3FBF7F3F7FBFBF3FBFBFFF3FFFFF3F7F3FFF3F3F7F7F3F3F7F7F3F +3F7F7F3F3F7F7F3F3FBF7FBFBF3FBFBFFF3FFFFF3F7F3FFF7F7F7FFF3F3F3FBF7F3FBFBFBFFFFF3F +FF7FFFBFFFFF7F7F7F7FFFFFFFFFFFFFFFFFFFFFFFFFFF7FBFFFFFBFFF3F3F3F7F3FFF7FBF7FFF3F +3F3F7FBF3F3F3FBF7FBFFF3FFFBF3F3F3FBF3F3F3FBFFFBFBF7F3F3F3F7F3FFF7FBF7FFF3F3F3F7F diff --git a/tests/raa_prime/test_enc.c b/tests/raa_prime/test_enc.c new file mode 100644 index 0000000..b063fde --- /dev/null +++ b/tests/raa_prime/test_enc.c @@ -0,0 +1,143 @@ +/* + * This C module is a unit test program for libosmotrau implementation + * of RAA' function in the encoding direction. + * + * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2024 - however, + * Mother Mychaela's contributions are NOT subject to copyright. + * No rights reserved, all rights relinquished. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <ctype.h> +#include <stdio.h> +#include <stdint.h> +#include <stdbool.h> +#include <stdlib.h> +#include <string.h> + +#include <osmocom/core/bits.h> +#include <osmocom/core/utils.h> +#include <osmocom/trau/raa_prime.h> + +/* + * The output A-TRAU frame in RA2 dressing is 160 binary bytes. + * But instead of emitting it as a single hex line of 320 digits + * followed by a single newline, we split it into 4 hex lines + * of 80 characters each. This approach is taken because the + * hex file against which we'll be comparing our output comes from + * Themyscira Wireless, and ThemWi (unlike Osmocom) treats the + * 80 characters line length as absolute and inviolable. + */ +static void print_hex_output(const uint8_t *bin) +{ + int i, j, n; + + n = 0; + for (i = 0; i < 4; i++) { + for (j = 0; j < 40; j++) + printf("%02X", bin[n++]); + putchar('\n'); + } +} + +static void process_record(const char *mbits_arg, const char *hex_str) +{ + uint8_t input_bytes[36]; + ubit_t m_bits[2], d_bits[288]; + uint8_t outbuf[OSMO_ATRAU_RA2_OCTETS]; + + m_bits[0] = mbits_arg[0] - '0'; + m_bits[1] = mbits_arg[1] - '0'; + osmo_hexparse(hex_str, input_bytes, sizeof(input_bytes)); + osmo_pbit2ubit(d_bits, input_bytes, sizeof(d_bits)); + /* + * We set C4=1 as will always be the case in BSS->IWF direction: + * see Table 3 in TS 48.020 section 11.1. We set C5=0 in this + * unit test to match the condition that existed in the hw test + * setup with Nokia TCSM2, which was used to produce the A-TRAU + * output we'll be comparing against. + */ + osmo_csd144_to_atrau_ra2(outbuf, m_bits, d_bits, 1, 0); + print_hex_output(outbuf); +} + +static void process_line(char *linebuf, const char *infname, int lineno) +{ + char *cp = linebuf, *mbits_arg, *hex_str; + int ndig; + + while (isspace(*cp)) + cp++; + if (*cp == '\0' || *cp == '#') + return; + /* expect M-bits argument */ + mbits_arg = cp; + for (ndig = 0; ndig < 2; ndig++) { + if (*cp != '0' && *cp != '1') + goto inv; + cp++; + } + if (!isspace(*cp)) + goto inv; + *cp++ = '\0'; + while (isspace(*cp)) + cp++; + if (*cp == '\0' || *cp == '#') + goto inv; + /* expect string of 72 hex digits */ + hex_str = cp; + for (ndig = 0; ndig < 72; ndig++) { + if (!isxdigit(*cp)) + goto inv; + cp++; + } + if (*cp) { + if (!isspace(*cp)) + goto inv; + *cp++ = '\0'; + } + /* must be end of non-comment line */ + while (isspace(*cp)) + cp++; + if (*cp != '\0' && *cp != '#') + goto inv; + + process_record(mbits_arg, hex_str); + return; + +inv: fprintf(stderr, "%s line %d: invalid syntax\n", infname, lineno); + exit(1); +} + +int main(int argc, char **argv) +{ + const char *infname; + FILE *inf; + char linebuf[256]; + int lineno; + + if (argc != 2) { + fprintf(stderr, "usage: %s input-file\n", argv[0]); + exit(1); + } + infname = argv[1]; + inf = fopen(infname, "r"); + if (!inf) { + perror(infname); + exit(1); + } + + for (lineno = 1; fgets(linebuf, sizeof(linebuf), inf); lineno++) + process_line(linebuf, infname, lineno); + fclose(inf); + exit(0); +} diff --git a/tests/testsuite.at b/tests/testsuite.at index 2528eb8..c430220 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -30,6 +30,12 @@ AT_CHECK([$abs_top_builddir/tests/rtp_test/rtp_test], [ignore], [expout]) AT_CLEANUP +AT_SETUP([raa_prime_encode]) +AT_KEYWORDS([raa_prime_encode]) +cat $abs_srcdir/raa_prime/nokia-tcsm2-atrau.hex > expout +AT_CHECK([$abs_top_builddir/tests/raa_prime/test_enc $abs_srcdir/raa_prime/d144-ul-input.asc], [0], [expout], [ignore]) +AT_CLEANUP + AT_SETUP([trau_sync]) AT_KEYWORDS([trau_sync]) cat $abs_srcdir/trau_sync/trau_sync_test.ok > expout -- To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/38292?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Change-Id: I11fc1529f5be88fa778c7e05cb11eef58a389d40 Gerrit-Change-Number: 38292 Gerrit-PatchSet: 1 Gerrit-Owner: falconia <falcon(a)freecalypso.org>
1 0
0 0
[M] Change in libosmo-abis[master]: libosmotrau: add CSD RA2 functions
by falconia 26 Sep '24

26 Sep '24
falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/38290?usp=email ) Change subject: libosmotrau: add CSD RA2 functions ...................................................................... libosmotrau: add CSD RA2 functions Rate adaption function RA2 for GSM CSD calls is defined in 3GPP TS 48.020 chapter 13. While it is nothing but one special case of I.460 submultiplexing and we do have i460_mux infrastructure in Osmocom, that fully-general I.460 infra is too heaviweight for CSD encoding and decoding functions that need simple, single-input and single-output RA2 packing and unpacking functions. Right now ad hoc RA2 functions are used in the trau_rtp_conv module and in OsmoBTS csd_v110; same functions will also be needed for the upcoming RAA' unit test addition. Add proper RA2 packing and unpacking functions that can be used in all of these places. Change-Id: I7b98b958651b3fc1a814d119d1b8644c91f98676 --- M include/Makefile.am A include/osmocom/trau/csd_ra2.h M src/Makefile.am A src/trau/csd_ra2.c 4 files changed, 140 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/90/38290/1 diff --git a/include/Makefile.am b/include/Makefile.am index 88d66dc..2832541 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -4,6 +4,7 @@ osmocom/abis/ipa_proxy.h osmocom/abis/ipaccess.h osmocom/abis/abis.h \ osmocom/abis/subchan_demux.h osmocom/abis/e1_input.h \ osmocom/abis/lapd.h osmocom/abis/lapd_pcap.h osmocom/abis/unixsocket_proto.h \ + osmocom/trau/csd_ra2.h \ osmocom/trau/trau_frame.h \ osmocom/trau/trau_sync.h \ osmocom/trau/trau_pcu_ericsson.h \ diff --git a/include/osmocom/trau/csd_ra2.h b/include/osmocom/trau/csd_ra2.h new file mode 100644 index 0000000..a629391 --- /dev/null +++ b/include/osmocom/trau/csd_ra2.h @@ -0,0 +1,67 @@ +/* + * Rate adaption function RA2 for GSM CSD calls is defined in 3GPP TS + * 48.020 chapter 13. While it is nothing but one special case of I.460 + * submultiplexing and we do have i460_mux infrastructure in Osmocom, + * that fully-general I.460 infra is too heaviweight for CSD encoding + * and decoding functions that need simple, single-input and single-output + * RA2 packing and unpacking functions. + * + * This header file defines the API to CSD-oriented RA2 packing and unpacking + * functions that support intermediate rates of 8 and 16 kbit/s: the two IRs + * that occur in "plain" single-slot CSD without EDGE. + * + * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2024 - however, + * Mother Mychaela's contributions are NOT subject to copyright. + * No rights reserved, all rights relinquished. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include <stdint.h> +#include <osmocom/core/bits.h> + +/*! pack bits into octets per RA2 with 8 kbit/s IR + * param[out] out_bytes caller-provided buffer of size nbytes + * param[in] in_bits source bits to be packed, size nbytes + * param[in] nbytes number of output bytes to pack, equals number of + * source bits with 8 kbit/s IR + */ +void osmo_csd_ra2_8k_pack(uint8_t *out_bytes, const ubit_t *in_bits, + unsigned nbytes); + +/*! unpack bits from octets per RA2 with 8 kbit/s IR + * param[out] out_bits caller-provided buffer of size nbytes + * param[in] in_bytes received 64 kbit/s octets to unpack, size nbytes + * param[in] nbytes number of received octets to unpack, equals number + * of output bits with 8 kbit/s IR + */ +void osmo_csd_ra2_8k_unpack(ubit_t *out_bits, const uint8_t *in_bytes, + unsigned nbytes); + +/*! pack bits into octets per RA2 with 16 kbit/s IR + * param[out] out_bytes caller-provided buffer of size nbytes + * param[in] in_bits source bits to be packed, size nbytes*2 + * param[in] nbytes number of output bytes to pack; the number of + * source bits is double this number + */ +void osmo_csd_ra2_16k_pack(uint8_t *out_bytes, const ubit_t *in_bits, + unsigned nbytes); + +/*! unpack bits from octets per RA2 with 16 kbit/s IR + * param[out] out_bits caller-provided buffer of size nbytes*2 + * param[in] in_bytes received 64 kbit/s octets to unpack, size nbytes + * param[in] nbytes number of received octets to unpack; the number + * of output bits is double this number + */ +void osmo_csd_ra2_16k_unpack(ubit_t *out_bits, const uint8_t *in_bytes, + unsigned nbytes); diff --git a/src/Makefile.am b/src/Makefile.am index 7c59ec3..1df7f4c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,7 +41,8 @@ -no-undefined \ $(NULL) libosmotrau_la_LIBADD = $(COMMONLIBS) $(LIBOSMOCODEC_LIBS) $(ORTP_LIBS) -libosmotrau_la_SOURCES = trau/trau_frame.c \ +libosmotrau_la_SOURCES = trau/csd_ra2.c \ + trau/trau_frame.c \ trau/trau_pcu_ericsson.c \ trau/trau_sync.c \ trau/trau_rtp_conv.c diff --git a/src/trau/csd_ra2.c b/src/trau/csd_ra2.c new file mode 100644 index 0000000..c44aa7c --- /dev/null +++ b/src/trau/csd_ra2.c @@ -0,0 +1,70 @@ +/* + * This C module contains the implementation of CSD RA2 functions + * defined in <osmocom/trau/csd_ra2.h>. + * + * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2024 - however, + * Mother Mychaela's contributions are NOT subject to copyright. + * No rights reserved, all rights relinquished. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <stdint.h> + +#include <osmocom/core/bits.h> +#include <osmocom/trau/csd_ra2.h> + +void osmo_csd_ra2_8k_pack(uint8_t *out_bytes, const ubit_t *in_bits, + unsigned nbytes) +{ + unsigned i; + + /* RA2: 1 bit per output byte */ + for (i = 0; i < nbytes; i++) + out_bytes[i] = 0x7F | (in_bits[i] << 7); +} + +void osmo_csd_ra2_8k_unpack(ubit_t *out_bits, const uint8_t *in_bytes, + unsigned nbytes) +{ + unsigned i; + + for (i = 0; i < nbytes; i++) + out_bits[i] = (in_bytes[i] >> 7) & 1; +} + +void osmo_csd_ra2_16k_pack(uint8_t *out_bytes, const ubit_t *in_bits, + unsigned nbytes) +{ + unsigned i, o; + uint8_t b; + + /* RA2: 2 bits per output byte */ + i = 0; + for (o = 0; o < nbytes; o++) { + b = 0x3F; + b |= (in_bits[i++] << 7); + b |= (in_bits[i++] << 6); + out_bytes[o] = b; + } +} + +void osmo_csd_ra2_16k_unpack(ubit_t *out_bits, const uint8_t *in_bytes, + unsigned nbytes) +{ + unsigned i, o; + + o = 0; + for (i = 0; i < nbytes; i++) { + out_bits[o++] = (in_bytes[i] >> 7) & 1; + out_bits[o++] = (in_bytes[i] >> 6) & 1; + } +} -- To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/38290?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Change-Id: I7b98b958651b3fc1a814d119d1b8644c91f98676 Gerrit-Change-Number: 38290 Gerrit-PatchSet: 1 Gerrit-Owner: falconia <falcon(a)freecalypso.org>
1 0
0 0
[L] Change in libosmo-abis[master]: libosmotrau: implement RAA' decoder function
by falconia 26 Sep '24

26 Sep '24
falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/38293?usp=email ) Change subject: libosmotrau: implement RAA' decoder function ...................................................................... libosmotrau: implement RAA' decoder function The previous patch implements RAA' encoder function; now comes the decoder. Related: OS#6167 Change-Id: I1347a25ce97d5022502ee9112caded66315b09a4 --- M .gitignore M include/osmocom/trau/raa_prime.h M src/Makefile.am A src/trau/raa_prime_decode.c M tests/Makefile.am A tests/raa_prime/test_dec.c M tests/testsuite.at 7 files changed, 280 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/93/38293/1 diff --git a/.gitignore b/.gitignore index 2f3ba99..fd0974d 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ tests/subchan_demux/.dirstamp tests/subchan_demux/subchan_demux_test tests/ipa_recv/ipa_recv_test +tests/raa_prime/test_dec tests/raa_prime/test_enc tests/trau_pcu_ericsson/trau_pcu_ericsson_test tests/trau_conv/trau16_to_rtp diff --git a/include/osmocom/trau/raa_prime.h b/include/osmocom/trau/raa_prime.h index 43bfe4e..7c3e817 100644 --- a/include/osmocom/trau/raa_prime.h +++ b/include/osmocom/trau/raa_prime.h @@ -55,3 +55,31 @@ void osmo_csd144_to_atrau_ra2(uint8_t *out_bytes, const ubit_t *m_bits, const ubit_t *d_bits, ubit_t atrau_c4, ubit_t atrau_c5); + +/*! Decode aligned A-TRAU frame into user form of 288 D-bits and + * two M-bits; the A-TRAU frame input is given in unpacked bit form. + * + * \param[out] m_bits caller-provided buffer for 2 M-bits + * \param[out] d_bits caller-provided buffer for 288 user data bits + * \param[out] atrau_c4 return of A-TRAU frame bit C4 (NULL pointer OK) + * \param[out] atrau_c5 return of A-TRAU frame bit C5 (NULL pointer OK) + * \param[in] atrau_bits A-TRAU frame as 320 unpacked bits + * \return 0 if A-TRAU frame is good; negative if it is invalid + */ +int osmo_csd144_from_atrau_bits(ubit_t *m_bits, ubit_t *d_bits, + ubit_t *atrau_c4, ubit_t *atrau_c5, + const ubit_t *atrau_bits); + +/*! Decode aligned A-TRAU frame into user form of 288 D-bits and + * two M-bits; the A-TRAU frame input is given in RA2 octet form. + * + * \param[out] m_bits caller-provided buffer for 2 M-bits + * \param[out] d_bits caller-provided buffer for 288 user data bits + * \param[out] atrau_c4 return of A-TRAU frame bit C4 (NULL pointer OK) + * \param[out] atrau_c5 return of A-TRAU frame bit C5 (NULL pointer OK) + * \param[in] atrau_bytes A-TRAU frame as 160 RA2 octets + * \return 0 if A-TRAU frame is good; negative if it is invalid + */ +int osmo_csd144_from_atrau_ra2(ubit_t *m_bits, ubit_t *d_bits, + ubit_t *atrau_c4, ubit_t *atrau_c5, + const uint8_t *atrau_bytes); diff --git a/src/Makefile.am b/src/Makefile.am index 6d8bc98..3a6b83d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -42,6 +42,7 @@ $(NULL) libosmotrau_la_LIBADD = $(COMMONLIBS) $(LIBOSMOCODEC_LIBS) $(ORTP_LIBS) libosmotrau_la_SOURCES = trau/csd_ra2.c \ + trau/raa_prime_decode.c \ trau/raa_prime_encode.c \ trau/trau_frame.c \ trau/trau_pcu_ericsson.c \ diff --git a/src/trau/raa_prime_decode.c b/src/trau/raa_prime_decode.c new file mode 100644 index 0000000..b34c67a --- /dev/null +++ b/src/trau/raa_prime_decode.c @@ -0,0 +1,121 @@ +/* + * This C module contains the implementation of RAA' (RAA-prime) function + * in the decoding direction, from an A-TRAU frame to user bits. + * The interface is defined in <osmocom/trau/raa_prime.h>. + * + * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2024 - however, + * Mother Mychaela's contributions are NOT subject to copyright. + * No rights reserved, all rights relinquished. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <stdint.h> +#include <string.h> +#include <errno.h> +#include <osmocom/core/bits.h> +#include <osmocom/core/utils.h> +#include <osmocom/trau/raa_prime.h> +#include <osmocom/trau/csd_ra2.h> + +static int decode_zsp(const ubit_t *atrau_bits, unsigned *pos) +{ + unsigned pos1, n; + + /* guard bits must be set */ + if (!atrau_bits[0] || !atrau_bits[7]) + return -EINVAL; + pos1 = 0; + for (n = 0; n < 5; n++) { + pos1 <<= 1; + pos1 |= atrau_bits[2 + n]; + } + if (pos1 < 1 || pos1 > 29) + return -EINVAL; + *pos = pos1 - 1; + return 0; +} + +static int decode_subframe(ubit_t *d_bits, const ubit_t *atrau_bits) +{ + ubit_t zi, cbit; + unsigned pos, z_pos, numd; + int rc; + + /* consume Zi bit and weed out the trivial case */ + zi = *atrau_bits++; + if (zi) { + memcpy(d_bits, atrau_bits, 36); + return 0; + } + pos = 0; + for (;;) { + if (pos > 28) + return -EINVAL; + rc = decode_zsp(atrau_bits + pos, &z_pos); + if (rc < 0) + return rc; + cbit = atrau_bits[pos + 1]; + if (z_pos < pos) + return -EINVAL; + numd = z_pos - pos; + memcpy(d_bits + pos, atrau_bits + 8 + pos, numd); + memset(d_bits + pos + numd, 0, 8); + pos += numd + 8; + if (cbit) + break; + } + OSMO_ASSERT(pos <= 36); + numd = 36 - pos; + memcpy(d_bits + pos, atrau_bits + pos, numd); + return 0; +} + +int osmo_csd144_from_atrau_bits(ubit_t *m_bits, ubit_t *d_bits, + ubit_t *atrau_c4, ubit_t *atrau_c5, + const ubit_t *atrau_bits) +{ + static const ubit_t header_bits[20] = {0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 1}; + int subf, rc; + + if (memcmp(atrau_bits, header_bits, 20) != 0) + return -EINVAL; + if (atrau_c4) + *atrau_c4 = atrau_bits[20]; + if (atrau_c5) + *atrau_c5 = atrau_bits[21]; + m_bits[0] = atrau_bits[22]; + m_bits[1] = atrau_bits[23]; + + /* done with the header, do the 8 subframes */ + atrau_bits += 24; + for (subf = 0; subf < 8; subf++) { + rc = decode_subframe(d_bits, atrau_bits); + if (rc < 0) + return rc; + atrau_bits += 37; + d_bits += 36; + } + return 0; +} + +int osmo_csd144_from_atrau_ra2(ubit_t *m_bits, ubit_t *d_bits, + ubit_t *atrau_c4, ubit_t *atrau_c5, + const uint8_t *atrau_bytes) +{ + ubit_t atrau_bits[OSMO_ATRAU_FRAME_BITS]; + + osmo_csd_ra2_16k_unpack(atrau_bits, atrau_bytes, OSMO_ATRAU_RA2_OCTETS); + return osmo_csd144_from_atrau_bits(m_bits, d_bits, atrau_c4, atrau_c5, + atrau_bits); +} diff --git a/tests/Makefile.am b/tests/Makefile.am index d50b09a..fd264d0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,6 +7,7 @@ ipa_proxy_test \ subchan_demux/subchan_demux_test \ ipa_recv/ipa_recv_test \ + raa_prime/test_dec \ raa_prime/test_enc \ trau_conv/trau16_to_rtp \ trau_sync/trau_sync_test \ @@ -39,6 +40,10 @@ $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) +raa_prime_test_dec_SOURCES = raa_prime/test_dec.c +raa_prime_test_dec_LDADD = $(top_builddir)/src/libosmotrau.la \ + $(LIBOSMOCORE_LIBS) + raa_prime_test_enc_SOURCES = raa_prime/test_enc.c raa_prime_test_enc_LDADD = $(top_builddir)/src/libosmotrau.la \ $(LIBOSMOCORE_LIBS) diff --git a/tests/raa_prime/test_dec.c b/tests/raa_prime/test_dec.c new file mode 100644 index 0000000..8f9b092 --- /dev/null +++ b/tests/raa_prime/test_dec.c @@ -0,0 +1,118 @@ +/* + * This C module is a unit test program for libosmotrau implementation + * of RAA' function in the decoding direction. + * + * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2024 - however, + * Mother Mychaela's contributions are NOT subject to copyright. + * No rights reserved, all rights relinquished. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <ctype.h> +#include <stdio.h> +#include <stdint.h> +#include <stdbool.h> +#include <stdlib.h> +#include <string.h> + +#include <osmocom/core/bits.h> +#include <osmocom/core/utils.h> +#include <osmocom/trau/raa_prime.h> + +static uint8_t frame_buf[OSMO_ATRAU_RA2_OCTETS]; +static unsigned hex_chunk_count; + +static void process_frame(void) +{ + ubit_t m_bits[2], d_bits[288]; + uint8_t d_bits_packed[36]; + int rc, i; + + rc = osmo_csd144_from_atrau_ra2(m_bits, d_bits, NULL, NULL, frame_buf); + if (rc < 0) { + printf("Bad A-TRAU frame!\n"); + return; + } + osmo_ubit2pbit(d_bits_packed, d_bits, 288); + printf("%u%u ", m_bits[0], m_bits[1]); + for (i = 0; i < 36; i++) + printf("%02x", d_bits_packed[i]); + putchar('\n'); +} + +static void process_hex_input(const char *hex_str) +{ + osmo_hexparse(hex_str, frame_buf + hex_chunk_count * 40, 40); + hex_chunk_count++; + if (hex_chunk_count >= 4) { + process_frame(); + hex_chunk_count = 0; + } +} + +static void process_line(char *linebuf, const char *infname, int lineno) +{ + char *cp = linebuf, *hex_str; + int ndig; + + while (isspace(*cp)) + cp++; + if (*cp == '\0' || *cp == '#') + return; + /* expect string of 80 hex digits */ + hex_str = cp; + for (ndig = 0; ndig < 80; ndig++) { + if (!isxdigit(*cp)) + goto inv; + cp++; + } + if (*cp) { + if (!isspace(*cp)) + goto inv; + *cp++ = '\0'; + } + /* must be end of non-comment line */ + while (isspace(*cp)) + cp++; + if (*cp != '\0' && *cp != '#') + goto inv; + + process_hex_input(hex_str); + return; + +inv: fprintf(stderr, "%s line %d: invalid syntax\n", infname, lineno); + exit(1); +} + +int main(int argc, char **argv) +{ + const char *infname; + FILE *inf; + char linebuf[256]; + int lineno; + + if (argc != 2) { + fprintf(stderr, "usage: %s input-file\n", argv[0]); + exit(1); + } + infname = argv[1]; + inf = fopen(infname, "r"); + if (!inf) { + perror(infname); + exit(1); + } + + for (lineno = 1; fgets(linebuf, sizeof(linebuf), inf); lineno++) + process_line(linebuf, infname, lineno); + fclose(inf); + exit(0); +} diff --git a/tests/testsuite.at b/tests/testsuite.at index c430220..70e7f25 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -36,6 +36,12 @@ AT_CHECK([$abs_top_builddir/tests/raa_prime/test_enc $abs_srcdir/raa_prime/d144-ul-input.asc], [0], [expout], [ignore]) AT_CLEANUP +AT_SETUP([raa_prime_decode]) +AT_KEYWORDS([raa_prime_decode]) +cat $abs_srcdir/raa_prime/d144-ul-input.asc > expout +AT_CHECK([$abs_top_builddir/tests/raa_prime/test_dec $abs_srcdir/raa_prime/nokia-tcsm2-atrau.hex], [0], [expout], [ignore]) +AT_CLEANUP + AT_SETUP([trau_sync]) AT_KEYWORDS([trau_sync]) cat $abs_srcdir/trau_sync/trau_sync_test.ok > expout -- To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/38293?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Change-Id: I1347a25ce97d5022502ee9112caded66315b09a4 Gerrit-Change-Number: 38293 Gerrit-PatchSet: 1 Gerrit-Owner: falconia <falcon(a)freecalypso.org>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: ggsn: testenv: add libosmocore-utils to package=
by laforge 25 Sep '24

25 Sep '24
Attention is currently required from: osmith. laforge has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38286?usp=email ) Change subject: ggsn: testenv: add libosmocore-utils to package= ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38286?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: I7d97e0f923d928e9b51ff41d50b28706e0e6790b Gerrit-Change-Number: 38286 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Wed, 25 Sep 2024 16:04:31 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: ggsn: testenv: fix paths in copy= and clean=
by laforge 25 Sep '24

25 Sep '24
Attention is currently required from: osmith. laforge has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38282?usp=email ) Change subject: ggsn: testenv: fix paths in copy= and clean= ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38282?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: Ibc8aeb43ff594a6b26699f81b29abc31b9b5b71f Gerrit-Change-Number: 38282 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Wed, 25 Sep 2024 16:04:25 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: testenv: improve --config argument parsing
by laforge 25 Sep '24

25 Sep '24
Attention is currently required from: osmith. laforge has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38285?usp=email ) Change subject: testenv: improve --config argument parsing ...................................................................... Patch Set 4: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38285?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: I66b976b0332be523c084a6b5d38d0f62134b495d Gerrit-Change-Number: 38285 Gerrit-PatchSet: 4 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Wed, 25 Sep 2024 16:04:11 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: Cosmetic: testenv: fix line length
by laforge 25 Sep '24

25 Sep '24
Attention is currently required from: osmith. laforge has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38284?usp=email ) Change subject: Cosmetic: testenv: fix line length ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38284?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: I766a07c6d54d0da11ad47acce1fc07b4b3a4801b Gerrit-Change-Number: 38284 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Wed, 25 Sep 2024 16:03:53 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: ruff.toml: new file
by laforge 25 Sep '24

25 Sep '24
Attention is currently required from: osmith. laforge has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38283?usp=email ) Change subject: ruff.toml: new file ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38283?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: I97ed1ececba85008ca754cf91bf46522e168a894 Gerrit-Change-Number: 38283 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Wed, 25 Sep 2024 16:03:44 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • ...
  • 199
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.