Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 1 | /* TITAN REW encode/decode definitions for 3GPP TS 44.060 RLC/MAC Blocks */ |
| 2 | |
| 3 | /* (C) 2017-2018 Harald Welte <laforge@gnumonks.org> |
| 4 | * (C) 2020 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | */ |
| 12 | |
| 13 | module RLCMAC_Templates { |
| 14 | import from General_Types all; |
| 15 | import from Osmocom_Types all; |
| 16 | import from GSM_Types all; |
| 17 | import from RLCMAC_CSN1_Types all; |
| 18 | import from RLCMAC_CSN1_Templates all; |
| 19 | import from RLCMAC_Types all; |
| 20 | |
Pau Espin Pedrol | 4fbeefd | 2020-11-05 13:47:24 +0100 | [diff] [blame] | 21 | template CodingScheme cs_gprs_any := (CS_1, CS_2, CS_3, CS_4); |
| 22 | template CodingScheme mcs_egprs_any := (MCS_1, MCS_2, MCS_3, MCS_4, MCS_5, |
| 23 | MCS_6, MCS_7, MCS_8, MCS_9); |
| 24 | |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 25 | /* TS 44.060 10.4.5 */ |
| 26 | function f_rrbp_fn_delay(MacRrbp rrbp) return uint32_t { |
| 27 | select (rrbp) { |
| 28 | case (RRBP_Nplus13_mod_2715648) { return 13; } |
| 29 | case (RRBP_Nplus17_or_18_mod_2715648) { return 17; } |
| 30 | case (RRBP_Nplus21_or_22_mod_2715648) { return 21; } |
| 31 | case (RRBP_Nplus26_mod_2715648) { return 26; } |
| 32 | } |
| 33 | return 0; |
| 34 | } |
| 35 | |
Vadim Yanitskiy | 2742bcd | 2020-05-10 12:45:18 +0700 | [diff] [blame] | 36 | function f_rrbp_ack_fn(uint32_t current_fn, MacRrbp rrbp) |
| 37 | return uint32_t { |
| 38 | return (current_fn + f_rrbp_fn_delay(rrbp)) mod 2715648; |
| 39 | } |
| 40 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 41 | function f_rlcmac_cs_mcs_is_mcs(CodingScheme cs_mcs) return boolean { |
| 42 | if (cs_mcs >= MCS_0) { |
| 43 | return true; |
| 44 | } |
| 45 | return false; |
| 46 | } |
| 47 | |
Pau Espin Pedrol | 27d6af5 | 2020-04-30 20:13:32 +0200 | [diff] [blame] | 48 | function f_rlcmac_mcs2headertype(CodingScheme mcs) return EgprsHeaderType { |
| 49 | select (mcs) { |
| 50 | case (MCS_0) { return RLCMAC_HDR_TYPE_3; } |
| 51 | case (MCS_1) { return RLCMAC_HDR_TYPE_3; } |
| 52 | case (MCS_2) { return RLCMAC_HDR_TYPE_3; } |
| 53 | case (MCS_3) { return RLCMAC_HDR_TYPE_3; } |
| 54 | case (MCS_4) { return RLCMAC_HDR_TYPE_3; } |
| 55 | case (MCS_5) { return RLCMAC_HDR_TYPE_2; } |
| 56 | case (MCS_6) { return RLCMAC_HDR_TYPE_2; } |
| 57 | case (MCS_7) { return RLCMAC_HDR_TYPE_1; } |
| 58 | case (MCS_8) { return RLCMAC_HDR_TYPE_1; } |
| 59 | case (MCS_9) { return RLCMAC_HDR_TYPE_1; } |
| 60 | } |
| 61 | return RLCMAC_HDR_TYPE_3; |
| 62 | } |
| 63 | |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 64 | function f_rlcmac_cs_mcs2block_len(CodingScheme cs_mcs) return uint32_t { |
| 65 | select (cs_mcs) { |
| 66 | case (CS_1) { return 23; } |
| 67 | case (CS_2) { return 34; } |
| 68 | case (CS_3) { return 40; } |
| 69 | case (CS_4) { return 54; } |
| 70 | case (MCS_1) { return 27; } |
| 71 | case (MCS_2) { return 33; } |
| 72 | case (MCS_3) { return 42; } |
| 73 | case (MCS_4) { return 49; } |
| 74 | case (MCS_5) { return 61; } |
| 75 | case (MCS_6) { return 79; } |
| 76 | case (MCS_7) { return 119; } |
| 77 | case (MCS_8) { return 143; } |
| 78 | case (MCS_9) { return 155; } |
| 79 | } |
| 80 | return 0; |
| 81 | } |
| 82 | |
| 83 | function f_rlcmac_block_len2cs_mcs(uint32_t len) return CodingScheme { |
| 84 | select (len) { |
| 85 | case (23) { return CS_1; } |
| 86 | case (34) { return CS_2; } |
| 87 | case (40) { return CS_3; } |
| 88 | case (54) { return CS_4; } |
| 89 | case (27) { return MCS_1; } |
| 90 | case (33) { return MCS_2; } |
| 91 | case (42) { return MCS_3; } |
| 92 | case (49) { return MCS_4; } |
| 93 | case (60) { return MCS_5; } |
| 94 | case (61) { return MCS_5; } |
| 95 | case (78) { return MCS_6; } |
| 96 | case (79) { return MCS_6; } |
| 97 | case (118) { return MCS_7; } |
| 98 | case (119) { return MCS_7; } |
| 99 | case (142) { return MCS_8; } |
| 100 | case (143) { return MCS_8; } |
| 101 | case (154) { return MCS_9; } |
| 102 | case (155) { return MCS_9; } |
| 103 | } |
| 104 | return CS_1; |
| 105 | } |
| 106 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 107 | function f_rlcmac_cs_mcs2block_len_no_spare_bits(CodingScheme cs_mcs) return uint32_t { |
| 108 | select (cs_mcs) { |
| 109 | /* 3GPP TS 44.060 Table 10.2.1: RLC data block size, discounting padding in octet */ |
| 110 | case (CS_1) { return 23; } |
| 111 | case (CS_2) { return 33; } |
| 112 | case (CS_3) { return 39; } |
| 113 | case (CS_4) { return 53; } |
| 114 | case (MCS_1) { return 27; } |
| 115 | case (MCS_2) { return 33; } |
| 116 | case (MCS_3) { return 42; } |
| 117 | case (MCS_4) { return 49; } |
| 118 | case (MCS_5) { return 61; } |
| 119 | case (MCS_6) { return 79; } |
| 120 | case (MCS_7) { return 119; } |
| 121 | case (MCS_8) { return 143; } |
| 122 | case (MCS_9) { return 155; } |
| 123 | } |
| 124 | return 0; |
| 125 | } |
| 126 | |
| 127 | /* Minimum CodingScheme required to fit RLCMAC block. Spare bits not counted. */ |
Pau Espin Pedrol | 245bfcb | 2020-06-30 20:17:07 +0200 | [diff] [blame] | 128 | function f_rlcmac_block_len_required_cs_mcs(uint32_t len, boolean is_mcs) return CodingScheme { |
| 129 | if (is_mcs) { |
| 130 | if (len <= 27) { return MCS_1; } |
| 131 | if (len <= 33) { return MCS_2; } |
| 132 | if (len <= 42) { return MCS_3; } |
| 133 | if (len <= 49) { return MCS_4; } |
| 134 | if (len <= 60) { return MCS_5; } |
| 135 | if (len <= 61) { return MCS_5; } |
| 136 | if (len <= 79) { return MCS_6; } |
| 137 | if (len <= 119) { return MCS_7; } |
| 138 | if (len <= 143) { return MCS_8; } |
| 139 | if (len <= 155) { return MCS_9; } |
| 140 | return MCS_1; /* error! */ |
| 141 | } else { |
| 142 | /* 3GPP TS 44.060 Table 10.2.1: RLC data block size, discounting padding in octet */ |
| 143 | if (len <= 23) { return CS_1; } |
| 144 | if (len <= 33) { return CS_2; } |
| 145 | if (len <= 39) { return CS_3; } |
| 146 | if (len <= 53) { return CS_4; } |
| 147 | return CS_1; /* error! */ |
| 148 | } |
| 149 | } |
| 150 | |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 151 | function f_rlcmac_block_ChCodingCommand2cs_mcs(ChCodingCommand chcc) return CodingScheme { |
| 152 | select (chcc) { |
| 153 | case (CH_CODING_CS1) { return CS_1; } |
| 154 | case (CH_CODING_CS2) { return CS_2; } |
| 155 | case (CH_CODING_CS3) { return CS_3; } |
| 156 | case (CH_CODING_CS4) { return CS_4; } |
| 157 | } |
| 158 | return CS_1; |
| 159 | } |
| 160 | |
| 161 | function f_rlcmac_block_EgprsChCodingCommand2cs_mcs(EgprsChCodingCommand echcc) return CodingScheme { |
| 162 | select (echcc) { |
| 163 | case (CH_CODING_MCS1) { return MCS_1; } |
| 164 | case (CH_CODING_MCS2) { return MCS_2; } |
| 165 | case (CH_CODING_MCS3) { return MCS_3; } |
| 166 | case (CH_CODING_MCS4) { return MCS_4; } |
| 167 | case (CH_CODING_MCS5) { return MCS_5; } |
| 168 | case (CH_CODING_MCS6) { return MCS_6; } |
| 169 | case (CH_CODING_MCS7) { return MCS_7; } |
| 170 | case (CH_CODING_MCS8) { return MCS_8; } |
| 171 | case (CH_CODING_MCS9) { return MCS_9; } |
| 172 | /* CH_CODING_MCS5_7 */ |
| 173 | /* CH_CODING_MCS6_9 */ |
| 174 | } |
| 175 | return MCS_1; |
| 176 | } |
| 177 | |
| 178 | /* 1 -> CS_1 / MCS_1, 2 -> CS_2 / MCS_2, etc. */ |
| 179 | function f_rlcmac_block_int2cs_mcs(integer n, boolean is_mcs) return CodingScheme { |
| 180 | var CodingScheme cs_mcs; |
| 181 | if (not is_mcs) { |
| 182 | int2enum(n - 1, cs_mcs); |
| 183 | return cs_mcs; |
| 184 | } else { |
| 185 | cs_mcs := MCS_0; |
| 186 | int2enum(enum2int(cs_mcs) + n, cs_mcs); |
| 187 | return cs_mcs; |
| 188 | } |
| 189 | } |
| 190 | |
Pau Espin Pedrol | 27d6af5 | 2020-04-30 20:13:32 +0200 | [diff] [blame] | 191 | /* Coding and Puncturing Scheme indicator field for Header type 1 in EGPRS TBF or EC TBF or downlink EGPRS2 TBF */ |
| 192 | function f_rlcmac_cps_htype1_to_mcs(uint3_t cps) return CodingScheme { |
| 193 | var CodingSchemeArray egprs_Header_type1_coding_puncturing_scheme_to_mcs := { |
| 194 | MCS_9 /* 0x00, "(MCS-9/P1 ; MCS-9/P1)" */, |
| 195 | MCS_9 /* 0x01, "(MCS-9/P1 ; MCS-9/P2)" */, |
| 196 | MCS_9 /* 0x02, "(MCS-9/P1 ; MCS-9/P3)" */, |
| 197 | MCS_0 /* 0x03, "reserved" */, |
| 198 | MCS_9 /* 0x04, "(MCS-9/P2 ; MCS-9/P1)" */, |
| 199 | MCS_9 /* 0x05, "(MCS-9/P2 ; MCS-9/P2)" */, |
| 200 | MCS_9 /* 0x06, "(MCS-9/P2 ; MCS-9/P3)" */, |
| 201 | MCS_0 /* 0x07, "reserved" */, |
| 202 | MCS_9 /* 0x08, "(MCS-9/P3 ; MCS-9/P1)" */, |
| 203 | MCS_9 /* 0x09, "(MCS-9/P3 ; MCS-9/P2)" */, |
| 204 | MCS_9 /* 0x0A, "(MCS-9/P3 ; MCS-9/P3)" */, |
| 205 | MCS_8 /* 0x0B, "(MCS-8/P1 ; MCS-8/P1)" */, |
| 206 | MCS_8 /* 0x0C, "(MCS-8/P1 ; MCS-8/P2)" */, |
| 207 | MCS_8 /* 0x0D, "(MCS-8/P1 ; MCS-8/P3)" */, |
| 208 | MCS_8 /* 0x0E, "(MCS-8/P2 ; MCS-8/P1)" */, |
| 209 | MCS_8 /* 0x0F, "(MCS-8/P2 ; MCS-8/P2)" */, |
| 210 | MCS_8 /* 0x10, "(MCS-8/P2 ; MCS-8/P3)" */, |
| 211 | MCS_8 /* 0x11, "(MCS-8/P3 ; MCS-8/P1)" */, |
| 212 | MCS_8 /* 0x12, "(MCS-8/P3 ; MCS-8/P2)" */, |
| 213 | MCS_8 /* 0x13, "(MCS-8/P3 ; MCS-8/P3)" */, |
| 214 | MCS_7 /* 0x14, "(MCS-7/P1 ; MCS-7/P1)" */, |
| 215 | MCS_7 /* 0x15, "(MCS-7/P1 ; MCS-7/P2)" */, |
| 216 | MCS_7 /* 0x16, "(MCS-7/P1 ; MCS-7/P3)" */, |
| 217 | MCS_7 /* 0x17, "(MCS-7/P2 ; MCS-7/P1)" */, |
| 218 | MCS_7 /* 0x18, "(MCS-7/P2 ; MCS-7/P2)" */, |
| 219 | MCS_7 /* 0x19, "(MCS-7/P2 ; MCS-7/P3)" */, |
| 220 | MCS_7 /* 0x1A, "(MCS-7/P3 ; MCS-7/P1)" */, |
| 221 | MCS_7 /* 0x1B, "(MCS-7/P3 ; MCS-7/P2)" */, |
| 222 | MCS_7 /* 0x1C, "(MCS-7/P3 ; MCS-7/P3)" */, |
| 223 | MCS_0 /* 0x1D, "reserved" */, |
| 224 | MCS_0 /* 0x1E, "reserved" */, |
| 225 | MCS_0 /* 0x1F, "reserved" */ |
| 226 | }; |
| 227 | return egprs_Header_type1_coding_puncturing_scheme_to_mcs[cps]; |
| 228 | } |
| 229 | |
| 230 | /* Coding and Puncturing Scheme indicator field for Header type 2 in (EC-)EGPRS TBF or uplink EGPRS2-A TBF */ |
| 231 | function f_rlcmac_cps_htype2_to_mcs(uint3_t cps) return CodingScheme { |
| 232 | var CodingSchemeArray egprs_Header_type2_coding_puncturing_scheme_to_mcs := { |
| 233 | MCS_6 /* {0x00, "MCS-6/P1"} */, |
| 234 | MCS_6 /* {0x01, "MCS-6/P2"} */, |
| 235 | MCS_6 /* {0x02, "MCS-6/P1 with 6 octet padding"} */, |
| 236 | MCS_6 /* {0x03, "MCS-6/P2 with 6 octet padding "} */, |
| 237 | MCS_5 /* {0x04, "MCS-5/P1"} */, |
| 238 | MCS_5 /* {0x05, "MCS-5/P2"} */, |
| 239 | MCS_5 /* {0x06, "MCS-6/P1 with 10 octet padding "} */, |
| 240 | MCS_5 /* {0x07, "MCS-6/P2 with 10 octet padding "} */ |
| 241 | }; |
| 242 | return egprs_Header_type2_coding_puncturing_scheme_to_mcs[cps]; |
| 243 | } |
| 244 | |
| 245 | /* Coding and Puncturing Scheme indicator field for Header type 3 */ |
| 246 | function f_rlcmac_cps_htype3_to_mcs(uint3_t cps) return CodingScheme { |
| 247 | var CodingSchemeArray egprs_Header_type3_coding_puncturing_scheme_to_mcs := { |
| 248 | MCS_4 /* {0x00, "MCS-4/P1"} */, |
| 249 | MCS_4 /* {0x01, "MCS-4/P2"} */, |
| 250 | MCS_4 /* {0x02, "MCS-4/P3"} */, |
| 251 | MCS_3 /* {0x03, "MCS-3/P1"} */, |
| 252 | MCS_3 /* {0x04, "MCS-3/P2"} */, |
| 253 | MCS_3 /* {0x05, "MCS-3/P3"} */, |
| 254 | MCS_3 /* {0x06, "MCS-3/P1 with padding"} */, |
| 255 | MCS_3 /* {0x07, "MCS-3/P2 with padding"} */, |
| 256 | MCS_3 /* {0x08, "MCS-3/P3 with padding"} */, |
| 257 | MCS_2 /* {0x09, "MCS-2/P1"} */, |
| 258 | MCS_2 /* {0x0A, "MCS-2/P2"} */, |
| 259 | MCS_1 /* {0x0B, "MCS-1/P1"} */, |
| 260 | MCS_1 /* {0x0C, "MCS-1/P2"} */, |
| 261 | MCS_2 /* {0x0D, "MCS-2/P1 with padding"} */, |
| 262 | MCS_2 /* {0x0E, "MCS-2/P2 with padding"} */, |
| 263 | MCS_0 /* {0x0F, "MCS-0"} */ |
| 264 | }; |
| 265 | return egprs_Header_type3_coding_puncturing_scheme_to_mcs[cps]; |
| 266 | } |
| 267 | |
| 268 | function f_rlcmac_cps_htype_to_mcs(uint3_t cps, EgprsHeaderType htype) return CodingScheme { |
| 269 | select (htype) { |
| 270 | case (RLCMAC_HDR_TYPE_1) { return f_rlcmac_cps_htype1_to_mcs(cps); } |
| 271 | case (RLCMAC_HDR_TYPE_2) { return f_rlcmac_cps_htype2_to_mcs(cps); } |
| 272 | case (RLCMAC_HDR_TYPE_3) { return f_rlcmac_cps_htype3_to_mcs(cps); } |
| 273 | } |
| 274 | //TODO: return error here. |
| 275 | return CS_1; |
| 276 | } |
| 277 | |
| 278 | function f_rlcmac_mcs_to_cps_htype1(CodingScheme mcs, uint2_t part, boolean with_padding) return uint5_t { |
| 279 | //TODO: implement similar to f_rlcmac_mcs_to_cps_htype3() |
| 280 | //TODO: return error here. |
| 281 | return 0; |
| 282 | } |
| 283 | |
| 284 | function f_rlcmac_mcs_to_cps_htype2(CodingScheme mcs, uint2_t part, boolean with_padding) return uint5_t { |
| 285 | //TODO: implement similar to f_rlcmac_mcs_to_cps_htype3() |
| 286 | //TODO: return error here. |
| 287 | return 0; |
| 288 | } |
| 289 | |
| 290 | function f_rlcmac_mcs_to_cps_htype3(CodingScheme mcs, uint2_t part, boolean with_padding) return uint5_t { |
| 291 | select (mcs) { |
| 292 | case (MCS_4) { |
| 293 | select (part) { |
| 294 | case (1) { return 0; /* {0x00, "MCS-4/P1"} */ } |
| 295 | case (2) { return 1; /* {0x01, "MCS-4/P2"} */ } |
| 296 | case (3) { return 2; /* {0x01, "MCS-4/P2"} */ } |
| 297 | } |
| 298 | } |
| 299 | case (MCS_3) { |
| 300 | if (not with_padding) { |
| 301 | select (part) { |
| 302 | case (1) { return 3; /* {0x03, "MCS-3/P1"} */ } |
| 303 | case (2) { return 4; /* {0x04, "MCS-3/P2"} */ } |
| 304 | case (3) { return 5; /* {0x05, "MCS-3/P3"} */ } |
| 305 | } |
| 306 | } else { |
| 307 | select (part) { |
| 308 | case (1) { return 6; /* {0x06, "MCS-3/P1 with padding"} */ } |
| 309 | case (2) { return 7; /* {0x07, "MCS-3/P2 with padding"} */ } |
| 310 | case (3) { return 8; /* {0x08, "MCS-3/P3 with padding"} */ } |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | case (MCS_2) { |
| 315 | if (not with_padding) { |
| 316 | select (part) { |
| 317 | case (1) { return 9; /* {0x09, "MCS-2/P1"} */ } |
| 318 | case (2) { return 10; /* {0x0A, "MCS-2/P2"} */ } |
| 319 | } |
| 320 | } else { |
| 321 | select (part) { |
| 322 | case (1) { return 13; /* {0x0D, "MCS-2/P1 with padding"} */ } |
| 323 | case (2) { return 14; /* {0x0E, "MCS-2/P2 with padding"} */} |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | case (MCS_1) { |
| 328 | select (part) { |
| 329 | case (1) { return 11; /* {0x0B, "MCS-1/P1"} */ } |
| 330 | case (2) { return 12; /* {0x0C, "MCS-1/P2"} */ } |
| 331 | } |
| 332 | } |
| 333 | case (MCS_0) { return 15; /* {0x0F, "MCS-0"} */ } |
| 334 | } |
| 335 | //TODO: return error here. |
| 336 | return 0; |
| 337 | } |
| 338 | |
| 339 | function f_rlcmac_mcs_to_cps(CodingScheme mcs, uint2_t part, boolean with_padding := false) return uint5_t { |
| 340 | |
| 341 | var EgprsHeaderType htype := f_rlcmac_mcs2headertype(mcs); |
| 342 | select (htype) { |
| 343 | case (RLCMAC_HDR_TYPE_1) { return f_rlcmac_mcs_to_cps_htype1(mcs, part, with_padding); } |
| 344 | case (RLCMAC_HDR_TYPE_2) { return f_rlcmac_mcs_to_cps_htype2(mcs, part, with_padding); } |
| 345 | case (RLCMAC_HDR_TYPE_3) { return f_rlcmac_mcs_to_cps_htype3(mcs, part, with_padding); } |
| 346 | } |
| 347 | //TODO: return error here. |
| 348 | return 0; |
| 349 | } |
| 350 | |
Vadim Yanitskiy | f3cb4dd | 2020-07-21 01:52:33 +0700 | [diff] [blame] | 351 | template (value) RlcmacUlBlock ts_RLC_UL_CTRL_ACK(template (value) RlcmacUlCtrlMsg ctrl, |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 352 | MacPayloadType pt := MAC_PT_RLCMAC_NO_OPT, |
| 353 | boolean retry := false) := { |
| 354 | ctrl := { |
| 355 | mac_hdr := { |
| 356 | payload_type := pt, |
| 357 | spare := '00000'B, |
| 358 | retry := retry |
| 359 | }, |
| 360 | payload := ctrl |
| 361 | } |
| 362 | } |
| 363 | |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 364 | private function f_presence_bit_chreq_desc(template (omit) ChannelReqDescription chreq_desc) return BIT1 { |
| 365 | if (istemplatekind(chreq_desc, "omit")) { |
| 366 | return '0'B; |
| 367 | } |
| 368 | return '1'B; |
| 369 | } |
| 370 | |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 371 | /* Send Template for Downlink ACK/NACK */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 372 | template RlcmacUlBlock ts_RLCMAC_DL_ACK_NACK(template uint5_t tfi, AckNackDescription andesc, boolean retry := false, |
| 373 | template (omit) ChannelReqDescription chreq_desc := omit) := { |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 374 | ctrl := { |
| 375 | mac_hdr := { |
| 376 | payload_type := MAC_PT_RLCMAC_NO_OPT, |
| 377 | spare := '00000'B, |
| 378 | retry := retry |
| 379 | }, |
| 380 | payload := { |
| 381 | msg_type := PACKET_DL_ACK_NACK, |
| 382 | u := { |
| 383 | dl_ack_nack := { |
| 384 | dl_tfi := tfi, |
| 385 | ack_nack_desc := andesc, |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 386 | chreq_desc_presence := f_presence_bit_chreq_desc(chreq_desc), |
| 387 | chreq_desc := chreq_desc, |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 388 | ch_qual_rep := c_ChQualRep_default |
| 389 | } |
| 390 | } |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | |
Pau Espin Pedrol | afdd28d | 2020-11-12 21:02:18 +0100 | [diff] [blame] | 395 | /* Send Template for Egprs Downlink ACK/NACK */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 396 | template RlcmacUlBlock ts_RLCMAC_DL_ACK_NACK_EGPRS(template uint5_t tfi, EgprsAckNackDescription andesc, boolean retry := false, |
| 397 | template (omit) ChannelReqDescription chreq_desc := omit) := { |
Pau Espin Pedrol | afdd28d | 2020-11-12 21:02:18 +0100 | [diff] [blame] | 398 | ctrl := { |
| 399 | mac_hdr := { |
| 400 | payload_type := MAC_PT_RLCMAC_NO_OPT, |
| 401 | spare := '00000'B, |
| 402 | retry := retry |
| 403 | }, |
| 404 | payload := { |
| 405 | msg_type := PACKET_EGPRS_DL_ACK_NACK, |
| 406 | u := { |
| 407 | dl_ack_nack_egprs := { |
| 408 | dl_tfi := tfi, |
| 409 | ms_oom := '0'B, |
| 410 | egprs_ch_qual_rep_presence := '0'B, |
| 411 | egprs_ch_qual_rep := omit, |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 412 | chreq_desc_presence := f_presence_bit_chreq_desc(chreq_desc), |
| 413 | chreq_desc := chreq_desc, |
Pau Espin Pedrol | afdd28d | 2020-11-12 21:02:18 +0100 | [diff] [blame] | 414 | pfi_presence := '0'B, |
| 415 | pfi := omit, |
| 416 | epdan_presence := '0'B, |
| 417 | ack_nack_desc_ie := ts_EgprsAckNackDescriptionIE(andesc) |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 424 | /* Template for uplink Data block */ |
Pau Espin Pedrol | dbc7127 | 2021-02-05 12:37:42 +0100 | [diff] [blame] | 425 | template (value) RlcmacUlBlock t_RLCMAC_UL_DATA(template (value) CodingScheme cs, |
| 426 | template (value) uint5_t tfi, |
| 427 | template (value) uint4_t cv, |
| 428 | template (value) uint7_t bsn, |
| 429 | template (value) LlcBlocks blocks := {}, |
| 430 | template (value) boolean stall := false) := { |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 431 | data := { |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 432 | cs := cs, |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 433 | mac_hdr := { |
| 434 | payload_type := MAC_PT_RLC_DATA, |
| 435 | countdown := cv, |
Pau Espin Pedrol | 80c1baa | 2020-11-10 17:45:31 +0100 | [diff] [blame] | 436 | stall_ind := stall, |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 437 | retry := false, |
| 438 | spare := '0'B, |
| 439 | pfi_ind := false, |
| 440 | tfi := tfi, |
| 441 | tlli_ind := false, |
| 442 | bsn := bsn, |
| 443 | e := false |
| 444 | }, |
| 445 | tlli := omit, |
| 446 | pfi := omit, |
| 447 | blocks := blocks |
| 448 | } |
| 449 | } |
Pau Espin Pedrol | dbc7127 | 2021-02-05 12:37:42 +0100 | [diff] [blame] | 450 | template (value) RlcmacUlBlock t_RLCMAC_UL_DATA_TLLI(template (value) CodingScheme cs, |
| 451 | template (value) uint5_t tfi, |
| 452 | template (value) uint4_t cv, |
| 453 | template (value) uint7_t bsn, |
| 454 | template (value) LlcBlocks blocks := {}, |
| 455 | template (value) boolean stall := false, |
| 456 | template (value) GprsTlli tlli) := { |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 457 | data := { |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 458 | cs := cs, |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 459 | mac_hdr := { |
| 460 | payload_type := MAC_PT_RLC_DATA, |
| 461 | countdown := cv, |
Pau Espin Pedrol | 80c1baa | 2020-11-10 17:45:31 +0100 | [diff] [blame] | 462 | stall_ind := stall, |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 463 | retry := false, |
| 464 | spare := '0'B, |
| 465 | pfi_ind := false, |
| 466 | tfi := tfi, |
| 467 | tlli_ind := true, |
| 468 | bsn := bsn, |
| 469 | e := false |
| 470 | }, |
| 471 | tlli := tlli, |
| 472 | pfi := omit, |
| 473 | blocks := blocks |
| 474 | } |
| 475 | } |
| 476 | |
Pau Espin Pedrol | 2456dad | 2020-04-30 20:22:38 +0200 | [diff] [blame] | 477 | /* Template for uplink Data block */ |
Pau Espin Pedrol | dbc7127 | 2021-02-05 12:37:42 +0100 | [diff] [blame] | 478 | template (value) RlcmacUlBlock t_RLCMAC_UL_EGPRS_DATA(CodingScheme mcs, |
| 479 | template (value) uint5_t tfi, |
| 480 | template (value) uint4_t cv, |
| 481 | template (value) uint11_t bsn1, |
| 482 | template (value) uint8_t bsn2_offset := 0, |
| 483 | template (value) EgprsLlcBlocks blocks := {}) := { |
Pau Espin Pedrol | 2456dad | 2020-04-30 20:22:38 +0200 | [diff] [blame] | 484 | data_egprs := { |
Pau Espin Pedrol | 5abfded | 2020-11-03 17:30:44 +0100 | [diff] [blame] | 485 | mcs := mcs, |
Pau Espin Pedrol | 2456dad | 2020-04-30 20:22:38 +0200 | [diff] [blame] | 486 | mac_hdr := { |
| 487 | header_type := f_rlcmac_mcs2headertype(mcs), |
| 488 | tfi := tfi, |
| 489 | countdown := cv, |
| 490 | foi_si := '0'B, |
| 491 | r_ri := '0'B, |
| 492 | bsn1 := bsn1, |
Pau Espin Pedrol | 081b168 | 2020-11-06 17:15:52 +0100 | [diff] [blame] | 493 | bsn2_offset := bsn2_offset, |
Pau Espin Pedrol | 2456dad | 2020-04-30 20:22:38 +0200 | [diff] [blame] | 494 | cps := f_rlcmac_mcs_to_cps(mcs, 1, false), |
| 495 | pfi_ind := false, |
| 496 | rsb := '0'B, |
| 497 | spb := '00'B |
| 498 | }, |
| 499 | tlli_ind := false, |
| 500 | e := false, |
| 501 | tlli := omit, |
| 502 | pfi := omit, |
| 503 | blocks := blocks |
| 504 | } |
| 505 | } |
| 506 | |
Vadim Yanitskiy | 0a9b148 | 2020-05-10 14:43:21 +0700 | [diff] [blame] | 507 | template DlMacHeader t_RLCMAC_DlMacH(template (present) MacPayloadType pt, |
| 508 | template (present) boolean rrbp_valid, |
| 509 | template (present) MacRrbp rrbp, |
| 510 | template (present) uint3_t usf) := { |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 511 | payload_type := pt, |
| 512 | rrbp := rrbp, |
Vadim Yanitskiy | 0a9b148 | 2020-05-10 14:43:21 +0700 | [diff] [blame] | 513 | rrbp_valid := rrbp_valid, |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 514 | usf := usf |
| 515 | } |
| 516 | |
Pau Espin Pedrol | 92c1908 | 2021-01-08 17:12:02 +0100 | [diff] [blame] | 517 | template RlcmacDlBlock tr_RLCMAC_DL_CTRL(template uint3_t usf := ?, template RlcmacDlCtrlMsg dl_ctrl := ?) := { |
| 518 | ctrl := { |
| 519 | mac_hdr := { |
| 520 | payload_type := (MAC_PT_RLCMAC_NO_OPT, MAC_PT_RLCMAC_OPT), |
| 521 | rrbp:= ?, |
| 522 | rrbp_valid := ?, |
| 523 | usf := usf |
| 524 | }, |
| 525 | opt := *, |
| 526 | payload := dl_ctrl |
| 527 | } |
| 528 | } |
| 529 | |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 530 | template RlcmacDlBlock tr_RLCMAC_DUMMY_CTRL(template uint3_t usf := ?, template PageMode page_mode := ?) := { |
| 531 | ctrl := { |
| 532 | mac_hdr := { |
| 533 | payload_type := (MAC_PT_RLCMAC_NO_OPT, MAC_PT_RLCMAC_OPT), |
| 534 | rrbp:= ?, |
| 535 | rrbp_valid := ?, |
| 536 | usf := usf |
| 537 | }, |
| 538 | opt := *, |
| 539 | payload := { |
| 540 | msg_type := PACKET_DL_DUMMY_CTRL, |
| 541 | u := { |
| 542 | dl_dummy := { |
| 543 | page_mode := page_mode, |
| 544 | persistence_levels_present := ?, |
| 545 | persistence_levels := * |
| 546 | } |
| 547 | } |
| 548 | } |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | template RlcmacDlBlock tr_RLCMAC_DL_PACKET_ASS(template uint3_t usf := ?) := { |
| 553 | ctrl := { |
| 554 | mac_hdr := { |
| 555 | payload_type := (MAC_PT_RLCMAC_NO_OPT, MAC_PT_RLCMAC_OPT), |
| 556 | rrbp:= ?, |
| 557 | rrbp_valid := ?, |
| 558 | usf := usf |
| 559 | }, |
| 560 | opt := *, |
| 561 | payload := { |
| 562 | msg_type := PACKET_DL_ASSIGNMENT, |
| 563 | u := { |
| 564 | dl_assignment := { |
| 565 | page_mode := ?, |
| 566 | pres1 := ?, |
| 567 | persistence_levels := *, |
Pau Espin Pedrol | 984d09f | 2020-05-19 18:51:58 +0200 | [diff] [blame] | 568 | tfi_or_tlli := ?, |
| 569 | egprs2 := '0'B, |
| 570 | mac_mode := ?, |
| 571 | rlc_mode := ?, |
| 572 | control_ack := ?, |
| 573 | timeslot_alloc := ?, |
| 574 | pkt_ta := ?, |
| 575 | p0_present := ?, |
| 576 | p0 := *, |
| 577 | reserved := *, |
| 578 | pr_mode := *, |
| 579 | freq_par_present := ?, |
| 580 | freq_par := *, |
| 581 | dl_tfi_ass_present := ?, |
| 582 | dl_tfi_assignment := *, |
| 583 | pwr_ctrl_present := ?, |
| 584 | pwr_ctrl := *, |
| 585 | tbf_starting_time_present := ?, |
| 586 | tbf_starting_time := *, |
Vadim Yanitskiy | 41b4dd8 | 2020-07-22 14:00:56 +0700 | [diff] [blame] | 587 | spare := '0'B, |
| 588 | rel_additions := * |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 589 | } |
| 590 | } |
| 591 | } |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | template RlcmacDlBlock tr_RLCMAC_UL_PACKET_ASS(template uint3_t usf := ?) := { |
| 596 | ctrl := { |
| 597 | mac_hdr := { |
| 598 | payload_type := (MAC_PT_RLCMAC_NO_OPT, MAC_PT_RLCMAC_OPT), |
| 599 | rrbp:= ?, |
| 600 | rrbp_valid := ?, |
| 601 | usf := usf |
| 602 | }, |
| 603 | opt := *, |
| 604 | payload := { |
| 605 | msg_type := PACKET_UL_ASSIGNMENT, |
| 606 | u := { |
| 607 | ul_assignment := { |
| 608 | page_mode := ?, |
| 609 | persistence_levels_present := ?, |
| 610 | persistence_levels := *, |
| 611 | identity := ?, |
| 612 | is_egprs := ?, /* msg escape */ |
Pau Espin Pedrol | 45b664b | 2020-05-14 15:16:40 +0200 | [diff] [blame] | 613 | gprs := *, |
| 614 | egprs := * |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 615 | } |
| 616 | } |
| 617 | } |
| 618 | } |
| 619 | } |
| 620 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 621 | template RlcmacDlBlock tr_RLCMAC_UL_PACKET_ASS_GPRS(template uint3_t usf := ?, template PktUlAssGprs gprs := ?) |
Vadim Yanitskiy | c227ea9 | 2020-07-21 02:48:58 +0700 | [diff] [blame] | 622 | modifies tr_RLCMAC_UL_PACKET_ASS := { |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 623 | ctrl := { |
| 624 | payload := { |
| 625 | u := { |
| 626 | ul_assignment := { |
| 627 | is_egprs := '0'B, |
Pau Espin Pedrol | 45b664b | 2020-05-14 15:16:40 +0200 | [diff] [blame] | 628 | gprs := gprs, |
| 629 | egprs := omit |
| 630 | } |
| 631 | } |
| 632 | } |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | template RlcmacDlBlock tr_RLCMAC_UL_PACKET_ASS_EGPRS(template uint3_t usf := ?, template PktUlAssEgprs egprs := ?) |
Vadim Yanitskiy | c227ea9 | 2020-07-21 02:48:58 +0700 | [diff] [blame] | 637 | modifies tr_RLCMAC_UL_PACKET_ASS := { |
Pau Espin Pedrol | 45b664b | 2020-05-14 15:16:40 +0200 | [diff] [blame] | 638 | ctrl := { |
| 639 | payload := { |
| 640 | u := { |
| 641 | ul_assignment := { |
| 642 | is_egprs := '1'B, |
| 643 | gprs := omit, |
| 644 | egprs := egprs |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 645 | } |
| 646 | } |
| 647 | } |
| 648 | } |
| 649 | } |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 650 | |
| 651 | /* Receive Template for Uplink ACK/NACK */ |
Pau Espin Pedrol | 692222c | 2020-05-17 00:25:37 +0200 | [diff] [blame] | 652 | template RlcmacDlBlock tr_RLCMAC_UL_ACK_NACK(template uint5_t ul_tfi) := { |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 653 | ctrl := { |
| 654 | mac_hdr := { |
| 655 | payload_type := (MAC_PT_RLCMAC_NO_OPT, MAC_PT_RLCMAC_OPT), |
| 656 | rrbp:= ?, |
| 657 | rrbp_valid := ?, |
| 658 | usf := ? |
| 659 | }, |
| 660 | opt := *, |
| 661 | payload := { |
| 662 | msg_type := PACKET_UL_ACK_NACK, |
| 663 | u := { |
| 664 | ul_ack_nack := { |
| 665 | page_mode := ?, |
| 666 | msg_excape := ?, |
| 667 | uplink_tfi := ul_tfi, |
Pau Espin Pedrol | 692222c | 2020-05-17 00:25:37 +0200 | [diff] [blame] | 668 | is_egprs := ?, |
| 669 | gprs := *, |
| 670 | egprs := * |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 671 | } |
| 672 | } |
| 673 | } |
| 674 | } |
Pau Espin Pedrol | 692222c | 2020-05-17 00:25:37 +0200 | [diff] [blame] | 675 | }; |
| 676 | |
| 677 | template RlcmacDlBlock tr_RLCMAC_UL_ACK_NACK_GPRS(template uint5_t ul_tfi, template UlAckNackGprs gprs := tr_UlAckNackGprs(*)) |
| 678 | modifies tr_RLCMAC_UL_ACK_NACK := { |
| 679 | ctrl := { |
| 680 | payload := { |
| 681 | u := { |
| 682 | ul_ack_nack := { |
| 683 | is_egprs := '0'B, |
| 684 | gprs := gprs, |
| 685 | egprs := omit |
| 686 | } |
| 687 | } |
| 688 | } |
| 689 | } |
| 690 | }; |
| 691 | |
| 692 | template RlcmacDlBlock tr_RLCMAC_UL_ACK_NACK_EGPRS(template uint5_t ul_tfi, template UlAckNackEgprs egprs := tr_UlAckNackEgprs(*)) |
| 693 | modifies tr_RLCMAC_UL_ACK_NACK := { |
| 694 | ctrl := { |
| 695 | payload := { |
| 696 | u := { |
| 697 | ul_ack_nack := { |
| 698 | is_egprs := '1'B, |
| 699 | gprs := omit, |
| 700 | egprs := egprs |
| 701 | } |
| 702 | } |
| 703 | } |
| 704 | } |
| 705 | }; |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 706 | |
| 707 | template RlcmacDlBlock tr_RLCMAC_PACKET_PAG_REQ(template uint3_t usf := ?) := { |
| 708 | ctrl := { |
| 709 | mac_hdr := { |
| 710 | payload_type := MAC_PT_RLCMAC_NO_OPT, |
| 711 | rrbp:= ?, |
| 712 | rrbp_valid := ?, |
| 713 | usf := usf |
| 714 | }, |
| 715 | opt := *, |
| 716 | payload := { |
| 717 | msg_type := PACKET_PAGING_REQUEST, |
| 718 | u := { |
| 719 | paging := { |
| 720 | page_mode := ?, |
| 721 | persistence_levels_present := ?, |
| 722 | persistence_levels := *, |
| 723 | nln_present := ?, |
| 724 | nln := *, |
Vadim Yanitskiy | e94164d | 2020-10-31 05:46:03 +0700 | [diff] [blame] | 725 | repeated_pageinfo := *, |
| 726 | repeated_pageinfo_term := '0'B |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 727 | } |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | } |
| 732 | |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 733 | /* Either GPRS or EGPRS data block with arbitrary contents */ |
| 734 | template RlcmacDlBlock tr_RLCMAC_DATA := (tr_RLCMAC_DATA_GPRS, tr_RLCMAC_DATA_EGPRS); |
| 735 | |
Vadim Yanitskiy | d4f22aa | 2020-05-10 13:13:46 +0700 | [diff] [blame] | 736 | template RlcmacDlBlock tr_RLCMAC_DATA_GPRS(template (present) boolean rrbp_valid := ?, |
| 737 | template (present) MacRrbp rrbp := ?, |
| 738 | template (present) uint3_t usf := ?) := { |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 739 | data := { |
Pau Espin Pedrol | 5abfded | 2020-11-03 17:30:44 +0100 | [diff] [blame] | 740 | cs := ?, |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 741 | mac_hdr := { |
| 742 | mac_hdr := { |
| 743 | payload_type := MAC_PT_RLC_DATA, |
Vadim Yanitskiy | d4f22aa | 2020-05-10 13:13:46 +0700 | [diff] [blame] | 744 | rrbp := rrbp, |
| 745 | rrbp_valid := rrbp_valid, |
| 746 | usf := usf |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 747 | }, |
| 748 | hdr_ext := ? |
| 749 | }, |
| 750 | blocks := ? |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | template RlcmacDlBlock tr_RLCMAC_DATA_EGPRS := { |
| 755 | data_egprs := { |
Pau Espin Pedrol | 5abfded | 2020-11-03 17:30:44 +0100 | [diff] [blame] | 756 | mcs := ?, |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 757 | mac_hdr := ?, |
| 758 | fbi := ?, |
| 759 | e := ?, |
| 760 | blocks := ? |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | /* Template for Uplink MAC Control Header */ |
| 765 | template UlMacCtrlHeader t_RLCMAC_UlMacCtrlH(template MacPayloadType pt, template boolean retry := false) := { |
| 766 | payload_type := pt, |
| 767 | spare := '00000'B, |
| 768 | retry := retry |
| 769 | } |
| 770 | |
| 771 | /* Template for Uplink Control ACK */ |
| 772 | template RlcmacUlBlock ts_RLCMAC_CTRL_ACK(GprsTlli tlli, CtrlAck ack := MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN) := { |
| 773 | ctrl := { |
| 774 | mac_hdr := t_RLCMAC_UlMacCtrlH(MAC_PT_RLCMAC_NO_OPT), |
| 775 | payload := { |
| 776 | msg_type := PACKET_CONTROL_ACK, |
| 777 | u := { |
| 778 | ctrl_ack := { |
| 779 | tlli := tlli, |
| 780 | ctrl_ack := ack |
| 781 | } |
| 782 | } |
| 783 | } |
| 784 | } |
| 785 | } |
| 786 | |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 787 | template LlcBlockHdr t_RLCMAC_LLCBLOCK_HDR(uint16_t length_ind, boolean more, boolean e) := { |
| 788 | length_ind := length_ind, |
| 789 | more := more, /* 1 = new LLC PDU starts */ |
| 790 | e := e /* 0 = another extension octet after LLC PDU, 1 = no more extension octets */ |
| 791 | } |
| 792 | |
| 793 | template EgprsLlcBlockHdr t_RLCMAC_LLCBLOCK_EGPRS_HDR(uint16_t length_ind, boolean e) := { |
| 794 | length_ind := length_ind, |
| 795 | e := e /* 0 = another extension octet after LLC PDU, 1 = no more extension octets */ |
| 796 | } |
| 797 | |
| 798 | /* Template for a LlcBlock (part of a LLC frame inside RlcMacDlDataBlock */ |
| 799 | template LlcBlock t_RLCMAC_LLCBLOCK(octetstring data, template (omit) LlcBlockHdr llc_hdr := omit) := { |
| 800 | hdr := llc_hdr, /* omit = let encoder figure out the header */ |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 801 | payload := data |
| 802 | } |
| 803 | |
Pau Espin Pedrol | 2456dad | 2020-04-30 20:22:38 +0200 | [diff] [blame] | 804 | /* Template for a LlcBlock (part of a LLC frame inside RlcMacEgprs?lDataBlock */ |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 805 | template EgprsLlcBlock t_RLCMAC_LLCBLOCK_EGPRS(octetstring data, template (omit) EgprsLlcBlockHdr llc_hdr := omit) := { |
Pau Espin Pedrol | 2456dad | 2020-04-30 20:22:38 +0200 | [diff] [blame] | 806 | /* let encoder figure out the header */ |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 807 | hdr := llc_hdr, /* omit = let encoder figure out the header */ |
Pau Espin Pedrol | 2456dad | 2020-04-30 20:22:38 +0200 | [diff] [blame] | 808 | payload := data |
| 809 | } |
| 810 | |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 811 | } with { encode "RAW"; variant "FIELDORDER(msb)" } |