blob: 8f0346d2ac287a3ed82b5f527d686d2273344859 [file] [log] [blame]
Vadim Yanitskiy0df8c942020-05-02 16:23:35 +07001/**
2 * GSM Rest Octets definitions as per 3GPP TS 44.018.
3 *
4 * (C) 2020 Vadim Yanitskiy <axilirator@gmail.com>
5 * All rights reserved.
6 *
7 * Released under the terms of GNU General Public License, Version 2 or
8 * (at your option) any later version.
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13module GSM_RestOctets {
14
15import from General_Types all;
16import from Osmocom_Types all;
17
18/* 10.5.2.34 SI 3 Rest Octets */
19type record SI3RestOctets {
20 SelectionParamsOpt sel_params,
21 PowerOffsetOpt pwr_offset,
22 BIT1 si_2ter_ind,
23 BIT1 early_cm_ind,
24 SchedIfAndWhere sched_where,
25 GPRSIndicatorOpt gprs_ind,
26 BIT1 umts_early_cm_ind,
27 SI2quaterIndicatorOpt si2_quater_ind,
28 BIT1 iu_mode_ind ('1'B) optional,
29 SI21IndicatorOpt si21_ind optional
30 /* ... spare padding ... */
31} with {
32 variant (si_2ter_ind) "CSN.1 L/H"
33 variant (early_cm_ind) "CSN.1 L/H"
34 variant (umts_early_cm_ind) "CSN.1 L/H"
35
36 /* If Iu mode is not supported in the cell, the Iu Indicator is not sent
37 * within this cell. Iu Indicator is included if and only if GPRS is
38 * not supported, and Iu mode is supported in the cell. */
39 variant (iu_mode_ind) "PRESENCE(gprs_ind.presence = '0'B)"
40 /* SI21 field is only present if 'WHERE' information is not present. */
41 variant (si21_ind) "PRESENCE(sched_where.presence = '0'B)"
42};
43
44/* Selection Parameters */
45type record SelectionParams {
46 boolean cbq,
47 uint6_t cr_offset,
48 uint3_t temp_offset,
49 uint5_t penalty_time
50} with {
51 variant (cbq) "FIELDLENGTH(1)"
52};
53
54/* Optional Selection Parameters: L | H < Selection Parameters > */
55type record SelectionParamsOpt {
56 BIT1 presence, // L/H
57 SelectionParams params optional
58} with {
59 variant (presence) "CSN.1 L/H"
60 variant (params) "PRESENCE(presence = '1'B)"
61};
62
63/* Optional Power Offset: L | H < Power Offset bit(2) > */
64type record PowerOffsetOpt {
65 BIT1 presence, // L/H
66 uint2_t offset optional
67} with {
68 variant (presence) "CSN.1 L/H"
69 variant (offset) "PRESENCE(presence = '1'B)"
70};
71
72/* Scheduling if and where: L | H < WHERE bit(3) > */
73type record SchedIfAndWhere {
74 BIT1 presence, // L/H
75 uint3_t where optional
76} with {
77 variant (presence) "CSN.1 L/H"
78 variant (where) "PRESENCE(presence = '1'B)"
79};
80
81type record GPRSIndicator {
82 uint3_t ra_colour,
83 BIT1 si13_pos
84} with { variant "" };
85
86/* Optional GPRS Indicator: L | H < GPRS Indicator > */
87type record GPRSIndicatorOpt {
88 BIT1 presence, // L/H
89 GPRSIndicator ind optional
90} with {
91 variant (presence) "CSN.1 L/H"
92 variant (ind) "PRESENCE(presence = '1'B)"
93};
94
95/* Optional SI2quater Indicator: L | H < SI2quater Indicator > */
96type record SI2quaterIndicatorOpt {
97 BIT1 presence, // L/H
98 BIT1 ind optional
99} with {
100 variant (presence) "CSN.1 L/H"
101 variant (ind) "PRESENCE(presence = '1'B)"
102};
103
104/* Optional SI21 Indicator: L | H < SI21 Position > */
105type record SI21IndicatorOpt {
106 BIT1 presence, // L/H
107 BIT1 pos optional
108} with {
109 variant (presence) "CSN.1 L/H"
110 variant (pos) "PRESENCE(presence = '1'B)"
111};
112
113external function enc_SI3RestOctets(in SI3RestOctets ro) return octetstring
114 with { extension "prototype(convert) encode(RAW)" };
115external function dec_SI3RestOctets(in octetstring stream) return SI3RestOctets
116 with { extension "prototype(convert) decode(RAW)" };
117
118
119} with { encode "RAW"; variant "FIELDORDER(msb)" }