|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
CRC-16 (cyclic redundancy check): polynomial 0x1021, no reflection, no final XOR, seed passed by the caller. More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Functions | |
| uint16_t | link_crc (uint16_t crc, const void *data, size_t len) |
| Fold len bytes into crc and return the new accumulator. | |
| uint32_t | link_fnv1a32 (uint32_t hash, const void *data, size_t len) |
| FNV-1a, 32 bits: per byte, XOR then multiply by 16777619. | |
CRC-16 (cyclic redundancy check): polynomial 0x1021, no reflection, no final XOR, seed passed by the caller.
With the seed 0xFFFF this is CRC-16/CCITT-FALSE, whose published check value is 0x29B1 over the ASCII string "123456789". With the seed 0x0000 it is CRC-16/XMODEM, which the OpenYGE protocol uses (check value 0x31C3); protocols/openyge carries its own routine and does not call this one.
The panel link carries no CRC of its own: CAN (Controller Area Network) provides a 15-bit CRC, an acknowledge slot and retransmission in silicon.
SPDX-License-Identifier: MIT
| uint16_t link_crc | ( | uint16_t | crc, |
| const void * | data, | ||
| size_t | len ) |
Fold len bytes into crc and return the new accumulator.
Incremental, so a receiver can check a frame as it arrives without buffering it first.
| crc | The accumulator: LINK_CRC_INIT, or the value a previous call returned. |
| data | The bytes to fold in. |
| len | Number of bytes in data. |
| uint32_t link_fnv1a32 | ( | uint32_t | hash, |
| const void * | data, | ||
| size_t | len ) |
FNV-1a, 32 bits: per byte, XOR then multiply by 16777619.
The content key of the board drawing (LINK_AW_HASH_LO/HI) next to its CRC. Not a cryptographic hash; it tells two drawings apart, it does not authenticate one. Incremental like link_crc().
| hash | The hash: LINK_FNV_INIT, or the value a previous call returned. |
| data | The bytes to fold in. |
| len | Number of bytes in data. |