blob: a4f59f0897ef2ca9b911500444182975626d053d [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
Philipp Maierdcba8d22023-06-15 12:48:36 +0200145 const CCNMeasReport ccn_meas_rep_def := {
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100146 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,
Philipp Maierdcba8d22023-06-15 12:48:36 +0200156 template (value) CCNMeasReport ccn_meas_rep := ccn_meas_rep_def)
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100157 := {
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
Philipp Maiere640d8f2023-06-30 14:43:01 +0200183 /* TS 44.060 sec 11.2.3a */
184 template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF_UTRAN(uint5_t tfi,
185 uint14_t uarfcn,
186 uint10_t scrambling_code,
187 template (value) CCNMeasReport ccn_meas_rep := ccn_meas_rep_def)
188 := {
189 msg_type := PACKET_CELL_CHANGE_NOTIFICATION,
190 u := {
191 cell_chg_notif := {
192 gtfi := {
193 is_dl_tfi := false,
194 tfi := tfi
195 },
196 u := {
197 u10 := {
198 tag := '10'B,
199 utran_target_cell := {
200 fdd_presence := '1'B,
201 fdd := {
202 arfcn := uarfcn,
203 bandwidth_presence := '0'B,
204 bandwidth := omit,
205 scrambling_code := scrambling_code
206 },
207 tdd_presence := '0'B,
208 tdd := omit,
209 reporting_quantity := 1
210 }
211 }
212 },
213 ba_psi3_presence := '0'B,
214 ba_used := '0'B,
215 psi3_change_mark := omit,
216 pmo_used := '0'B,
217 pccn_sending := '0'B,
218 ccn_meas_rep := ccn_meas_rep,
219 rel_additions := omit
220 }
221 }
222 };
223
224 /* TS 44.060 sec 11.2.3a */
225 template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF_EUTRAN(uint5_t tfi,
226 uint16_t earfcn,
227 uint9_t phys_layer_cell_id,
228 template (value) CCNMeasReport ccn_meas_rep := ccn_meas_rep_def)
229 := {
230 msg_type := PACKET_CELL_CHANGE_NOTIFICATION,
231 u := {
232 cell_chg_notif := {
233 gtfi := {
234 is_dl_tfi := false,
235 tfi := tfi
236 },
237 u := {
238 u110 := {
239 tag := '110'B,
240 arfcn_bsic_presence := '0'B,
241 arfcn := omit,
242 bsic := omit,
243
244 utran_target_cell_presence := '0'B,
245 utran_target_cell := omit,
246
247 eutran_target_cell_presence := '1'B,
248 eutran_target_cell := {
249 earfcn := earfcn,
250 meas_bandwidth_presence := '0'B,
251 meas_bandwidth := omit,
252 phys_layer_cell_id := phys_layer_cell_id,
253 reporting_quantity := 1
254 },
255 eutran_ccn_meas_rep_presence := '1'B,
256 eutran_ccn_meas_rep := {
257 utran_ba_used := 0,
258 n_eutran := 1,
259 cells := {{frequency_list_index := 1,
260 cell_identity := phys_layer_cell_id,
261 reporting_quantity := 1}}
262 }
263 }
264 },
265 ba_psi3_presence := '0'B,
266 ba_used := '0'B,
267 psi3_change_mark := omit,
268 pmo_used := '0'B,
269 pccn_sending := '0'B,
270 ccn_meas_rep := ccn_meas_rep,
271 rel_additions := omit
272 }
273 }
274 };
275
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100276 /* TS 44.060 sec 11.2.2a */
277 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE(template GlobalTfi tfi := ?)
278 := {
279 msg_type := PACKET_CELL_CHANGE_CONTINUE,
280 u := {
281 cell_chg_continue := {
282 page_mode := ?,
283 zero := '0'B,
284 gtfi := tfi,
285 arfcn_bsic_presence := ?,
286 arfcn := *,
287 bsic := *,
288 container_id := *
289 }
290 }
291 };
292
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200293 /* TS 44.060 sec 11.2.9 */
294 template (value) NCMeasurement ts_NCMeasurement(uint6_t frequency_n, BIT6 bsic, uint6_t rxlev)
295 := {
296 frequency_n := frequency_n,
297 bsic_n_presence := '1'B,
298 bsic_n := bsic,
299 rxlev_n := rxlev
300 };
301 template (value) NCMeasurementReport ts_NCMeasurementReport(BIT1 nc_mode,
302 uint6_t rxlev_serving_cell,
303 template (value) NCMeasurementList nc_meas_list := {})
304 := {
305 nc_mode := nc_mode,
306 rxlev_serving_cell := rxlev_serving_cell,
307 zero := '0'B,
308 num_nc_measurements := 0, /* automatically updated */
309 nm_measurements := nc_meas_list
310 };
311 template RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_MEAS_REPORT(template (value) GprsTlli tlli,
312 template (value) NCMeasurementReport nc_meas_rep)
313 := {
314 msg_type := PACKET_MEASUREMENT_REPORT,
315 u := {
316 meas_report := {
317 tlli := tlli,
318 psi5_change_mark_presence := '0'B,
319 psi5_change_mark := omit,
320 additions_99 := '0'B,
321 nc_meas_report := nc_meas_rep
322 }
323 }
324 };
325
326 /* TS 44.060 sec 11.2.9b */
327 template RepeatedAddFrequencyItem tr_RepeatedAddFrequencyItem(template (present) uint10_t start_frequency := ?,
328 template (present) uint6_t bsic := ?)
329 := {
330 presence := '1'B,
331 item := {
332 start_frequency := start_frequency,
333 bsic := bsic,
334 cell_sel_par_present := ?,
335 cell_sel_par := *,
336 nr_of_frequencies := 0,
337 freq_diff_length := ?
338 /* TODO: support Frequency diff list */
339 }
340 };
341 template NCFrequencyList tr_NCFrequencyList(template FreqIndexList removed_freq_index := *, template RepeatedAddFrequencyItemList repeated_add_frequency := *)
342 := {
343 removed_freq_present := ?,
344 nr_of_removed_freq := *,
345 removed_freq_index := removed_freq_index,
346 repeated_add_frequency := repeated_add_frequency,
347 repeated_add_frequency_term := '0'B
348 };
349 template NCMeasurementParameters tr_NCMeasurementParameters(template (present) NetworkControlOrder nco := ?,
350 template uint3_t nc_non_drx_period := *,
351 template uint3_t nc_reporting_period_i := *,
352 template uint3_t nc_reporting_period_t := *,
353 template NCFrequencyList nc_freq_list := *)
354 := {
355 nco := nco,
356 nc_period_present := ?,
357 nc_non_drx_period := nc_non_drx_period,
358 nc_reporting_period_i := nc_reporting_period_i,
359 nc_reporting_period_t := nc_reporting_period_t,
360 nc_freq_list_present := ?,
361 nc_freq_list := nc_freq_list
362 };
363 /* This template is used by osmo-pcu to reset the GSM Neighbour Cell List of the MS */
364 template (value) NCMeasurementParameters ts_NCMeasurementParametersRESET
365 := {
366 nco := NC_RESET,
367 nc_period_present := '0'B,
368 nc_non_drx_period := omit,
369 nc_reporting_period_i := omit,
370 nc_reporting_period_t := omit,
371 nc_freq_list_present := '0'B,
372 nc_freq_list := omit
373 };
374 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_MEAS_ORDER(template (present) GlobalTfiOrTlli tfi_or_tlli := ?,
375 template (present) uint3_t pmo_index := ?,
376 template (present) uint3_t pmo_count := ?,
377 template (present) NCMeasurementParameters nc_meas_param := ?)
378 := {
379 msg_type := PACKET_MEASUREMENT_ORDER,
380 u := {
381 meas_order := {
382 page_mode := ?,
383 tfi_or_tlli := tfi_or_tlli,
384 pmo_index := pmo_index,
385 pmo_count := pmo_count,
386 nc_meas_param_present := '1'B,
387 nc_meas_param := nc_meas_param,
388 zero := '0'B
389 }
390 }
391 };
392
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100393 /* TS 44.060 sec 11.2.9e */
394 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(template (present) GlobalTfi tfi := ?,
395 template (present) uint5_t container_index := ?)
396 := {
397 msg_type := PACKET_NEIGHBOUR_CELL_DATA,
398 u := {
399 neighbour_cell_data := {
400 page_mode := ?,
401 zero := '0'B,
402 gtfi := tfi,
403 container_id := ?,
404 spare := '0'B,
405 container_index := container_index,
406 arfcn_bsic_presence := ?,
407 arfcn := *,
408 bsic := *,
409 container_list := ?
410 }
411 }
412 };
413
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200414 private function f_presence_bit_tfi(template uint5_t tfi) return BIT1 {
415 if (istemplatekind(tfi, "omit")) {
416 return '0'B;
417 }
418 return '1'B;
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +0200419 }
420
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200421 template DynamicAllocation tr_DynamicAllocation(template uint5_t tfi:= ?) := {
422 extd_dyn_alloc := ?,
423 p0_present := ?,
424 p0 := *,
425 pr_mode := *,
426 usf_granularity := ?,
427 ul_tfi_ass_present := f_presence_bit_tfi(tfi),
428 ul_tfi_assignment := tfi,
429 reserved := '0'B,
430 tbf_starting_time_present := ?,
431 tbf_starting_time := *,
432 ts_allocation := ?
433 };
434
435 template PktUlAssGprs tr_PktUlAssGprsDynamic(template DynamicAllocation dyn_alloc := ?) := {
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200436 ch_coding_cmd := ?,
437 tlli_block_chan_coding := ?,
438 pkt_ta := ?,
439 freq_par_present := ?,
440 freq_par := *,
441 alloc_present := '01'B,
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200442 dyn_block_alloc := dyn_alloc,
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200443 sgl_block_alloc := omit
444 };
445
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200446 template PktUlAssEgprs tr_PktUlAssEgprsDynamic(template DynamicAllocation dyn_alloc := ?) := {
447 dual_carrier := '00'B,
448 tlli_present := ?,
449 tlli := *,
450 compact_reduced_ma_present := ?,
451 compact_reduced_ma := *,
452 chan_coding_cmd := ?,
453 resegment := ?,
454 window_size := ?,
455 ats_present := ?,
456 ats := *, /* ? */
457 arac_retrans_req := ?,
458 tlli_block_chan_coding := ?,
459 bep_period2_present := ?,
460 bep_period2 := *,
461 pkt_ta := ?,
462 pkt_ext_ta_present := ?,
463 pkt_ext_ta := *,
464 freq_par_present := ?,
465 freq_par := *,
466 alloc_present := ?,
467 dyn_block_alloc := dyn_alloc,
468 multi_block_alloc := omit
469 };
470
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200471 template AckNackDescription tr_AckNackDescription(template BIT1 final_ack := ?) := {
472 final_ack := final_ack,
473 starting_seq_nr := ?,
474 receive_block_bitmap := ?
475 };
476
477 template UlAckNackGprsAdditionsRel99 tr_UlAckNackGprsAdditionsRel99(template boolean tbf_est := ?) := {
478 ext_pkt_ta_present := ?,
479 ext_pkt_ta := *,
480 tbf_est := tbf_est
481 };
482
483 template UlAckNackGprs tr_UlAckNackGprs(template GprsTlli tlli := *,
484 template AckNackDescription acknack_desc := ?,
485 template UlAckNackGprsAdditionsRel99 rel99 := *) := {
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200486 ch_coding_cmd := ?,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200487 ack_nack_desc := acknack_desc,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200488 cont_res_tlli_present := ?,
489 cont_res_tlli := tlli,
490 pkt_ta_present := ?,
491 pkt_ta := *,
492 pwr_ctrl_present := ?,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200493 pwr_ctrl := *,
494 extension_bits_present := ?,
495 extension_bits := *,
496 not_used := '0'B,
497 rel99_present := ?,
498 rel99 := rel99
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200499 };
500
501 template UlAckNackEgprs tr_UlAckNackEgprs(template GprsTlli tlli := *) := {
Pau Espin Pedrolf8fe2d22020-11-10 18:39:25 +0100502 msg_excape := '00'B,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200503 ch_coding_cmd := ?,
504 resegment := ?,
505 preemptive_tx := ?,
506 prr_retrans_req := ?,
507 arac_retrans_req := ?,
508 cont_res_tlli_present := ?,
509 cont_res_tlli := tlli,
510 tbf_est := ?,
511 pkt_ta_present := ?,
512 pkt_ta := *,
513 pkt_ext_ta_present := ?,
514 pkt_ext_ta := *,
515 pwr_ctrl_present := ?,
516 pwr_ctrl := *
517 };
518
Pau Espin Pedrolfa64e282021-02-05 17:56:52 +0100519 template (value) EgprsAckNackDescriptionIE ts_EgprsAckNackDescriptionIE(template (value) EgprsAckNackDescription andesc) := {
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100520 len_present := '1'B,
521 len := 0, /* Overwritten by RAW encoder */
522 acknack_desc := andesc
523 }
524
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +0200525} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };