crc.h File Reference
Cyclic Redundancy Check 16 (CRC). More...
#include "cfg/cfg_arch.h"#include <cfg/compiler.h>#include <cpu/pgm.h>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. | |
Detailed Description
Cyclic Redundancy Check 16 (CRC).
This algorithm is the one used by the XMODEM protocol.
- Note:
- This algorithm is incompatible with the CCITT-CRC16.
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 Documentation
| #define UPDCRC16 | ( | c, | |||
| oldcrc | ) | ((crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) |
Compute the updated CRC16 value for one octet (macro version).
- Note:
- This version is only intended for old/broken compilers. Use the inline function in new code.
- Parameters:
-
c New octet (range 0-255) oldcrc Previous CRC16 value (referenced twice, beware of side effects)
Function Documentation
| uint16_t crc16 | ( | uint16_t | crc, | |
| const void * | buf, | |||
| size_t | len | |||
| ) |
