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 2022

  • 2 participants
  • 1343 discussions
Change in libosmocore[master]: iuup: Fix IPTIs_present not set to 0 if no IPTIs received
by pespin 27 May '22

27 May '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/28198 ) Change subject: iuup: Fix IPTIs_present not set to 0 if no IPTIs received ...................................................................... iuup: Fix IPTIs_present not set to 0 if no IPTIs received Related: SYS#5969 Change-Id: I503dc509ad8619f13cd83ae03261a2297e2b9fc7 --- M src/gsm/iuup.c M tests/iuup/iuup_test.c M tests/iuup/iuup_test.ok 3 files changed, 118 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/98/28198/1 diff --git a/src/gsm/iuup.c b/src/gsm/iuup.c index edcea3b..2c70307 100644 --- a/src/gsm/iuup.c +++ b/src/gsm/iuup.c @@ -593,6 +593,7 @@ buf++; itail = (struct iuup_ctrl_init_tail *)buf; } else { + iui->config.IPTIs_present = false; itail = (struct iuup_ctrl_init_tail *)ihdr_rfci; } if (itail->data_pdu_type > 1) { diff --git a/tests/iuup/iuup_test.c b/tests/iuup/iuup_test.c index 6e3d8ca..3c06fd3 100644 --- a/tests/iuup/iuup_test.c +++ b/tests/iuup/iuup_test.c @@ -528,6 +528,118 @@ osmo_iuup_instance_free(iui); } +static int _decode_passive_init_2_rfci_no_iptis_user_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_rnl_prim *irp = (struct osmo_iuup_rnl_prim *)oph; + printf("%s(): Initialization decoded fine!\n", __func__); + OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_STATUS, PRIM_OP_INDICATION)); + OSMO_ASSERT(irp->u.status.procedure == IUUP_PROC_INIT); + OSMO_ASSERT(irp->u.status.u.initialization.num_rfci == 2); + OSMO_ASSERT(irp->u.status.u.initialization.num_subflows == 3); + OSMO_ASSERT(irp->u.status.u.initialization.data_pdu_type == 0); + OSMO_ASSERT(irp->u.status.u.initialization.IPTIs_present == false); + msgb_free(oph->msg); + return 0; +} +static int _decode_passive_init_2_rfci_no_iptis_transport_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_tnl_prim *itp = (struct osmo_iuup_tnl_prim *)oph; + struct msgb *msg; + struct iuup_pdutype14_hdr *hdr; + + printf("%s()\n", __func__); + msg = oph->msg; + OSMO_ASSERT(OSMO_PRIM_HDR(&itp->oph) == OSMO_PRIM(OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST)); + printf("Transport: DL len=%u: %s\n", msgb_l2len(msg), + osmo_hexdump((const unsigned char *) msgb_l2(msg), msgb_l2len(msg))); + hdr = msgb_l2(msg); + OSMO_ASSERT(hdr->pdu_type == IUUP_PDU_T_CONTROL); + OSMO_ASSERT(hdr->ack_nack == IUUP_AN_ACK); + msgb_free(msg); + return 0; +} +void test_decode_passive_init_2_rfci_no_iptis(void) +{ + /* Here we check the passive INIT code path, aka receiving INIT and returning INIT_ACK/NACK */ + struct osmo_iuup_instance *iui; + struct osmo_iuup_rnl_prim *rnp; + struct osmo_iuup_tnl_prim *tnp; + struct iuup_pdutype14_hdr *hdr14; + int rc; + + /* Frame 46, "Initialization", SYS#5969 call4_Iu_Iuh.pcap + 1110 .... = PDU Type: Control Procedure (14) + .... 00.. = Ack/Nack: Procedure (0) + .... ..00 = Frame Number: 0 + 0000 .... = Mode Version: 0x0 + .... 0000 = Procedure: Initialization (0) + 1101 11.. = Header CRC: 0x37 [correct] + .... ..01 1011 0100 = Payload CRC: 0x1b4 + 000. .... = Spare: 0x0 + ...0 .... = TI: IPTIs not present (0) + .... 011. = Subflows: 3 + .... ...0 = Chain Indicator: this frame is the last frame for the procedure (0) + RFCI 1 Initialization + 0... .... = RFCI 0 LRI: Not last RFCI (0x0) + .0.. .... = RFCI 0 LI: one octet used (0x0) + ..00 0001 = RFCI 0: 1 + RFCI 0 Flow 0 Len: 81 + RFCI 0 Flow 1 Len: 103 + RFCI 0 Flow 2 Len: 60 + RFCI 6 Initialization + 1... .... = RFCI 1 LRI: Last RFCI in current frame (0x1) + .0.. .... = RFCI 1 LI: one octet used (0x0) + ..00 0110 = RFCI 1: 6 + RFCI 1 Flow 0 Len: 39 + RFCI 1 Flow 1 Len: 0 + RFCI 1 Flow 2 Len: 0 + Iu UP Mode Versions Supported: 0x0001 + 0... .... .... .... = Version 16: not supported (0x0) + .0.. .... .... .... = Version 15: not supported (0x0) + ..0. .... .... .... = Version 14: not supported (0x0) + ...0 .... .... .... = Version 13: not supported (0x0) + .... 0... .... .... = Version 12: not supported (0x0) + .... .0.. .... .... = Version 11: not supported (0x0) + .... ..0. .... .... = Version 10: not supported (0x0) + .... ...0 .... .... = Version 9: not supported (0x0) + .... .... 0... .... = Version 8: not supported (0x0) + .... .... .0.. .... = Version 7: not supported (0x0) + .... .... ..0. .... = Version 6: not supported (0x0) + .... .... ...0 .... = Version 5: not supported (0x0) + .... .... .... 0... = Version 4: not supported (0x0) + .... .... .... .0.. = Version 3: not supported (0x0) + .... .... .... ..0. = Version 2: not supported (0x0) + .... .... .... ...1 = Version 1: supported (0x1) + 0000 .... = RFCI Data Pdu Type: PDU type 0 (0x0) + */ + const uint8_t iuup_init[] = { + 0xe0, 0x00, 0xdd, 0xb4, 0x06, 0x01, 0x51, 0x67, 0x3c, 0x86, 0x27, + 0x00, 0x00, 0x00, 0x01, 0x00 + }; + + iui = osmo_iuup_instance_alloc(iuup_test_ctx, __func__); + OSMO_ASSERT(iui); + osmo_iuup_instance_set_user_prim_cb(iui, _decode_passive_init_2_rfci_no_iptis_user_prim_cb, NULL); + osmo_iuup_instance_set_transport_prim_cb(iui, _decode_passive_init_2_rfci_no_iptis_transport_prim_cb, NULL); + + clock_override_set(0, 0); + + /* Tx CONFIG.req */ + rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_CONFIG, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + rnp->u.config = def_configure_req; + rnp->u.config.active = false; + OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0); + + /* Send Init: */ + tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(iuup_init)); + hdr14 = (struct iuup_pdutype14_hdr *)msgb_l2(tnp->oph.msg); + memcpy(hdr14, iuup_init, sizeof(iuup_init)); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + + osmo_iuup_instance_free(iui); +} + int main(int argc, char **argv) { iuup_test_ctx = talloc_named_const(NULL, 0, "iuup_test"); @@ -546,6 +658,7 @@ test_init_nack_retrans(); test_init_ack(); test_passive_init(); + test_decode_passive_init_2_rfci_no_iptis(); printf("OK.\n"); } diff --git a/tests/iuup/iuup_test.ok b/tests/iuup/iuup_test.ok index 681672b..a2f48ec 100644 --- a/tests/iuup/iuup_test.ok +++ b/tests/iuup/iuup_test.ok @@ -43,4 +43,8 @@ User: UL len=31: 08 55 6d 94 4c 71 a1 a0 81 e7 ea d2 04 24 44 80 00 0e cd 82 b8 11 18 00 00 97 c4 79 4e 77 40 _passive_init_transport_prim_cb() Transport: DL len=35: 01 00 e3 ff 08 55 6d 94 4c 71 a1 a0 81 e7 ea d2 04 24 44 80 00 0e cd 82 b8 11 18 00 00 97 c4 79 4e 77 40 +sys={0.000000}, clock_override_set +_decode_passive_init_2_rfci_no_iptis_user_prim_cb(): Initialization decoded fine! +_decode_passive_init_2_rfci_no_iptis_transport_prim_cb() +Transport: DL len=4: e4 00 24 00 OK. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/28198 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I503dc509ad8619f13cd83ae03261a2297e2b9fc7 Gerrit-Change-Number: 28198 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-dev[master]: tmux/ttcn3-bsc-test.sh: pass missing features to osmo-bts-omldummy
by fixeria 27 May '22

27 May '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-dev/+/28197 ) Change subject: tmux/ttcn3-bsc-test.sh: pass missing features to osmo-bts-omldummy ...................................................................... tmux/ttcn3-bsc-test.sh: pass missing features to osmo-bts-omldummy Change-Id: I119b29885be71bf0d7535f5f9337748998ff1470 --- M ttcn3/tmux/ttcn3-bsc-test.sh 1 file changed, 4 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/97/28197/1 diff --git a/ttcn3/tmux/ttcn3-bsc-test.sh b/ttcn3/tmux/ttcn3-bsc-test.sh index c0d9709..0f76071 100755 --- a/ttcn3/tmux/ttcn3-bsc-test.sh +++ b/ttcn3/tmux/ttcn3-bsc-test.sh @@ -36,8 +36,9 @@ tmux send-keys -t $SESSION:1.0 "cd $SUITE_DIR/bsc" C-m tmux send-keys -t $SESSION:1.0 "osmo-stp -c osmo-stp.cfg" C-m # Start osmo-bts-omldummy -tmux send-keys -t $SESSION:1.1 "$RESPAWN osmo-bts-omldummy 127.0.0.1 1234" C-m -tmux send-keys -t $SESSION:1.2 "$RESPAWN osmo-bts-omldummy 127.0.0.1 1235" C-m -tmux send-keys -t $SESSION:1.3 "$RESPAWN osmo-bts-omldummy 127.0.0.1 1236" C-m +BTS_FEATURES="-fCCN,EGPRS,GPRS,IPv6_NSVC,PAGING_COORDINATION" +tmux send-keys -t $SESSION:1.1 "$RESPAWN osmo-bts-omldummy $BTS_FEATURES 127.0.0.1 1234 1" C-m +tmux send-keys -t $SESSION:1.2 "$RESPAWN osmo-bts-omldummy $BTS_FEATURES 127.0.0.1 1235 1" C-m +tmux send-keys -t $SESSION:1.3 "$RESPAWN osmo-bts-omldummy $BTS_FEATURES 127.0.0.1 1236 1" C-m tmux attach -t $SESSION:0 -- To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/28197 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-dev Gerrit-Branch: master Gerrit-Change-Id: I119b29885be71bf0d7535f5f9337748998ff1470 Gerrit-Change-Number: 28197 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-bsc[master]: fix gsm_lchan_and_pchan2chan_nr(): log proper lchan_nr value
by fixeria 27 May '22

27 May '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28195 ) Change subject: fix gsm_lchan_and_pchan2chan_nr(): log proper lchan_nr value ...................................................................... fix gsm_lchan_and_pchan2chan_nr(): log proper lchan_nr value VAMOS lchans are behind the primary ones in the ts->lchan[] array. For example, for TCH/F, there is a primary ts->lchan[0] and a VAMOS ts->lchan[1]. We should print 'ss 0' for both of them. Change-Id: I8e7a5a2ecc9b9a33e3ddb76cb1bc04d7802fd320 --- M src/osmo-bsc/gsm_data.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/95/28195/1 diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 64c348f..1d6df12 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -600,7 +600,7 @@ if (rc < 0) LOG_LCHAN(lchan, LOGL_ERROR, "Error encoding Channel Number: pchan %s ts %u ss %u%s\n", - gsm_pchan_name(lchan->ts->pchan_from_config), lchan->ts->nr, lchan->nr, + gsm_pchan_name(lchan->ts->pchan_from_config), lchan->ts->nr, lchan_nr, lchan->vamos.is_secondary ? " (VAMOS shadow)" : ""); return rc; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28195 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I8e7a5a2ecc9b9a33e3ddb76cb1bc04d7802fd320 Gerrit-Change-Number: 28195 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-bsc[master]: gsm_data: subslots_per_pchan_vamos[GSM_PCHAN_TCH_F]: 2 -> 1
by fixeria 27 May '22

27 May '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28196 ) Change subject: gsm_data: subslots_per_pchan_vamos[GSM_PCHAN_TCH_F]: 2 -> 1 ...................................................................... gsm_data: subslots_per_pchan_vamos[GSM_PCHAN_TCH_F]: 2 -> 1 As far as I can see, multiplexing one TCH/F and two TCH/H sub-slots on one timeslot is not properly implemented yet. At least when trying to 'activate-all-lchan' from the VTY, I see messages like: DCHAN ERROR lchan(0-1-2-TCH_F-shadow1)[0x612000012220]{WAIT_ACTIV_ACK}: (type=TCH_F) Error encoding Channel Number: pchan TCH/F ts 2 ss 1 (VAMOS shadow) The logic basically tries to activate the second shadow sub-slot of TCH/F (not TCH/H!), which indeed does not exist. Change-Id: Ic8243c688385b3b6a3adfbf24ff74b63963bdab2 --- M src/osmo-bsc/gsm_data.c 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/96/28196/1 diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 1d6df12..641a51b 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -639,8 +639,9 @@ [GSM_PCHAN_CCCH] = 0, [GSM_PCHAN_PDCH] = 0, [GSM_PCHAN_CCCH_SDCCH4] = 0, - /* VAMOS: on a TCH/F, there may be a TCH/H shadow */ - [GSM_PCHAN_TCH_F] = 2, + /* FIXME: VAMOS: on a TCH/F, there may be a TCH/H shadow, + * however this is not properly implemented yet. */ + [GSM_PCHAN_TCH_F] = 1, [GSM_PCHAN_TCH_H] = 2, [GSM_PCHAN_SDCCH8_SACCH8C] = 0, [GSM_PCHAN_CCCH_SDCCH4_CBCH] = 0, -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28196 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ic8243c688385b3b6a3adfbf24ff74b63963bdab2 Gerrit-Change-Number: 28196 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-bsc[master]: bsc_vty: use llist_for_each_entry in lchan_act_all_cmd
by fixeria 27 May '22

27 May '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28194 ) Change subject: bsc_vty: use llist_for_each_entry in lchan_act_all_cmd ...................................................................... bsc_vty: use llist_for_each_entry in lchan_act_all_cmd Change-Id: Iaa29696c8de268796da118e7ea3384b6186bf688 --- M src/osmo-bsc/bsc_vty.c 1 file changed, 2 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/94/28194/1 diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index d293862..fc03c78 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -1787,9 +1787,7 @@ struct gsm_network *net = gsmnet_from_vty(vty); const char *act_str = argv[0]; int activate; - int bts_nr; struct gsm_bts *bts; - int trx_nr; struct gsm_bts_trx *trx; if (!strcmp(act_str, "activate-all-lchan")) @@ -1797,12 +1795,9 @@ else activate = 0; - for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { - bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); - for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { - trx = gsm_bts_trx_num(bts, trx_nr); + llist_for_each_entry(bts, &net->bts_list, list) { + llist_for_each_entry(trx, &bts->trx_list, list) lchan_act_trx(vty, trx, activate); - } } vty_out(vty, "%% All channels have been %s on all BTS/TRX, please " -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28194 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Iaa29696c8de268796da118e7ea3384b6186bf688 Gerrit-Change-Number: 28194 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmocore[master]: coding: separate gsm0503_tch_a[fh]s_decode_inband()
by fixeria 27 May '22

27 May '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28177 ) Change subject: coding: separate gsm0503_tch_a[fh]s_decode_inband() ...................................................................... coding: separate gsm0503_tch_a[fh]s_decode_inband() These functions can be re-used for parsing in-band data from DTX specific frames like SID_FIRST, SID_UPDATE, SID_ONSET, etc. Change-Id: I0106de7a7f87517006e323299b2dc08457d1c6cf Related: OS#5570 --- M src/coding/gsm0503_coding.c 1 file changed, 46 insertions(+), 26 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index 168e120..6f33b78 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -2115,6 +2115,26 @@ return 0; } +/* TCH/AFS: parse codec ID (CMI or CMC/CMR) from coded in-band data (16 bit) */ +static uint8_t gsm0503_tch_afs_decode_inband(const sbit_t *cB) +{ + unsigned int id = 0, best = 0; + unsigned int i, j, k; + + for (i = 0; i < 4; i++) { + /* FIXME: why not using remaining (16 - 8) soft-bits here? */ + for (j = 0, k = 0; j < 8; j++) + k += abs(((int)gsm0503_afs_ic_sbit[i][j]) - ((int)cB[j])); + + if (i == 0 || k < best) { + best = k; + id = i; + } + } + + return id; +} + /*! Perform channel decoding of a TCH/AFS channel according TS 05.03 * \param[out] tch_data Codec frame in RTP payload format * \param[in] bursts buffer containing the symbols of 8 bursts @@ -2157,7 +2177,7 @@ { sbit_t iB[912], cB[456], h; ubit_t d[244], p[6], conv[250]; - int i, j, k, best = 0, rv, len, steal = 0, id = -1; + int i, rv, len, steal = 0, id = -1; *n_errors = 0; *n_bits_total = 0; static ubit_t sid_first_dummy[64] = { 0 }; sbit_t sid_update_enc[256]; @@ -2236,18 +2256,8 @@ } } - for (i = 0; i < 4; i++) { - for (j = 0, k = 0; j < 8; j++) - k += abs(((int)gsm0503_afs_ic_sbit[i][j]) - ((int)cB[j])); - - if (i == 0 || k < best) { - best = k; - id = i; - } - } - - /* Check if indicated codec fits into range of codecs */ - if (id >= codecs) { + /* Parse codec ID (CMI or CMC/CMR) and check if it fits into range of codecs */ + if ((id = gsm0503_tch_afs_decode_inband(&cB[0])) >= codecs) { /* Codec mode out of range, return id */ return id; } @@ -2578,6 +2588,26 @@ return -1; } +/* TCH/AHS: parse codec ID (CMI or CMC/CMR) from coded in-band data (16 bit) */ +static uint8_t gsm0503_tch_ahs_decode_inband(const sbit_t *cB) +{ + unsigned int id = 0, best = 0; + unsigned int i, j, k; + + for (i = 0, k = 0; i < 4; i++) { + /* FIXME: why not using remaining (16 - 4) soft-bits here? */ + for (j = 0, k = 0; j < 4; j++) + k += abs(((int)gsm0503_ahs_ic_sbit[i][j]) - ((int)cB[j])); + + if (i == 0 || k < best) { + best = k; + id = i; + } + } + + return id; +} + /*! Perform channel decoding of a TCH/AFS channel according TS 05.03 * \param[out] tch_data Codec frame in RTP payload format * \param[in] bursts buffer containing the symbols of 8 bursts @@ -2622,7 +2652,7 @@ { sbit_t iB[912], cB[456], h; ubit_t d[244], p[6], conv[135]; - int i, j, k, best = 0, rv, len, steal = 0, id = -1; + int i, rv, len, steal = 0, id = -1; static ubit_t sid_first_dummy[64] = { 0 }; /* only unmap the stealing bits */ @@ -2738,18 +2768,8 @@ } } - for (i = 0; i < 4; i++) { - for (j = 0, k = 0; j < 4; j++) - k += abs(((int)gsm0503_ahs_ic_sbit[i][j]) - ((int)cB[j])); - - if (i == 0 || k < best) { - best = k; - id = i; - } - } - - /* Check if indicated codec fits into range of codecs */ - if (id >= codecs) { + /* Parse codec ID (CMI or CMC/CMR) and check if it fits into range of codecs */ + if ((id = gsm0503_tch_ahs_decode_inband(&cB[0])) >= codecs) { /* Codec mode out of range, return id */ return id; } 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/28177 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I0106de7a7f87517006e323299b2dc08457d1c6cf Gerrit-Change-Number: 28177 Gerrit-PatchSet: 4 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: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in libosmocore[master]: coding: add gsm0503_detect_a[fh]s_dtx_frame2()
by fixeria 27 May '22

27 May '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28176 ) Change subject: coding: add gsm0503_detect_a[fh]s_dtx_frame2() ...................................................................... coding: add gsm0503_detect_a[fh]s_dtx_frame2() The new functions accept an additional mode_id poiner, which is currently set for the following frames: AFS_ONSET, AHS_ONSET, AHS_SID_FIRST_P2 with N * 16 - M bit pattern. Also, the new API accepts soft-bits instead of hard-bits. Converting bits from soft to hard is now performed internally. Change-Id: Ibcac395f800bb64150c97fcdaca3523ecfc5fcee Related: OS#5570 --- M include/osmocom/coding/gsm0503_amr_dtx.h M src/coding/gsm0503_amr_dtx.c M src/coding/gsm0503_coding.c M src/coding/libosmocoding.map M tests/dtx/dtx_gsm0503_test.c M tests/dtx/dtx_gsm0503_test.ok 6 files changed, 158 insertions(+), 110 deletions(-) Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/coding/gsm0503_amr_dtx.h b/include/osmocom/coding/gsm0503_amr_dtx.h index f048a6e..dc22ec7 100644 --- a/include/osmocom/coding/gsm0503_amr_dtx.h +++ b/include/osmocom/coding/gsm0503_amr_dtx.h @@ -34,7 +34,14 @@ return get_value_string(gsm0503_amr_dtx_frame_names, frame); } -enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t *ubits); -enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t *ubits); +enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t *ubits) + OSMO_DEPRECATED("Use gsm0503_detect_afs_dtx_frame2() instead"); +enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t *ubits) + OSMO_DEPRECATED("Use gsm0503_detect_ahs_dtx_frame2() instead"); + +enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame2(int *n_errors, int *n_bits_total, + int *mode_id, const sbit_t *sbits); +enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame2(int *n_errors, int *n_bits_total, + int *mode_id, const sbit_t *sbits); /*! @} */ diff --git a/src/coding/gsm0503_amr_dtx.c b/src/coding/gsm0503_amr_dtx.c index b149330..7de3b28 100644 --- a/src/coding/gsm0503_amr_dtx.c +++ b/src/coding/gsm0503_amr_dtx.c @@ -1,5 +1,5 @@ /* - * (C) 2020 by sysmocom - s.f.m.c. GmbH, Author: Philipp Maier + * (C) 2020-2022 by sysmocom - s.f.m.c. GmbH, Author: Philipp Maier * All Rights Reserved * * SPDX-License-Identifier: GPL-2.0+ @@ -32,6 +32,8 @@ #include <osmocom/coding/gsm0503_parity.h> #include <osmocom/gsm/gsm0503.h> +#define S2U(b) ((b) < 0) + /* See also: 3GPP TS 05.03, chapter 3.10.1.3, 3.10.5.2 Identification marker */ static const ubit_t id_marker_1[] = { 1, 0, 1, 1, 0, 0, 0, 0, 1 }; @@ -60,7 +62,7 @@ { 0, NULL } }; -static bool detect_afs_id_marker(int *n_errors, int *n_bits_total, const ubit_t * ubits, uint8_t offset, uint8_t count, +static bool detect_afs_id_marker(int *n_errors, int *n_bits_total, const sbit_t *sbits, uint8_t offset, uint8_t count, const ubit_t * id_marker, uint8_t id_marker_len) { unsigned int i, k; @@ -69,20 +71,20 @@ int bits = 0; /* Override coded in-band data */ - ubits += offset; + sbits += offset; /* Check for identification marker bits */ for (i = 0; i < count; i++) { for (k = 0; k < 4; k++) { - if (id_marker[id_bit_nr % id_marker_len] != *ubits) + if (*sbits == 0 || id_marker[id_bit_nr % id_marker_len] != S2U(*sbits)) errors++; id_bit_nr++; - ubits++; + sbits++; bits++; } /* Jump to the next block of 4 bits */ - ubits += 4; + sbits += 4; } *n_errors = errors; @@ -92,30 +94,30 @@ return *n_errors < *n_bits_total / 8; } -static bool detect_ahs_id_marker(int *n_errors, int *n_bits_total, const ubit_t * ubits, const ubit_t * id_marker) +static bool detect_ahs_id_marker(int *n_errors, int *n_bits_total, const sbit_t *sbits, const ubit_t *id_marker) { unsigned int i, k; int errors = 0; int bits = 0; /* Override coded in-band data */ - ubits += 16; + sbits += 16; /* Check first identification marker bits (23*9 bits) */ for (i = 0; i < 23; i++) { for (k = 0; k < 9; k++) { - if (id_marker[k] != *ubits) + if (*sbits == 0 || id_marker[k] != S2U(*sbits)) errors++; - ubits++; + sbits++; bits++; } } /* Check remaining identification marker bits (5 bits) */ for (k = 0; k < 5; k++) { - if (id_marker[k] != *ubits) + if (*sbits == 0 || id_marker[k] != S2U(*sbits)) errors++; - ubits++; + sbits++; bits++; } @@ -126,7 +128,7 @@ return *n_errors < *n_bits_total / 8; } -static bool detect_interleaved_ahs_id_marker(int *n_errors, int *n_bits_total, const ubit_t * ubits, uint8_t offset, +static bool detect_interleaved_ahs_id_marker(int *n_errors, int *n_bits_total, const sbit_t *sbits, uint8_t offset, uint8_t n_bits, const ubit_t * id_marker, uint8_t id_marker_len) { unsigned int i, k; @@ -136,23 +138,23 @@ uint8_t remainder = n_bits % id_marker_len; /* Override coded in-band data */ - ubits += offset; + sbits += offset; /* Check first identification marker bits (23*9 bits) */ for (i = 0; i < full_rounds; i++) { for (k = 0; k < id_marker_len; k++) { - if (id_marker[k] != *ubits) + if (*sbits == 0 || id_marker[k] != S2U(*sbits)) errors++; - ubits += 2; + sbits += 2; bits++; } } /* Check remaining identification marker bits (5 bits) */ for (k = 0; k < remainder; k++) { - if (id_marker[k] != *ubits) + if (*sbits == 0 || id_marker[k] != S2U(*sbits)) errors++; - ubits += 2; + sbits += 2; bits++; } @@ -164,125 +166,127 @@ } /* Detect an FR AMR SID_FIRST frame by its identifcation marker */ -static bool detect_afs_sid_first(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static bool detect_afs_sid_first(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_afs_id_marker(n_errors, n_bits_total, ubits, 32, 53, id_marker_0, 9); + return detect_afs_id_marker(n_errors, n_bits_total, sbits, 32, 53, id_marker_0, 9); } /* Detect an FR AMR SID_UPDATE frame by its identification marker */ -static bool detect_afs_sid_update(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static bool detect_afs_sid_update(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_afs_id_marker(n_errors, n_bits_total, ubits, 36, 53, id_marker_0, 9); + return detect_afs_id_marker(n_errors, n_bits_total, sbits, 36, 53, id_marker_0, 9); } /* Detect an FR AMR ONSET frame by its repeating coded inband data */ -static bool detect_afs_onset(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static int detect_afs_onset(int *n_errors, int *n_bits_total, const sbit_t *sbits) { bool rc; - rc = detect_afs_id_marker(n_errors, n_bits_total, ubits, 4, 57, codec_mode_1_sid, 16); + rc = detect_afs_id_marker(n_errors, n_bits_total, sbits, 4, 57, codec_mode_1_sid, 16); if (rc) - return true; + return 0; - rc = detect_afs_id_marker(n_errors, n_bits_total, ubits, 4, 57, codec_mode_2_sid, 16); + rc = detect_afs_id_marker(n_errors, n_bits_total, sbits, 4, 57, codec_mode_2_sid, 16); if (rc) - return true; + return 1; - rc = detect_afs_id_marker(n_errors, n_bits_total, ubits, 4, 57, codec_mode_3_sid, 16); + rc = detect_afs_id_marker(n_errors, n_bits_total, sbits, 4, 57, codec_mode_3_sid, 16); if (rc) - return true; + return 2; - rc = detect_afs_id_marker(n_errors, n_bits_total, ubits, 4, 57, codec_mode_4_sid, 16); + rc = detect_afs_id_marker(n_errors, n_bits_total, sbits, 4, 57, codec_mode_4_sid, 16); if (rc) - return true; + return 3; - return false; + return -1; } /* Detect an HR AMR SID UPDATE frame by its identification marker */ -static bool detect_ahs_sid_update(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static bool detect_ahs_sid_update(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_ahs_id_marker(n_errors, n_bits_total, ubits, id_marker_1); + return detect_ahs_id_marker(n_errors, n_bits_total, sbits, id_marker_1); } /* Detect an HR AMR SID FIRST (part 1) frame by its identification marker */ -static bool detect_ahs_sid_first_p1(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static bool detect_ahs_sid_first_p1(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_ahs_id_marker(n_errors, n_bits_total, ubits, id_marker_0); + return detect_ahs_id_marker(n_errors, n_bits_total, sbits, id_marker_0); } /* Detect an HR AMR SID FIRST (part 2) frame by its repeating coded inband data */ -static bool detect_ahs_sid_first_p2(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static int detect_ahs_sid_first_p2(int *n_errors, int *n_bits_total, const sbit_t *sbits) { bool rc; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 0, 114, codec_mode_1_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 0, 114, codec_mode_1_sid, 16); if (rc) - return true; + return 0; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 0, 114, codec_mode_2_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 0, 114, codec_mode_2_sid, 16); if (rc) - return true; + return 1; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 0, 114, codec_mode_3_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 0, 114, codec_mode_3_sid, 16); if (rc) - return true; + return 2; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 0, 114, codec_mode_4_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 0, 114, codec_mode_4_sid, 16); if (rc) - return true; + return 3; - return false; + return -1; } /* Detect an HR AMR ONSET frame by its repeating coded inband data */ -static bool detect_ahs_onset(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static int detect_ahs_onset(int *n_errors, int *n_bits_total, const sbit_t *sbits) { bool rc; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 1, 114, codec_mode_1_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 1, 114, codec_mode_1_sid, 16); if (rc) - return true; + return 0; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 1, 114, codec_mode_2_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 1, 114, codec_mode_2_sid, 16); if (rc) - return true; + return 1; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 1, 114, codec_mode_3_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 1, 114, codec_mode_3_sid, 16); if (rc) - return true; + return 2; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 1, 114, codec_mode_4_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 1, 114, codec_mode_4_sid, 16); if (rc) - return true; + return 3; - return false; + return -1; } /* Detect an HR AMR SID FIRST INHIBIT frame by its identification marker */ -static bool detect_ahs_sid_first_inh(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static bool detect_ahs_sid_first_inh(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 33, 212, id_marker_1, 9); + return detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 33, 212, id_marker_1, 9); } /* Detect an HR AMR SID UPDATE INHIBIT frame by its identification marker */ -static bool detect_ahs_sid_update_inh(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static bool detect_ahs_sid_update_inh(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 33, 212, id_marker_0, 9); + return detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 33, 212, id_marker_0, 9); } /*! Detect FR AMR DTX frame in unmapped, deinterleaved frame bits. - * \param[in] ubits input bits (456 bit). * \param[out] n_errors number of errornous bits. * \param[out] n_bits_total number of checked bits. + * \param[out] mode_id codec mode ID (0..3 or -1). + * \param[in] sbits input soft-bits (456 bit). * \returns dtx frame type. */ -enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t * ubits) +enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame2(int *n_errors, int *n_bits_total, + int *mode_id, const sbit_t *sbits) { - if (detect_afs_sid_first(n_errors, n_bits_total, ubits)) + if (detect_afs_sid_first(n_errors, n_bits_total, sbits)) return AFS_SID_FIRST; - if (detect_afs_sid_update(n_errors, n_bits_total, ubits)) + if (detect_afs_sid_update(n_errors, n_bits_total, sbits)) return AFS_SID_UPDATE; - if (detect_afs_onset(n_errors, n_bits_total, ubits)) + if ((*mode_id = detect_afs_onset(n_errors, n_bits_total, sbits)) != -1) return AFS_ONSET; *n_errors = 0; @@ -290,27 +294,62 @@ return AMR_OTHER; } -/*! Detect HR AMR DTX frame in unmapped, deinterleaved frame bits. - * \param[in] ubits input bits (456 bit). +/*! Detect FR AMR DTX frame in unmapped, deinterleaved frame bits. + * DEPRECATED: use gsm0503_detect_afs_dtx_frame2() instead. * \param[out] n_errors number of errornous bits. * \param[out] n_bits_total number of checked bits. - * \returns dtx frame type, */ -enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t * ubits) + * \param[in] ubits input bits (456 bit). + * \returns dtx frame type. */ +enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame(int *n_errors, int *n_bits_total, + const ubit_t *ubits) { - if (detect_ahs_sid_update(n_errors, n_bits_total, ubits)) + int mode_id; /* unused */ + sbit_t sbits[456]; + + osmo_ubit2sbit(&sbits[0], &ubits[0], sizeof(sbits)); + return gsm0503_detect_afs_dtx_frame2(n_errors, n_bits_total, &mode_id, &sbits[0]); +} + +/*! Detect HR AMR DTX frame in unmapped, deinterleaved frame bits. + * \param[out] n_errors number of errornous bits. + * \param[out] n_bits_total number of checked bits. + * \param[out] mode_id codec ID (CMI or CMC/CMR). + * \param[out] mode_id codec mode ID (0..3 or -1). + * \param[in] sbits input soft-bits (456 bit). + * \returns dtx frame type, */ +enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame2(int *n_errors, int *n_bits_total, + int *mode_id, const sbit_t *sbits) +{ + if (detect_ahs_sid_update(n_errors, n_bits_total, sbits)) return AHS_SID_UPDATE; - if (detect_ahs_sid_first_inh(n_errors, n_bits_total, ubits)) + if (detect_ahs_sid_first_inh(n_errors, n_bits_total, sbits)) return AHS_SID_FIRST_INH; - if (detect_ahs_sid_update_inh(n_errors, n_bits_total, ubits)) + if (detect_ahs_sid_update_inh(n_errors, n_bits_total, sbits)) return AHS_SID_UPDATE_INH; - if (detect_ahs_sid_first_p1(n_errors, n_bits_total, ubits)) + if (detect_ahs_sid_first_p1(n_errors, n_bits_total, sbits)) return AHS_SID_FIRST_P1; - if (detect_ahs_sid_first_p2(n_errors, n_bits_total, ubits)) + if ((*mode_id = detect_ahs_sid_first_p2(n_errors, n_bits_total, sbits)) != -1) return AHS_SID_FIRST_P2; - if (detect_ahs_onset(n_errors, n_bits_total, ubits)) + if ((*mode_id = detect_ahs_onset(n_errors, n_bits_total, sbits)) != -1) return AHS_ONSET; *n_errors = 0; *n_bits_total = 0; return AMR_OTHER; } + +/*! Detect HR AMR DTX frame in unmapped, deinterleaved frame bits. + * DEPRECATED: use gsm0503_detect_ahs_dtx_frame2() instead. + * \param[out] n_errors number of errornous bits. + * \param[out] n_bits_total number of checked bits. + * \param[in] ubits input bits (456 bit). + * \returns dtx frame type, */ +enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame(int *n_errors, int *n_bits_total, + const ubit_t *ubits) +{ + int mode_id; /* unused */ + sbit_t sbits[456]; + + osmo_ubit2sbit(&sbits[0], &ubits[0], sizeof(sbits)); + return gsm0503_detect_ahs_dtx_frame2(n_errors, n_bits_total, &mode_id, &sbits[0]); +} diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index 2b59b7b..168e120 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -2158,7 +2158,6 @@ sbit_t iB[912], cB[456], h; ubit_t d[244], p[6], conv[250]; int i, j, k, best = 0, rv, len, steal = 0, id = -1; - ubit_t cBd[456]; *n_errors = 0; *n_bits_total = 0; static ubit_t sid_first_dummy[64] = { 0 }; sbit_t sid_update_enc[256]; @@ -2172,7 +2171,7 @@ if (steal > 0) { /* If not NULL, dtx indicates type of previously decoded TCH/AFS frame. - * It's normally updated by gsm0503_detect_afs_dtx_frame(), which is not + * It's normally updated by gsm0503_detect_afs_dtx_frame2(), which is not * reached in case of FACCH. Reset it here to avoid FACCH/F frames being * misinterpreted as AMR's special DTX frames. */ if (dtx != NULL) @@ -2190,8 +2189,7 @@ if (dtx) { const enum gsm0503_amr_dtx_frames dtx_prev = *dtx; - osmo_sbit2ubit(cBd, cB, 456); - *dtx = gsm0503_detect_afs_dtx_frame(n_errors, n_bits_total, cBd); + *dtx = gsm0503_detect_afs_dtx_frame2(n_errors, n_bits_total, &id, cB); switch (*dtx) { case AMR_OTHER: @@ -2230,7 +2228,7 @@ len = 5; goto out; case AFS_SID_UPDATE: /* TODO: parse CMI _and_ CMC/CMR (16 + 16 bit) */ - case AFS_ONSET: /* TODO: parse CMI or CMC/CMR (N * 16 - M bit) */ + case AFS_ONSET: len = 0; goto out; default: @@ -2625,7 +2623,6 @@ sbit_t iB[912], cB[456], h; ubit_t d[244], p[6], conv[135]; int i, j, k, best = 0, rv, len, steal = 0, id = -1; - ubit_t cBd[456]; static ubit_t sid_first_dummy[64] = { 0 }; /* only unmap the stealing bits */ @@ -2643,7 +2640,7 @@ /* if we found a stole FACCH, but only at correct alignment */ if (steal > 0) { /* If not NULL, dtx indicates type of previously decoded TCH/AHS frame. - * It's normally updated by gsm0503_detect_ahs_dtx_frame(), which is not + * It's normally updated by gsm0503_detect_ahs_dtx_frame2(), which is not * reached in case of FACCH. Reset it here to avoid FACCH/H frames being * misinterpreted as AMR's special DTX frames. */ if (dtx != NULL) @@ -2682,8 +2679,7 @@ int n_bits_total_sid; int n_errors_sid; - osmo_sbit2ubit(cBd, cB, 456); - *dtx = gsm0503_detect_ahs_dtx_frame(n_errors, n_bits_total, cBd); + *dtx = gsm0503_detect_ahs_dtx_frame2(n_errors, n_bits_total, &id, cB); /* TODO: detect and handle AHS_SID_UPDATE + AHS_SID_UPDATE_INH */ switch (*dtx) { @@ -2705,7 +2701,7 @@ osmo_conv_decode_ber(&gsm0503_tch_axs_sid_update, cB + 16, conv, &n_errors_sid, &n_bits_total_sid); - /* gsm0503_detect_ahs_dtx_frame() calculates BER for the marker, + /* gsm0503_detect_ahs_dtx_frame2() calculates BER for the marker, * osmo_conv_decode_ber() calculates BER for the coded data. */ if (n_errors != NULL) *n_errors += n_errors_sid; @@ -2724,14 +2720,14 @@ tch_amr_reassemble(tch_data, conv, 39); len = 5; goto out; - case AHS_SID_FIRST_P2: /* TODO: parse CMI or CMC/CMR (N * 16 - M bit) */ + case AHS_SID_FIRST_P2: tch_amr_sid_update_append(sid_first_dummy, 0, (codec_mode_req) ? codec[*ft] : codec[id > 0 ? id : 0]); tch_amr_reassemble(tch_data, sid_first_dummy, 39); len = 5; goto out; - case AHS_ONSET: /* TODO: parse CMI or CMC/CMR (N * 16 - M bit) */ + case AHS_ONSET: case AHS_SID_FIRST_INH: /* TODO: parse CMI or CMC/CMR (16 bit) */ case AHS_SID_UPDATE_INH: /* TODO: parse CMI or CMC/CMR (16 bit) */ case AHS_SID_FIRST_P1: /* TODO: parse CMI or CMC/CMR (16 bit) */ diff --git a/src/coding/libosmocoding.map b/src/coding/libosmocoding.map index 325b6d8..b083564 100644 --- a/src/coding/libosmocoding.map +++ b/src/coding/libosmocoding.map @@ -123,6 +123,8 @@ gsm0503_amr_dtx_frame_name; gsm0503_detect_afs_dtx_frame; gsm0503_detect_ahs_dtx_frame; +gsm0503_detect_afs_dtx_frame2; +gsm0503_detect_ahs_dtx_frame2; local: *; }; diff --git a/tests/dtx/dtx_gsm0503_test.c b/tests/dtx/dtx_gsm0503_test.c index fe4577e..21d1751 100644 --- a/tests/dtx/dtx_gsm0503_test.c +++ b/tests/dtx/dtx_gsm0503_test.c @@ -72,7 +72,7 @@ "xBxBxBxBxBxBxBxBxBxBxBxBxBxBxBxBx0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1" }; -unsigned int string_to_ubit(ubit_t * ubits, char *string) +unsigned int string_to_sbit(sbit_t *sbits, char *string) { unsigned int len; unsigned int i; @@ -80,7 +80,7 @@ len = strlen(string); for (i = 0; i < len; i++) { - ubits[i] = string[i] & 1; + sbits[i] = string[i] == '1' ? -127 : 127; } return len; @@ -88,28 +88,32 @@ void test_gsm0503_detect_afs_dtx_frame(char *string) { - ubit_t ubits[512]; + sbit_t sbits[512]; uint8_t dtx_frame_type; int n_errors; int n_bits_total; + int mode_id = -1; - string_to_ubit(ubits, string); - dtx_frame_type = gsm0503_detect_afs_dtx_frame(&n_errors, &n_bits_total, ubits); - printf(" ==> %s, n_errors=%i, n_bits_total=%i\n", gsm0503_amr_dtx_frame_name(dtx_frame_type), - n_errors, n_bits_total); + string_to_sbit(sbits, string); + dtx_frame_type = gsm0503_detect_afs_dtx_frame2(&n_errors, &n_bits_total, &mode_id, sbits); + printf(" ==> %s, n_errors=%d, n_bits_total=%d, mode_id=%d\n", + gsm0503_amr_dtx_frame_name(dtx_frame_type), + n_errors, n_bits_total, mode_id); } void test_gsm0503_detect_ahs_dtx_frame(char *string) { - ubit_t ubits[512]; + sbit_t sbits[512]; uint8_t dtx_frame_type; int n_errors; int n_bits_total; + int mode_id = -1; - string_to_ubit(ubits, string); - dtx_frame_type = gsm0503_detect_ahs_dtx_frame(&n_errors, &n_bits_total, ubits); - printf(" ==> %s, n_errors=%i, n_bits_total=%i\n", gsm0503_amr_dtx_frame_name(dtx_frame_type), - n_errors, n_bits_total); + string_to_sbit(sbits, string); + dtx_frame_type = gsm0503_detect_ahs_dtx_frame2(&n_errors, &n_bits_total, &mode_id, sbits); + printf(" ==> %s, n_errors=%d, n_bits_total=%d, mode_id=%d\n", + gsm0503_amr_dtx_frame_name(dtx_frame_type), + n_errors, n_bits_total, mode_id); } static void test_gsm0503_tch_afhs_decode_dtx(const sbit_t *bursts, size_t offset, diff --git a/tests/dtx/dtx_gsm0503_test.ok b/tests/dtx/dtx_gsm0503_test.ok index 60f3884..477d431 100644 --- a/tests/dtx/dtx_gsm0503_test.ok +++ b/tests/dtx/dtx_gsm0503_test.ok @@ -1,14 +1,14 @@ FR AMR DTX FRAMES: - ==> AFS_SID_FIRST, n_errors=0, n_bits_total=212 - ==> AFS_SID_UPDATE (marker), n_errors=0, n_bits_total=212 - ==> AFS_ONSET, n_errors=0, n_bits_total=228 + ==> AFS_SID_FIRST, n_errors=0, n_bits_total=212, mode_id=-1 + ==> AFS_SID_UPDATE (marker), n_errors=0, n_bits_total=212, mode_id=-1 + ==> AFS_ONSET, n_errors=0, n_bits_total=228, mode_id=0 HR AMR DTX FRAMES: - ==> AHS_SID_UPDATE (marker), n_errors=0, n_bits_total=212 - ==> AHS_SID_FIRST_P1, n_errors=0, n_bits_total=212 - ==> AHS_SID_FIRST_P2, n_errors=0, n_bits_total=114 - ==> AHS_ONSET, n_errors=0, n_bits_total=114 - ==> AHS_SID_FIRST_INH, n_errors=0, n_bits_total=212 - ==> AHS_SID_UPDATE_INH, n_errors=0, n_bits_total=212 + ==> AHS_SID_UPDATE (marker), n_errors=0, n_bits_total=212, mode_id=-1 + ==> AHS_SID_FIRST_P1, n_errors=0, n_bits_total=212, mode_id=-1 + ==> AHS_SID_FIRST_P2, n_errors=0, n_bits_total=114, mode_id=0 + ==> AHS_ONSET, n_errors=0, n_bits_total=114, mode_id=0 + ==> AHS_SID_FIRST_INH, n_errors=0, n_bits_total=212, mode_id=-1 + ==> AHS_SID_UPDATE_INH, n_errors=0, n_bits_total=212, mode_id=-1 Running test_gsm0503_tch_afhs_decode_dtx(at offset=0): testing detection of AFS_SID_UPDATE ==> gsm0503_tch_afs_decode_dtx() yields 'AFS_SID_UPDATE (marker)' (rc=0, BER 0/212) Running test_gsm0503_tch_afhs_decode_dtx(at offset=464): testing decoding of AFS_SID_UPDATE -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/28176 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ibcac395f800bb64150c97fcdaca3523ecfc5fcee Gerrit-Change-Number: 28176 Gerrit-PatchSet: 4 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: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in libosmocore[master]: coding: add gsm0503_detect_a[fh]s_dtx_frame2()
by fixeria 27 May '22

27 May '22
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28176 ) Change subject: coding: add gsm0503_detect_a[fh]s_dtx_frame2() ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/28176 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ibcac395f800bb64150c97fcdaca3523ecfc5fcee Gerrit-Change-Number: 28176 Gerrit-PatchSet: 3 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: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Fri, 27 May 2022 08:31:11 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-ccid-firmware[master]: contrib/jenkins.sh: skip upload if nothing new
by osmith 27 May '22

27 May '22
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/28186 ) Change subject: contrib/jenkins.sh: skip upload if nothing new ...................................................................... contrib/jenkins.sh: skip upload if nothing new The contrib/jenkins.sh script gets triggered daily. Do not upload new files unless a new commit was added (then the filename changes). Otherwise the binary and timestamp change on the server each day, which is confusing and potentially makes catching regressions harder. I've also considered disabling the daily trigger for this repository, but I think it's better to keep it so we notice without much delay if changes in libosmocore or the toolchain cause a build failure. Change-Id: I3f70d6149b29ec2ff7f185dfae8bc8d4a1953dc2 --- M contrib/jenkins.sh 1 file changed, 16 insertions(+), 8 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 7877dcf..961acf1 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -71,14 +71,22 @@ [ftp.osmocom.org]:48 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8iivY70EiR5NiGChV39gRLjNpC8lvu1ZdHtdMw2zuX EOF SSH_COMMAND="ssh -o 'UserKnownHostsFile=/build/known_hosts' -p 48" - rsync --archive --copy-links --verbose --compress --delete --rsh "$SSH_COMMAND" \ - $TOPDIR/sysmoOCTSIM/gcc/sysmoOCTSIM.{bin,elf} \ - binaries@ftp.osmocom.org:web-files/osmo-ccid-firmware/latest/ - rsync --archive --verbose --compress --rsh "$SSH_COMMAND" \ - --exclude $TOPDIR/sysmoOCTSIM/gcc/sysmoOCTSIM.bin \ - --exclude $TOPDIR/sysmoOCTSIM/gcc/sysmoOCTSIM.elf \ - $TOPDIR/sysmoOCTSIM/gcc/*-*.{bin,elf} \ - binaries@ftp.osmocom.org:web-files/osmo-ccid-firmware/all/ + LATEST_BIN="$(cd "$TOPDIR"/sysmoOCTSIM/gcc/; ls -1 sysmoOCTSIM-*-*.bin)" + + echo "LATEST_BIN: $LATEST_BIN" + + if rsync --rsh "$SSH_COMMAND" binaries@ftp.osmocom.org:web-files/osmo-ccid-firmware/all/ | grep -q "$LATEST_BIN"; then + echo "Skipping upload, $LATEST_BIN has already been uploaded." + else + rsync --archive --copy-links --verbose --compress --delete --rsh "$SSH_COMMAND" \ + $TOPDIR/sysmoOCTSIM/gcc/sysmoOCTSIM.{bin,elf} \ + binaries@ftp.osmocom.org:web-files/osmo-ccid-firmware/latest/ + rsync --archive --verbose --compress --rsh "$SSH_COMMAND" \ + --exclude $TOPDIR/sysmoOCTSIM/gcc/sysmoOCTSIM.bin \ + --exclude $TOPDIR/sysmoOCTSIM/gcc/sysmoOCTSIM.elf \ + $TOPDIR/sysmoOCTSIM/gcc/*-*.{bin,elf} \ + binaries@ftp.osmocom.org:web-files/osmo-ccid-firmware/all/ + fi fi echo -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/28186 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-Change-Id: I3f70d6149b29ec2ff7f185dfae8bc8d4a1953dc2 Gerrit-Change-Number: 28186 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in libosmocore[master]: coding: add gsm0503_detect_a[fh]s_dtx_frame2()
by osmith 27 May '22

27 May '22
Attention is currently required from: fixeria. osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28176 ) Change subject: coding: add gsm0503_detect_a[fh]s_dtx_frame2() ...................................................................... Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/28176 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ibcac395f800bb64150c97fcdaca3523ecfc5fcee Gerrit-Change-Number: 28176 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 27 May 2022 08:26:47 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • ...
  • 135
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.