blob: 943717ed49a5514f7552996c579d44e62c9bf475 [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 },
165 arfcn_bsic_presence := '0'B,
166 arfcn := arfcn,
167 bsic := bsic,
168 ba_psi3_presence := '0'B,
169 ba_used := '0'B,
170 psi3_change_mark := omit,
171 pmo_used := '0'B,
172 pccn_sending := '0'B,
173 ccn_meas_rep := ccn_meas_rep
174 }
175 }
176 };
177
178 /* TS 44.060 sec 11.2.2a */
179 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE(template GlobalTfi tfi := ?)
180 := {
181 msg_type := PACKET_CELL_CHANGE_CONTINUE,
182 u := {
183 cell_chg_continue := {
184 page_mode := ?,
185 zero := '0'B,
186 gtfi := tfi,
187 arfcn_bsic_presence := ?,
188 arfcn := *,
189 bsic := *,
190 container_id := *
191 }
192 }
193 };
194
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200195 /* TS 44.060 sec 11.2.9 */
196 template (value) NCMeasurement ts_NCMeasurement(uint6_t frequency_n, BIT6 bsic, uint6_t rxlev)
197 := {
198 frequency_n := frequency_n,
199 bsic_n_presence := '1'B,
200 bsic_n := bsic,
201 rxlev_n := rxlev
202 };
203 template (value) NCMeasurementReport ts_NCMeasurementReport(BIT1 nc_mode,
204 uint6_t rxlev_serving_cell,
205 template (value) NCMeasurementList nc_meas_list := {})
206 := {
207 nc_mode := nc_mode,
208 rxlev_serving_cell := rxlev_serving_cell,
209 zero := '0'B,
210 num_nc_measurements := 0, /* automatically updated */
211 nm_measurements := nc_meas_list
212 };
213 template RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_MEAS_REPORT(template (value) GprsTlli tlli,
214 template (value) NCMeasurementReport nc_meas_rep)
215 := {
216 msg_type := PACKET_MEASUREMENT_REPORT,
217 u := {
218 meas_report := {
219 tlli := tlli,
220 psi5_change_mark_presence := '0'B,
221 psi5_change_mark := omit,
222 additions_99 := '0'B,
223 nc_meas_report := nc_meas_rep
224 }
225 }
226 };
227
228 /* TS 44.060 sec 11.2.9b */
229 template RepeatedAddFrequencyItem tr_RepeatedAddFrequencyItem(template (present) uint10_t start_frequency := ?,
230 template (present) uint6_t bsic := ?)
231 := {
232 presence := '1'B,
233 item := {
234 start_frequency := start_frequency,
235 bsic := bsic,
236 cell_sel_par_present := ?,
237 cell_sel_par := *,
238 nr_of_frequencies := 0,
239 freq_diff_length := ?
240 /* TODO: support Frequency diff list */
241 }
242 };
243 template NCFrequencyList tr_NCFrequencyList(template FreqIndexList removed_freq_index := *, template RepeatedAddFrequencyItemList repeated_add_frequency := *)
244 := {
245 removed_freq_present := ?,
246 nr_of_removed_freq := *,
247 removed_freq_index := removed_freq_index,
248 repeated_add_frequency := repeated_add_frequency,
249 repeated_add_frequency_term := '0'B
250 };
251 template NCMeasurementParameters tr_NCMeasurementParameters(template (present) NetworkControlOrder nco := ?,
252 template uint3_t nc_non_drx_period := *,
253 template uint3_t nc_reporting_period_i := *,
254 template uint3_t nc_reporting_period_t := *,
255 template NCFrequencyList nc_freq_list := *)
256 := {
257 nco := nco,
258 nc_period_present := ?,
259 nc_non_drx_period := nc_non_drx_period,
260 nc_reporting_period_i := nc_reporting_period_i,
261 nc_reporting_period_t := nc_reporting_period_t,
262 nc_freq_list_present := ?,
263 nc_freq_list := nc_freq_list
264 };
265 /* This template is used by osmo-pcu to reset the GSM Neighbour Cell List of the MS */
266 template (value) NCMeasurementParameters ts_NCMeasurementParametersRESET
267 := {
268 nco := NC_RESET,
269 nc_period_present := '0'B,
270 nc_non_drx_period := omit,
271 nc_reporting_period_i := omit,
272 nc_reporting_period_t := omit,
273 nc_freq_list_present := '0'B,
274 nc_freq_list := omit
275 };
276 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_MEAS_ORDER(template (present) GlobalTfiOrTlli tfi_or_tlli := ?,
277 template (present) uint3_t pmo_index := ?,
278 template (present) uint3_t pmo_count := ?,
279 template (present) NCMeasurementParameters nc_meas_param := ?)
280 := {
281 msg_type := PACKET_MEASUREMENT_ORDER,
282 u := {
283 meas_order := {
284 page_mode := ?,
285 tfi_or_tlli := tfi_or_tlli,
286 pmo_index := pmo_index,
287 pmo_count := pmo_count,
288 nc_meas_param_present := '1'B,
289 nc_meas_param := nc_meas_param,
290 zero := '0'B
291 }
292 }
293 };
294
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100295 /* TS 44.060 sec 11.2.9e */
296 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(template (present) GlobalTfi tfi := ?,
297 template (present) uint5_t container_index := ?)
298 := {
299 msg_type := PACKET_NEIGHBOUR_CELL_DATA,
300 u := {
301 neighbour_cell_data := {
302 page_mode := ?,
303 zero := '0'B,
304 gtfi := tfi,
305 container_id := ?,
306 spare := '0'B,
307 container_index := container_index,
308 arfcn_bsic_presence := ?,
309 arfcn := *,
310 bsic := *,
311 container_list := ?
312 }
313 }
314 };
315
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200316 private function f_presence_bit_tfi(template uint5_t tfi) return BIT1 {
317 if (istemplatekind(tfi, "omit")) {
318 return '0'B;
319 }
320 return '1'B;
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +0200321 }
322
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200323 template DynamicAllocation tr_DynamicAllocation(template uint5_t tfi:= ?) := {
324 extd_dyn_alloc := ?,
325 p0_present := ?,
326 p0 := *,
327 pr_mode := *,
328 usf_granularity := ?,
329 ul_tfi_ass_present := f_presence_bit_tfi(tfi),
330 ul_tfi_assignment := tfi,
331 reserved := '0'B,
332 tbf_starting_time_present := ?,
333 tbf_starting_time := *,
334 ts_allocation := ?
335 };
336
337 template PktUlAssGprs tr_PktUlAssGprsDynamic(template DynamicAllocation dyn_alloc := ?) := {
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200338 ch_coding_cmd := ?,
339 tlli_block_chan_coding := ?,
340 pkt_ta := ?,
341 freq_par_present := ?,
342 freq_par := *,
343 alloc_present := '01'B,
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200344 dyn_block_alloc := dyn_alloc,
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200345 sgl_block_alloc := omit
346 };
347
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200348 template PktUlAssEgprs tr_PktUlAssEgprsDynamic(template DynamicAllocation dyn_alloc := ?) := {
349 dual_carrier := '00'B,
350 tlli_present := ?,
351 tlli := *,
352 compact_reduced_ma_present := ?,
353 compact_reduced_ma := *,
354 chan_coding_cmd := ?,
355 resegment := ?,
356 window_size := ?,
357 ats_present := ?,
358 ats := *, /* ? */
359 arac_retrans_req := ?,
360 tlli_block_chan_coding := ?,
361 bep_period2_present := ?,
362 bep_period2 := *,
363 pkt_ta := ?,
364 pkt_ext_ta_present := ?,
365 pkt_ext_ta := *,
366 freq_par_present := ?,
367 freq_par := *,
368 alloc_present := ?,
369 dyn_block_alloc := dyn_alloc,
370 multi_block_alloc := omit
371 };
372
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200373 template AckNackDescription tr_AckNackDescription(template BIT1 final_ack := ?) := {
374 final_ack := final_ack,
375 starting_seq_nr := ?,
376 receive_block_bitmap := ?
377 };
378
379 template UlAckNackGprsAdditionsRel99 tr_UlAckNackGprsAdditionsRel99(template boolean tbf_est := ?) := {
380 ext_pkt_ta_present := ?,
381 ext_pkt_ta := *,
382 tbf_est := tbf_est
383 };
384
385 template UlAckNackGprs tr_UlAckNackGprs(template GprsTlli tlli := *,
386 template AckNackDescription acknack_desc := ?,
387 template UlAckNackGprsAdditionsRel99 rel99 := *) := {
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200388 ch_coding_cmd := ?,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200389 ack_nack_desc := acknack_desc,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200390 cont_res_tlli_present := ?,
391 cont_res_tlli := tlli,
392 pkt_ta_present := ?,
393 pkt_ta := *,
394 pwr_ctrl_present := ?,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200395 pwr_ctrl := *,
396 extension_bits_present := ?,
397 extension_bits := *,
398 not_used := '0'B,
399 rel99_present := ?,
400 rel99 := rel99
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200401 };
402
403 template UlAckNackEgprs tr_UlAckNackEgprs(template GprsTlli tlli := *) := {
Pau Espin Pedrolf8fe2d22020-11-10 18:39:25 +0100404 msg_excape := '00'B,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200405 ch_coding_cmd := ?,
406 resegment := ?,
407 preemptive_tx := ?,
408 prr_retrans_req := ?,
409 arac_retrans_req := ?,
410 cont_res_tlli_present := ?,
411 cont_res_tlli := tlli,
412 tbf_est := ?,
413 pkt_ta_present := ?,
414 pkt_ta := *,
415 pkt_ext_ta_present := ?,
416 pkt_ext_ta := *,
417 pwr_ctrl_present := ?,
418 pwr_ctrl := *
419 };
420
Pau Espin Pedrolfa64e282021-02-05 17:56:52 +0100421 template (value) EgprsAckNackDescriptionIE ts_EgprsAckNackDescriptionIE(template (value) EgprsAckNackDescription andesc) := {
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100422 len_present := '1'B,
423 len := 0, /* Overwritten by RAW encoder */
424 acknack_desc := andesc
425 }
426
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +0200427} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };