Zephyr Project API  3.2.0
A Scalable Open Source RTOS
crc.h File Reference

CRC computation function. More...

#include <zephyr/types.h>
#include <stdbool.h>
#include <stddef.h>

Go to the source code of this file.

Macros

#define CRC8_CCITT_INITIAL_VALUE   0xFF
 

Functions

uint16_t crc16 (uint16_t poly, uint16_t seed, const uint8_t *src, size_t len)
 Generic function for computing a CRC-16 without input or output reflection. More...
 
uint16_t crc16_reflect (uint16_t poly, uint16_t seed, const uint8_t *src, size_t len)
 Generic function for computing a CRC-16 with input and output reflection. More...
 
uint8_t crc8 (const uint8_t *src, size_t len, uint8_t polynomial, uint8_t initial_value, bool reversed)
 Generic function for computing CRC 8. More...
 
uint16_t crc16_ccitt (uint16_t seed, const uint8_t *src, size_t len)
 Compute the checksum of a buffer with polynomial 0x1021, reflecting input and output. More...
 
uint16_t crc16_itu_t (uint16_t seed, const uint8_t *src, size_t len)
 Compute the checksum of a buffer with polynomial 0x1021, no reflection of input or output. More...
 
static uint16_t crc16_ansi (const uint8_t *src, size_t len)
 Compute the ANSI (or Modbus) variant of CRC-16. More...
 
uint32_t crc32_ieee (const uint8_t *data, size_t len)
 Generate IEEE conform CRC32 checksum. More...
 
uint32_t crc32_ieee_update (uint32_t crc, const uint8_t *data, size_t len)
 Update an IEEE conforming CRC32 checksum. More...
 
uint32_t crc32_c (uint32_t crc, const uint8_t *data, size_t len, bool first_pkt, bool last_pkt)
 Calculate CRC32C (Castagnoli) checksum. More...
 
uint8_t crc8_ccitt (uint8_t initial_value, const void *buf, size_t len)
 Compute CCITT variant of CRC 8. More...
 
uint8_t crc7_be (uint8_t seed, const uint8_t *src, size_t len)
 Compute the CRC-7 checksum of a buffer. More...
 

Detailed Description

CRC computation function.

Macro Definition Documentation

◆ CRC8_CCITT_INITIAL_VALUE

#define CRC8_CCITT_INITIAL_VALUE   0xFF