blob: 254983a88ca65a8a4736de7aa9ddfae1692e6bae [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
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 Pedrole8d7d162020-04-29 19:07:36 +020058 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 Pedrol6791eb62020-05-20 18:27:10 +020074 const ChannelReqDescription c_ChReqDesc_default := {
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +020075 peak_tput_class := 0,
76 priority := 0,
Pau Espin Pedrol6791eb62020-05-20 18:27:10 +020077 rlc_mode := RLC_MODE_ACKNOWLEDGED,
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +020078 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 Pedrol02c972d2020-05-13 15:56:16 +0200109 };
110
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100111 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
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200161 /* TS 44.060 sec 11.2.9 */
162 template (value) NCMeasurement ts_NCMeasurement(uint6_t frequency_n, BIT6 bsic, uint6_t rxlev)
163 := {
164 frequency_n := frequency_n,
165 bsic_n_presence := '1'B,
166 bsic_n := bsic,
167 rxlev_n := rxlev
168 };
169 template (value) NCMeasurementReport ts_NCMeasurementReport(BIT1 nc_mode,
170 uint6_t rxlev_serving_cell,
171 template (value) NCMeasurementList nc_meas_list := {})
172 := {
173 nc_mode := nc_mode,
174 rxlev_serving_cell := rxlev_serving_cell,
175 zero := '0'B,
176 num_nc_measurements := 0, /* automatically updated */
177 nm_measurements := nc_meas_list
178 };
179 template RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_MEAS_REPORT(template (value) GprsTlli tlli,
180 template (value) NCMeasurementReport nc_meas_rep)
181 := {
182 msg_type := PACKET_MEASUREMENT_REPORT,
183 u := {
184 meas_report := {
185 tlli := tlli,
186 psi5_change_mark_presence := '0'B,
187 psi5_change_mark := omit,
188 additions_99 := '0'B,
189 nc_meas_report := nc_meas_rep
190 }
191 }
192 };
193
194 /* TS 44.060 sec 11.2.9b */
195 template RepeatedAddFrequencyItem tr_RepeatedAddFrequencyItem(template (present) uint10_t start_frequency := ?,
196 template (present) uint6_t bsic := ?)
197 := {
198 presence := '1'B,
199 item := {
200 start_frequency := start_frequency,
201 bsic := bsic,
202 cell_sel_par_present := ?,
203 cell_sel_par := *,
204 nr_of_frequencies := 0,
205 freq_diff_length := ?
206 /* TODO: support Frequency diff list */
207 }
208 };
209 template NCFrequencyList tr_NCFrequencyList(template FreqIndexList removed_freq_index := *, template RepeatedAddFrequencyItemList repeated_add_frequency := *)
210 := {
211 removed_freq_present := ?,
212 nr_of_removed_freq := *,
213 removed_freq_index := removed_freq_index,
214 repeated_add_frequency := repeated_add_frequency,
215 repeated_add_frequency_term := '0'B
216 };
217 template NCMeasurementParameters tr_NCMeasurementParameters(template (present) NetworkControlOrder nco := ?,
218 template uint3_t nc_non_drx_period := *,
219 template uint3_t nc_reporting_period_i := *,
220 template uint3_t nc_reporting_period_t := *,
221 template NCFrequencyList nc_freq_list := *)
222 := {
223 nco := nco,
224 nc_period_present := ?,
225 nc_non_drx_period := nc_non_drx_period,
226 nc_reporting_period_i := nc_reporting_period_i,
227 nc_reporting_period_t := nc_reporting_period_t,
228 nc_freq_list_present := ?,
229 nc_freq_list := nc_freq_list
230 };
231 /* This template is used by osmo-pcu to reset the GSM Neighbour Cell List of the MS */
232 template (value) NCMeasurementParameters ts_NCMeasurementParametersRESET
233 := {
234 nco := NC_RESET,
235 nc_period_present := '0'B,
236 nc_non_drx_period := omit,
237 nc_reporting_period_i := omit,
238 nc_reporting_period_t := omit,
239 nc_freq_list_present := '0'B,
240 nc_freq_list := omit
241 };
242 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_MEAS_ORDER(template (present) GlobalTfiOrTlli tfi_or_tlli := ?,
243 template (present) uint3_t pmo_index := ?,
244 template (present) uint3_t pmo_count := ?,
245 template (present) NCMeasurementParameters nc_meas_param := ?)
246 := {
247 msg_type := PACKET_MEASUREMENT_ORDER,
248 u := {
249 meas_order := {
250 page_mode := ?,
251 tfi_or_tlli := tfi_or_tlli,
252 pmo_index := pmo_index,
253 pmo_count := pmo_count,
254 nc_meas_param_present := '1'B,
255 nc_meas_param := nc_meas_param,
256 zero := '0'B
257 }
258 }
259 };
260
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100261 /* TS 44.060 sec 11.2.9e */
262 template RlcmacDlCtrlMsg tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(template (present) GlobalTfi tfi := ?,
263 template (present) uint5_t container_index := ?)
264 := {
265 msg_type := PACKET_NEIGHBOUR_CELL_DATA,
266 u := {
267 neighbour_cell_data := {
268 page_mode := ?,
269 zero := '0'B,
270 gtfi := tfi,
271 container_id := ?,
272 spare := '0'B,
273 container_index := container_index,
274 arfcn_bsic_presence := ?,
275 arfcn := *,
276 bsic := *,
277 container_list := ?
278 }
279 }
280 };
281
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200282 private function f_presence_bit_tfi(template uint5_t tfi) return BIT1 {
283 if (istemplatekind(tfi, "omit")) {
284 return '0'B;
285 }
286 return '1'B;
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +0200287 }
288
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200289 template DynamicAllocation tr_DynamicAllocation(template uint5_t tfi:= ?) := {
290 extd_dyn_alloc := ?,
291 p0_present := ?,
292 p0 := *,
293 pr_mode := *,
294 usf_granularity := ?,
295 ul_tfi_ass_present := f_presence_bit_tfi(tfi),
296 ul_tfi_assignment := tfi,
297 reserved := '0'B,
298 tbf_starting_time_present := ?,
299 tbf_starting_time := *,
300 ts_allocation := ?
301 };
302
303 template PktUlAssGprs tr_PktUlAssGprsDynamic(template DynamicAllocation dyn_alloc := ?) := {
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200304 ch_coding_cmd := ?,
305 tlli_block_chan_coding := ?,
306 pkt_ta := ?,
307 freq_par_present := ?,
308 freq_par := *,
309 alloc_present := '01'B,
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200310 dyn_block_alloc := dyn_alloc,
Pau Espin Pedrol02c972d2020-05-13 15:56:16 +0200311 sgl_block_alloc := omit
312 };
313
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200314 template PktUlAssEgprs tr_PktUlAssEgprsDynamic(template DynamicAllocation dyn_alloc := ?) := {
315 dual_carrier := '00'B,
316 tlli_present := ?,
317 tlli := *,
318 compact_reduced_ma_present := ?,
319 compact_reduced_ma := *,
320 chan_coding_cmd := ?,
321 resegment := ?,
322 window_size := ?,
323 ats_present := ?,
324 ats := *, /* ? */
325 arac_retrans_req := ?,
326 tlli_block_chan_coding := ?,
327 bep_period2_present := ?,
328 bep_period2 := *,
329 pkt_ta := ?,
330 pkt_ext_ta_present := ?,
331 pkt_ext_ta := *,
332 freq_par_present := ?,
333 freq_par := *,
334 alloc_present := ?,
335 dyn_block_alloc := dyn_alloc,
336 multi_block_alloc := omit
337 };
338
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200339 template AckNackDescription tr_AckNackDescription(template BIT1 final_ack := ?) := {
340 final_ack := final_ack,
341 starting_seq_nr := ?,
342 receive_block_bitmap := ?
343 };
344
345 template UlAckNackGprsAdditionsRel99 tr_UlAckNackGprsAdditionsRel99(template boolean tbf_est := ?) := {
346 ext_pkt_ta_present := ?,
347 ext_pkt_ta := *,
348 tbf_est := tbf_est
349 };
350
351 template UlAckNackGprs tr_UlAckNackGprs(template GprsTlli tlli := *,
352 template AckNackDescription acknack_desc := ?,
353 template UlAckNackGprsAdditionsRel99 rel99 := *) := {
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200354 ch_coding_cmd := ?,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200355 ack_nack_desc := acknack_desc,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200356 cont_res_tlli_present := ?,
357 cont_res_tlli := tlli,
358 pkt_ta_present := ?,
359 pkt_ta := *,
360 pwr_ctrl_present := ?,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200361 pwr_ctrl := *,
362 extension_bits_present := ?,
363 extension_bits := *,
364 not_used := '0'B,
365 rel99_present := ?,
366 rel99 := rel99
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200367 };
368
369 template UlAckNackEgprs tr_UlAckNackEgprs(template GprsTlli tlli := *) := {
Pau Espin Pedrolf8fe2d22020-11-10 18:39:25 +0100370 msg_excape := '00'B,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200371 ch_coding_cmd := ?,
372 resegment := ?,
373 preemptive_tx := ?,
374 prr_retrans_req := ?,
375 arac_retrans_req := ?,
376 cont_res_tlli_present := ?,
377 cont_res_tlli := tlli,
378 tbf_est := ?,
379 pkt_ta_present := ?,
380 pkt_ta := *,
381 pkt_ext_ta_present := ?,
382 pkt_ext_ta := *,
383 pwr_ctrl_present := ?,
384 pwr_ctrl := *
385 };
386
Pau Espin Pedrolfa64e282021-02-05 17:56:52 +0100387 template (value) EgprsAckNackDescriptionIE ts_EgprsAckNackDescriptionIE(template (value) EgprsAckNackDescription andesc) := {
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100388 len_present := '1'B,
389 len := 0, /* Overwritten by RAW encoder */
390 acknack_desc := andesc
391 }
392
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +0200393} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };