aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-04-30 20:13:32 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-04-30 20:22:25 +0200
commit27d6af5edbac8a165eb497515dc35b63be441578 (patch)
treea19351b52aac6ca63b0a33db8947006361bfdb30 /library
parent0b8e22be4668515322cbf96230bd7ada3f56d0fb (diff)
RLCMAC_Templates: Add functions to convert HeaderType<->MCS<->CPS
They will be used by tests, templates and RLCMAC_EncDec.cc itself. MCS HEader Type 1 and 2 to CPS conversion lefts as a TODO with placeholder functions to easily implement when needed. Change-Id: I18ff55a8067165bf081bf21473b4f88af955bf5b
Diffstat (limited to 'library')
-rw-r--r--library/RLCMAC_Templates.ttcn176
-rw-r--r--library/RLCMAC_Types.ttcn1
2 files changed, 177 insertions, 0 deletions
diff --git a/library/RLCMAC_Templates.ttcn b/library/RLCMAC_Templates.ttcn
index 8fb6b0c1..d2174d7b 100644
--- a/library/RLCMAC_Templates.ttcn
+++ b/library/RLCMAC_Templates.ttcn
@@ -29,6 +29,22 @@ module RLCMAC_Templates {
return 0;
}
+ function f_rlcmac_mcs2headertype(CodingScheme mcs) return EgprsHeaderType {
+ select (mcs) {
+ case (MCS_0) { return RLCMAC_HDR_TYPE_3; }
+ case (MCS_1) { return RLCMAC_HDR_TYPE_3; }
+ case (MCS_2) { return RLCMAC_HDR_TYPE_3; }
+ case (MCS_3) { return RLCMAC_HDR_TYPE_3; }
+ case (MCS_4) { return RLCMAC_HDR_TYPE_3; }
+ case (MCS_5) { return RLCMAC_HDR_TYPE_2; }
+ case (MCS_6) { return RLCMAC_HDR_TYPE_2; }
+ case (MCS_7) { return RLCMAC_HDR_TYPE_1; }
+ case (MCS_8) { return RLCMAC_HDR_TYPE_1; }
+ case (MCS_9) { return RLCMAC_HDR_TYPE_1; }
+ }
+ return RLCMAC_HDR_TYPE_3;
+ }
+
function f_rlcmac_cs_mcs2block_len(CodingScheme cs_mcs) return uint32_t {
select (cs_mcs) {
case (CS_1) { return 23; }
@@ -72,6 +88,166 @@ module RLCMAC_Templates {
return CS_1;
}
+ /* Coding and Puncturing Scheme indicator field for Header type 1 in EGPRS TBF or EC TBF or downlink EGPRS2 TBF */
+ function f_rlcmac_cps_htype1_to_mcs(uint3_t cps) return CodingScheme {
+ var CodingSchemeArray egprs_Header_type1_coding_puncturing_scheme_to_mcs := {
+ MCS_9 /* 0x00, "(MCS-9/P1 ; MCS-9/P1)" */,
+ MCS_9 /* 0x01, "(MCS-9/P1 ; MCS-9/P2)" */,
+ MCS_9 /* 0x02, "(MCS-9/P1 ; MCS-9/P3)" */,
+ MCS_0 /* 0x03, "reserved" */,
+ MCS_9 /* 0x04, "(MCS-9/P2 ; MCS-9/P1)" */,
+ MCS_9 /* 0x05, "(MCS-9/P2 ; MCS-9/P2)" */,
+ MCS_9 /* 0x06, "(MCS-9/P2 ; MCS-9/P3)" */,
+ MCS_0 /* 0x07, "reserved" */,
+ MCS_9 /* 0x08, "(MCS-9/P3 ; MCS-9/P1)" */,
+ MCS_9 /* 0x09, "(MCS-9/P3 ; MCS-9/P2)" */,
+ MCS_9 /* 0x0A, "(MCS-9/P3 ; MCS-9/P3)" */,
+ MCS_8 /* 0x0B, "(MCS-8/P1 ; MCS-8/P1)" */,
+ MCS_8 /* 0x0C, "(MCS-8/P1 ; MCS-8/P2)" */,
+ MCS_8 /* 0x0D, "(MCS-8/P1 ; MCS-8/P3)" */,
+ MCS_8 /* 0x0E, "(MCS-8/P2 ; MCS-8/P1)" */,
+ MCS_8 /* 0x0F, "(MCS-8/P2 ; MCS-8/P2)" */,
+ MCS_8 /* 0x10, "(MCS-8/P2 ; MCS-8/P3)" */,
+ MCS_8 /* 0x11, "(MCS-8/P3 ; MCS-8/P1)" */,
+ MCS_8 /* 0x12, "(MCS-8/P3 ; MCS-8/P2)" */,
+ MCS_8 /* 0x13, "(MCS-8/P3 ; MCS-8/P3)" */,
+ MCS_7 /* 0x14, "(MCS-7/P1 ; MCS-7/P1)" */,
+ MCS_7 /* 0x15, "(MCS-7/P1 ; MCS-7/P2)" */,
+ MCS_7 /* 0x16, "(MCS-7/P1 ; MCS-7/P3)" */,
+ MCS_7 /* 0x17, "(MCS-7/P2 ; MCS-7/P1)" */,
+ MCS_7 /* 0x18, "(MCS-7/P2 ; MCS-7/P2)" */,
+ MCS_7 /* 0x19, "(MCS-7/P2 ; MCS-7/P3)" */,
+ MCS_7 /* 0x1A, "(MCS-7/P3 ; MCS-7/P1)" */,
+ MCS_7 /* 0x1B, "(MCS-7/P3 ; MCS-7/P2)" */,
+ MCS_7 /* 0x1C, "(MCS-7/P3 ; MCS-7/P3)" */,
+ MCS_0 /* 0x1D, "reserved" */,
+ MCS_0 /* 0x1E, "reserved" */,
+ MCS_0 /* 0x1F, "reserved" */
+ };
+ return egprs_Header_type1_coding_puncturing_scheme_to_mcs[cps];
+ }
+
+ /* Coding and Puncturing Scheme indicator field for Header type 2 in (EC-)EGPRS TBF or uplink EGPRS2-A TBF */
+ function f_rlcmac_cps_htype2_to_mcs(uint3_t cps) return CodingScheme {
+ var CodingSchemeArray egprs_Header_type2_coding_puncturing_scheme_to_mcs := {
+ MCS_6 /* {0x00, "MCS-6/P1"} */,
+ MCS_6 /* {0x01, "MCS-6/P2"} */,
+ MCS_6 /* {0x02, "MCS-6/P1 with 6 octet padding"} */,
+ MCS_6 /* {0x03, "MCS-6/P2 with 6 octet padding "} */,
+ MCS_5 /* {0x04, "MCS-5/P1"} */,
+ MCS_5 /* {0x05, "MCS-5/P2"} */,
+ MCS_5 /* {0x06, "MCS-6/P1 with 10 octet padding "} */,
+ MCS_5 /* {0x07, "MCS-6/P2 with 10 octet padding "} */
+ };
+ return egprs_Header_type2_coding_puncturing_scheme_to_mcs[cps];
+ }
+
+ /* Coding and Puncturing Scheme indicator field for Header type 3 */
+ function f_rlcmac_cps_htype3_to_mcs(uint3_t cps) return CodingScheme {
+ var CodingSchemeArray egprs_Header_type3_coding_puncturing_scheme_to_mcs := {
+ MCS_4 /* {0x00, "MCS-4/P1"} */,
+ MCS_4 /* {0x01, "MCS-4/P2"} */,
+ MCS_4 /* {0x02, "MCS-4/P3"} */,
+ MCS_3 /* {0x03, "MCS-3/P1"} */,
+ MCS_3 /* {0x04, "MCS-3/P2"} */,
+ MCS_3 /* {0x05, "MCS-3/P3"} */,
+ MCS_3 /* {0x06, "MCS-3/P1 with padding"} */,
+ MCS_3 /* {0x07, "MCS-3/P2 with padding"} */,
+ MCS_3 /* {0x08, "MCS-3/P3 with padding"} */,
+ MCS_2 /* {0x09, "MCS-2/P1"} */,
+ MCS_2 /* {0x0A, "MCS-2/P2"} */,
+ MCS_1 /* {0x0B, "MCS-1/P1"} */,
+ MCS_1 /* {0x0C, "MCS-1/P2"} */,
+ MCS_2 /* {0x0D, "MCS-2/P1 with padding"} */,
+ MCS_2 /* {0x0E, "MCS-2/P2 with padding"} */,
+ MCS_0 /* {0x0F, "MCS-0"} */
+ };
+ return egprs_Header_type3_coding_puncturing_scheme_to_mcs[cps];
+ }
+
+ function f_rlcmac_cps_htype_to_mcs(uint3_t cps, EgprsHeaderType htype) return CodingScheme {
+ select (htype) {
+ case (RLCMAC_HDR_TYPE_1) { return f_rlcmac_cps_htype1_to_mcs(cps); }
+ case (RLCMAC_HDR_TYPE_2) { return f_rlcmac_cps_htype2_to_mcs(cps); }
+ case (RLCMAC_HDR_TYPE_3) { return f_rlcmac_cps_htype3_to_mcs(cps); }
+ }
+ //TODO: return error here.
+ return CS_1;
+ }
+
+ function f_rlcmac_mcs_to_cps_htype1(CodingScheme mcs, uint2_t part, boolean with_padding) return uint5_t {
+ //TODO: implement similar to f_rlcmac_mcs_to_cps_htype3()
+ //TODO: return error here.
+ return 0;
+ }
+
+ function f_rlcmac_mcs_to_cps_htype2(CodingScheme mcs, uint2_t part, boolean with_padding) return uint5_t {
+ //TODO: implement similar to f_rlcmac_mcs_to_cps_htype3()
+ //TODO: return error here.
+ return 0;
+ }
+
+ function f_rlcmac_mcs_to_cps_htype3(CodingScheme mcs, uint2_t part, boolean with_padding) return uint5_t {
+ select (mcs) {
+ case (MCS_4) {
+ select (part) {
+ case (1) { return 0; /* {0x00, "MCS-4/P1"} */ }
+ case (2) { return 1; /* {0x01, "MCS-4/P2"} */ }
+ case (3) { return 2; /* {0x01, "MCS-4/P2"} */ }
+ }
+ }
+ case (MCS_3) {
+ if (not with_padding) {
+ select (part) {
+ case (1) { return 3; /* {0x03, "MCS-3/P1"} */ }
+ case (2) { return 4; /* {0x04, "MCS-3/P2"} */ }
+ case (3) { return 5; /* {0x05, "MCS-3/P3"} */ }
+ }
+ } else {
+ select (part) {
+ case (1) { return 6; /* {0x06, "MCS-3/P1 with padding"} */ }
+ case (2) { return 7; /* {0x07, "MCS-3/P2 with padding"} */ }
+ case (3) { return 8; /* {0x08, "MCS-3/P3 with padding"} */ }
+ }
+ }
+ }
+ case (MCS_2) {
+ if (not with_padding) {
+ select (part) {
+ case (1) { return 9; /* {0x09, "MCS-2/P1"} */ }
+ case (2) { return 10; /* {0x0A, "MCS-2/P2"} */ }
+ }
+ } else {
+ select (part) {
+ case (1) { return 13; /* {0x0D, "MCS-2/P1 with padding"} */ }
+ case (2) { return 14; /* {0x0E, "MCS-2/P2 with padding"} */}
+ }
+ }
+ }
+ case (MCS_1) {
+ select (part) {
+ case (1) { return 11; /* {0x0B, "MCS-1/P1"} */ }
+ case (2) { return 12; /* {0x0C, "MCS-1/P2"} */ }
+ }
+ }
+ case (MCS_0) { return 15; /* {0x0F, "MCS-0"} */ }
+ }
+ //TODO: return error here.
+ return 0;
+ }
+
+ function f_rlcmac_mcs_to_cps(CodingScheme mcs, uint2_t part, boolean with_padding := false) return uint5_t {
+
+ var EgprsHeaderType htype := f_rlcmac_mcs2headertype(mcs);
+ select (htype) {
+ case (RLCMAC_HDR_TYPE_1) { return f_rlcmac_mcs_to_cps_htype1(mcs, part, with_padding); }
+ case (RLCMAC_HDR_TYPE_2) { return f_rlcmac_mcs_to_cps_htype2(mcs, part, with_padding); }
+ case (RLCMAC_HDR_TYPE_3) { return f_rlcmac_mcs_to_cps_htype3(mcs, part, with_padding); }
+ }
+ //TODO: return error here.
+ return 0;
+ }
+
template (value) RlcmacUlBlock ts_RLC_UL_CTRL_ACK(RlcmacUlCtrlMsg ctrl,
MacPayloadType pt := MAC_PT_RLCMAC_NO_OPT,
boolean retry := false) := {
diff --git a/library/RLCMAC_Types.ttcn b/library/RLCMAC_Types.ttcn
index 27c18054..96b8a647 100644
--- a/library/RLCMAC_Types.ttcn
+++ b/library/RLCMAC_Types.ttcn
@@ -55,6 +55,7 @@ module RLCMAC_Types {
//MCS5_7, ?
// MCS6_9 ?
};
+ type record of CodingScheme CodingSchemeArray;
/* Partof DL RLC data block and DL RLC/MAC ctrl block */
type record DlMacHeader {