pespin has uploaded this change for review.

View Change

bts: Test AMR in TC_speech_rtp_tch{h,f}()

Related: SYS#5987
Requires: osmocom-bb.git Ib80be434c06d07b3611bd18ae25dff8b14a7aad9 (trxcon)
Change-Id: I8cf7792a00b0a858f6a02bf5cb0d283484b820eb
---
M bts/BTS_Tests.ttcn
M bts/gen_links.sh
2 files changed, 56 insertions(+), 3 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/72/29272/1
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 646e5bf..ea53212 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -47,6 +47,8 @@
import from RSL_Emulation all;
import from RTP_Emulation all;

+import from AMR_Types all;
+
import from IPL4asp_Types all;
import from TRXC_Types all;
import from TRXC_CodecPort all;
@@ -2542,6 +2544,28 @@
g_first_meas_res := true;
}

+private function get_start_amr_ft() runs on ConnHdlr return integer {
+ var integer start_nth;
+ if (g_pars.mr_conf.icmi) {
+ start_nth := 0; /* FIXME: implement 3GPP TS 45.009 3.4.3 */
+ } else {
+ start_nth := g_pars.mr_conf.start_mode;
+ }
+
+ var integer n := 0;
+ for (var integer i:= 7; i >= 0; i := i - 1) {
+ if (g_pars.mr_conf.amr_codec_modes[i] == '1'B) {
+ if (n == start_nth) {
+ return 7 - i;
+ }
+ n := n + 1;
+ }
+ }
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("mr_conf is wrong! ", g_pars.mr_conf));
+ return 0;
+}
+
/* Initialize and start the RTP emulation component for a ConnHdlr */
friend function f_rtpem_activate(inout octetstring payload,
RtpemConfig cfg := c_RtpemDefaultCfg,
@@ -2566,7 +2590,27 @@
{ payload_len := 15; hdr := '00'O; }
case (tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2)) /* TCH/EFS */
{ payload_len := 31; hdr := 'C0'O; }
- case else { /* FIXME: also handle TCH/AFS and TCH/AHS */
+ case (tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3)) /* TCH/AFS */
+ {
+ var integer amr_ft := get_start_amr_ft();
+ payload_len := f_amrft_payload_len(amr_ft) + 2;
+ hdr := bit2oct(int2bit(amr_ft, 4) & /*CMR: */
+ '00000'B & /* padding */
+ int2bit(amr_ft, 4) & /* FT */
+ '1'B & /* q */
+ '00'B); /* padding */
+ }
+ case (tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3)) /* TCH/AHS */
+ {
+ var integer amr_ft := get_start_amr_ft();
+ payload_len := f_amrft_payload_len(amr_ft) + 2;
+ hdr := bit2oct(int2bit(amr_ft, 4) & /*CMR: */
+ '00000'B & /* padding */
+ int2bit(amr_ft, 4) & /* FT */
+ '1'B & /* q */
+ '00'B); /* padding */
+ }
+ case else {
setverdict(fail, "Unhandled RSL channel mode := ", g_pars.chan_mode);
Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
}
@@ -8147,7 +8191,11 @@
vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars);
vc_conn.done;

- /* TODO: also test V3 (AMR codec) */
+ /* TS1, TCH/F, V3 (AMR codec) */
+ pars := valueof(t_Pars(ts_RslChanNr_Bm(1), ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3)));
+ pars.mr_conf := valueof(ts_RSL_MultirateCfg(false, 0, '00000100'B /* 5,90k */));
+ vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars);
+ vc_conn.done;

Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
}
@@ -8162,7 +8210,11 @@
vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars);
vc_conn.done;

- /* TODO: also test V3 (AMR codec) */
+ /* TS1, TCH/H0, V3 (AMR codec) */
+ pars := valueof(t_Pars(ts_RslChanNr_Lm(5, 0), ts_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3)));
+ pars.mr_conf := valueof(ts_RSL_MultirateCfg(false, 0, '00000100'B /* 5,90k */));
+ vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars);
+ vc_conn.done;

Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
}
diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index c8c2b98..b7ba2cc 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -44,6 +44,7 @@
FILES+="L3_Templates.ttcn L3_Common.ttcn "
FILES+="Native_Functions.ttcn Native_FunctionDefs.cc "
FILES+="TRXC_Types.ttcn TRXC_CodecPort.ttcn TRXC_CodecPort_CtrlFunct.ttcn TRXC_CodecPort_CtrlFunctDef.cc "
+FILES+="AMR_Types.ttcn "
FILES+="RTP_CodecPort.ttcn RTP_Emulation.ttcn IuUP_Types.ttcn IuUP_Emulation.ttcn IuUP_EncDec.cc "
FILES+="RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc "
FILES+="PCUIF_Types.ttcn PCUIF_CodecPort.ttcn "

To view, visit change 29272. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8cf7792a00b0a858f6a02bf5cb0d283484b820eb
Gerrit-Change-Number: 29272
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange