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

May 2023

  • 1 participants
  • 2583 discussions
[M] Change in osmo-bts[master]: osmo-bts-trx: use direct pointer to chan_state->{ul,dl}_bursts
by lynxis lazus 26 May '23

26 May '23
Attention is currently required from: fixeria. lynxis lazus has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32726 ) Change subject: osmo-bts-trx: use direct pointer to chan_state->{ul,dl}_bursts ...................................................................... Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32726 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ib1e8e86ac60a7ac9b0415ef66b609eaa33443c19 Gerrit-Change-Number: 32726 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 26 May 2023 08:15:11 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmocore[master]: Add support for receiving Bter UI frames at lapdm.c
by jolly 26 May '23

26 May '23
Attention is currently required from: jolly, pespin, dexter. Hello Jenkins Builder, laforge, dexter, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/32934 to look at the new patch set (#8). Change subject: Add support for receiving Bter UI frames at lapdm.c ...................................................................... Add support for receiving Bter UI frames at lapdm.c Similar to support of sending Bter frame, the same rules apply when receiving them. Change-Id: If04115884743455c7bf2b2bc5f7e49e74b6ffb60 --- M src/gsm/lapdm.c 1 file changed, 35 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/34/32934/8 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32934 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: If04115884743455c7bf2b2bc5f7e49e74b6ffb60 Gerrit-Change-Number: 32934 Gerrit-PatchSet: 8 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[L] Change in libosmocore[master]: ASCI: Add message definition and encoding according to 3GPP TS 48.008
by jolly 26 May '23

26 May '23
Attention is currently required from: pespin. jolly has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32932 ) Change subject: ASCI: Add message definition and encoding according to 3GPP TS 48.008 ...................................................................... Patch Set 5: (1 comment) File include/osmocom/gsm/gsm0808.h: https://gerrit.osmocom.org/c/libosmocore/+/32932/comment/c61f8b20_99e45843 PS5, Line 386: struct sockaddr_storage *aoip_transport_layer; > You could add osmocom/core/socket. […] osmocom/core/socket.h will not work on embedded systems. see line 5. I agree with you to change that in the future, but currently I don't see a solution. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32932 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ib94c64136c31ce4af67c314a8550d93946cc844f Gerrit-Change-Number: 32932 Gerrit-PatchSet: 5 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Fri, 26 May 2023 06:54:08 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: jolly <andreas(a)eversberg.eu> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmocom-bb[master]: trxcon/l1sched: do not align Tx burst transmission
by fixeria 25 May '23

25 May '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/33006 ) Change subject: trxcon/l1sched: do not align Tx burst transmission ...................................................................... trxcon/l1sched: do not align Tx burst transmission This is no longer needed thanks to recent patch b0be904b. Change-Id: Ia397cbe16f719729a814b7ef0b7035c7fe8ba165 Related: b0be904b "trxcon: do not call l1sched_prim_dequeue() at ul_bid != 0" --- M src/host/trxcon/src/sched_lchan_pdtch.c M src/host/trxcon/src/sched_lchan_tchf.c M src/host/trxcon/src/sched_lchan_tchh.c M src/host/trxcon/src/sched_lchan_xcch.c 4 files changed, 18 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/06/33006/1 diff --git a/src/host/trxcon/src/sched_lchan_pdtch.c b/src/host/trxcon/src/sched_lchan_pdtch.c index b6c3b4c..4b5ffdf 100644 --- a/src/host/trxcon/src/sched_lchan_pdtch.c +++ b/src/host/trxcon/src/sched_lchan_pdtch.c @@ -114,13 +114,8 @@ mask = &lchan->tx_burst_mask; bursts_p = lchan->tx_bursts; - if (br->bid > 0) { - /* If we have encoded bursts */ - if (*mask) - goto send_burst; - else - return 0; - } + if (br->bid > 0) + goto send_burst; /* Encode payload */ rc = gsm0503_pdtch_encode(bursts_p, msgb_l2(lchan->prim), msgb_l2len(lchan->prim)); diff --git a/src/host/trxcon/src/sched_lchan_tchf.c b/src/host/trxcon/src/sched_lchan_tchf.c index f38c82a..691ad5a 100644 --- a/src/host/trxcon/src/sched_lchan_tchf.c +++ b/src/host/trxcon/src/sched_lchan_tchf.c @@ -224,13 +224,8 @@ mask = &lchan->tx_burst_mask; bursts_p = lchan->tx_bursts; - /* If we have encoded bursts */ - if (*mask) - goto send_burst; - - /* Wait until a first burst in period */ if (br->bid > 0) - return 0; + goto send_burst; /* Shift buffer by 4 bursts back for interleaving */ memcpy(bursts_p, bursts_p + 464, 464); diff --git a/src/host/trxcon/src/sched_lchan_tchh.c b/src/host/trxcon/src/sched_lchan_tchh.c index e8dc463..78ae734 100644 --- a/src/host/trxcon/src/sched_lchan_tchh.c +++ b/src/host/trxcon/src/sched_lchan_tchh.c @@ -431,12 +431,8 @@ mask = &lchan->tx_burst_mask; bursts_p = lchan->tx_bursts; - if (br->bid > 0) { - /* Align to the first burst */ - if (*mask == 0x00) - return 0; + if (br->bid > 0) goto send_burst; - } if (*mask == 0x00) { /* Align transmission of the first FACCH/H frame */ diff --git a/src/host/trxcon/src/sched_lchan_xcch.c b/src/host/trxcon/src/sched_lchan_xcch.c index b246a17..f76d518 100644 --- a/src/host/trxcon/src/sched_lchan_xcch.c +++ b/src/host/trxcon/src/sched_lchan_xcch.c @@ -110,13 +110,8 @@ mask = &lchan->tx_burst_mask; bursts_p = lchan->tx_bursts; - if (br->bid > 0) { - /* If we have encoded bursts */ - if (*mask) - goto send_burst; - else - return 0; - } + if (br->bid > 0) + goto send_burst; /* Check the prim payload length */ if (msgb_l2len(lchan->prim) != GSM_MACBLOCK_LEN) { -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/33006 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ia397cbe16f719729a814b7ef0b7035c7fe8ba165 Gerrit-Change-Number: 33006 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libosmocore[master]: coding: test FACCH/[FH] bitstealing in test_csd()
by fixeria 25 May '23

25 May '23
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/33004 ) Change subject: coding: test FACCH/[FH] bitstealing in test_csd() ...................................................................... coding: test FACCH/[FH] bitstealing in test_csd() In test_csd() we encode three data frames filled-in with three specific patterns and then try decoding them. Additionally execute the same set of tests, but with FACCH/[FH] bitstealing (pattern 0x2b). As can be seen from the test output, we have problems decoding FACCH: * FACCH/F: decoding fails (n_errors=0 / n_bits_total=0), * FACCH/H: decoding with errors (n_errors=2 / n_bits_total=456). A patch fixing the problem follows. Change-Id: Idc6decec3b84981d2aab4e27caab9ad65180f945 Related: OS#1572 --- M tests/coding/coding_test.c M tests/coding/coding_test.ok 2 files changed, 148 insertions(+), 6 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve falconia: Looks good to me, approved diff --git a/tests/coding/coding_test.c b/tests/coding/coding_test.c index e8dbe83..e53c8ad 100644 --- a/tests/coding/coding_test.c +++ b/tests/coding/coding_test.c @@ -540,6 +540,7 @@ unsigned int num_bits; int (*enc_fn)(ubit_t *out, const ubit_t *in); int (*dec_fn)(ubit_t *out, const sbit_t *in, int *ne, int *nb); + bool half_rate; }; static const struct csd_test_case csd_tests[] = { @@ -560,12 +561,14 @@ .num_bits = 4 * 60, .enc_fn = &gsm0503_tch_hr48_encode, .dec_fn = &gsm0503_tch_hr48_decode, + .half_rate = true, }, { .name = "TCH/H2.4", .num_bits = 2 * 72, .enc_fn = &gsm0503_tch_hr24_encode, .dec_fn = &gsm0503_tch_hr24_decode, + .half_rate = true, }, { .name = "TCH/F14.4", @@ -575,7 +578,7 @@ }, }; -static void test_csd(const struct csd_test_case *tc) +static void test_csd(const struct csd_test_case *tc, bool facch) { const uint8_t patterns[] = { 0x00, 0xaa, 0xff }; ubit_t bursts_u[116 * (22 + 8)] = { 0 }; @@ -590,9 +593,17 @@ rc = tc->enc_fn(&bursts_u[i * 4 * 116], &data[0]); CHECK_RC_OR_RET(rc == 0, "encoding"); - } - /* TODO: test FACCH stealing */ + /* Test FACCH bitstealing */ + if (facch && i == 1) { + memset(&data, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); + if (tc->half_rate) + rc = gsm0503_tch_hr_facch_encode(&bursts_u[116 * 4], &data[0]); + else + rc = gsm0503_tch_fr_facch_encode(&bursts_u[116 * 4], &data[0]); + CHECK_RC_OR_RET(rc == 0, "encoding FACCH"); + } + } /* Prepare soft-bits */ osmo_ubit2sbit(&bursts_s[0], &bursts_u[0], sizeof(bursts_s)); @@ -618,6 +629,27 @@ printf("\n"); } + /* Test FACCH bitstealing if requested */ + if (facch) { + int n_errors = 0, n_bits_total = 0; + + if (tc->half_rate) { + rc = gsm0503_tch_hr_facch_decode(&data[0], &bursts_s[116 * 4], + &n_errors, &n_bits_total); + } else { + rc = gsm0503_tch_fr_facch_decode(&data[0], &bursts_s[116 * 4], + &n_errors, &n_bits_total); + } +#if 0 + /* FIXME: there's something wrong with CSD mapping */ + CHECK_RC_OR_RET(rc == GSM_MACBLOCK_LEN, "decoding FACCH"); +#endif + + printf("%s(%s): FACCH/%c (pattern 0x2b): n_errors=%d / n_bits_total=%d\n", + __func__, tc->name, tc->half_rate ? 'H' : 'F', n_errors, n_bits_total); + printf("%s\n", osmo_hexdump(&data[0], GSM_MACBLOCK_LEN)); + } + printf("\n"); } @@ -688,9 +720,12 @@ for (i = 0; i < ARRAY_SIZE(test_l2); i++) test_facch(test_l2[i], true); - printf("\nTesting CSD functions:\n"); + printf("\nTesting CSD functions (no FACCH):\n"); for (i = 0; i < ARRAY_SIZE(csd_tests); i++) - test_csd(&csd_tests[i]); + test_csd(&csd_tests[i], false); + printf("\nTesting CSD functions (with FACCH):\n"); + for (i = 0; i < ARRAY_SIZE(csd_tests); i++) + test_csd(&csd_tests[i], true); printf("Success\n"); diff --git a/tests/coding/coding_test.ok b/tests/coding/coding_test.ok index 3985513..c9c6bb7 100644 --- a/tests/coding/coding_test.ok +++ b/tests/coding/coding_test.ok @@ -402,7 +402,7 @@ test_facch(FACCH/H): decoded (BER=0/456): 01 02 03 00 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 -Testing CSD functions: +Testing CSD functions (no FACCH): test_csd(TCH/F9.6): block #0 (pattern 0x00): n_errors=0 / n_bits_total=456 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 @@ -477,4 +477,90 @@ 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11 + +Testing CSD functions (with FACCH): +test_csd(TCH/F9.6): block #0 (pattern 0x00): n_errors=34 / n_bits_total=456 +00000000 00000000 00000000 00000000 00010010 01100000 00000000 00000000 +00000000 00010011 01111000 00000000 00000000 00000000 00100100 10000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 +test_csd(TCH/F9.6): block #1 (pattern 0xaa): n_errors=34 / n_bits_total=456 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 00101011 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 +test_csd(TCH/F9.6): block #2 (pattern 0xff): n_errors=6 / n_bits_total=456 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 +test_csd(TCH/F9.6): FACCH/F (pattern 0x2b): n_errors=0 / n_bits_total=0 +01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + +test_csd(TCH/F4.8): block #0 (pattern 0x00): n_errors=38 / n_bits_total=456 +00000000 00000000 01010000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 +test_csd(TCH/F4.8): block #1 (pattern 0xaa): n_errors=37 / n_bits_total=456 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 +test_csd(TCH/F4.8): block #2 (pattern 0xff): n_errors=1 / n_bits_total=456 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 +test_csd(TCH/F4.8): FACCH/F (pattern 0x2b): n_errors=0 / n_bits_total=0 +01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + +test_csd(TCH/H4.8): block #0 (pattern 0x00): n_errors=35 / n_bits_total=456 +00000000 00000000 00000000 00000000 00111000 10000000 00000000 00000000 +00000001 00000000 00000000 00000000 00000000 00000000 00011000 10000000 +00000000 00000000 00000000 00000000 00000000 00001000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 +test_csd(TCH/H4.8): block #1 (pattern 0xaa): n_errors=38 / n_bits_total=456 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 00101011 01010101 +01010101 01010101 01010101 00111010 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 +test_csd(TCH/H4.8): block #2 (pattern 0xff): n_errors=1 / n_bits_total=456 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 +test_csd(TCH/H4.8): FACCH/H (pattern 0x2b): n_errors=2 / n_bits_total=456 +2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b + +test_csd(TCH/H2.4): block #0 (pattern 0x00): n_errors=38 / n_bits_total=456 +00000000 00000000 00000101 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 +test_csd(TCH/H2.4): block #1 (pattern 0xaa): n_errors=32 / n_bits_total=456 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 +test_csd(TCH/H2.4): block #2 (pattern 0xff): n_errors=0 / n_bits_total=456 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 +test_csd(TCH/H2.4): FACCH/H (pattern 0x2b): n_errors=2 / n_bits_total=456 +2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b + +test_csd(TCH/F14.4): block #0 (pattern 0x00): n_errors=27 / n_bits_total=456 +00000000 00000000 00000000 00000000 00000000 00111100 01000000 00000000 +00000000 00000000 00000000 00111000 10011000 00000000 10000000 00000000 +00000000 00000000 00001111 10001101 01110000 00000000 00000000 00000000 +00000000 00000000 00001001 11000000 00000000 00000000 00000000 00000000 +00000000 00000010 00100010 01000000 00 +test_csd(TCH/F14.4): block #1 (pattern 0xaa): n_errors=35 / n_bits_total=456 +01010101 01010100 10110111 01010101 01010101 00011000 10010001 11000110 +11011100 11011101 11000110 01010101 01010101 01010101 10100100 10010001 +11000110 00001010 01010101 01010101 11101101 11010101 01010100 01010101 +01010101 01010101 00101001 00100101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01 +test_csd(TCH/F14.4): block #2 (pattern 0xff): n_errors=3 / n_bits_total=456 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11 +test_csd(TCH/F14.4): FACCH/F (pattern 0x2b): n_errors=0 / n_bits_total=0 +01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + Success -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/33004 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idc6decec3b84981d2aab4e27caab9ad65180f945 Gerrit-Change-Number: 33004 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: falconia <falcon(a)freecalypso.org> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmocore[master]: coding: fix _tch_csd_burst_map(): do not overwrite FACCH
by fixeria 25 May '23

25 May '23
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/33005 ) Change subject: coding: fix _tch_csd_burst_map(): do not overwrite FACCH ...................................................................... coding: fix _tch_csd_burst_map(): do not overwrite FACCH As was demonstrated in the unit test [1], FACCH bitstealing does not work as expected in conjunction CSD specific encoding functions. The problem is in _tch_csd_burst_map(): we don't check the stealing flags hu(B) and hl(B) and overwrite both odd and even numbered bits unconditionally. Even worse, we reset these stealing flags to 0. * Do not overwrite the hu(B) and hl(B) flags. * Copy *even* numbered bits only if hu(B) is not set. * Copy *odd* numbered bits only if hl(B) is not set. Change-Id: Ib5395c70e3e725469c18ff7d4c47c62ddfdbd55d Related: [1] Idc6decec3b84981d2aab4e27caab9ad65180f945 Related: OS#1572 --- M src/coding/gsm0503_coding.c M tests/coding/coding_test.c M tests/coding/coding_test.ok 3 files changed, 51 insertions(+), 22 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve falconia: Looks good to me, approved diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index 5badbd0..a34cd92 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -3298,13 +3298,23 @@ static inline void _tch_csd_burst_map(ubit_t *burst, const ubit_t *iB) { - for (unsigned int i = 0; i < 57; i++) { - burst[i] |= iB[i]; - burst[59 + i] |= iB[57 + i]; + unsigned int i; + + /* hu(B): copy *even* numbered bits if not stolen by FACCH */ + if (burst[58] == 0) { + for (i = 0; i < 57; i += 2) + burst[i] |= iB[i]; + for (i = 58; i < 114; i += 2) + burst[i + 2] |= iB[i]; } - burst[57] = 0; /* hl(B) */ - burst[58] = 0; /* hu(B) */ + /* hl(B): copy *odd* numbered bits if not stolen by FACCH */ + if (burst[57] == 0) { + for (i = 1; i < 57; i += 2) + burst[i] |= iB[i]; + for (i = 57; i < 114; i += 2) + burst[i + 2] |= iB[i]; + } } /*! Perform channel encoding of a TCH/F9.6 channel as per section 3.3. diff --git a/tests/coding/coding_test.c b/tests/coding/coding_test.c index e53c8ad..7cef7b3 100644 --- a/tests/coding/coding_test.c +++ b/tests/coding/coding_test.c @@ -640,10 +640,7 @@ rc = gsm0503_tch_fr_facch_decode(&data[0], &bursts_s[116 * 4], &n_errors, &n_bits_total); } -#if 0 - /* FIXME: there's something wrong with CSD mapping */ CHECK_RC_OR_RET(rc == GSM_MACBLOCK_LEN, "decoding FACCH"); -#endif printf("%s(%s): FACCH/%c (pattern 0x2b): n_errors=%d / n_bits_total=%d\n", __func__, tc->name, tc->half_rate ? 'H' : 'F', n_errors, n_bits_total); diff --git a/tests/coding/coding_test.ok b/tests/coding/coding_test.ok index c9c6bb7..c5c145d 100644 --- a/tests/coding/coding_test.ok +++ b/tests/coding/coding_test.ok @@ -489,13 +489,13 @@ 01010101 01010101 01010101 01010101 01010101 01010101 00101011 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 -test_csd(TCH/F9.6): block #2 (pattern 0xff): n_errors=6 / n_bits_total=456 -11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +test_csd(TCH/F9.6): block #2 (pattern 0xff): n_errors=14 / n_bits_total=456 +11111111 11111111 11111111 11110111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 -test_csd(TCH/F9.6): FACCH/F (pattern 0x2b): n_errors=0 / n_bits_total=0 -01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 +test_csd(TCH/F9.6): FACCH/F (pattern 0x2b): n_errors=0 / n_bits_total=456 +2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b test_csd(TCH/F4.8): block #0 (pattern 0x00): n_errors=38 / n_bits_total=456 00000000 00000000 01010000 00000000 00000000 00000000 00000000 00000000 @@ -503,11 +503,11 @@ test_csd(TCH/F4.8): block #1 (pattern 0xaa): n_errors=37 / n_bits_total=456 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 -test_csd(TCH/F4.8): block #2 (pattern 0xff): n_errors=1 / n_bits_total=456 +test_csd(TCH/F4.8): block #2 (pattern 0xff): n_errors=13 / n_bits_total=456 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 -test_csd(TCH/F4.8): FACCH/F (pattern 0x2b): n_errors=0 / n_bits_total=0 -01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 +test_csd(TCH/F4.8): FACCH/F (pattern 0x2b): n_errors=0 / n_bits_total=456 +2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b test_csd(TCH/H4.8): block #0 (pattern 0x00): n_errors=35 / n_bits_total=456 00000000 00000000 00000000 00000000 00111000 10000000 00000000 00000000 @@ -519,12 +519,12 @@ 01010101 01010101 01010101 01010101 01010101 01010101 00101011 01010101 01010101 01010101 01010101 00111010 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 -test_csd(TCH/H4.8): block #2 (pattern 0xff): n_errors=1 / n_bits_total=456 +test_csd(TCH/H4.8): block #2 (pattern 0xff): n_errors=3 / n_bits_total=456 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 -test_csd(TCH/H4.8): FACCH/H (pattern 0x2b): n_errors=2 / n_bits_total=456 +test_csd(TCH/H4.8): FACCH/H (pattern 0x2b): n_errors=0 / n_bits_total=456 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b test_csd(TCH/H2.4): block #0 (pattern 0x00): n_errors=38 / n_bits_total=456 @@ -535,11 +535,11 @@ 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 -test_csd(TCH/H2.4): block #2 (pattern 0xff): n_errors=0 / n_bits_total=456 +test_csd(TCH/H2.4): block #2 (pattern 0xff): n_errors=2 / n_bits_total=456 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 -test_csd(TCH/H2.4): FACCH/H (pattern 0x2b): n_errors=2 / n_bits_total=456 +test_csd(TCH/H2.4): FACCH/H (pattern 0x2b): n_errors=0 / n_bits_total=456 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b test_csd(TCH/F14.4): block #0 (pattern 0x00): n_errors=27 / n_bits_total=456 @@ -554,13 +554,13 @@ 11000110 00001010 01010101 01010101 11101101 11010101 01010100 01010101 01010101 01010101 00101001 00100101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 01 -test_csd(TCH/F14.4): block #2 (pattern 0xff): n_errors=3 / n_bits_total=456 +test_csd(TCH/F14.4): block #2 (pattern 0xff): n_errors=10 / n_bits_total=456 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11 -test_csd(TCH/F14.4): FACCH/F (pattern 0x2b): n_errors=0 / n_bits_total=0 -01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 +test_csd(TCH/F14.4): FACCH/F (pattern 0x2b): n_errors=0 / n_bits_total=456 +2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b Success -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/33005 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ib5395c70e3e725469c18ff7d4c47c62ddfdbd55d Gerrit-Change-Number: 33005 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: falconia <falcon(a)freecalypso.org> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[L] Change in libosmocore[master]: coding: implement dedicated codec API for FACCH/[FH]
by fixeria 25 May '23

25 May '23
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/33003 ) Change subject: coding: implement dedicated codec API for FACCH/[FH] ...................................................................... coding: implement dedicated codec API for FACCH/[FH] Currently FACCH/[FH] encoding and decoding is implemented as part of the gsm0503_tch_[fh]r_{en,de}code and gsm0503_tch_a[fh]s_{en,de}code API. This works fine for speech because one FACCH frame completely replaces one or two speech frames, but this is not the case for CSD. According to 3GPP TS 45.002, sections 4.2.5 and 4.3.5, for TCH data channels FACCH does not replace data frames but disturbs some amount of bits from them. Therefore we need to be able to perform FACCH encoding and decoding independently from CSD specific coding API. Change-Id: I0c7a9c180dcafe64e6aebe53518d3d11e1f29886 Related: OS#1572 --- M include/osmocom/coding/gsm0503_coding.h M src/coding/gsm0503_coding.c M src/coding/libosmocoding.map M tests/coding/coding_test.c M tests/coding/coding_test.ok 5 files changed, 254 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve falconia: Looks good to me, approved diff --git a/include/osmocom/coding/gsm0503_coding.h b/include/osmocom/coding/gsm0503_coding.h index c6181d8..75e12e6 100644 --- a/include/osmocom/coding/gsm0503_coding.h +++ b/include/osmocom/coding/gsm0503_coding.h @@ -109,4 +109,12 @@ int gsm0503_tch_fr144_decode(ubit_t *data, const sbit_t *bursts, int *n_errors, int *n_bits_total); +int gsm0503_tch_fr_facch_encode(ubit_t *bursts, const uint8_t *data); +int gsm0503_tch_fr_facch_decode(uint8_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total); + +int gsm0503_tch_hr_facch_encode(ubit_t *bursts, const uint8_t *data); +int gsm0503_tch_hr_facch_decode(uint8_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total); + /*! @} */ diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index b761cd0..5badbd0 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -3589,4 +3589,138 @@ return 290; } +/* + * FACCH/[FH] transcoding + */ + +/*! Perform channel encoding of a FACCH/F data as per section 4.2. + * \param[out] bursts Caller-allocated buffer for symbols of 8 bursts, + * 8 * 2 * 58 == 928 bits total. + * \param[in] data FACCH MAC block to be encoded (GSM_MACBLOCK_LEN). + * \returns 0 in case of success; negative on error */ +int gsm0503_tch_fr_facch_encode(ubit_t *bursts, const uint8_t *data) +{ + ubit_t iB[8 * 114], cB[4 * 114]; + const ubit_t h = 1; + + /* 4.2.1-3 as specified for the SACCH in 4.1.1-3 */ + _xcch_encode_cB(&cB[0], &data[0]); + + /* 4.2.4 Interleaving: as specified for the TCH/FS in subclause 3.1.3 */ + gsm0503_tch_fr_interleave(&cB[0], &iB[0]); + + /* 4.2.5 Mapping on a Burst: + * - hu(B)=1 the even numbered bits in the first 4 bursts and + * - hl(B)=1 the odd numbered bits of the last 4 bursts are stolen. */ + for (unsigned int i = 0; i < 8; i++) + gsm0503_tch_burst_map(&iB[i * 114], &bursts[i * 116], &h, i >> 2); + + return 0; +} + +/*! Perform channel decoding of a FACCH/F data as per section 4.2. + * \param[out] data Caller-allocated buffer for decoded FACCH (GSM_MACBLOCK_LEN). + * \param[in] bursts Buffer containing the symbols of 8 bursts, + * 8 * 2 * 58 == 928 bits total. + * \param[out] n_errors Number of detected bit errors. + * \param[out] n_bits_total Total number of bits. + * \returns Number of bytes used in the output buffer; negative on error. */ +int gsm0503_tch_fr_facch_decode(uint8_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total) +{ + sbit_t iB[8 * 114], cB[4 * 114]; + int steal = 0; + + /* FACCH decision: sum of 4 first hu(B) and 4 last hl(B) soft-bits */ + for (unsigned int i = 0; i < 4; i++) + steal -= bursts[i * 116 + 58]; /* hu(B) */ + for (unsigned int i = 4; i < 8; i++) + steal -= bursts[i * 116 + 57]; /* hl(B) */ + if (steal <= 0) + return -1; + + /* 4.2.5 Mapping on a Burst: + * - hu(B)=1 the even numbered bits in the first 4 bursts and + * - hl(B)=1 the odd numbered bits of the last 4 bursts are stolen. */ + for (unsigned int i = 0; i < 8; i++) + gsm0503_tch_burst_unmap(&iB[i * 114], &bursts[i * 116], NULL, i >> 2); + + /* 4.2.4 Interleaving: as specified for the TCH/FS in subclause 3.1.3 */ + gsm0503_tch_fr_deinterleave(&cB[0], &iB[0]); + + /* 4.2.1-3 as specified for the SACCH in 4.1.1-3 */ + if (_xcch_decode_cB(&data[0], &cB[0], n_errors, n_bits_total) != 0) + return -1; + + return GSM_MACBLOCK_LEN; +} + +/*! Perform channel encoding of a FACCH/H data as per section 4.3. + * \param[out] bursts Caller-allocated buffer for symbols of 6 bursts, + * 6 * 2 * 58 == 696 bits total. + * \param[in] data FACCH MAC block to be encoded (GSM_MACBLOCK_LEN). + * \returns 0 in case of success; negative on error */ +int gsm0503_tch_hr_facch_encode(ubit_t *bursts, const uint8_t *data) +{ + ubit_t iB[8 * 114], cB[4 * 114]; + const ubit_t h = 1; + + /* 4.3.1-3 as specified for the SACCH in 4.1.1-3 */ + _xcch_encode_cB(&cB[0], &data[0]); + + /* 4.3.4 Interleaving */ + gsm0503_tch_fr_interleave(&cB[0], &iB[0]); + + /* 4.3.5 Mapping on a Burst: + * - hu(B)=1 the even numbered bits of the first 2 bursts, + * - hu(B)=1 & hl(B)=1 all bits of the middle 2 bursts and + * - hl(B)=1 the odd numbered bits of the last 2 bursts are stolen. */ + for (unsigned int i = 0; i < 6; i++) + gsm0503_tch_burst_map(&iB[i * 114], &bursts[i * 116], &h, i >> 2); + for (unsigned int i = 2; i < 4; i++) + gsm0503_tch_burst_map(&iB[i * 114 + 456], &bursts[i * 116], &h, 1); + + return 0; +} + +/*! Perform channel decoding of a FACCH/H data as per section 4.3. + * \param[out] data Caller-allocated buffer for decoded FACCH (GSM_MACBLOCK_LEN). + * \param[in] bursts Buffer containing the symbols of 6 bursts, + * 6 * 2 * 58 == 696 bits total. + * \param[out] n_errors Number of detected bit errors. + * \param[out] n_bits_total Total number of bits. + * \returns Number of bytes used in the output buffer; negative on error. */ +int gsm0503_tch_hr_facch_decode(uint8_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total) +{ + sbit_t iB[8 * 114], cB[4 * 114]; + int steal = 0; + + /* FACCH decision: sum of 4 first hu(B) and 4 last hl(B) soft-bits */ + for (unsigned int i = 0; i < 4; i++) + steal -= bursts[i * 116 + 58]; /* hu(B) */ + for (unsigned int i = 2; i < 6; i++) + steal -= bursts[i * 116 + 57]; /* hl(B) */ + if (steal <= 0) + return -1; + + /* 4.3.5 Mapping on a Burst: + * - hu(B)=1 the even numbered bits of the first 2 bursts, + * - hu(B)=1 & hl(B)=1 all bits of the middle 2 bursts and + * - hl(B)=1 the odd numbered bits of the last 2 bursts are stolen. */ + for (unsigned int i = 0; i < 6; i++) + gsm0503_tch_burst_unmap(&iB[i * 114], &bursts[i * 116], NULL, i >> 2); + for (unsigned int i = 2; i < 4; i++) + gsm0503_tch_burst_unmap(&iB[i * 114 + 456], &bursts[i * 116], NULL, 1); + + /* 4.3.4 Interleaving */ + gsm0503_tch_fr_deinterleave(&cB[0], &iB[0]); + + /* 4.3.1-3 as specified for the SACCH in 4.1.1-3 */ + if (_xcch_decode_cB(&data[0], &cB[0], n_errors, n_bits_total) != 0) + return -1; + + return GSM_MACBLOCK_LEN; +} + /*! @} */ diff --git a/src/coding/libosmocoding.map b/src/coding/libosmocoding.map index a645a58..b1087e3 100644 --- a/src/coding/libosmocoding.map +++ b/src/coding/libosmocoding.map @@ -140,5 +140,10 @@ gsm0503_tch_fr144_encode; gsm0503_tch_fr144_decode; +gsm0503_tch_fr_facch_encode; +gsm0503_tch_fr_facch_decode; +gsm0503_tch_hr_facch_encode; +gsm0503_tch_hr_facch_decode; + local: *; }; diff --git a/tests/coding/coding_test.c b/tests/coding/coding_test.c index a13dc4c..e8dbe83 100644 --- a/tests/coding/coding_test.c +++ b/tests/coding/coding_test.c @@ -24,6 +24,7 @@ #include <osmocom/core/bits.h> #include <osmocom/core/utils.h> +#include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/coding/gsm0503_coding.h> #define DUMP_U_AT(b, x, u) do { \ @@ -312,6 +313,51 @@ printf("\n"); } +static void test_facch(const uint8_t *data, bool half_rate) +{ + ubit_t bursts_u[116 * 8 * 2] = { 0 }; + sbit_t bursts_s[116 * 8 * 2] = { 0 }; + int rc; + + /* Encode the given FACCH message three times (at different offsets) */ + printf("%s(FACCH/%c): encoding: %s\n", + __func__, half_rate ? 'H' : 'F', + osmo_hexdump(&data[0], GSM_MACBLOCK_LEN)); + for (unsigned int i = 0; i < 3; i++) { + ubit_t *pos = &bursts_u[116 * 4 * i]; + + if (half_rate) + rc = gsm0503_tch_hr_facch_encode(pos, &data[0]); + else + rc = gsm0503_tch_fr_facch_encode(pos, &data[0]); + CHECK_RC_OR_RET(rc == 0, "encoding"); + } + + /* Prepare soft-bits */ + osmo_ubit2sbit(bursts_s, bursts_u, sizeof(bursts_s)); + + /* Decode three FACCH messages (at different offsets) */ + for (unsigned int i = 0; i < 3; i++) { + const sbit_t *pos = &bursts_s[116 * 4 * i]; + uint8_t result[GSM_MACBLOCK_LEN]; + int n_errors, n_bits_total; + + if (half_rate) + rc = gsm0503_tch_hr_facch_decode(&result[0], pos, + &n_errors, &n_bits_total); + else + rc = gsm0503_tch_fr_facch_decode(&result[0], pos, + &n_errors, &n_bits_total); + CHECK_RC_OR_RET(rc == GSM_MACBLOCK_LEN, "decoding"); + + printf("%s(FACCH/%c): decoded (BER=%d/%d): %s\n", + __func__, half_rate ? 'H' : 'F', n_errors, n_bits_total, + osmo_hexdump(result, GSM_MACBLOCK_LEN)); + } + + printf("\n"); +} + struct test_macblock { bool is_egprs; uint16_t exp_burst_bits; @@ -635,6 +681,13 @@ } } + printf("\nTesting FACCH/F codec:\n"); + for (i = 0; i < ARRAY_SIZE(test_l2); i++) + test_facch(test_l2[i], false); + printf("\nTesting FACCH/H codec:\n"); + for (i = 0; i < ARRAY_SIZE(test_l2); i++) + test_facch(test_l2[i], true); + printf("\nTesting CSD functions:\n"); for (i = 0; i < ARRAY_SIZE(csd_tests); i++) test_csd(&csd_tests[i]); diff --git a/tests/coding/coding_test.ok b/tests/coding/coding_test.ok index e1bd89d..3985513 100644 --- a/tests/coding/coding_test.ok +++ b/tests/coding/coding_test.ok @@ -368,6 +368,40 @@ 81 81 81 81 7f 7f 7f 7f 81 81 7f 81 7f 7f 81 7f 81 81 7f 81 7f 7f 7f 7f 81 81 7f 81 81 81 81 7f 7f 7f 7f 81 7f 7f 81 7f 7f 81 7f 7f 7f 7f 7f 81 7f 7f 7f 81 7f 7f 81 81 7f 7f 81 7f 7f 7f 7f 7f 7f 81 81 7f 81 81 7f 81 81 7f 81 7f 7f 7f 81 81 81 81 81 7f 81 81 81 81 7f 7f 81 81 7f 7f 81 81 7f 81 81 7f 7f 7f 7f 7f 81 81 81 81 7f 7f 7f 81 7f 7f 7f 81 7f 7f 81 7f 7f 7f 81 81 7f 7f 81 81 7f 81 7f 81 81 7f 7f 81 81 7f 81 81 7f 7f 81 7f 81 81 81 7f 7f 81 7f 7f 7f 81 7f 7f 7f 81 81 7f 81 81 7f 81 7f 81 81 81 7f 7f 7f 7f 7f 81 7f 7f 7f 7f 7f 81 7f 7f 7f 7f 7f 81 7f 7f 81 7f 81 81 7f 7f 7f 81 81 81 81 81 81 81 7f 7f 81 7f 81 81 81 7f 81 7f 81 81 7f 7f 7f 7f 7f 7f 7f 81 81 81 7f 81 81 7f 7f 7f 81 7f +Testing FACCH/F codec: +test_facch(FACCH/F): encoding: 03 03 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +test_facch(FACCH/F): decoded (BER=0/456): 03 03 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +test_facch(FACCH/F): decoded (BER=0/456): 03 03 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +test_facch(FACCH/F): decoded (BER=0/456): 03 03 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + +test_facch(FACCH/F): encoding: a3 af 5f 00 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 +test_facch(FACCH/F): decoded (BER=0/456): a3 af 5f 00 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 +test_facch(FACCH/F): decoded (BER=0/456): a3 af 5f 00 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 +test_facch(FACCH/F): decoded (BER=0/456): a3 af 5f 00 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 + +test_facch(FACCH/F): encoding: 01 02 03 00 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 +test_facch(FACCH/F): decoded (BER=0/456): 01 02 03 00 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 +test_facch(FACCH/F): decoded (BER=0/456): 01 02 03 00 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 +test_facch(FACCH/F): decoded (BER=0/456): 01 02 03 00 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 + + +Testing FACCH/H codec: +test_facch(FACCH/H): encoding: 03 03 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +test_facch(FACCH/H): decoded (BER=0/456): 03 03 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +test_facch(FACCH/H): decoded (BER=0/456): 03 03 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +test_facch(FACCH/H): decoded (BER=0/456): 03 03 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + +test_facch(FACCH/H): encoding: a3 af 5f 00 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 +test_facch(FACCH/H): decoded (BER=0/456): a3 af 5f 00 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 +test_facch(FACCH/H): decoded (BER=0/456): a3 af 5f 00 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 +test_facch(FACCH/H): decoded (BER=0/456): a3 af 5f 00 36 43 44 ab d9 6d 7d 62 24 c9 d2 92 fa 27 5d 71 7a 59 a8 + +test_facch(FACCH/H): encoding: 01 02 03 00 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 +test_facch(FACCH/H): decoded (BER=0/456): 01 02 03 00 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 +test_facch(FACCH/H): decoded (BER=0/456): 01 02 03 00 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 +test_facch(FACCH/H): decoded (BER=0/456): 01 02 03 00 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 + + Testing CSD functions: test_csd(TCH/F9.6): block #0 (pattern 0x00): n_errors=0 / n_bits_total=456 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/33003 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I0c7a9c180dcafe64e6aebe53518d3d11e1f29886 Gerrit-Change-Number: 33003 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: falconia <falcon(a)freecalypso.org> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: gsm: fix convolutional code definition for TCH/F4.8
by fixeria 25 May '23

25 May '23
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32986 ) Change subject: gsm: fix convolutional code definition for TCH/F4.8 ...................................................................... gsm: fix convolutional code definition for TCH/F4.8 The block length for TCH/F4.8 is off by 4 bits. Value 152 matches with what TS 45.003 section 3.4.3 defines, but for some reason the encoder generates more bits (468) than it must (456). This results in buffer overruns when encoding TCH/F4.8. All block length values in conv_codes_gsm.py are 4 bits less than the respective values in TS 45.003. I have no idea why... Change-Id: Id86d1aa0fd6791a8be431b5547bb723c74c35757 Related: OS#1572 --- M tests/conv/conv_gsm0503_test.ok M utils/conv_codes_gsm.py 2 files changed, 21 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, approved diff --git a/tests/conv/conv_gsm0503_test.ok b/tests/conv/conv_gsm0503_test.ok index bfefcd0..6fd3793 100644 --- a/tests/conv/conv_gsm0503_test.ok +++ b/tests/conv/conv_gsm0503_test.ok @@ -15,8 +15,8 @@ [..] Encoding / Decoding cycle : OK [+] Testing: gsm0503_tch_f48 -[.] Input length : ret = 152 exp = 152 -> OK -[.] Output length : ret = 468 exp = 468 -> OK +[.] Input length : ret = 148 exp = 148 -> OK +[.] Output length : ret = 456 exp = 456 -> OK [.] Random vector checks: [..] Encoding / Decoding cycle : OK [..] Encoding / Decoding cycle : OK diff --git a/utils/conv_codes_gsm.py b/utils/conv_codes_gsm.py index a6e471e..721e546 100644 --- a/utils/conv_codes_gsm.py +++ b/utils/conv_codes_gsm.py @@ -68,7 +68,7 @@ # TCH/F4.8 definition ConvolutionalCode( - 152, + 148, [ (G1, 1), (G2, 1), -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32986 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Id86d1aa0fd6791a8be431b5547bb723c74c35757 Gerrit-Change-Number: 32986 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-MessageType: merged
1 0
0 0
[L] Change in libosmocore[master]: coding: implement TCH/F9.6, TCH/[FH]4.8, TCH/H2.4, TCH/F14.4
by fixeria 25 May '23

25 May '23
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32808 ) Change subject: coding: implement TCH/F9.6, TCH/[FH]4.8, TCH/H2.4, TCH/F14.4 ...................................................................... coding: implement TCH/F9.6, TCH/[FH]4.8, TCH/H2.4, TCH/F14.4 Implement all CSD specific channel modes, except TCH/F2.4. All of these modes are more or less similar to each other. The TCH/F2.4 is more similar to TCH/FS and slightly more complicated. FACCH/F and FACCH/H will be implemented in a follow-up change. Change-Id: Ib482817b5f6a4e3c7299f6e0b3841143b60fc93d Related: OS#1572 --- M include/osmocom/coding/gsm0503_coding.h M src/coding/gsm0503_coding.c M src/coding/libosmocoding.map M tests/coding/coding_test.c M tests/coding/coding_test.ok 5 files changed, 510 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve falconia: Looks good to me, approved diff --git a/include/osmocom/coding/gsm0503_coding.h b/include/osmocom/coding/gsm0503_coding.h index 2112b0f..c6181d8 100644 --- a/include/osmocom/coding/gsm0503_coding.h +++ b/include/osmocom/coding/gsm0503_coding.h @@ -89,4 +89,24 @@ int gsm0503_sch_encode(ubit_t *burst, const uint8_t *sb_info); int gsm0503_sch_decode(uint8_t *sb_info, const sbit_t *burst); +int gsm0503_tch_fr96_encode(ubit_t *bursts, const ubit_t *data); +int gsm0503_tch_fr96_decode(ubit_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total); + +int gsm0503_tch_fr48_encode(ubit_t *bursts, const ubit_t *data); +int gsm0503_tch_fr48_decode(ubit_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total); + +int gsm0503_tch_hr48_encode(ubit_t *bursts, const ubit_t *data); +int gsm0503_tch_hr48_decode(ubit_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total); + +int gsm0503_tch_hr24_encode(ubit_t *bursts, const ubit_t *data); +int gsm0503_tch_hr24_decode(ubit_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total); + +int gsm0503_tch_fr144_encode(ubit_t *bursts, const ubit_t *data); +int gsm0503_tch_fr144_decode(ubit_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total); + /*! @} */ diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index f42deb2..b761cd0 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -3292,4 +3292,301 @@ return 0; } +/* + * GSM CSD transcoding + */ + +static inline void _tch_csd_burst_map(ubit_t *burst, const ubit_t *iB) +{ + for (unsigned int i = 0; i < 57; i++) { + burst[i] |= iB[i]; + burst[59 + i] |= iB[57 + i]; + } + + burst[57] = 0; /* hl(B) */ + burst[58] = 0; /* hu(B) */ +} + +/*! Perform channel encoding of a TCH/F9.6 channel as per section 3.3. + * \param[out] bursts Caller-allocated buffer for symbols of 22 bursts, + * 22 * 2 * 58 == 2552 bits total. + * \param[in] data Data to be encoded (240 unpacked bits). + * \returns 0 in case of success; negative on error. */ +int gsm0503_tch_fr96_encode(ubit_t *bursts, const ubit_t *data) +{ + ubit_t iB[22 * 114], cB[4 * 114]; + ubit_t conv[4 * 60 + 4]; + + /* 3.3.2 Block code: b1(60) + b2(60) + b3(60) + b4(60) + pad(4) */ + memcpy(&conv[0], &data[0], 4 * 60); + memset(&conv[240], 0, 4); + + /* 3.3.3 Convolutional encoder */ + osmo_conv_encode(&gsm0503_tch_f96, &conv[0], &cB[0]); + + /* 3.3.4 Interleaving */ + memset(&iB[0], 0, sizeof(iB)); + gsm0503_tch_f96_interleave(&cB[0], &iB[0]); + + /* 3.3.5 Mapping on a burst: as specified for TCH/FS in subclause 3.1.4 */ + for (unsigned int i = 0; i < 22; i++) + _tch_csd_burst_map(&bursts[i * 116], &iB[i * 114]); + + return 0; +} + +/*! Perform channel decoding of a TCH/F9.6 channel as per section 3.3. + * \param[out] data Caller-allocated buffer for decoded data (240 unpacked bits). + * \param[in] bursts Buffer containing the symbols of 22 bursts, + * 22 * 2 * 58 == 2552 bits total. + * \param[out] n_errors Number of detected bit errors. + * \param[out] n_bits_total Total number of bits. + * \returns Number of unpacked bits used in the output buffer; negative on error. */ +int gsm0503_tch_fr96_decode(ubit_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total) +{ + sbit_t iB[22 * 114], cB[4 * 114]; + ubit_t conv[4 * 60 + 4]; + + /* 3.3.5 Mapping on a burst: as specified for TCH/FS in subclause 3.1.4 */ + for (unsigned int i = 0; i < 22; i++) { + memcpy(&iB[i * 114], &bursts[i * 116], 57); + memcpy(&iB[i * 114 + 57], &bursts[i * 116 + 59], 57); + } + + /* 3.3.4 Interleaving */ + gsm0503_tch_f96_deinterleave(&cB[0], &iB[0]); + + /* 3.3.3 Convolutional encoder */ + osmo_conv_decode_ber(&gsm0503_tch_f96, &cB[0], &conv[0], n_errors, n_bits_total); + + /* 3.3.2 Block code: b1(60) + b2(60) + b3(60) + b4(60) + pad(4) */ + memcpy(&data[0], &conv[0], 4 * 60); + + return 4 * 60; +} + +/*! Perform channel encoding of a TCH/F4.8 channel as per section 3.4. + * \param[out] bursts Caller-allocated buffer for symbols of 22 bursts, + * 22 * 2 * 58 == 2552 bits total. + * \param[in] data Data to be encoded (120 unpacked bits). + * \returns 0 in case of success; negative on error */ +int gsm0503_tch_fr48_encode(ubit_t *bursts, const ubit_t *data) +{ + ubit_t iB[22 * 114], cB[4 * 114]; + ubit_t conv[2 * 60 + 32]; + + /* 3.4.2 Block code: + * + * Sixteen bits equal to 0 are added to the 60 information bits, the result + * being a block of 76 bits, {u(0),u(1),...,u(75)}, with: + * + * u(19k+p) = d(15k+p) for k = 0,1,2,3 and p = 0,1,...,14; + * u(19k+p) = 0 for k = 0,1,2,3 and p = 15,16,17,18. + * + * Two such blocks forming a block of 152 bits: u1 + u2. */ + for (unsigned int k = 0; k < 2 * 4; k++) { + memcpy(&conv[19 * k], &data[15 * k], 15); + memset(&conv[19 * k + 15], 0, 4); + } + + /* 3.4.3 Convolutional encoder */ + osmo_conv_encode(&gsm0503_tch_f48, &conv[0], &cB[0]); + + /* 3.4.4 Interleaving: as specified for the TCH/F9.6 in subclause 3.3.4 */ + memset(&iB[0], 0, sizeof(iB)); + gsm0503_tch_f96_interleave(&cB[0], &iB[0]); + + /* 3.4.5 Mapping on a burst: as specified for TCH/FS in subclause 3.1.4 */ + for (unsigned int i = 0; i < 22; i++) + _tch_csd_burst_map(&bursts[i * 116], &iB[i * 114]); + + return 0; +} + +/*! Perform channel decoding of a TCH/F4.8 channel as per section 3.4. + * \param[out] data Caller-allocated buffer for decoded data (120 unpacked bits). + * \param[in] bursts Buffer containing the symbols of 22 bursts, + * 22 * 2 * 58 == 2552 bits total. + * \param[out] n_errors Number of detected bit errors. + * \param[out] n_bits_total Total number of bits. + * \returns Number of unpacked bits used in the output buffer; negative on error. */ +int gsm0503_tch_fr48_decode(ubit_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total) +{ + sbit_t iB[22 * 114], cB[4 * 114]; + ubit_t conv[2 * 60 + 32]; + + /* 3.4.5 Mapping on a burst: as specified for TCH/FS in subclause 3.1.4 */ + for (unsigned int i = 0; i < 22; i++) { + memcpy(&iB[i * 114], &bursts[i * 116], 57); + memcpy(&iB[i * 114 + 57], &bursts[i * 116 + 59], 57); + } + + /* 3.4.4 Interleaving: as specified for the TCH/F9.6 in subclause 3.3.4 */ + gsm0503_tch_f96_deinterleave(&cB[0], &iB[0]); + + /* 3.4.3 Convolutional encoder */ + osmo_conv_decode_ber(&gsm0503_tch_f48, &cB[0], &conv[0], n_errors, n_bits_total); + + /* 3.4.2 Block code: + * + * Sixteen bits equal to 0 are added to the 60 information bits, the result + * being a block of 76 bits, {u(0),u(1),...,u(75)}, with: + * + * u(19k+p) = d(15k+p) for k = 0,1,2,3 and p = 0,1,...,14; + * u(19k+p) = 0 for k = 0,1,2,3 and p = 15,16,17,18. + * + * Two such blocks forming a block of 152 bits: u1 + u2. */ + for (unsigned int k = 0; k < 2 * 4; k++) + memcpy(&data[15 * k], &conv[19 * k], 15); + + return 2 * 60; +} + +/*! Perform channel encoding of a TCH/H4.8 channel as per section 3.5. + * The algorithm is identical to TCH/F9.6, so it's just a wrapper. + * \param[out] bursts Caller-allocated buffer for symbols of 22 bursts, + * 22 * 2 * 58 == 2552 bits total. + * \param[in] data Data to be encoded (240 unpacked bits). + * \returns 0 in case of success; negative on error */ +int gsm0503_tch_hr48_encode(ubit_t *bursts, const ubit_t *data) +{ + return gsm0503_tch_fr96_encode(bursts, data); +} + +/*! Perform channel decoding of a TCH/H4.8 channel as per section 3.5. + * The algorithm is identical to TCH/F9.6, so it's just a wrapper. + * \param[out] data Caller-allocated buffer for decoded data (240 unpacked bits). + * \param[in] bursts Buffer containing the symbols of 22 bursts, + * 22 * 2 * 58 == 2552 bits total. + * \param[out] n_errors Number of detected bit errors. + * \param[out] n_bits_total Total number of bits. + * \returns Number of unpacked bits used in the output buffer; negative on error. */ +int gsm0503_tch_hr48_decode(ubit_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total) +{ + return gsm0503_tch_fr96_decode(data, bursts, n_errors, n_bits_total); +} + +/*! Perform channel encoding of a TCH/H2.4 channel as per section 3.7. + * \param[out] bursts Caller-allocated buffer for symbols of 22 bursts, + * 22 * 2 * 58 == 2552 bits total. + * \param[in] data Data to be encoded (144 unpacked bits). + * \returns 0 in case of success; negative on error */ +int gsm0503_tch_hr24_encode(ubit_t *bursts, const ubit_t *data) +{ + ubit_t iB[22 * 114], cB[4 * 114]; + ubit_t conv[2 * 72 + 8]; + + /* 3.7.2 Block code: d1(72) + pad(4) + d2(72) + pad(4) */ + memset(&conv[0], 0, sizeof(conv)); + memcpy(&conv[0], &data[0], 72); + memcpy(&conv[76], &data[72], 72); + + /* 3.7.3 Convolutional encoder: as specified for the TCH/F4.8 in subclause 3.4.3 */ + osmo_conv_encode(&gsm0503_tch_f48, &conv[0], &cB[0]); + + /* 3.7.4 Interleaving: as specified for the TCH/F9.6 in subclause 3.3.4 */ + memset(&iB[0], 0, sizeof(iB)); + gsm0503_tch_f96_interleave(&cB[0], &iB[0]); + + /* 3.7.5 Mapping on a burst: as specified for TCH/FS in subclause 3.1.4 */ + for (unsigned int i = 0; i < 22; i++) + _tch_csd_burst_map(&bursts[i * 116], &iB[i * 114]); + + return 0; +} + +/*! Perform channel decoding of a TCH/H2.4 channel as per section 3.7. + * \param[out] data Caller-allocated buffer for decoded data (144 unpacked bits). + * \param[in] bursts Buffer containing the symbols of 22 bursts, + * 22 * 2 * 58 == 2552 bits total. + * \param[out] n_errors Number of detected bit errors. + * \param[out] n_bits_total Total number of bits. + * \returns Number of unpacked bits used in the output buffer; negative on error. */ +int gsm0503_tch_hr24_decode(ubit_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total) +{ + sbit_t iB[22 * 114], cB[4 * 114]; + ubit_t conv[120 + 32]; + + /* 3.7.5 Mapping on a burst: as specified for TCH/FS in subclause 3.1.4 */ + for (unsigned int i = 0; i < 22; i++) { + memcpy(&iB[i * 114], &bursts[i * 116], 57); + memcpy(&iB[i * 114 + 57], &bursts[i * 116 + 59], 57); + } + + /* 3.7.4 Interleaving: as specified for the TCH/F9.6 in subclause 3.3.4 */ + gsm0503_tch_f96_deinterleave(&cB[0], &iB[0]); + + /* 3.7.3 Convolutional encoder: as specified for the TCH/F4.8 in subclause 3.4.3 */ + osmo_conv_decode_ber(&gsm0503_tch_f48, &cB[0], &conv[0], n_errors, n_bits_total); + + /* 3.7.2 Block code: d1(72) + pad(4) + d2(72) + pad(4) */ + memcpy(&data[0], &conv[0], 72); + memcpy(&data[72], &conv[76], 72); + + return 2 * 72; +} + +/*! Perform channel encoding of a TCH/F14.4 channel as per section 3.8. + * \param[out] bursts Caller-allocated buffer for symbols of 22 bursts, + * 22 * 2 * 58 == 2552 bits total. + * \param[in] data Data to be encoded (290 unpacked bits). + * \returns 0 in case of success; negative on error */ +int gsm0503_tch_fr144_encode(ubit_t *bursts, const ubit_t *data) +{ + ubit_t iB[22 * 114], cB[4 * 114]; + ubit_t conv[290 + 4]; + + /* 3.8.2 Block code: b(290) + pad(4) */ + memcpy(&conv[0], &data[0], 290); + memset(&conv[290], 0, 4); + + /* 3.8.3 Convolutional encoder */ + osmo_conv_encode(&gsm0503_tch_f144, &conv[0], &cB[0]); + + /* 3.8.4 Interleaving */ + memset(&iB[0], 0, sizeof(iB)); + gsm0503_tch_f96_interleave(&cB[0], &iB[0]); + + /* 3.8.5 Mapping on a burst: as specified for TCH/FS in subclause 3.1.4 */ + for (unsigned int i = 0; i < 22; i++) + _tch_csd_burst_map(&bursts[i * 116], &iB[i * 114]); + + return 0; +} + +/*! Perform channel decoding of a TCH/14.4 channel as per section 3.8. + * \param[out] data Caller-allocated buffer for decoded data (290 unpacked bits). + * \param[in] bursts Buffer containing the symbols of 22 bursts, + * 22 * 2 * 58 == 2552 bits total. + * \param[out] n_errors Number of detected bit errors. + * \param[out] n_bits_total Total number of bits. + * \returns Number of unpacked bits used in the output buffer; negative on error. */ +int gsm0503_tch_fr144_decode(ubit_t *data, const sbit_t *bursts, + int *n_errors, int *n_bits_total) +{ + sbit_t iB[22 * 114], cB[4 * 114]; + ubit_t conv[294]; + + /* 3.8.5 Mapping on a burst: as specified for TCH/FS in subclause 3.1.4 */ + for (unsigned int i = 0; i < 22; i++) { + memcpy(&iB[i * 114], &bursts[i * 116], 57); + memcpy(&iB[i * 114 + 57], &bursts[i * 116 + 59], 57); + } + + /* 3.8.4 Interleaving: as specified for the TCH/F9.6 in subclause 3.3.4 */ + gsm0503_tch_f96_deinterleave(&cB[0], &iB[0]); + + /* 3.8.3 Convolutional encoder */ + osmo_conv_decode_ber(&gsm0503_tch_f144, &cB[0], &conv[0], n_errors, n_bits_total); + + /* 3.8.2 Block code: b(290) + pad(4) */ + memcpy(&data[0], &conv[0], 290); + + return 290; +} + /*! @} */ diff --git a/src/coding/libosmocoding.map b/src/coding/libosmocoding.map index a78da27..a645a58 100644 --- a/src/coding/libosmocoding.map +++ b/src/coding/libosmocoding.map @@ -129,5 +129,16 @@ gsm0503_detect_afs_dtx_frame2; gsm0503_detect_ahs_dtx_frame2; +gsm0503_tch_fr96_encode; +gsm0503_tch_fr96_decode; +gsm0503_tch_fr48_encode; +gsm0503_tch_fr48_decode; +gsm0503_tch_hr48_encode; +gsm0503_tch_hr48_decode; +gsm0503_tch_hr24_encode; +gsm0503_tch_hr24_decode; +gsm0503_tch_fr144_encode; +gsm0503_tch_fr144_decode; + local: *; }; diff --git a/tests/coding/coding_test.c b/tests/coding/coding_test.c index 8a0506a..a13dc4c 100644 --- a/tests/coding/coding_test.c +++ b/tests/coding/coding_test.c @@ -489,6 +489,92 @@ uint8_t test_speech_efr[31]; uint8_t test_speech_hr[14]; +struct csd_test_case { + const char *name; + unsigned int num_bits; + int (*enc_fn)(ubit_t *out, const ubit_t *in); + int (*dec_fn)(ubit_t *out, const sbit_t *in, int *ne, int *nb); +}; + +static const struct csd_test_case csd_tests[] = { + { + .name = "TCH/F9.6", + .num_bits = 4 * 60, + .enc_fn = &gsm0503_tch_fr96_encode, + .dec_fn = &gsm0503_tch_fr96_decode, + }, + { + .name = "TCH/F4.8", + .num_bits = 2 * 60, + .enc_fn = &gsm0503_tch_fr48_encode, + .dec_fn = &gsm0503_tch_fr48_decode, + }, + { + .name = "TCH/H4.8", + .num_bits = 4 * 60, + .enc_fn = &gsm0503_tch_hr48_encode, + .dec_fn = &gsm0503_tch_hr48_decode, + }, + { + .name = "TCH/H2.4", + .num_bits = 2 * 72, + .enc_fn = &gsm0503_tch_hr24_encode, + .dec_fn = &gsm0503_tch_hr24_decode, + }, + { + .name = "TCH/F14.4", + .num_bits = 290, + .enc_fn = &gsm0503_tch_fr144_encode, + .dec_fn = &gsm0503_tch_fr144_decode, + }, +}; + +static void test_csd(const struct csd_test_case *tc) +{ + const uint8_t patterns[] = { 0x00, 0xaa, 0xff }; + ubit_t bursts_u[116 * (22 + 8)] = { 0 }; + sbit_t bursts_s[116 * (22 + 8)] = { 0 }; + ubit_t data[512]; + int rc; + + /* Encode three data blocks, each block filled-in with a pattern */ + for (unsigned int i = 0; i < ARRAY_SIZE(patterns); i++) { + for (unsigned int j = 0; j < tc->num_bits; j++) + data[j] = (patterns[i] & (1 << (j % 8))) != 0; + + rc = tc->enc_fn(&bursts_u[i * 4 * 116], &data[0]); + CHECK_RC_OR_RET(rc == 0, "encoding"); + } + + /* TODO: test FACCH stealing */ + + /* Prepare soft-bits */ + osmo_ubit2sbit(&bursts_s[0], &bursts_u[0], sizeof(bursts_s)); + + /* Decode the soft-bits, print decoded blocks */ + for (unsigned int i = 0; i < ARRAY_SIZE(patterns); i++) { + int n_errors, n_bits_total; + + rc = tc->dec_fn(&data[0], &bursts_s[i * 4 * 116], + &n_errors, &n_bits_total); + CHECK_RC_OR_RET(rc == tc->num_bits, "decoding"); + + printf("%s(%s): block #%u (pattern 0x%02x): n_errors=%d / n_bits_total=%d\n", + __func__, tc->name, i, patterns[i], n_errors, n_bits_total); + + for (unsigned int j = 0; j < tc->num_bits; j++) { + if (j && j % 64 == 0) + printf("\n"); + else if (j && j % 8 == 0) + printf(" "); + printf("%c", data[j] ? '1' : '0'); + } + printf("\n"); + } + + printf("\n"); +} + int main(int argc, char **argv) { int i, len_l2, len_mb; @@ -549,6 +635,10 @@ } } + printf("\nTesting CSD functions:\n"); + for (i = 0; i < ARRAY_SIZE(csd_tests); i++) + test_csd(&csd_tests[i]); + printf("Success\n"); return 0; diff --git a/tests/coding/coding_test.ok b/tests/coding/coding_test.ok index 0927a33..e1bd89d 100644 --- a/tests/coding/coding_test.ok +++ b/tests/coding/coding_test.ok @@ -367,4 +367,80 @@ 81 7f 7f 7f 81 7f 7f 81 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 81 81 7f 81 7f 7f 81 81 81 81 81 81 7f 7f 81 7f 81 7f 7f 81 7f 7f 7f 7f 81 7f 7f 7f 81 7f 7f 81 81 81 7f 81 7f 7f 81 7f 7f 81 7f 7f 81 7f 81 7f 81 7f 81 81 7f 7f 7f 81 7f 81 81 81 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 81 7f 81 81 81 81 7f 7f 7f 81 81 81 7f 7f 7f 81 81 7f 81 7f 7f 7f 81 7f 7f 81 81 81 81 81 7f 7f 7f 7f 81 81 7f 81 7f 7f 81 7f 81 81 7f 81 7f 7f 7f 7f 81 81 7f 81 81 81 81 7f 7f 7f 7f 81 7f 7f 81 7f 7f 81 7f 7f 7f 7f 7f 81 7f 7f 7f 81 7f 7f 81 81 7f 7f 81 7f 7f 7f 7f 7f 7f 81 81 7f 81 81 7f 81 81 7f 81 7f 7f 7f 81 81 81 81 81 7f 81 81 81 81 7f 7f 81 81 7f 7f 81 81 7f 81 81 7f 7f 7f 7f 7f 81 81 81 81 7f 7f 7f 81 7f 7f 7f 81 7f 7f 81 7f 7f 7f 81 81 7f 7f 81 81 7f 81 7f 81 81 7f 7f 81 81 7f 81 81 7f 7f 81 7f 81 81 81 7f 7f 81 7f 7f 7f 81 7f 7f 7f 81 81 7f 81 81 7f 81 7f 81 81 81 7f 7f 7f 7f 7f 81 7f 7f 7f 7f 7f 81 7f 7f 7f 7f 7f 81 7f 7f 81 7f 81 81 7f 7f 7f 81 81 81 81 81 81 81 7f 7f 81 7f 81 81 81 7f 81 7f 81 81 7f 7f 7f 7f 7f 7f 7f 81 81 81 7f 81 81 7f 7f 7f 81 7f + +Testing CSD functions: +test_csd(TCH/F9.6): block #0 (pattern 0x00): n_errors=0 / n_bits_total=456 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 +test_csd(TCH/F9.6): block #1 (pattern 0xaa): n_errors=0 / n_bits_total=456 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 +test_csd(TCH/F9.6): block #2 (pattern 0xff): n_errors=0 / n_bits_total=456 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 + +test_csd(TCH/F4.8): block #0 (pattern 0x00): n_errors=0 / n_bits_total=456 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 +test_csd(TCH/F4.8): block #1 (pattern 0xaa): n_errors=0 / n_bits_total=456 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 +test_csd(TCH/F4.8): block #2 (pattern 0xff): n_errors=0 / n_bits_total=456 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 + +test_csd(TCH/H4.8): block #0 (pattern 0x00): n_errors=0 / n_bits_total=456 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 +test_csd(TCH/H4.8): block #1 (pattern 0xaa): n_errors=0 / n_bits_total=456 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 +test_csd(TCH/H4.8): block #2 (pattern 0xff): n_errors=0 / n_bits_total=456 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 + +test_csd(TCH/H2.4): block #0 (pattern 0x00): n_errors=0 / n_bits_total=456 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 +test_csd(TCH/H2.4): block #1 (pattern 0xaa): n_errors=0 / n_bits_total=456 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 +test_csd(TCH/H2.4): block #2 (pattern 0xff): n_errors=0 / n_bits_total=456 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 + +test_csd(TCH/F14.4): block #0 (pattern 0x00): n_errors=0 / n_bits_total=456 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00 +test_csd(TCH/F14.4): block #1 (pattern 0xaa): n_errors=0 / n_bits_total=456 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 +01010101 01010101 01010101 01010101 01 +test_csd(TCH/F14.4): block #2 (pattern 0xff): n_errors=0 / n_bits_total=456 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 11111111 11 + Success -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32808 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ib482817b5f6a4e3c7299f6e0b3841143b60fc93d Gerrit-Change-Number: 32808 Gerrit-PatchSet: 9 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: falconia <falcon(a)freecalypso.org> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: gsm: fix convolutional code definition for TCH/F4.8
by fixeria 25 May '23

25 May '23
Attention is currently required from: tnt. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32986 ) Change subject: gsm: fix convolutional code definition for TCH/F4.8 ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32986 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Id86d1aa0fd6791a8be431b5547bb723c74c35757 Gerrit-Change-Number: 32986 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-Attention: tnt <tnt(a)246tNt.com> Gerrit-Comment-Date: Thu, 25 May 2023 20:52:28 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • ...
  • 259
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.