blob: 72751019c555509e124ddb65446eecea97f859ac [file] [log] [blame]
Harald Weltea082a692017-07-15 15:58:13 +02001/* Encoding/Decoding routines for GSM System Information messages
2 * according to 3GPP TS 44.018 Version 12.3.0 Release 12 */
3
4/* (C) 2017 by Harald Welte <laforge@gnumonks.org> */
5
6module GSM_Types {
7
8 import from General_Types all;
9 import from Osmocom_Types all;
10
Harald Weltebdc5dbd2017-07-16 00:00:43 +020011 type integer GsmArfcn (0..1023);
12 type integer UmtsArfcn (0..16383);
13 type integer UmtsScramblingCode (0..511);
Harald Welted2e342f2017-07-16 07:34:13 +020014 const integer GsmMaxFrameNumber := 26*51*2048;
15 type integer GsmFrameNumber (0..GsmMaxFrameNumber);
16 type integer GsmRxLev (0..63);
17 type integer GsmTsc (0..7) with { variant "FIELDLENGTH(8)" };
18 type uint32_t GsmTmsi;
Harald Welte484160b2017-07-28 13:30:24 +020019 type uint32_t GprsTlli;
Harald Weltebdc5dbd2017-07-16 00:00:43 +020020
Harald Weltea082a692017-07-15 15:58:13 +020021 /* Table 10.4.1 of Section 10.4 / 3GPP TS 44.018 */
22 type enumerated RrMessageType {
23 ADDITIONAL_ASSIGNMENT ('00111011'B),
24 IMMEDIATE_ASSIGNMENT ('00111111'B),
25 IMMEDIATE_ASSIGNMENT_EXTENDED ('00111001'B),
26 IMMEDIATE_ASSIGNMENT_REJECT ('00111010'B),
27 IMMEDIATE_PACKET_ASSIGNMENT ('01101001'B),
28
29 CIPHERING_MODE_COMMAND ('00110101'B),
30 CIPHERING_MODE_COMPLETE ('00110010'B),
31
32 CONFIGURATION_CHANGE_COMMAND ('00110000'B),
33 CONFIGURATION_CHANGE_ACK ('00110001'B),
34 CONFIGURATION_CHANGE_REJECT ('00110011'B),
35
36 ASSIGNMENT_COMMAND ('00101110'B),
37 ASSIGNMENT_COMPLETE ('00101001'B),
38 ASSIGNMENT_FAILURE ('00101111'B),
39 HANDOVER_COMMAND ('00101011'B),
40 HANDOVER_COMPLETE ('00101100'B),
41 HANDOVER_FAILURE ('00101000'B),
42 PHYSICAL_INFORMATION ('00101101'B),
43
44 CHANNEL_RELEASE ('00001101'B),
45 PARTIAL_RELEASE ('00001010'B),
46 PARTIAL_RELEASE_COMPLETE ('00001111'B),
47
48 PAGING_REQUEST_TYPE_1 ('00100001'B),
49 PAGING_REQUEST_TYPE_2 ('00100010'B),
50 PAGING_REQUEST_TYPE_3 ('00100100'B),
51 PAGING_RESPONSE ('00100111'B),
52 NOTIFICATION_NCH ('00100000'B),
53 NOTIFICATION_RESPOSNE ('00100110'B),
54
55 SYSTEM_INFORMATION_TYPE_8 ('00011000'B),
56 SYSTEM_INFORMATION_TYPE_1 ('00011001'B),
57 SYSTEM_INFORMATION_TYPE_2 ('00011010'B),
58 SYSTEM_INFORMATION_TYPE_3 ('00011011'B),
59 SYSTEM_INFORMATION_TYPE_4 ('00011100'B),
60 SYSTEM_INFORMATION_TYPE_5 ('00011101'B),
61 SYSTEM_INFORMATION_TYPE_6 ('00011110'B),
62 SYSTEM_INFORMATION_TYPE_7 ('00011111'B),
63 SYSTEM_INFORMATION_TYPE_2bis ('00000010'B),
64 SYSTEM_INFORMATION_TYPE_2ter ('00000011'B),
65 SYSTEM_INFORMATION_TYPE_2quater ('00000111'B),
66 SYSTEM_INFORMATION_TYPE_5bis ('00000101'B),
67 SYSTEM_INFORMATION_TYPE_5ter ('00000110'B),
68 SYSTEM_INFORMATION_TYPE_9 ('00000100'B),
69 SYSTEM_INFORMATION_TYPE_13 ('00000000'B),
70
71 SYSTEM_INFORMATION_TYPE_16 ('00111101'B),
72 SYSTEM_INFORMATION_TYPE_17 ('00111110'B),
73
74 CHANNEL_MODE_MODIFY ('00010000'B),
75 RR_STATUS ('00010010'B),
76 CHANNEL_MODE_MODIFY_ACKNOWLEDGE ('00010111'B),
77 FREQUENCY_REDEFINITION ('00010100'B),
78 MEASUREMENT_REPORT ('00010101'B),
79 CLASSMARK_CHANGE ('00010110'B),
80 CLASSMARK_ENQUIRY ('00010011'B),
81 EXTENDED_MEASUREMENT_REPORT ('00110110'B),
82 EXTENDED_MEASUREMENT_ORDER ('00110111'B),
83 GPRS_SUSPENSION_REQUEST ('00110100'B),
84 //MBMS_ANNOUNCEMENT ('00010110'B), duplicate?
85 //SERVICE_INFORMATION ('00110110'B), duplicate?
86
87 APPLICATION_INFORMATION ('00111000'B),
88
89 SYSTEM_INFORMATION_TYPE_14 ('00000001'B),
90 SYSTEM_INFORMATION_TYPE_15 ('01000011'B),
91 SYSTEM_INFORMATION_TYPE_18 ('01000000'B),
92 SYSTEM_INFORMATION_TYPE_19 ('01000001'B),
93 SYSTEM_INFORMATION_TYPE_20 ('01000010'B),
94 SYSTEM_INFORMATION_TYPE_13alt ('01000100'B),
95 SYSTEM_INFORMATION_TYPE_2n ('01000101'B),
96 SYSTEM_INFORMATION_TYPE_21 ('01000110'B),
97 SYSTEM_INFORMATION_TYPE_22 ('01000111'B),
98 SYSTEM_INFORMATION_TYPE_23 ('01001111'B),
99
100 DTM_ASSIGNMENT_FAILURE ('01001000'B),
101 DTM_REJECT ('01001001'B),
102 DTM_REQUEST ('01001010'B),
103 PACKET_ASSIGNMENT ('01001011'B),
104 DTM_ASSIGNMENT_COMMAND ('01001100'B),
105 DTM_INFORMATION ('01001101'B),
106 PACKET_INFORMATION ('01001110'B),
107
108 UTRAN_CLASSMARK_CHANGE ('01100000'B),
109 CDMA2000_CLASSMARK_CHANGE ('01100010'B),
110 INTERSYS_TO_UTRAN_HO_CMD ('01100011'B),
111 INTERSYS_TO_CDMA2000_HO_CMD ('01100100'B),
112 GERAN_IU_MODE_CLASSMARK_CHG ('01100101'B),
113 INTERSYS_TO_EUTRAN_HO_CMD ('01100110'B)
114 } with { variant "FIELDLENGTH(8)" };
115
Harald Welted2e342f2017-07-16 07:34:13 +0200116 type octetstring RestOctets with { variant "PADDING(yes), PADDING_PATTERN('00101011'B)" };
117 type hexstring GsmBcdString with { variant "HEXORDER(low)" };
118 type GsmBcdString BcdMccMnc with { variant "FIELDLENGTH(6)" };
119
120 type record L2PseudoLength {
121 uint6_t l2_plen,
122 BIT2 zero_one
123 } with { variant "" };
124
125 template L2PseudoLength t_L2Pseudolength(template uint6_t len) := {
126 l2_plen := len,
127 zero_one := '01'B
128 };
129
130 type record RrHeader {
131 L2PseudoLength l2_plen,
132 uint4_t skip_indicator,
133 uint4_t rr_protocol_discriminator,
134 RrMessageType message_type
135 } with { variant "" };
136
137 template RrHeader t_RrHeader(RrMessageType msg_type, template uint6_t len) := {
138 l2_plen := t_L2Pseudolength(len),
139 skip_indicator := 0,
140 rr_protocol_discriminator := 6,
141 message_type := msg_type
142 };
143
144 type record RrL3Header {
145 uint4_t skip_indicator,
146 uint4_t rr_protocol_discriminator,
147 RrMessageType message_type
148 } with { variant "" };
149
150 type record MaioHsn {
151 } with { variant "" };
152
Harald Welte484160b2017-07-28 13:30:24 +0200153 /* TS 24.008 10.5.1.1 */
154 type uint16_t CellIdentity;
155
Harald Welted2e342f2017-07-16 07:34:13 +0200156 /* TS 24.008 10.5.1.2 */
157 type uint4_t CipheringKeySeqNr (0..7);
158
159 /* 24.008 10.5.1.3 */
160 type record LocationAreaIdentification {
161 BcdMccMnc mcc_mnc,
162 uint16_t lac
163 } with { variant "" };
164
165 /* TS 24.008 10.5.1.4 */
166 type enumerated MobileIdentityType {
167 MI_TYPE_NONE (0),
168 MI_TYPE_IMSI,
169 MI_TYPE_IMEI,
170 MI_TYPE_IMEISV,
171 MI_TYPE_TMSI,
172 MI_TYPE_TMGI
173 } with { variant "FIELDLENGTH(3)" };
174
175 type record MobileIdentityBCD {
176 MobileIdentityType mi_type (MI_TYPE_IMSI, MI_TYPE_IMEI, MI_TYPE_IMEISV),
177 boolean odd,
178 hexstring digits
179 } with { variant "" };
180
181 type record MobileIdentityTMSI {
Harald Welted2e342f2017-07-16 07:34:13 +0200182 BIT4 pad ('1111'B),
Harald Welte57a31502017-07-16 21:03:47 +0200183 boolean odd (false),
184 MobileIdentityType mi_type (MI_TYPE_TMSI),
Harald Welted2e342f2017-07-16 07:34:13 +0200185 GsmTmsi tmsi
186 } with { variant "" };
187
Harald Welte57a31502017-07-16 21:03:47 +0200188 type record MobileIdentityNone {
189 BIT4 pad ('1111'B),
190 boolean odd (false),
191 MobileIdentityType mi_type (MI_TYPE_NONE)
192 } with { variant "" };
193
Harald Welted2e342f2017-07-16 07:34:13 +0200194 type union MobileIdentity {
195 MobileIdentityBCD bcd,
Harald Welte57a31502017-07-16 21:03:47 +0200196 MobileIdentityTMSI tmsi,
197 MobileIdentityNone unused
Harald Welted2e342f2017-07-16 07:34:13 +0200198 } with { variant "TAG(bcd, mi_type = MI_TYPE_IMSI;
199 bcd, mi_type = MI_TYPE_IMEI;
200 bcd, mi_type = MI_TYPE_IMEISV;
Harald Welte57a31502017-07-16 21:03:47 +0200201 tmsi, mi_type = MI_TYPE_TMSI;
202 unused, mi_type = MI_TYPE_NONE)" };
Harald Welted2e342f2017-07-16 07:34:13 +0200203
204 type record MobileIdentityLV {
205 uint8_t len,
206 MobileIdentity mi
207 } with { variant (len) "LENGTHTO(mi)" };
208
209 type record MobileIdentityTLV {
210 uint8_t tag,
211 uint8_t len,
212 MobileIdentity mi
213 } with { variant (len) "LENGTHTO(mi)" };
214
215 /* TS 24.008 10.5.1.5 */
216 type record MsClassmark1 {
217 BIT1 spare,
218 uint2_t rev_level,
219 boolean es_ind,
220 boolean a51,
221 uint3_t rf_pwr_cap
222 } with { variant "" };
223
224 /* TS 24.008 10.5.1.6 */
225 type record MsClassmark2 {
226 BIT1 spare,
227 uint2_t rev_level,
228 boolean es_ind,
229 boolean a51,
230 uint3_t rf_pwr_cap,
231 BIT1 spare1,
232 boolean ps_cap,
233 uint2_t ss_screen_ind,
234 boolean sm_cap,
235 boolean vbs,
236 boolean vgcs,
237 boolean fc,
238 boolean cm3,
239 BIT1 spare2,
240 boolean lcsva_cap,
241 boolean ucs2,
242 boolean solsa,
243 boolean cmsp,
244 boolean a53,
245 boolean a52
246 } with { variant "" };
247 type record MsClassmark2LV {
248 uint8_t len,
249 MsClassmark2 cm2
250 } with { variant (len) "LENGTHTO(cm2)" };
251
252
Harald Welted2e342f2017-07-16 07:34:13 +0200253 /* 44.018 10.5.2.5 */
254 type record ChannelDescription {
Harald Weltead091b62017-07-16 21:03:17 +0200255 RslChannelNr chan_nr,
Harald Welted2e342f2017-07-16 07:34:13 +0200256 uint3_t tsc,
257 boolean h,
258 uint12_t arfcn optional,
259 MaioHsn maio_hsn optional
Harald Weltead091b62017-07-16 21:03:17 +0200260 } with { variant (arfcn) "PRESENCE(h = false)"
261 variant (maio_hsn) "PRESENCE(h = true)" };
262
263 type record ChannelDescriptionTV {
264 OCT1 iei,
265 ChannelDescription v
266 } with { variant "" };
Harald Welted2e342f2017-07-16 07:34:13 +0200267
268 /* 10.5.2.8 */
269 type enumerated ChannelNeeded {
270 CHAN_NEED_ANY (0),
271 CHAN_NEED_SDCCH (1),
272 CHAN_NEED_TCH_F (2),
273 CHAN_NEED_TCH_H (3)
274 } with { variant "FIELDLENGTH(2)" };
275 type record ChannelNeeded12 {
276 ChannelNeeded second,
277 ChannelNeeded first
278 } with { variant "" };
279
280 /* 10.5.2.21 */
281 type record MobileAllocation {
282 uint8_t len,
283 bitstring ma
284 } with { variant (len) "LENGTHTO(ma)" };
285
286 /* 10.5.2.25a */
287 type OCT3 PacketChannelDescription;
288
289 /* 10.5.2.25b */
290 type record DedicatedModeOrTbf {
291 BIT1 spare,
292 boolean tma,
293 boolean downlink,
294 boolean tbf
295 } with { variant "" };
296
297 /* 10.5.2.26 */
298 type enumerated PageMode {
299 PAGE_MODE_NORMAL,
300 PAGE_MODE_EXTENDED,
301 PAGE_MODE_REORGANIZATION,
302 PAGE_MODE_SAME_AS_BEFORE
303 } with { variant "FIELDLENGTH(4)" };
304
305 /* 10.5.2.30 */
306 type record RequestReference {
307 bitstring ra length(8),
308 uint5_t t1p,
309 uint6_t t3,
Harald Weltec3286cc2017-07-16 21:04:34 +0200310 uint5_t t2
Harald Welted2e342f2017-07-16 07:34:13 +0200311 } with { variant "" };
312
Harald Weltec3286cc2017-07-16 21:04:34 +0200313 template RequestReference t_RequestReference(template bitstring ra, template uint5_t t1p, template uint6_t t3, template uint5_t t2) := {
314 ra := ra,
315 t1p := t1p,
316 t3 := t3,
317 t2 := t2
318 }
319
320 /* compute the expected request reference for given RA + FN */
321 function f_compute_ReqRef(uint8_t ra, GsmFrameNumber fn) return RequestReference {
322 var RequestReference req_ref := { ra := int2bit(ra, 8) };
323 req_ref.t1p := (fn / 1326) mod 32;
324 req_ref.t2 := fn mod 26;
325 req_ref.t3 := fn mod 51;
326 return req_ref
327 }
328
Harald Welted2e342f2017-07-16 07:34:13 +0200329 /* 10.5.2.40 */
330 type integer TimingAdvance (0..219);
331
332 /* 10.5.2.43 */
333 type uint8_t WaitIndication;
334
335 /* 10.5.2.76 */
336 type record FeatureIndicator {
337 BIT2 spare,
338 boolean cs_ir,
339 boolean ps_ir
340 } with { variant "" };
341
Harald Welte484160b2017-07-28 13:30:24 +0200342 /* 24.008 10.5.5.6 */
343 type record DrxParameter {
344 uint8_t split_pg_cycle_code,
345 uint4_t drx_cycle_len_coeff,
346 boolean split_on_ccch,
347 uint3_t non_drx_timer
348 } with { variant "" };
349
350 /* 24.008 10.5.5.15 */
351 type record RoutingAreaIdentification {
352 LocationAreaIdentification lai,
353 uint8_t rac
354 } with { variant "" };
355
356
Harald Welted2e342f2017-07-16 07:34:13 +0200357
358 /* 9.1.18 */
359 type record ImmediateAssignment {
360 DedicatedModeOrTbf ded_or_tbf,
361 PageMode page_mode,
362 ChannelDescription chan_desc optional,
363 PacketChannelDescription pkt_chan_desc optional,
364 RequestReference req_ref,
365 TimingAdvance timing_advance,
366 MobileAllocation mobile_allocation
367 } with { variant (chan_desc) "PRESENCE(ded_or_tbf.tbf = false)"
368 variant (pkt_chan_desc) "PRESENCE(ded_or_tbf.tbf = true)" };
369
370 /* 9.1.20 */
371 type record ReqRefWaitInd {
372 RequestReference req_ref,
373 WaitIndication wait_ind
374 } with { variant "" };
375 type record length(4) of ReqRefWaitInd ReqRefWaitInd4;
376 type record ImmediateAssignmentReject {
377 FeatureIndicator feature_ind,
378 PageMode page_mode,
379 ReqRefWaitInd4 payload
380 } with { variant "" };
381
382 /* 9.1.22 */
383 type record PagingRequestType1 {
384 ChannelNeeded12 chan_needed,
385 PageMode page_mode,
386 MobileIdentityLV mi1,
387 MobileIdentityTLV mi2 optional,
388 RestOctets rest_octets
389 } with { variant "TAG(mi2, tag = 23)" };
390
391 /* 9.1.23 */
392 type record PagingRequestType2 {
393 ChannelNeeded12 chan_needed,
394 PageMode page_mode,
395 GsmTmsi mi1,
396 GsmTmsi mi2,
397 MobileIdentityTLV mi3 optional,
398 RestOctets rest_octets
399 } with { variant "TAG(mi3, tag = 23)" };
400
401 /* 9.1.24 */
402 type record length(4) of GsmTmsi GsmTmsi4;
403 type record PagingRequestType3 {
404 ChannelNeeded12 chan_needed,
405 PageMode page_mode,
406 GsmTmsi4 mi,
407 RestOctets rest_octets
408 } with { variant "" };
409
410
411 type union RrUnion {
412/*
413 SystemInformationType1 si1,
414 SystemInformationType2 si2,
415 SystemInformationType2bis si2bis,
416 SystemInformationType2ter si2ter,
417 SystemInformationType3 si3,
418 SystemInformationType4 si4,
419 SystemInformationType5 si5,
420 SystemInformationType5bis si5bis,
421 SystemInformationType5ter si5ter,
422 SystemInformationType6 si6,
423*/
424 ImmediateAssignment imm_ass,
425 ImmediateAssignmentReject imm_ass_rej,
426 PagingRequestType1 pag_req_1,
427 PagingRequestType2 pag_req_2,
428 PagingRequestType3 pag_req_3,
429 octetstring other
430 } with { variant "" };
431
432 /* Special RR Message on BCCH / CCCH Dowlink */
433
434 type record GsmRrMessage {
435 RrHeader header,
436 RrUnion payload
437 } with { variant (payload) "CROSSTAG(
438/*
439 si1, header.message_type = SYSTEM_INFORMATION_TYPE_1;
440 si2, header.message_type = SYSTEM_INFORMATION_TYPE_2;
441 si2bis, header.message_type = SYSTEM_INFORMATION_TYPE_2bis;
442 si2ter, header.message_type = SYSTEM_INFORMATION_TYPE_2ter;
443 si3, header.message_type = SYSTEM_INFORMATION_TYPE_3;
444 si4, header.message_type = SYSTEM_INFORMATION_TYPE_4;
445 si5, header.message_type = SYSTEM_INFORMATION_TYPE_5;
446 si5bis, header.message_type = SYSTEM_INFORMATION_TYPE_5bis;
447 si5ter, header.message_type = SYSTEM_INFORMATION_TYPE_5ter;
448 si6, header.message_type = SYSTEM_INFORMATION_TYPE_6;
449*/
450 imm_ass, header.message_type = IMMEDIATE_ASSIGNMENT;
451 imm_ass_rej, header.message_type = IMMEDIATE_ASSIGNMENT_REJECT;
452 pag_req_1, header.message_type = PAGING_REQUEST_TYPE_1;
453 pag_req_2, header.message_type = PAGING_REQUEST_TYPE_2;
454 pag_req_3, header.message_type = PAGING_REQUEST_TYPE_3;
455 other, OTHERWISE;
456 )" };
457
Harald Welte0b1e5b82017-07-16 18:53:17 +0200458 external function enc_GsmRrMessage(in GsmRrMessage msg) return octetstring
459 with { extension "prototype(convert) encode(RAW)" };
460 external function dec_GsmRrMessage(in octetstring stream) return GsmRrMessage
461 with { extension "prototype(convert) decode(RAW)" };
462
Harald Welted2e342f2017-07-16 07:34:13 +0200463 /* Normal L3 Message on Dedicated Channel */
464
465 /* 9.1.25 Paging Response */
466 type record PagingResponse {
467 uint4_t spare_half_octet,
468 CipheringKeySeqNr cksn,
469 MsClassmark2LV cm2,
470 MobileIdentityLV mi,
471 uint8_t addl_upd_par optional
472 } with { variant "" };
473
474 type union RrL3Union {
475 PagingResponse paging_response,
476 octetstring other
477 };
478
479 type record GsmRrL3Message {
480 RrL3Header header,
481 RrL3Union payload
482 } with { variant (payload) "CROSSTAG(
483 paging_response, header.message_type = PAGING_RESPONSE;
484
485 other, OTHERWISE;
486 )" }
487
Harald Welte0c8d5c02017-07-16 18:53:58 +0200488 /* TS 48.058 9.3.1 Channel Number IE */
489 type enumerated RslChanNr0 {
490 RSL_CHAN_NR_INVALID ('00'H),
491 RSL_CHAN_NR_Bm_ACCH ('01'H),
492 RSL_CHAN_NR_BCCH ('10'H),
493 RSL_CHAN_NR_RACH ('11'H),
494 RSL_CHAN_NR_PCH_AGCH ('12'H)
495 } with { variant "FIELDLENGTH(5)" };
496
497 type record RslChanNr2 {
498 BIT4 tag ('0001'B),
499 uint1_t sub_chan
500 } with { variant "FIELDLENGTH(5)" };
501
502 type record RslChanNr4 {
503 BIT3 tag ('001'B),
504 uint2_t sub_chan
505 } with { variant "FIELDLENGTH(5)" };
506
507 type record RslChanNr8 {
508 BIT2 tag ('01'B),
509 uint3_t sub_chan
510 } with { variant "FIELDLENGTH(5)" };
511
512 type union RslChanNrU {
513 RslChanNr0 ch0,
514 RslChanNr2 lm,
515 RslChanNr4 sdcch4,
516 RslChanNr8 sdcch8
517 } with {
518 variant "TAG(lm, tag = '0001'B;
519 sdcch4, tag = '001'B;
520 sdcch8, tag = '01'B;
521 ch0, OTHERWISE)"
522 variant "FIELDLENGTH(5)"
523 };
524
525 type record RslChannelNr {
526 RslChanNrU u,
527 uint3_t tn
528 } with { variant "FIELDLENGTH(8)" };
529
530 template RslChannelNr t_RslChanNr0(template uint3_t tn, template RslChanNr0 cht) := {
531 u := { ch0 := cht },
532 tn := tn
533 }
534
535 template RslChannelNr t_RslChanNr_RACH(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_RACH);
536 template RslChannelNr t_RslChanNr_BCCH(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_BCCH);
537 template RslChannelNr t_RslChanNr_PCH_AGCH(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_PCH_AGCH);
538 template RslChannelNr t_RslChanNr_Bm(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_Bm_ACCH);
539 template RslChannelNr t_RslChanNr_Lm(template uint3_t tn, uint1_t sub_slot) := {
540 u := { lm := { tag := '0001'B, sub_chan := sub_slot } },
541 tn := tn
542 }
543 template RslChannelNr t_RslChanNr_SDCCH4(template uint3_t tn, template uint2_t sub_slot) := {
544 u := { sdcch4 := { tag := '001'B, sub_chan := sub_slot } },
545 tn := tn
546 }
547 template RslChannelNr t_RslChanNr_SDCCH8(template uint3_t tn, template uint3_t sub_slot) := {
548 u := { sdcch8 := { tag := '01'B, sub_chan := sub_slot } },
549 tn := tn
550 }
Harald Welted2e342f2017-07-16 07:34:13 +0200551
Harald Welteb33e7272017-07-16 21:04:12 +0200552 /* TS 48.058 9.3.2 Link ID */
553 type enumerated RslLinkIdC {
554 FACCH_SDCCH (0),
555 SACCH (1)
556 } with { variant "FIELDLENGTH(2)" };
557
558 type enumerated RslSapi0Prio {
559 SAPI0_PRIO_NORMAL (0),
560 SAPI0_PRIO_HIGH (1),
561 SAPI0_PRIO_LOW (2)
562 } with { variant "FIELDLENGTH(2)" };
563
564 type uint3_t GsmSapi;
565
566 type record RslLinkId {
567 RslLinkIdC c,
568 boolean na,
569 RslSapi0Prio prio,
570 GsmSapi sapi
571 } with { variant "" };
572
573 template RslLinkId tr_RslLinkId := {
574 c := ?,
575 na := ?,
576 prio := ?,
577 sapi := ?
578 };
579
580 template RslLinkId tr_RslLinkID_DCCH(template GsmSapi sapi) modifies tr_RslLinkId := {
581 c := FACCH_SDCCH,
582 na := false,
583 sapi := sapi
584 };
585
586 template RslLinkId tr_RslLinkID_SACCH(template GsmSapi sapi) modifies tr_RslLinkId := {
587 c := SACCH,
588 na := false,
589 sapi := sapi
590 };
591
592 template RslLinkId ts_RslLinkID_DCCH(GsmSapi sapi) := {
593 c := FACCH_SDCCH,
594 na := false,
595 prio := SAPI0_PRIO_NORMAL,
596 sapi := sapi
597 };
598
Harald Weltecb5d1fb2017-07-17 21:00:15 +0200599 template RslLinkId ts_RslLinkID_SACCH(GsmSapi sapi) := {
600 c := SACCH,
601 na := false,
602 prio := SAPI0_PRIO_NORMAL,
603 sapi := sapi
Harald Welteb33e7272017-07-16 21:04:12 +0200604 };
605
Harald Weltea082a692017-07-15 15:58:13 +0200606} with { encode "RAW"; variant "FIELDORDER(msb)" }