-
Notifications
You must be signed in to change notification settings - Fork 4
/
CRC_Cfg.h
43 lines (35 loc) · 2 KB
/
CRC_Cfg.h
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
/*
CRC_Cfg.h - Simple library to calculate 8-, 16-, and 32-Bit CRC
Copyright (c) 2022 Patrick F.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with program. If not, see <http://www.gnu.org/licenses/>.
*/
#define RUNTTIME 0
#define TABLE 1
#define HARDWARE 2
/* ---------- Defines for 8-bit SAE J1850 CRC calculation (Not reflected) ------------------------------------------------------- */
#define CRC_8_RESULT_WIDTH 8u
#define CRC_8_POLYNOMIAL 0x1Du
#define CRC_8_INIT_VALUE 0xFFu
#define CRC_8_XOR_VALUE 0xFFu
#define CRC_8_MODE RUNTTIME
/* ---------- Defines for 16-bit CCITT CRC calculation (Not reflected) ---------------------------------------------------------- */
#define CRC_16_RESULT_WIDTH 16u
#define CRC_16_POLYNOMIAL 0x1021u
#define CRC_16_INIT_VALUE 0xFFFFu
#define CRC_16_XOR_VALUE 0x0000u
#define CRC_16_MODE RUNTTIME
/* ---------- Defines for 32-bit CCITT CRC calculation (Reflected) -------------------------------------------------------------- */
#define CRC_32_RESULT_WIDTH 32u
#define CRC_32_POLYNOMIAL 0x04C11DB7u
#define CRC_32_INIT_VALUE 0xFFFFFFFFu
#define CRC_32_XOR_VALUE 0xFFFFFFFFu
#define CRC_32_MODE RUNTTIME