Vadim Yanitskiy | 0df8c94 | 2020-05-02 16:23:35 +0700 | [diff] [blame] | 1 | /** |
| 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 | |
| 13 | module GSM_RestOctets { |
| 14 | |
| 15 | import from General_Types all; |
| 16 | import from Osmocom_Types all; |
| 17 | |
| 18 | /* 10.5.2.34 SI 3 Rest Octets */ |
| 19 | type 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 | |
Vadim Yanitskiy | 72add6d | 2020-05-03 21:46:42 +0700 | [diff] [blame^] | 44 | /* 10.5.2.35 SI 4 Rest Octets (O & S) */ |
| 45 | type record SI4RestOctets { |
| 46 | SelectionParamsOpt sel_params, |
| 47 | PowerOffsetOpt pwr_offset, |
| 48 | GPRSIndicatorOpt gprs_ind, |
| 49 | BIT1 s_presence, // L/H |
| 50 | /* TODO: optional "Rest Octets S" part */ |
| 51 | bitstring s optional |
| 52 | } with { |
| 53 | variant (s_presence) "CSN.1 L/H" |
| 54 | variant (s) "PRESENCE(s_presence = '1'B)" |
| 55 | }; |
| 56 | |
Vadim Yanitskiy | 0df8c94 | 2020-05-02 16:23:35 +0700 | [diff] [blame] | 57 | /* Selection Parameters */ |
| 58 | type record SelectionParams { |
| 59 | boolean cbq, |
| 60 | uint6_t cr_offset, |
| 61 | uint3_t temp_offset, |
| 62 | uint5_t penalty_time |
| 63 | } with { |
| 64 | variant (cbq) "FIELDLENGTH(1)" |
| 65 | }; |
| 66 | |
| 67 | /* Optional Selection Parameters: L | H < Selection Parameters > */ |
| 68 | type record SelectionParamsOpt { |
| 69 | BIT1 presence, // L/H |
| 70 | SelectionParams params optional |
| 71 | } with { |
| 72 | variant (presence) "CSN.1 L/H" |
| 73 | variant (params) "PRESENCE(presence = '1'B)" |
| 74 | }; |
| 75 | |
| 76 | /* Optional Power Offset: L | H < Power Offset bit(2) > */ |
| 77 | type record PowerOffsetOpt { |
| 78 | BIT1 presence, // L/H |
| 79 | uint2_t offset optional |
| 80 | } with { |
| 81 | variant (presence) "CSN.1 L/H" |
| 82 | variant (offset) "PRESENCE(presence = '1'B)" |
| 83 | }; |
| 84 | |
| 85 | /* Scheduling if and where: L | H < WHERE bit(3) > */ |
| 86 | type record SchedIfAndWhere { |
| 87 | BIT1 presence, // L/H |
| 88 | uint3_t where optional |
| 89 | } with { |
| 90 | variant (presence) "CSN.1 L/H" |
| 91 | variant (where) "PRESENCE(presence = '1'B)" |
| 92 | }; |
| 93 | |
| 94 | type record GPRSIndicator { |
| 95 | uint3_t ra_colour, |
| 96 | BIT1 si13_pos |
| 97 | } with { variant "" }; |
| 98 | |
| 99 | /* Optional GPRS Indicator: L | H < GPRS Indicator > */ |
| 100 | type record GPRSIndicatorOpt { |
| 101 | BIT1 presence, // L/H |
| 102 | GPRSIndicator ind optional |
| 103 | } with { |
| 104 | variant (presence) "CSN.1 L/H" |
| 105 | variant (ind) "PRESENCE(presence = '1'B)" |
| 106 | }; |
| 107 | |
| 108 | /* Optional SI2quater Indicator: L | H < SI2quater Indicator > */ |
| 109 | type record SI2quaterIndicatorOpt { |
| 110 | BIT1 presence, // L/H |
| 111 | BIT1 ind optional |
| 112 | } with { |
| 113 | variant (presence) "CSN.1 L/H" |
| 114 | variant (ind) "PRESENCE(presence = '1'B)" |
| 115 | }; |
| 116 | |
| 117 | /* Optional SI21 Indicator: L | H < SI21 Position > */ |
| 118 | type record SI21IndicatorOpt { |
| 119 | BIT1 presence, // L/H |
| 120 | BIT1 pos optional |
| 121 | } with { |
| 122 | variant (presence) "CSN.1 L/H" |
| 123 | variant (pos) "PRESENCE(presence = '1'B)" |
| 124 | }; |
| 125 | |
| 126 | external function enc_SI3RestOctets(in SI3RestOctets ro) return octetstring |
| 127 | with { extension "prototype(convert) encode(RAW)" }; |
| 128 | external function dec_SI3RestOctets(in octetstring stream) return SI3RestOctets |
| 129 | with { extension "prototype(convert) decode(RAW)" }; |
| 130 | |
Vadim Yanitskiy | 72add6d | 2020-05-03 21:46:42 +0700 | [diff] [blame^] | 131 | external function enc_SI4RestOctets(in SI4RestOctets ro) return octetstring |
| 132 | with { extension "prototype(convert) encode(RAW)" }; |
| 133 | external function dec_SI4RestOctets(in octetstring stream) return SI4RestOctets |
| 134 | with { extension "prototype(convert) decode(RAW)" }; |
| 135 | |
Vadim Yanitskiy | 0df8c94 | 2020-05-02 16:23:35 +0700 | [diff] [blame] | 136 | |
| 137 | } with { encode "RAW"; variant "FIELDORDER(msb)" } |