Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 1 | /* GPRS RLC/MAC Control Messages as per 3GPP TS 44.060 manually transcribed from the CSN.1 syntax, as no CSN.1 |
| 2 | * tool for Eclipse TITAN could be found. Implements only the minimum necessary messages for Osmocom teseting |
| 3 | * purposes. */ |
| 4 | |
| 5 | /* (C) 2017-2018 Harald Welte <laforge@gnumonks.org> |
| 6 | * contributions by sysmocom - s.f.m.c. GmbH |
| 7 | * All rights reserved. |
| 8 | * |
| 9 | * Released under the terms of GNU General Public License, Version 2 or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 13 | */ |
| 14 | |
| 15 | module RLCMAC_CSN1_Templates { |
| 16 | import from General_Types all; |
| 17 | import from Osmocom_Types all; |
| 18 | import from GSM_Types all; |
| 19 | import from MobileL3_GMM_SM_Types all; |
| 20 | import from RLCMAC_CSN1_Types all; |
| 21 | |
| 22 | template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_CTRL_ACK(GprsTlli tlli, |
| 23 | CtrlAck ack := MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN) := { |
| 24 | msg_type := PACKET_CONTROL_ACK, |
| 25 | u := { |
| 26 | ctrl_ack := { |
| 27 | tlli := tlli, |
| 28 | ctrl_ack := ack |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | const ILevel iNone := { |
| 34 | presence := '0'B, |
| 35 | i_level := omit |
| 36 | } |
| 37 | const ChannelQualityReport c_ChQualRep_default := { |
| 38 | c_value := 0, |
| 39 | rxqual := 0, |
| 40 | sign_var := 0, |
| 41 | i_levels := { iNone, iNone, iNone, iNone, iNone, iNone, iNone, iNone } |
| 42 | } |
| 43 | template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_DL_ACK(uint5_t dl_tfi, |
| 44 | AckNackDescription andesc, |
| 45 | ChannelQualityReport qual_rep := c_ChQualRep_default) := { |
| 46 | msg_type := PACKET_DL_ACK_NACK, |
| 47 | u := { |
| 48 | dl_ack_nack := { |
| 49 | dl_tfi := dl_tfi, |
| 50 | ack_nack_desc := andesc, |
| 51 | chreq_desc_presence := '0'B, |
| 52 | chreq_desc := omit, |
| 53 | ch_qual_rep := qual_rep |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 58 | private function f_presence_bit_MSRadioAccessCapabilityV(template (omit) MSRadioAccessCapabilityV ms_rac) return BIT1 { |
| 59 | if (istemplatekind(ms_rac, "omit")) { |
| 60 | return '0'B; |
| 61 | } |
| 62 | return '1'B; |
| 63 | } |
| 64 | |
| 65 | private function f_template_MSRadioAccessCapabilityV_to_MSRadioAccCap2(template (omit) MSRadioAccessCapabilityV ms_rac) return template (omit) MSRadioAccCap2 { |
| 66 | var template (omit) MSRadioAccCap2 ms_rac2 := omit; |
| 67 | if (istemplatekind(ms_rac, "omit")) { |
| 68 | return ms_rac2; |
| 69 | } |
| 70 | ms_rac2 := { msRadioAccessCapabilityV := ms_rac }; |
| 71 | return ms_rac2; |
| 72 | } |
| 73 | |
Pau Espin Pedrol | 6791eb6 | 2020-05-20 18:27:10 +0200 | [diff] [blame] | 74 | const ChannelReqDescription c_ChReqDesc_default := { |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 75 | peak_tput_class := 0, |
| 76 | priority := 0, |
Pau Espin Pedrol | 6791eb6 | 2020-05-20 18:27:10 +0200 | [diff] [blame] | 77 | rlc_mode := RLC_MODE_ACKNOWLEDGED, |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 78 | llc_pdu_type := LLC_PDU_IS_NOT_SACK_OR_ACK, |
| 79 | RlcOctetCount := 0 |
| 80 | } |
| 81 | |
| 82 | /* TS 44.060 sec 11.2.16 */ |
| 83 | template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_RES_REQ(GprsTlli tlli, |
| 84 | template (omit) MSRadioAccessCapabilityV ms_rac, |
| 85 | ChannelReqDescription ch_req_desc := c_ChReqDesc_default, |
| 86 | RlcAccessType acc_type := RLC_ACC_TYPE_TWO_PHASE) |
| 87 | := { |
| 88 | msg_type := PACKET_RESOURCE_REQUEST, |
| 89 | u := { |
| 90 | resource_req := { |
| 91 | acc_type_presence := '1'B, |
| 92 | acc_type := acc_type, |
| 93 | id_type := '1'B, |
| 94 | id := { tlli := tlli }, |
| 95 | ms_rac2_presence := f_presence_bit_MSRadioAccessCapabilityV(ms_rac), |
| 96 | ms_rac2 := f_template_MSRadioAccessCapabilityV_to_MSRadioAccCap2(ms_rac), |
| 97 | ch_req_desc := ch_req_desc, |
| 98 | change_mark_presence := '0'B, |
| 99 | change_mark := omit, |
| 100 | C_val := '000000'B, |
| 101 | sign_var_presence := '0'B, |
| 102 | sign_var := omit, |
| 103 | I_levels := { |
| 104 | iNone, iNone, iNone, iNone, |
| 105 | iNone, iNone, iNone, iNone |
| 106 | } |
| 107 | } |
| 108 | } |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 109 | }; |
| 110 | |
Pau Espin Pedrol | 9df362a | 2021-01-08 17:14:03 +0100 | [diff] [blame] | 111 | const CCNMesurementReport ccn_meas_rep_def := { |
| 112 | rxlev_servig_cell := 0, |
| 113 | zero := '0'B, |
| 114 | num_meas := 0, |
| 115 | meas := { } |
| 116 | } |
| 117 | |
| 118 | /* TS 44.060 sec 11.2.3a */ |
| 119 | template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(uint5_t tfi, |
| 120 | GsmArfcn arfcn, |
| 121 | uint6_t bsic, |
| 122 | template (value) CCNMesurementReport ccn_meas_rep := ccn_meas_rep_def) |
| 123 | := { |
| 124 | msg_type := PACKET_CELL_CHANGE_NOTIFICATION, |
| 125 | u := { |
| 126 | cell_chg_notif := { |
| 127 | gtfi := { |
| 128 | is_dl_tfi := false, |
| 129 | tfi := tfi |
| 130 | }, |
| 131 | arfcn_bsic_presence := '0'B, |
| 132 | arfcn := arfcn, |
| 133 | bsic := bsic, |
| 134 | ba_psi3_presence := '0'B, |
| 135 | ba_used := '0'B, |
| 136 | psi3_change_mark := omit, |
| 137 | pmo_used := '0'B, |
| 138 | pccn_sending := '0'B, |
| 139 | ccn_meas_rep := ccn_meas_rep |
| 140 | } |
| 141 | } |
| 142 | }; |
| 143 | |
| 144 | /* TS 44.060 sec 11.2.2a */ |
| 145 | template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE(template GlobalTfi tfi := ?) |
| 146 | := { |
| 147 | msg_type := PACKET_CELL_CHANGE_CONTINUE, |
| 148 | u := { |
| 149 | cell_chg_continue := { |
| 150 | page_mode := ?, |
| 151 | zero := '0'B, |
| 152 | gtfi := tfi, |
| 153 | arfcn_bsic_presence := ?, |
| 154 | arfcn := *, |
| 155 | bsic := *, |
| 156 | container_id := * |
| 157 | } |
| 158 | } |
| 159 | }; |
| 160 | |
| 161 | /* TS 44.060 sec 11.2.9e */ |
| 162 | template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(template (present) GlobalTfi tfi := ?, |
| 163 | template (present) uint5_t container_index := ?) |
| 164 | := { |
| 165 | msg_type := PACKET_NEIGHBOUR_CELL_DATA, |
| 166 | u := { |
| 167 | neighbour_cell_data := { |
| 168 | page_mode := ?, |
| 169 | zero := '0'B, |
| 170 | gtfi := tfi, |
| 171 | container_id := ?, |
| 172 | spare := '0'B, |
| 173 | container_index := container_index, |
| 174 | arfcn_bsic_presence := ?, |
| 175 | arfcn := *, |
| 176 | bsic := *, |
| 177 | container_list := ? |
| 178 | } |
| 179 | } |
| 180 | }; |
| 181 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 182 | private function f_presence_bit_tfi(template uint5_t tfi) return BIT1 { |
| 183 | if (istemplatekind(tfi, "omit")) { |
| 184 | return '0'B; |
| 185 | } |
| 186 | return '1'B; |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 187 | } |
| 188 | |
Pau Espin Pedrol | 45b664b | 2020-05-14 15:16:40 +0200 | [diff] [blame] | 189 | template DynamicAllocation tr_DynamicAllocation(template uint5_t tfi:= ?) := { |
| 190 | extd_dyn_alloc := ?, |
| 191 | p0_present := ?, |
| 192 | p0 := *, |
| 193 | pr_mode := *, |
| 194 | usf_granularity := ?, |
| 195 | ul_tfi_ass_present := f_presence_bit_tfi(tfi), |
| 196 | ul_tfi_assignment := tfi, |
| 197 | reserved := '0'B, |
| 198 | tbf_starting_time_present := ?, |
| 199 | tbf_starting_time := *, |
| 200 | ts_allocation := ? |
| 201 | }; |
| 202 | |
| 203 | template PktUlAssGprs tr_PktUlAssGprsDynamic(template DynamicAllocation dyn_alloc := ?) := { |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 204 | ch_coding_cmd := ?, |
| 205 | tlli_block_chan_coding := ?, |
| 206 | pkt_ta := ?, |
| 207 | freq_par_present := ?, |
| 208 | freq_par := *, |
| 209 | alloc_present := '01'B, |
Pau Espin Pedrol | 45b664b | 2020-05-14 15:16:40 +0200 | [diff] [blame] | 210 | dyn_block_alloc := dyn_alloc, |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 211 | sgl_block_alloc := omit |
| 212 | }; |
| 213 | |
Pau Espin Pedrol | 45b664b | 2020-05-14 15:16:40 +0200 | [diff] [blame] | 214 | template PktUlAssEgprs tr_PktUlAssEgprsDynamic(template DynamicAllocation dyn_alloc := ?) := { |
| 215 | dual_carrier := '00'B, |
| 216 | tlli_present := ?, |
| 217 | tlli := *, |
| 218 | compact_reduced_ma_present := ?, |
| 219 | compact_reduced_ma := *, |
| 220 | chan_coding_cmd := ?, |
| 221 | resegment := ?, |
| 222 | window_size := ?, |
| 223 | ats_present := ?, |
| 224 | ats := *, /* ? */ |
| 225 | arac_retrans_req := ?, |
| 226 | tlli_block_chan_coding := ?, |
| 227 | bep_period2_present := ?, |
| 228 | bep_period2 := *, |
| 229 | pkt_ta := ?, |
| 230 | pkt_ext_ta_present := ?, |
| 231 | pkt_ext_ta := *, |
| 232 | freq_par_present := ?, |
| 233 | freq_par := *, |
| 234 | alloc_present := ?, |
| 235 | dyn_block_alloc := dyn_alloc, |
| 236 | multi_block_alloc := omit |
| 237 | }; |
| 238 | |
Pau Espin Pedrol | 630c1cf | 2020-07-08 13:34:53 +0200 | [diff] [blame] | 239 | template AckNackDescription tr_AckNackDescription(template BIT1 final_ack := ?) := { |
| 240 | final_ack := final_ack, |
| 241 | starting_seq_nr := ?, |
| 242 | receive_block_bitmap := ? |
| 243 | }; |
| 244 | |
| 245 | template UlAckNackGprsAdditionsRel99 tr_UlAckNackGprsAdditionsRel99(template boolean tbf_est := ?) := { |
| 246 | ext_pkt_ta_present := ?, |
| 247 | ext_pkt_ta := *, |
| 248 | tbf_est := tbf_est |
| 249 | }; |
| 250 | |
| 251 | template UlAckNackGprs tr_UlAckNackGprs(template GprsTlli tlli := *, |
| 252 | template AckNackDescription acknack_desc := ?, |
| 253 | template UlAckNackGprsAdditionsRel99 rel99 := *) := { |
Pau Espin Pedrol | 692222c | 2020-05-17 00:25:37 +0200 | [diff] [blame] | 254 | ch_coding_cmd := ?, |
Pau Espin Pedrol | 630c1cf | 2020-07-08 13:34:53 +0200 | [diff] [blame] | 255 | ack_nack_desc := acknack_desc, |
Pau Espin Pedrol | 692222c | 2020-05-17 00:25:37 +0200 | [diff] [blame] | 256 | cont_res_tlli_present := ?, |
| 257 | cont_res_tlli := tlli, |
| 258 | pkt_ta_present := ?, |
| 259 | pkt_ta := *, |
| 260 | pwr_ctrl_present := ?, |
Pau Espin Pedrol | 630c1cf | 2020-07-08 13:34:53 +0200 | [diff] [blame] | 261 | pwr_ctrl := *, |
| 262 | extension_bits_present := ?, |
| 263 | extension_bits := *, |
| 264 | not_used := '0'B, |
| 265 | rel99_present := ?, |
| 266 | rel99 := rel99 |
Pau Espin Pedrol | 692222c | 2020-05-17 00:25:37 +0200 | [diff] [blame] | 267 | }; |
| 268 | |
| 269 | template UlAckNackEgprs tr_UlAckNackEgprs(template GprsTlli tlli := *) := { |
Pau Espin Pedrol | f8fe2d2 | 2020-11-10 18:39:25 +0100 | [diff] [blame] | 270 | msg_excape := '00'B, |
Pau Espin Pedrol | 692222c | 2020-05-17 00:25:37 +0200 | [diff] [blame] | 271 | ch_coding_cmd := ?, |
| 272 | resegment := ?, |
| 273 | preemptive_tx := ?, |
| 274 | prr_retrans_req := ?, |
| 275 | arac_retrans_req := ?, |
| 276 | cont_res_tlli_present := ?, |
| 277 | cont_res_tlli := tlli, |
| 278 | tbf_est := ?, |
| 279 | pkt_ta_present := ?, |
| 280 | pkt_ta := *, |
| 281 | pkt_ext_ta_present := ?, |
| 282 | pkt_ext_ta := *, |
| 283 | pwr_ctrl_present := ?, |
| 284 | pwr_ctrl := * |
| 285 | }; |
| 286 | |
Pau Espin Pedrol | afdd28d | 2020-11-12 21:02:18 +0100 | [diff] [blame] | 287 | template EgprsAckNackDescriptionIE ts_EgprsAckNackDescriptionIE(template EgprsAckNackDescription andesc) := { |
| 288 | len_present := '1'B, |
| 289 | len := 0, /* Overwritten by RAW encoder */ |
| 290 | acknack_desc := andesc |
| 291 | } |
| 292 | |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 293 | } with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" }; |