blob: 000709d51b02b69863b35181e4521ee0b93fb226 [file] [log] [blame]
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +02001/* 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
15module 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
Pau Espin Pedrole8a94442021-11-15 17:05:46 +010022 /* 11.2.1 Packet Access Reject */
23 template PacketAccessRejectStruct tr_PacketAccessRejectStruct_TLLI(template GprsTlli tlli := ?,
24 template uint8_t wait_ind := *,
25 template BIT1 wait_ind_size := *) := {
26 id_type := '0'B,
27 id := {
28 tlli := tlli
29 },
30 wait_ind_presence := ?,
31 wait_ind := wait_ind,
32 wait_ind_size := wait_ind_size
33 }
34 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_ACC_REJ(template PacketAccessRejectStruct rej := ?) := {
35 msg_type := PACKET_ACCESS_REJECT,
36 u := {
37 access_reject := {
38 page_mode := ?,
39 reject_struct := rej
40 }
41 }
42 }
43
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +020044 template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_CTRL_ACK(GprsTlli tlli,
45 CtrlAck ack := MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN) := {
46 msg_type := PACKET_CONTROL_ACK,
47 u := {
48 ctrl_ack := {
49 tlli := tlli,
50 ctrl_ack := ack
51 }
52 }
53 }
54
55 const ILevel iNone := {
56 presence := '0'B,
57 i_level := omit
58 }
59 const ChannelQualityReport c_ChQualRep_default := {
60 c_value := 0,
61 rxqual := 0,
62 sign_var := 0,
63 i_levels := { iNone, iNone, iNone, iNone, iNone, iNone, iNone, iNone }
64 }
65 template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_DL_ACK(uint5_t dl_tfi,
66 AckNackDescription andesc,
67 ChannelQualityReport qual_rep := c_ChQualRep_default) := {
68 msg_type := PACKET_DL_ACK_NACK,
69 u := {
70 dl_ack_nack := {
71 dl_tfi := dl_tfi,
72 ack_nack_desc := andesc,
73 chreq_desc_presence := '0'B,
74 chreq_desc := omit,
75 ch_qual_rep := qual_rep
76 }
77 }
78 }
79
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +020080 private function f_presence_bit_MSRadioAccessCapabilityV(template (omit) MSRadioAccessCapabilityV ms_rac) return BIT1 {
81 if (istemplatekind(ms_rac, "omit")) {
82 return '0'B;
83 }
84 return '1'B;
85 }
86
87 private function f_template_MSRadioAccessCapabilityV_to_MSRadioAccCap2(template (omit) MSRadioAccessCapabilityV ms_rac) return template (omit) MSRadioAccCap2 {
88 var template (omit) MSRadioAccCap2 ms_rac2 := omit;
89 if (istemplatekind(ms_rac, "omit")) {
90 return ms_rac2;
91 }
92 ms_rac2 := { msRadioAccessCapabilityV := ms_rac };
93 return ms_rac2;
94 }
95
Pau Espin Pedrol6791eb62020-05-20 18:27:10 +020096 const ChannelReqDescription c_ChReqDesc_default := {
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +020097 peak_tput_class := 0,
98 priority := 0,
Pau Espin Pedrol6791eb62020-05-20 18:27:10 +020099 rlc_mode := RLC_MODE_ACKNOWLEDGED,
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +0200100 llc_pdu_type := LLC_PDU_IS_NOT_SACK_OR_ACK,
101 RlcOctetCount := 0
102 }
103
Pau Espin Pedrole8a94442021-11-15 17:05:46 +0100104 template (value) ChannelReqDescription ts_ChannelReqDescription(uint4_t peak_tput_class := 0,
105 uint2_t priority := 0,
106 RlcMode rlc_mode := RLC_MODE_ACKNOWLEDGED,
107 LlcPduType llc_pdu_type := LLC_PDU_IS_NOT_SACK_OR_ACK,
108 uint16_t RlcOctetCount := 0) := {
109 peak_tput_class := peak_tput_class,
110 priority := priority,
111 rlc_mode := rlc_mode,
112 llc_pdu_type := llc_pdu_type,
113 RlcOctetCount := RlcOctetCount
114 };
115
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +0200116 /* TS 44.060 sec 11.2.16 */
117 template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_RES_REQ(GprsTlli tlli,
118 template (omit) MSRadioAccessCapabilityV ms_rac,
119 ChannelReqDescription ch_req_desc := c_ChReqDesc_default,
120 RlcAccessType acc_type := RLC_ACC_TYPE_TWO_PHASE)
121 := {
122 msg_type := PACKET_RESOURCE_REQUEST,
123 u := {
124 resource_req := {
125 acc_type_presence := '1'B,
126 acc_type := acc_type,
127 id_type := '1'B,
128 id := { tlli := tlli },
129 ms_rac2_presence := f_presence_bit_MSRadioAccessCapabilityV(ms_rac),
130 ms_rac2 := f_template_MSRadioAccessCapabilityV_to_MSRadioAccCap2(ms_rac),
131 ch_req_desc := ch_req_desc,
132 change_mark_presence := '0'B,
133 change_mark := omit,
134 C_val := '000000'B,
135 sign_var_presence := '0'B,
136 sign_var := omit,
137 I_levels := {
138 iNone, iNone, iNone, iNone,
139 iNone, iNone, iNone, iNone
140 }
141 }
142 }
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200143 };
144
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100145 const CCNMesurementReport ccn_meas_rep_def := {
146 rxlev_servig_cell := 0,
147 zero := '0'B,
148 num_meas := 0,
149 meas := { }
150 }
151
152 /* TS 44.060 sec 11.2.3a */
153 template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(uint5_t tfi,
154 GsmArfcn arfcn,
155 uint6_t bsic,
156 template (value) CCNMesurementReport ccn_meas_rep := ccn_meas_rep_def)
157 := {
158 msg_type := PACKET_CELL_CHANGE_NOTIFICATION,
159 u := {
160 cell_chg_notif := {
161 gtfi := {
162 is_dl_tfi := false,
163 tfi := tfi
164 },
Philipp Maier48bfd562023-05-25 15:05:55 +0200165 u := {
166 u0 := {
167 tag := '0'B,
168 arfcn := arfcn,
169 bsic := bsic
170 }
171 },
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100172 ba_psi3_presence := '0'B,
173 ba_used := '0'B,
174 psi3_change_mark := omit,
175 pmo_used := '0'B,
176 pccn_sending := '0'B,
Philipp Maier48bfd562023-05-25 15:05:55 +0200177 ccn_meas_rep := ccn_meas_rep,
178 rel_additions := omit
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100179 }
180 }
181 };
182
183 /* TS 44.060 sec 11.2.2a */
184 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE(template GlobalTfi tfi := ?)
185 := {
186 msg_type := PACKET_CELL_CHANGE_CONTINUE,
187 u := {
188 cell_chg_continue := {
189 page_mode := ?,
190 zero := '0'B,
191 gtfi := tfi,
192 arfcn_bsic_presence := ?,
193 arfcn := *,
194 bsic := *,
195 container_id := *
196 }
197 }
198 };
199
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200200 /* TS 44.060 sec 11.2.9 */
201 template (value) NCMeasurement ts_NCMeasurement(uint6_t frequency_n, BIT6 bsic, uint6_t rxlev)
202 := {
203 frequency_n := frequency_n,
204 bsic_n_presence := '1'B,
205 bsic_n := bsic,
206 rxlev_n := rxlev
207 };
208 template (value) NCMeasurementReport ts_NCMeasurementReport(BIT1 nc_mode,
209 uint6_t rxlev_serving_cell,
210 template (value) NCMeasurementList nc_meas_list := {})
211 := {
212 nc_mode := nc_mode,
213 rxlev_serving_cell := rxlev_serving_cell,
214 zero := '0'B,
215 num_nc_measurements := 0, /* automatically updated */
216 nm_measurements := nc_meas_list
217 };
218 template RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_MEAS_REPORT(template (value) GprsTlli tlli,
219 template (value) NCMeasurementReport nc_meas_rep)
220 := {
221 msg_type := PACKET_MEASUREMENT_REPORT,
222 u := {
223 meas_report := {
224 tlli := tlli,
225 psi5_change_mark_presence := '0'B,
226 psi5_change_mark := omit,
227 additions_99 := '0'B,
228 nc_meas_report := nc_meas_rep
229 }
230 }
231 };
232
233 /* TS 44.060 sec 11.2.9b */
234 template RepeatedAddFrequencyItem tr_RepeatedAddFrequencyItem(template (present) uint10_t start_frequency := ?,
235 template (present) uint6_t bsic := ?)
236 := {
237 presence := '1'B,
238 item := {
239 start_frequency := start_frequency,
240 bsic := bsic,
241 cell_sel_par_present := ?,
242 cell_sel_par := *,
243 nr_of_frequencies := 0,
244 freq_diff_length := ?
245 /* TODO: support Frequency diff list */
246 }
247 };
248 template NCFrequencyList tr_NCFrequencyList(template FreqIndexList removed_freq_index := *, template RepeatedAddFrequencyItemList repeated_add_frequency := *)
249 := {
250 removed_freq_present := ?,
251 nr_of_removed_freq := *,
252 removed_freq_index := removed_freq_index,
253 repeated_add_frequency := repeated_add_frequency,
254 repeated_add_frequency_term := '0'B
255 };
256 template NCMeasurementParameters tr_NCMeasurementParameters(template (present) NetworkControlOrder nco := ?,
257 template uint3_t nc_non_drx_period := *,
258 template uint3_t nc_reporting_period_i := *,
259 template uint3_t nc_reporting_period_t := *,
260 template NCFrequencyList nc_freq_list := *)
261 := {
262 nco := nco,
263 nc_period_present := ?,
264 nc_non_drx_period := nc_non_drx_period,
265 nc_reporting_period_i := nc_reporting_period_i,
266 nc_reporting_period_t := nc_reporting_period_t,
267 nc_freq_list_present := ?,
268 nc_freq_list := nc_freq_list
269 };
270 /* This template is used by osmo-pcu to reset the GSM Neighbour Cell List of the MS */
271 template (value) NCMeasurementParameters ts_NCMeasurementParametersRESET
272 := {
273 nco := NC_RESET,
274 nc_period_present := '0'B,
275 nc_non_drx_period := omit,
276 nc_reporting_period_i := omit,
277 nc_reporting_period_t := omit,
278 nc_freq_list_present := '0'B,
279 nc_freq_list := omit
280 };
281 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_MEAS_ORDER(template (present) GlobalTfiOrTlli tfi_or_tlli := ?,
282 template (present) uint3_t pmo_index := ?,
283 template (present) uint3_t pmo_count := ?,
284 template (present) NCMeasurementParameters nc_meas_param := ?)
285 := {
286 msg_type := PACKET_MEASUREMENT_ORDER,
287 u := {
288 meas_order := {
289 page_mode := ?,
290 tfi_or_tlli := tfi_or_tlli,
291 pmo_index := pmo_index,
292 pmo_count := pmo_count,
293 nc_meas_param_present := '1'B,
294 nc_meas_param := nc_meas_param,
295 zero := '0'B
296 }
297 }
298 };
299
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100300 /* TS 44.060 sec 11.2.9e */
301 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(template (present) GlobalTfi tfi := ?,
302 template (present) uint5_t container_index := ?)
303 := {
304 msg_type := PACKET_NEIGHBOUR_CELL_DATA,
305 u := {
306 neighbour_cell_data := {
307 page_mode := ?,
308 zero := '0'B,
309 gtfi := tfi,
310 container_id := ?,
311 spare := '0'B,
312 container_index := container_index,
313 arfcn_bsic_presence := ?,
314 arfcn := *,
315 bsic := *,
316 container_list := ?
317 }
318 }
319 };
320
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200321 private function f_presence_bit_tfi(template uint5_t tfi) return BIT1 {
322 if (istemplatekind(tfi, "omit")) {
323 return '0'B;
324 }
325 return '1'B;
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +0200326 }
327
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200328 template DynamicAllocation tr_DynamicAllocation(template uint5_t tfi:= ?) := {
329 extd_dyn_alloc := ?,
330 p0_present := ?,
331 p0 := *,
332 pr_mode := *,
333 usf_granularity := ?,
334 ul_tfi_ass_present := f_presence_bit_tfi(tfi),
335 ul_tfi_assignment := tfi,
336 reserved := '0'B,
337 tbf_starting_time_present := ?,
338 tbf_starting_time := *,
339 ts_allocation := ?
340 };
341
342 template PktUlAssGprs tr_PktUlAssGprsDynamic(template DynamicAllocation dyn_alloc := ?) := {
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200343 ch_coding_cmd := ?,
344 tlli_block_chan_coding := ?,
345 pkt_ta := ?,
346 freq_par_present := ?,
347 freq_par := *,
348 alloc_present := '01'B,
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200349 dyn_block_alloc := dyn_alloc,
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200350 sgl_block_alloc := omit
351 };
352
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200353 template PktUlAssEgprs tr_PktUlAssEgprsDynamic(template DynamicAllocation dyn_alloc := ?) := {
354 dual_carrier := '00'B,
355 tlli_present := ?,
356 tlli := *,
357 compact_reduced_ma_present := ?,
358 compact_reduced_ma := *,
359 chan_coding_cmd := ?,
360 resegment := ?,
361 window_size := ?,
362 ats_present := ?,
363 ats := *, /* ? */
364 arac_retrans_req := ?,
365 tlli_block_chan_coding := ?,
366 bep_period2_present := ?,
367 bep_period2 := *,
368 pkt_ta := ?,
369 pkt_ext_ta_present := ?,
370 pkt_ext_ta := *,
371 freq_par_present := ?,
372 freq_par := *,
373 alloc_present := ?,
374 dyn_block_alloc := dyn_alloc,
375 multi_block_alloc := omit
376 };
377
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200378 template AckNackDescription tr_AckNackDescription(template BIT1 final_ack := ?) := {
379 final_ack := final_ack,
380 starting_seq_nr := ?,
381 receive_block_bitmap := ?
382 };
383
384 template UlAckNackGprsAdditionsRel99 tr_UlAckNackGprsAdditionsRel99(template boolean tbf_est := ?) := {
385 ext_pkt_ta_present := ?,
386 ext_pkt_ta := *,
387 tbf_est := tbf_est
388 };
389
390 template UlAckNackGprs tr_UlAckNackGprs(template GprsTlli tlli := *,
391 template AckNackDescription acknack_desc := ?,
392 template UlAckNackGprsAdditionsRel99 rel99 := *) := {
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200393 ch_coding_cmd := ?,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200394 ack_nack_desc := acknack_desc,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200395 cont_res_tlli_present := ?,
396 cont_res_tlli := tlli,
397 pkt_ta_present := ?,
398 pkt_ta := *,
399 pwr_ctrl_present := ?,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200400 pwr_ctrl := *,
401 extension_bits_present := ?,
402 extension_bits := *,
403 not_used := '0'B,
404 rel99_present := ?,
405 rel99 := rel99
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200406 };
407
408 template UlAckNackEgprs tr_UlAckNackEgprs(template GprsTlli tlli := *) := {
Pau Espin Pedrolf8fe2d22020-11-10 18:39:25 +0100409 msg_excape := '00'B,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200410 ch_coding_cmd := ?,
411 resegment := ?,
412 preemptive_tx := ?,
413 prr_retrans_req := ?,
414 arac_retrans_req := ?,
415 cont_res_tlli_present := ?,
416 cont_res_tlli := tlli,
417 tbf_est := ?,
418 pkt_ta_present := ?,
419 pkt_ta := *,
420 pkt_ext_ta_present := ?,
421 pkt_ext_ta := *,
422 pwr_ctrl_present := ?,
423 pwr_ctrl := *
424 };
425
Pau Espin Pedrolfa64e282021-02-05 17:56:52 +0100426 template (value) EgprsAckNackDescriptionIE ts_EgprsAckNackDescriptionIE(template (value) EgprsAckNackDescription andesc) := {
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100427 len_present := '1'B,
428 len := 0, /* Overwritten by RAW encoder */
429 acknack_desc := andesc
430 }
431
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +0200432} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };