Harald Welte | a082a69 | 2017-07-15 15:58:13 +0200 | [diff] [blame] | 1 | /* Encoding/Decoding routines for GSM System Information messages |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 2 | * according to 3GPP TS 44.018 Version 12.3.0 Release 12 |
| 3 | * |
| 4 | * (C) 2017-2018 Harald Welte <laforge@gnumonks.org> |
| 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 | */ |
Harald Welte | a082a69 | 2017-07-15 15:58:13 +0200 | [diff] [blame] | 12 | |
| 13 | module GSM_Types { |
| 14 | |
| 15 | import from General_Types all; |
| 16 | import from Osmocom_Types all; |
| 17 | |
Harald Welte | bdc5dbd | 2017-07-16 00:00:43 +0200 | [diff] [blame] | 18 | type integer GsmArfcn (0..1023); |
| 19 | type integer UmtsArfcn (0..16383); |
| 20 | type integer UmtsScramblingCode (0..511); |
Harald Welte | d2e342f | 2017-07-16 07:34:13 +0200 | [diff] [blame] | 21 | const integer GsmMaxFrameNumber := 26*51*2048; |
| 22 | type integer GsmFrameNumber (0..GsmMaxFrameNumber); |
| 23 | type integer GsmRxLev (0..63); |
| 24 | type integer GsmTsc (0..7) with { variant "FIELDLENGTH(8)" }; |
| 25 | type uint32_t GsmTmsi; |
Harald Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 26 | type OCT4 GprsTlli; |
Harald Welte | 72cecfa | 2017-12-11 19:50:14 +0100 | [diff] [blame] | 27 | type hexstring GsmMcc length(3); |
| 28 | type hexstring GsmMnc length(2 .. 3); |
| 29 | type uint16_t GsmLac; |
| 30 | type uint16_t GsmCellId; |
Harald Welte | bdc5dbd | 2017-07-16 00:00:43 +0200 | [diff] [blame] | 31 | |
Harald Welte | 1dcc371 | 2017-08-01 00:05:52 +0200 | [diff] [blame] | 32 | type enumerated GprsCodingScheme { |
| 33 | CS1, CS2, CS3, CS4 |
| 34 | }; |
| 35 | |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 36 | function f_gprs_blocksize(GprsCodingScheme cs) return integer { |
| 37 | select (cs) { |
| 38 | case (CS1) { return 22 } |
| 39 | case (CS2) { return 32 } |
| 40 | case (CS3) { return 38 } |
| 41 | case (CS3) { return 52 } |
| 42 | case else { |
| 43 | setverdict(fail, "Invalid GPRS CS ", cs); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 44 | mtc.stop; |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
Harald Welte | d2e342f | 2017-07-16 07:34:13 +0200 | [diff] [blame] | 49 | /* 10.5.2.8 */ |
| 50 | type enumerated ChannelNeeded { |
| 51 | CHAN_NEED_ANY (0), |
| 52 | CHAN_NEED_SDCCH (1), |
| 53 | CHAN_NEED_TCH_F (2), |
| 54 | CHAN_NEED_TCH_H (3) |
| 55 | } with { variant "FIELDLENGTH(2)" }; |
| 56 | type record ChannelNeeded12 { |
| 57 | ChannelNeeded second, |
| 58 | ChannelNeeded first |
| 59 | } with { variant "" }; |
| 60 | |
Harald Welte | d2e342f | 2017-07-16 07:34:13 +0200 | [diff] [blame] | 61 | |
Harald Welte | 0c8d5c0 | 2017-07-16 18:53:58 +0200 | [diff] [blame] | 62 | /* TS 48.058 9.3.1 Channel Number IE */ |
| 63 | type enumerated RslChanNr0 { |
Harald Welte | 6f3c223 | 2017-07-30 17:17:12 +0200 | [diff] [blame] | 64 | RSL_CHAN_NR_INVALID ('00000'B), |
| 65 | RSL_CHAN_NR_Bm_ACCH ('00001'B), |
| 66 | RSL_CHAN_NR_BCCH ('10000'B), |
| 67 | RSL_CHAN_NR_RACH ('10001'B), |
| 68 | RSL_CHAN_NR_PCH_AGCH ('10010'B), |
Harald Welte | 42ca6b1 | 2018-09-15 17:44:06 +0300 | [diff] [blame] | 69 | RSL_CHAN_NR_OSMO_PDCH ('11000'B), |
Harald Welte | 6b86b34 | 2019-05-27 17:14:36 +0200 | [diff] [blame] | 70 | RSL_CHAN_NR_OSMO_CBCH4 ('11001'B), |
| 71 | RSL_CHAN_NR_OSMO_CBCH8 ('11010'B) |
Harald Welte | c84d847 | 2017-07-30 00:49:56 +0200 | [diff] [blame] | 72 | } with { variant "FIELDLENGTH(5)" variant "FIELDORDER(msb)" }; |
Harald Welte | 0c8d5c0 | 2017-07-16 18:53:58 +0200 | [diff] [blame] | 73 | |
| 74 | type record RslChanNr2 { |
| 75 | BIT4 tag ('0001'B), |
| 76 | uint1_t sub_chan |
Harald Welte | c84d847 | 2017-07-30 00:49:56 +0200 | [diff] [blame] | 77 | } with { variant "FIELDLENGTH(5)" variant "FIELDORDER(msb)" }; |
Harald Welte | 0c8d5c0 | 2017-07-16 18:53:58 +0200 | [diff] [blame] | 78 | |
| 79 | type record RslChanNr4 { |
| 80 | BIT3 tag ('001'B), |
| 81 | uint2_t sub_chan |
Harald Welte | c84d847 | 2017-07-30 00:49:56 +0200 | [diff] [blame] | 82 | } with { variant "FIELDLENGTH(5)" variant "FIELDORDER(msb)" }; |
Harald Welte | 0c8d5c0 | 2017-07-16 18:53:58 +0200 | [diff] [blame] | 83 | |
| 84 | type record RslChanNr8 { |
| 85 | BIT2 tag ('01'B), |
| 86 | uint3_t sub_chan |
Harald Welte | c84d847 | 2017-07-30 00:49:56 +0200 | [diff] [blame] | 87 | } with { variant "FIELDLENGTH(5)" variant "FIELDORDER(msb)" }; |
Harald Welte | 0c8d5c0 | 2017-07-16 18:53:58 +0200 | [diff] [blame] | 88 | |
| 89 | type union RslChanNrU { |
| 90 | RslChanNr0 ch0, |
| 91 | RslChanNr2 lm, |
| 92 | RslChanNr4 sdcch4, |
| 93 | RslChanNr8 sdcch8 |
| 94 | } with { |
| 95 | variant "TAG(lm, tag = '0001'B; |
| 96 | sdcch4, tag = '001'B; |
| 97 | sdcch8, tag = '01'B; |
| 98 | ch0, OTHERWISE)" |
| 99 | variant "FIELDLENGTH(5)" |
Harald Welte | c84d847 | 2017-07-30 00:49:56 +0200 | [diff] [blame] | 100 | variant "FIELDORDER(msb)" |
Harald Welte | 0c8d5c0 | 2017-07-16 18:53:58 +0200 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | type record RslChannelNr { |
| 104 | RslChanNrU u, |
| 105 | uint3_t tn |
Harald Welte | c84d847 | 2017-07-30 00:49:56 +0200 | [diff] [blame] | 106 | } with { variant "FIELDLENGTH(8)" variant "FIELDORDER(msb)" }; |
Harald Welte | 0c8d5c0 | 2017-07-16 18:53:58 +0200 | [diff] [blame] | 107 | |
| 108 | template RslChannelNr t_RslChanNr0(template uint3_t tn, template RslChanNr0 cht) := { |
| 109 | u := { ch0 := cht }, |
| 110 | tn := tn |
| 111 | } |
| 112 | |
| 113 | template RslChannelNr t_RslChanNr_RACH(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_RACH); |
| 114 | template RslChannelNr t_RslChanNr_BCCH(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_BCCH); |
| 115 | template RslChannelNr t_RslChanNr_PCH_AGCH(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_PCH_AGCH); |
| 116 | template RslChannelNr t_RslChanNr_Bm(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_Bm_ACCH); |
Harald Welte | 1dcc371 | 2017-08-01 00:05:52 +0200 | [diff] [blame] | 117 | template RslChannelNr t_RslChanNr_PDCH(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_OSMO_PDCH); |
Harald Welte | 6b86b34 | 2019-05-27 17:14:36 +0200 | [diff] [blame] | 118 | template RslChannelNr t_RslChanNr_CBCH4(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_OSMO_CBCH4); |
| 119 | template RslChannelNr t_RslChanNr_CBCH8(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_OSMO_CBCH8); |
Harald Welte | 2c2e8c4 | 2018-01-29 21:59:39 +0100 | [diff] [blame] | 120 | template RslChannelNr t_RslChanNr_Lm(template uint3_t tn, template uint1_t sub_slot) := { |
Harald Welte | 0c8d5c0 | 2017-07-16 18:53:58 +0200 | [diff] [blame] | 121 | u := { lm := { tag := '0001'B, sub_chan := sub_slot } }, |
| 122 | tn := tn |
| 123 | } |
| 124 | template RslChannelNr t_RslChanNr_SDCCH4(template uint3_t tn, template uint2_t sub_slot) := { |
| 125 | u := { sdcch4 := { tag := '001'B, sub_chan := sub_slot } }, |
| 126 | tn := tn |
| 127 | } |
| 128 | template RslChannelNr t_RslChanNr_SDCCH8(template uint3_t tn, template uint3_t sub_slot) := { |
| 129 | u := { sdcch8 := { tag := '01'B, sub_chan := sub_slot } }, |
| 130 | tn := tn |
| 131 | } |
Harald Welte | d2e342f | 2017-07-16 07:34:13 +0200 | [diff] [blame] | 132 | |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 133 | template (value) RslChannelNr ts_RslChanNr0(uint3_t tn, RslChanNr0 cht) := { |
| 134 | u := { ch0 := cht }, |
| 135 | tn := tn |
| 136 | } |
| 137 | template (value) RslChannelNr ts_RslChanNr_RACH(uint3_t tn) := ts_RslChanNr0(tn, RSL_CHAN_NR_RACH); |
| 138 | template (value) RslChannelNr ts_RslChanNr_BCCH(uint3_t tn) := ts_RslChanNr0(tn, RSL_CHAN_NR_BCCH); |
| 139 | template (value) RslChannelNr ts_RslChanNr_PCH_AGCH(uint3_t tn) := ts_RslChanNr0(tn, RSL_CHAN_NR_PCH_AGCH); |
| 140 | template (value) RslChannelNr ts_RslChanNr_Bm(uint3_t tn) := ts_RslChanNr0(tn, RSL_CHAN_NR_Bm_ACCH); |
| 141 | template (value) RslChannelNr ts_RslChanNr_PDCH(uint3_t tn) := ts_RslChanNr0(tn, RSL_CHAN_NR_OSMO_PDCH); |
Harald Welte | 6b86b34 | 2019-05-27 17:14:36 +0200 | [diff] [blame] | 142 | template (value) RslChannelNr ts_RslChanNr_CBCH4(uint3_t tn) := ts_RslChanNr0(tn, RSL_CHAN_NR_OSMO_CBCH4); |
| 143 | template (value) RslChannelNr ts_RslChanNr_CBCH8(uint3_t tn) := ts_RslChanNr0(tn, RSL_CHAN_NR_OSMO_CBCH8); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 144 | template (value) RslChannelNr ts_RslChanNr_Lm(uint3_t tn, uint1_t sub_slot) := { |
| 145 | u := { lm := { tag := '0001'B, sub_chan := sub_slot } }, |
| 146 | tn := tn |
| 147 | } |
| 148 | template (value) RslChannelNr ts_RslChanNr_SDCCH4(uint3_t tn, uint2_t sub_slot) := { |
| 149 | u := { sdcch4 := { tag := '001'B, sub_chan := sub_slot } }, |
| 150 | tn := tn |
| 151 | } |
| 152 | template (value) RslChannelNr ts_RslChanNr_SDCCH8(uint3_t tn, uint3_t sub_slot) := { |
| 153 | u := { sdcch8 := { tag := '01'B, sub_chan := sub_slot } }, |
| 154 | tn := tn |
| 155 | } |
| 156 | |
Harald Welte | b33e727 | 2017-07-16 21:04:12 +0200 | [diff] [blame] | 157 | /* TS 48.058 9.3.2 Link ID */ |
| 158 | type enumerated RslLinkIdC { |
| 159 | FACCH_SDCCH (0), |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 160 | SACCH (1), |
| 161 | OSMO_PTCCH (2) /* Osmocom (trxcon) specific extension */ |
Harald Welte | b33e727 | 2017-07-16 21:04:12 +0200 | [diff] [blame] | 162 | } with { variant "FIELDLENGTH(2)" }; |
| 163 | |
| 164 | type enumerated RslSapi0Prio { |
| 165 | SAPI0_PRIO_NORMAL (0), |
| 166 | SAPI0_PRIO_HIGH (1), |
| 167 | SAPI0_PRIO_LOW (2) |
| 168 | } with { variant "FIELDLENGTH(2)" }; |
| 169 | |
| 170 | type uint3_t GsmSapi; |
| 171 | |
| 172 | type record RslLinkId { |
| 173 | RslLinkIdC c, |
| 174 | boolean na, |
| 175 | RslSapi0Prio prio, |
| 176 | GsmSapi sapi |
| 177 | } with { variant "" }; |
| 178 | |
| 179 | template RslLinkId tr_RslLinkId := { |
| 180 | c := ?, |
| 181 | na := ?, |
| 182 | prio := ?, |
| 183 | sapi := ? |
| 184 | }; |
| 185 | |
| 186 | template RslLinkId tr_RslLinkID_DCCH(template GsmSapi sapi) modifies tr_RslLinkId := { |
| 187 | c := FACCH_SDCCH, |
| 188 | na := false, |
| 189 | sapi := sapi |
| 190 | }; |
| 191 | |
| 192 | template RslLinkId tr_RslLinkID_SACCH(template GsmSapi sapi) modifies tr_RslLinkId := { |
| 193 | c := SACCH, |
| 194 | na := false, |
| 195 | sapi := sapi |
| 196 | }; |
| 197 | |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 198 | template RslLinkId tr_RslLinkID_OSMO_PTCCH(template GsmSapi sapi) modifies tr_RslLinkId := { |
| 199 | c := OSMO_PTCCH, |
| 200 | na := false, |
| 201 | sapi := sapi |
| 202 | }; |
| 203 | |
Harald Welte | 3b2ce02 | 2017-12-07 17:47:00 +0100 | [diff] [blame] | 204 | template (value) RslLinkId ts_RslLinkID_DCCH(GsmSapi sapi) := { |
Harald Welte | b33e727 | 2017-07-16 21:04:12 +0200 | [diff] [blame] | 205 | c := FACCH_SDCCH, |
| 206 | na := false, |
| 207 | prio := SAPI0_PRIO_NORMAL, |
| 208 | sapi := sapi |
| 209 | }; |
| 210 | |
Harald Welte | 3b2ce02 | 2017-12-07 17:47:00 +0100 | [diff] [blame] | 211 | template (value) RslLinkId ts_RslLinkID_SACCH(GsmSapi sapi) := { |
Harald Welte | cb5d1fb | 2017-07-17 21:00:15 +0200 | [diff] [blame] | 212 | c := SACCH, |
| 213 | na := false, |
| 214 | prio := SAPI0_PRIO_NORMAL, |
| 215 | sapi := sapi |
Harald Welte | b33e727 | 2017-07-16 21:04:12 +0200 | [diff] [blame] | 216 | }; |
| 217 | |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 218 | template (value) RslLinkId ts_RslLinkID_OSMO_PTCCH(GsmSapi sapi) := { |
| 219 | c := OSMO_PTCCH, |
| 220 | na := false, |
| 221 | prio := SAPI0_PRIO_NORMAL, |
| 222 | sapi := sapi |
| 223 | }; |
| 224 | |
Harald Welte | 23b774e | 2018-02-05 09:14:34 +0100 | [diff] [blame] | 225 | function f_hex_is_odd_length(hexstring digits) return bitstring { |
| 226 | if (lengthof(digits) rem 2 == 1) { |
| 227 | return '1'B; |
| 228 | } else { |
| 229 | return '0'B; |
| 230 | } |
| 231 | } |
| 232 | |
Harald Welte | f097a8b | 2018-09-16 18:11:26 +0200 | [diff] [blame] | 233 | |
| 234 | /* TS 04.12 Section 3.3.1 Block type */ |
| 235 | type record CBCH_BlockType { |
| 236 | BIT1 spare, |
| 237 | BIT2 lpd, |
| 238 | boolean last_block, |
| 239 | uint4_t seq_nr |
| 240 | }; |
| 241 | template (value) CBCH_BlockType ts_CBCH_BlockType(template (value) uint4_t seq_nr, template (value) boolean last_block) := { |
| 242 | spare := '0'B, |
| 243 | lpd := '01'B, |
| 244 | last_block := last_block, |
| 245 | seq_nr := seq_nr |
| 246 | }; |
| 247 | template CBCH_BlockType tr_CBCH_BlockType(template uint4_t seq_nr := ?, template boolean last_block := ?) := { |
| 248 | spare := '0'B, |
| 249 | lpd := '01'B, |
| 250 | last_block := last_block, |
| 251 | seq_nr := seq_nr |
| 252 | }; |
| 253 | |
| 254 | /* TS 04.12 Section 3.3 */ |
| 255 | type record CBCH_Block { |
| 256 | CBCH_BlockType block_type, |
| 257 | OCT22 payload |
| 258 | }; |
| 259 | template (value) CBCH_Block ts_CBCH_Block(template (value) uint4_t seq_nr, template (value) boolean last_block, template (value) OCT22 payload) := { |
| 260 | block_type := ts_CBCH_BlockType(seq_nr, last_block), |
| 261 | payload := payload |
| 262 | }; |
| 263 | template CBCH_Block tr_CBCH_Block(template uint4_t seq_nr := ?, template boolean last_block := ?, template OCT22 payload := ?) := { |
| 264 | block_type := tr_CBCH_BlockType(seq_nr, last_block), |
| 265 | payload := payload |
| 266 | }; |
| 267 | |
| 268 | |
| 269 | external function enc_CBCH_Block(in CBCH_Block msg) return octetstring |
| 270 | with { extension "prototype(convert) encode(RAW)" }; |
| 271 | external function dec_CBCH_Block(in octetstring stream) return CBCH_Block |
| 272 | with { extension "prototype(convert) decode(RAW)" }; |
| 273 | |
| 274 | |
Harald Welte | 5377d2f | 2018-02-24 01:01:19 +0100 | [diff] [blame] | 275 | /* Convert RF signal level in dBm to RxLev (TS 45.008 Chapter 8.1.4) */ |
| 276 | function dbm2rxlev(integer dbm) return uint6_t { |
| 277 | var integer rxlev := dbm + 110; |
| 278 | if (rxlev > 63) { |
| 279 | rxlev := 63; |
| 280 | } else if (rxlev < 0) { |
| 281 | rxlev := 0; |
| 282 | } |
| 283 | return rxlev; |
| 284 | } |
| 285 | |
| 286 | function rxlev2dbm(uint6_t rxlev) return integer { |
| 287 | return -110 + rxlev; |
| 288 | } |
| 289 | |
| 290 | /* convert BER to RxQual value (TS 45.008 Chapter 8.2.4 */ |
| 291 | function ber2rxqual(float ber) return uint3_t { |
| 292 | if (ber < 0.2) { |
| 293 | return 0; |
| 294 | } else if (ber < 0.4) { |
| 295 | return 1; |
| 296 | } else if (ber < 0.8) { |
| 297 | return 2; |
| 298 | } else if (ber < 1.6) { |
| 299 | return 3; |
| 300 | } else if (ber < 3.2) { |
| 301 | return 4; |
| 302 | } else if (ber < 6.4) { |
| 303 | return 5; |
| 304 | } else if (ber < 12.8) { |
| 305 | return 6; |
| 306 | } else { |
| 307 | return 7; |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | /* convert RxQual to BER (TS 45.008 Chapter 8.2.4 */ |
| 312 | function rxqual2ber(uint3_t rxqual) return float { |
| 313 | select (rxqual) { |
| 314 | case (0) { return 0.14 } |
| 315 | case (1) { return 0.28 } |
| 316 | case (2) { return 0.57 } |
| 317 | case (3) { return 1.13 } |
| 318 | case (4) { return 2.26 } |
| 319 | case (5) { return 4.53 } |
| 320 | case (6) { return 9.05 } |
| 321 | case (7) { return 18.10 } |
| 322 | case else { return 1000.0 } |
| 323 | } |
| 324 | } |
| 325 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 326 | const float GSM_FRAME_DURATION := 0.12/26.0; /* 4.615 ms */ |
| 327 | const float GSM51_MFRAME_DURATION := 51.0 * GSM_FRAME_DURATION; /* 235.365 ms */ |
| 328 | const float GSM51_MFRAMES_PER_SEC := 1.0 / GSM51_MFRAME_DURATION; /* 4.248 */ |
| 329 | |
| 330 | /* number of downlink CCCH blocks per second */ |
| 331 | function f_ccch_blocks_per_mframe(boolean combined_ccch) return integer { |
| 332 | if (not combined_ccch) { |
| 333 | /* 9 blocks per 51 multiframe */ |
| 334 | return 9; |
| 335 | } else { |
| 336 | /* 3 blocks per 51 multiframe */ |
| 337 | return 3; |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | /* this ignores any possible paging combining! */ |
| 342 | function f_pch_block_rate_est(boolean combined_ccch, integer bs_ag_blks_res) return float { |
| 343 | var integer ccch_per_mframe := f_ccch_blocks_per_mframe(combined_ccch); |
| 344 | var integer pch_per_mframe := ccch_per_mframe - bs_ag_blks_res; |
| 345 | return GSM51_MFRAMES_PER_SEC * int2float(pch_per_mframe); |
| 346 | } |
| 347 | |
| 348 | /* this ignores any possible imm.ass combining! */ |
| 349 | function f_agch_block_rate_est(boolean combined_ccch, integer bs_ag_blks_res) return float { |
| 350 | var integer ccch_per_mframe := f_ccch_blocks_per_mframe(combined_ccch); |
| 351 | return GSM51_MFRAMES_PER_SEC * int2float(bs_ag_blks_res); |
| 352 | } |
| 353 | |
Harald Welte | 262f122 | 2018-02-25 16:33:38 +0100 | [diff] [blame] | 354 | /* compute TC as per 45.002 6.3.1.3 */ |
| 355 | function f_gsm_compute_tc(integer fn) return integer { |
| 356 | return (fn / 51) mod 8; |
| 357 | } |
| 358 | |
Harald Welte | 5377d2f | 2018-02-24 01:01:19 +0100 | [diff] [blame] | 359 | |
Harald Welte | a082a69 | 2017-07-15 15:58:13 +0200 | [diff] [blame] | 360 | } with { encode "RAW"; variant "FIELDORDER(msb)" } |