This implementation follows the "bad CRC16-CCITT" algorithm, as described in http://srecord.sourceforge.net/crc16-ccitt.html.
Definition in file crc.h.
Go to the source code of this file.
◆ Crc_addByte()
uint16_t Crc_addByte |
( |
uint16_t |
crc, |
|
|
uint8_t |
byte |
|
) |
| |
Add byte to CRC result
- Parameters
-
crc | Cumulative result of CRC calculation |
byte | The byte to add to the result |
- Note
- 90.1 us for 50 bytes -> 1.80 us per byte for CRC_CCITT_FAST_LUT
-
96.4 us for 50 bytes -> 1.93 us per byte for CRC_CCITT_LEGACY
◆ Crc_fromBuffer()
uint16_t Crc_fromBuffer |
( |
const uint8_t * |
buf, |
|
|
uint32_t |
len |
|
) |
| |
Calculate CRC over a buffer
- Parameters
-
buf | Pointer to a buffer |
len | Length of the buffer in bytes |
- Note
- 63.8 us for 50 bytes -> 1.28 us per byte for CRC_CCITT_FAST_LUT
-
92.1 us for 50 bytes -> 1.84 us per byte for CRC_CCITT_LEGACY
◆ Crc_fromBuffer32()
uint16_t Crc_fromBuffer32 |
( |
const uint32_t * |
buf, |
|
|
uint32_t |
len |
|
) |
| |
Calculate CRC over a buffer
- Parameters
-
buf | Pointer to a buffer |
len | Length of the buffer in words |
- Note
- Approximately 65% execution time compared to uint8_t version when calculating checksums from ROM contents
◆ crc_t
Definition at line 27 of file crc.h.
Data Fields |
struct crc_t |
__unnamed__ |
|
uint16_t |
crc |
|
◆ crc_t.__unnamed__
Definition at line 29 of file crc.h.
Data Fields |
uint8_t |
lsb |
|
uint8_t |
msb |
|
◆ CRC_CCITT_FAST_LUT
#define CRC_CCITT_FAST_LUT |
Fast LUT based algorithm. Original CRC algorithm, ported 1:1 from PIC18F
Definition at line 22 of file crc.h.
◆ Crc_initValue
#define Crc_initValue |
( |
| ) |
0xffff |
Startup value for CRC result
Definition at line 40 of file crc.h.