Documentation
Tools for embedded systems
Loading...
Searching...
No Matches
qcrc.h
1
9#ifndef QCRC_H
10#define QCRC_H
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16 #include <stdlib.h>
17 #include <stdint.h>
18
27 typedef enum {
28 QCRC8 = 0,
30 QCRC32
32
48 uint32_t qCRCx( const qCRC_Mode_t mode,
49 const void * const pData,
50 const size_t length,
51 uint32_t poly,
52 const uint32_t init,
53 const uint8_t refIn,
54 const uint8_t refOut,
55 uint32_t xorOut );
56
59 #define qCRC8( pData, length ) \
60 qCRCx( QCRC8, pData, length, 0x07UL, 0x00UL, 0U, 0U, 0x00UL ); \
61
64 #define qCRC8_CDMA2000( pData, length ) \
65 qCRCx( QCRC8, pData, length, 0x9BUL, 0xFFUL, 0U, 0U, 0x00UL ); \
66
69 #define qCRC8_DARC( pData, length ) \
70 qCRCx( QCRC8, pData, length, 0x39UL, 0x00UL, 1U, 1U, 0x00UL ); \
71
74 #define qCRC8_DVB_S2( pData, length ) \
75 qCRCx( QCRC8, pData, length, 0xD5UL, 0x00UL, 0U, 0U, 0x00UL ); \
76
79 #define qCRC8_EBU( pData, length ) \
80 qCRCx( QCRC8, pData, length, 0x1DUL, 0xFFUL, 1U, 1U, 0x00UL ); \
81
84 #define qCRC8_I_CODE( pData, length ) \
85 qCRCx( QCRC8, pData, length, 0x1DUL, 0xFDUL, 0U, 0U, 0x00UL ); \
86
89 #define qCRC8_ITU( pData, length ) \
90 qCRCx( QCRC8, pData, length, 0x07UL, 0x00UL, 0U, 0U, 0x55UL ); \
91
94 #define qCRC8_MAXIM( pData, length ) \
95 qCRCx( QCRC8, pData, length, 0x31UL, 0x00UL, 1U, 1U, 0x00UL ); \
96
99 #define qCRC8_ROHC( pData, length ) \
100 qCRCx( QCRC8, pData, length, 0x07UL, 0xFFUL, 1U, 1U, 0x00UL ); \
101
104 #define qCRC8_WCDMA( pData, length ) \
105 qCRCx( QCRC8, pData, length, 0x9BUL, 0x00UL, 1U, 1U, 0x00UL ); \
106
109 #define qCRC16_CCITT_FALSE( pData, length ) \
110 qCRCx( QCRC16, pData, length, 0x1021UL, 0xFFFFUL, 0U, 0U, 0x0000UL ); \
111
114 #define qCRC16_ARC( pData, length ) \
115 qCRCx( QCRC16, pData, length, 0x8005UL, 0x0000UL, 1U, 1U, 0x0000UL ); \
116
119 #define qCRC16_AUG_CCITT( pData, length ) \
120 qCRCx( QCRC16, pData, length, 0x1021UL, 0x1D0FUL, 0U, 0U, 0x0000UL ); \
121
124 #define qCRC16_BUYPASS( pData, length ) \
125 qCRCx( QCRC16, pData, length, 0x8005UL, 0x0000UL, 0U, 0U, 0x0000UL ); \
126
129 #define qCRC16_CDMA2000( pData, length ) \
130 qCRCx( QCRC16, pData, length, 0xC867UL, 0xFFFFUL, 0U, 0U, 0x0000UL ); \
131
134 #define qCRC16_DDS_110( pData, length ) \
135 qCRCx( QCRC16, pData, length, 0x8005UL, 0x800DUL, 0U, 0U, 0x0000UL ); \
136
139 #define qCRC16_DECT_R( pData, length ) \
140 qCRCx( QCRC16, pData, length, 0x0589UL, 0x0000UL, 0U, 0U, 0x0001UL ); \
141
144 #define qCRC16_DECT_X( pData, length ) \
145 qCRCx( QCRC16, pData, length, 0x0589UL, 0x0000UL, 0U, 0U, 0x0000UL ); \
146
149 #define qCRC16_DNP( pData, length ) \
150 qCRCx( QCRC16, pData, length, 0x3D65UL, 0x0000UL, 1U, 1U, 0xFFFFUL ); \
151
154 #define qCRC16_EN_13757( pData, length ) \
155 qCRCx( QCRC16, pData, length, 0x03D65UL, 0x0000UL, 0U, 0U, 0xFFFFUL ); \
156
159 #define qCRC16_GENIBUS( pData, length ) \
160 qCRCx( QCRC16, pData, length, 0x1021UL, 0xFFFFUL, 0U, 0U, 0xFFFFUL ); \
161
164 #define qCRC16_MAXIM( pData, length ) \
165 qCRCx( QCRC16, pData, length, 0x8005UL, 0x0000UL, 1U, 1U, 0xFFFFUL ); \
166
169 #define qCRC16_MCRF4XX( pData, length ) \
170 qCRCx( QCRC16, pData, length, 0x1021UL, 0xFFFFUL, 1U, 1U, 0x0000UL ); \
171
174 #define qCRC16_RIELLO( pData, length ) \
175 qCRCx( QCRC16, pData, length, 0x1021UL, 0xB2AAUL, 1U, 1U, 0x0000UL ); \
176
179 #define qCRC16_T10_DIF( pData, length ) \
180 qCRCx( QCRC16, pData, length, 0x8BB7UL, 0x0000UL, 0U, 0U, 0x0000UL ); \
181
184 #define qCRC16_TELEDISK( pData, length ) \
185 qCRCx( QCRC16, pData, length, 0xA097UL, 0x0000UL, 0U, 0U, 0x0000UL ); \
186
189 #define qCRC16_TMS37157( pData, length ) \
190 qCRCx( QCRC16, pData, length, 0x1021UL, 0x89ECUL, 1U, 1U, 0x0000UL ); \
191
194 #define qCRC16_USB( pData, length ) \
195 qCRCx( QCRC16, pData, length, 0x8005UL, 0xFFFFUL, 1U, 1U, 0xFFFFUL ); \
196
199 #define qCRC16_A( pData, length ) \
200 qCRCx( QCRC16, pData, length, 0x1021UL, 0xC6C6UL, 1U, 1U, 0x0000UL ); \
201
204 #define qCRC16_KERMIT( pData, length ) \
205 qCRCx( QCRC16, pData, length, 0x1021UL, 0x0000UL, 1U, 1U, 0x0000UL ); \
206
209 #define qCRC16_MODBUS( pData, length ) \
210 qCRCx( QCRC16, pData, length, 0x8005UL, 0xFFFFUL, 1U, 1U, 0x0000UL ); \
211
214 #define qCRC16_X_25( pData, length ) \
215 qCRCx( QCRC16, pData, length, 0x1021UL, 0xFFFFUL, 1U, 1U, 0xFFFFUL ); \
216
219 #define qCRC16_XMODEM( pData, length ) \
220 qCRCx( QCRC16, pData, length, 0x1021UL, 0x0000UL, 0U, 0U, 0x0000UL ); \
221
224 #define qCRC32( pData, length ) \
225 qCRCx( QCRC32, pData, length, 0x04C11DB7UL, 0xFFFFFFFFUL, 1U, 1U, 0xFFFFFFFFUL ); \
226
229 #define qCRC32_BZIP2( pData, length ) \
230 qCRCx( QCRC32, pData, length, 0x04C11DB7UL, 0xFFFFFFFFUL, 0U, 0U, 0xFFFFFFFFUL ); \
231
234 #define qCRC32_C( pData, length ) \
235 qCRCx( QCRC32, pData, length, 0x1EDC6F41UL, 0xFFFFFFFFUL, 1U, 1U, 0xFFFFFFFFUL ); \
236
239 #define qCRC32_D( pData, length ) \
240 qCRCx( QCRC32, pData, length, 0xA833982BUL, 0xFFFFFFFFUL, 1U, 1U, 0xFFFFFFFFUL ); \
241
244 #define qCRC32_JAMCRC( pData, length ) \
245 qCRCx( QCRC32, pData, length, 0x04C11DB7UL, 0xFFFFFFFFUL, 1U, 1U, 0x00000000UL ); \
246
249 #define qCRC32_MPEG2( pData, length ) \
250 qCRCx( QCRC32, pData, length, 0x04C11DB7UL, 0xFFFFFFFFUL, 0U, 0U, 0x00000000UL ); \
251
254 #define qCRC32_POSIX( pData, length ) \
255 qCRCx( QCRC32, pData, length, 0x04C11DB7UL, 0x00000000UL, 0U, 0U, 0xFFFFFFFFUL ); \
256
259 #define qCRC32_Q( pData, length ) \
260 qCRCx( QCRC32, pData, length, 0x814141ABUL, 0x00000000UL, 0U, 0U, 0x00000000UL ); \
261
264 #define qCRC32_XFER( pData, length ) \
265 qCRCx( QCRC32, pData, length, 0x000000AFUL, 0x00000000UL, 0U, 0U, 0x00000000UL ); \
266
269#ifdef __cplusplus
270}
271#endif
272
273#endif
qCRC_Mode_t
Enumeration with all the supported cyclic redundancy checks.
Definition qcrc.h:27
uint32_t qCRCx(const qCRC_Mode_t mode, const void *const pData, const size_t length, uint32_t poly, const uint32_t init, const uint8_t refIn, const uint8_t refOut, uint32_t xorOut)
CalcULates in one pass the common width bit CRC value for a block of data that is passed to the funct...
Definition qcrc.c:33
@ QCRC8
Definition qcrc.h:28
@ QCRC16
Definition qcrc.h:29
@ QCRC32
Definition qcrc.h:30