From f097a8b94ee6a2f70d90709323b55d1bea7a4480 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 16 Sep 2018 18:11:26 +0200 Subject: GSM_Types: Add CBCH_Block definition of TS 04.12 Change-Id: Ib034aba11a0219959c4224238e559ba36e95cacf --- library/GSM_Types.ttcn | 42 ++++++++++++++++++++++++++++++++++++++++++ library/General_Types.ttcn | 1 + 2 files changed, 43 insertions(+) diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn index 53208e5d..88be9757 100644 --- a/library/GSM_Types.ttcn +++ b/library/GSM_Types.ttcn @@ -207,6 +207,48 @@ module GSM_Types { } } + +/* TS 04.12 Section 3.3.1 Block type */ +type record CBCH_BlockType { + BIT1 spare, + BIT2 lpd, + boolean last_block, + uint4_t seq_nr +}; +template (value) CBCH_BlockType ts_CBCH_BlockType(template (value) uint4_t seq_nr, template (value) boolean last_block) := { + spare := '0'B, + lpd := '01'B, + last_block := last_block, + seq_nr := seq_nr +}; +template CBCH_BlockType tr_CBCH_BlockType(template uint4_t seq_nr := ?, template boolean last_block := ?) := { + spare := '0'B, + lpd := '01'B, + last_block := last_block, + seq_nr := seq_nr +}; + +/* TS 04.12 Section 3.3 */ +type record CBCH_Block { + CBCH_BlockType block_type, + OCT22 payload +}; +template (value) CBCH_Block ts_CBCH_Block(template (value) uint4_t seq_nr, template (value) boolean last_block, template (value) OCT22 payload) := { + block_type := ts_CBCH_BlockType(seq_nr, last_block), + payload := payload +}; +template CBCH_Block tr_CBCH_Block(template uint4_t seq_nr := ?, template boolean last_block := ?, template OCT22 payload := ?) := { + block_type := tr_CBCH_BlockType(seq_nr, last_block), + payload := payload +}; + + +external function enc_CBCH_Block(in CBCH_Block msg) return octetstring + with { extension "prototype(convert) encode(RAW)" }; +external function dec_CBCH_Block(in octetstring stream) return CBCH_Block + with { extension "prototype(convert) decode(RAW)" }; + + /* Convert RF signal level in dBm to RxLev (TS 45.008 Chapter 8.1.4) */ function dbm2rxlev(integer dbm) return uint6_t { var integer rxlev := dbm + 110; diff --git a/library/General_Types.ttcn b/library/General_Types.ttcn index 83b2a422..612d5c7e 100644 --- a/library/General_Types.ttcn +++ b/library/General_Types.ttcn @@ -233,6 +233,7 @@ group SimpleRAWEncodedTypes { type octetstring OCT18 length(18) with { variant "FIELDLENGTH(18)" }; type octetstring OCT19 length(19) with { variant "FIELDLENGTH(19)" }; type octetstring OCT20 length(20) with { variant "FIELDLENGTH(20)" }; + type octetstring OCT22 length(22) with { variant "FIELDLENGTH(22)" }; type octetstring OCT32 length(32) with { variant "FIELDLENGTH(32)" }; type octetstring OCT34 length(34) with { variant "FIELDLENGTH(34)" }; type octetstring OCT46 length(46) with { variant "FIELDLENGTH(46)" }; -- cgit v1.2.3