BeRTOS
|
Cyclic Redundancy Check 16 (CRC). More...
Go to the source code of this file.
Defines | |
#define | UPDCRC16(c, oldcrc) ((crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) |
Compute the updated CRC16 value for one octet (macro version) | |
#define | CRC16_INIT_VAL ((uint16_t)0) |
CRC-16 init value. | |
Functions | |
uint16_t | updcrc16 (uint8_t c, uint16_t oldcrc) |
Compute the updated CRC16 value for one octet (inline version) | |
uint16_t | crc16 (uint16_t crc, const void *buf, size_t len) |
This function implements the CRC 16 calculation on a buffer. |
Cyclic Redundancy Check 16 (CRC).
This algorithm is the one used by the XMODEM protocol.
This code is based on the article Copyright 1986 Stephen Satchell.
Programmers may incorporate any or all code into their programs, giving proper credit within the source. Publication of the source routines is permitted so long as proper credit is given to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, Omen Technology.
Definition in file crc.h.
#define UPDCRC16 | ( | c, | |
oldcrc | |||
) | ((crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) |
Compute the updated CRC16 value for one octet (macro version)
c | New octet (range 0-255) |
oldcrc | Previous CRC16 value (referenced twice, beware of side effects) |
uint16_t crc16 | ( | uint16_t | crc, |
const void * | buf, | ||
size_t | len | ||
) |