1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#include <stdint.h>
#include <osmocom/core/crcgen.h>
#include "gsm0503_parity.h"
/*
* GSM (SACCH) parity (FIRE code)
*
* g(x) = (x^23 + 1)(x^17 + x^3 + 1)
* = x^40 + x^26 + x^23 + x^17 + x^3 + a1
*/
const struct osmo_crc64gen_code gsm0503_fire_crc40 = {
.bits = 40,
.poly = 0x0004820009ULL,
.init = 0x0000000000ULL,
.remainder = 0xffffffffffULL,
};
/*
* GSM PDTCH CS-2, CS-3, CS-4 parity
*
* g(x) = x^16 + x^12 + x^5 + 1
*/
const struct osmo_crc16gen_code gsm0503_cs234_crc16 = {
.bits = 16,
.poly = 0x1021,
.init = 0x0000,
.remainder = 0xffff,
};
/*
* GSM RACH parity
*
* g(x) = x^6 + x^5 + x^3 + x^2 + x^1 + 1
*/
const struct osmo_crc8gen_code gsm0503_rach_crc6 = {
.bits = 6,
.poly = 0x2f,
.init = 0x00,
.remainder = 0x3f,
};
/*
* GSM SCH parity
*
* g(x) = x^10 + x^8 + x^6 + x^5 + x^4 + x^2 + 1
*/
const struct osmo_crc16gen_code gsm0503_sch_crc10 = {
.bits = 10,
.poly = 0x175,
.init = 0x000,
.remainder = 0x3ff,
};
/*
* GSM TCH FR/EFR parity
*
* g(x) = x^3 + x + 1
*/
const struct osmo_crc8gen_code gsm0503_tch_fr_crc3 = {
.bits = 3,
.poly = 0x3,
.init = 0x0,
.remainder = 0x7,
};
/*
* GSM TCH EFR parity
*
* g(x) = x^8 + x^4 + x^3 + x^2 + 1
*/
const struct osmo_crc8gen_code gsm0503_tch_efr_crc8 = {
.bits = 8,
.poly = 0x1d,
.init = 0x00,
.remainder = 0x00,
};
|