#include <avr/crc16.h>
This header file provides a optimized inline functions for calculating 16 bit cyclic redundancy checks (CRC) using common polynomials.
See the Dallas Semiconductor app note 27 for 8051 assembler example and general CRC optimization suggestions. The table on the last page of the app note is the key to understanding these implementations.
Jack Crenshaw's "Impementing CRCs" article in the January 1992 isue of Embedded Systems Programming. This may be difficult to find, but it explains CRC's in very clear and concise terms. Well worth the effort to obtain a copy.
Functions | |
uint16_t | _crc16_update (uint16_t __crc, uint8_t __data) |
uint16_t | _crc_xmodem_update (uint16_t __crc, uint8_t __data) |
uint16_t | _crc_ccitt_update (uint16_t __crc, uint8_t __data) |
|
Optimized CRC-16 calcutation.
Polynomial: x^16 + x^15 + x^2 + 1 (0xa001) This CRC is normally used in disk-drive controllers. |
|
Optimized CRC-CCITT calculation.
Polynomial: x^16 + x^12 + x^5 + 1 (0x8408) This is the CRC used by PPP and IrDA. See RFC1171 (PPP protocol) and IrDA IrLAP 1.1
|
|
Optimized CRC-XMODEM calculation.
Polynomial: x^16 + x^12 + x^5 + 1 (0x1021) This is the CRC used by the Xmodem-CRC protocol. The following is the equivalent functionality written in C.
|