3#define CRC_POLY_16 0xA001
4#define CRC_START_16 0x0000
5#define CRC_TABLE_SIZE 64
21uint16_t
crc16(
const void* input_str,
size_t num_bytes)
24 const unsigned char* ptr;
31 ptr = (
const unsigned char*)input_str;
34 for (a = 0; a < num_bytes; a++)
56 return (crc >> 8) ^
crc_tab16[(crc ^ (uint16_t)c) & 0x00FF];
81 for (j = 0; j < 8; j++)
83 if ((crc ^ c) & 0x0001)
98uint16_t
fletcher16(
const void* input_str,
size_t num_bytes)
101 uint8_t* sum1 = (uint8_t*)∑
102 uint8_t* sum2 = sum1 + 1;
104 const uint8_t* buf = (uint8_t*)input_str;
106 for (
int i = 0; i < num_bytes; i++)
static uint16_t crc_tab16[CRC_TABLE_SIZE]
static void init_crc16_tab(void)
uint16_t update_crc_16(uint16_t crc, unsigned char c)
uint16_t crc16(const void *input_str, size_t num_bytes)
static bool crc_tab16_init
uint16_t fletcher16(const void *input_str, size_t num_bytes)