System CRC API

nRF5 SDK v14.2.0

Module to declare System CRC API. More...

Macros

#define SYS_CRC_INIT 0
Defines an initial value for the CRC sum.

Typedefs

typedef uint16_t sys_crc_t
CRC value type. This module uses 16-bit CRC.

Functions

sys_crc_t sys_crc_calc (const uint8_t *p_data, size_t length)
Function for computing CRC value for given data. More...
sys_crc_t sys_crc_continue ( sys_crc_t current_crc, const uint8_t *p_data, size_t length)
Function for updating the CRC value taking into the account the previously counted value. More...

Detailed Description

Module to declare System CRC API.

The CRC module implements a set of routines to compute the 16-bit CRC value for octet arrays.

Function Documentation

sys_crc_t sys_crc_calc ( const uint8_t * p_data ,
size_t length
)

Function for computing CRC value for given data.

Parameters
[in] p_data Pointer to data to compute.
[in] length Length of data.
Returns
Returns the CRC value for input data.
sys_crc_t sys_crc_continue ( sys_crc_t current_crc ,
const uint8_t * p_data ,
size_t length
)

Function for updating the CRC value taking into the account the previously counted value.

This function is used when input data is represented by several pieces. Consequently, a call to this function for each piece will give a correct total CRC value.

Parameters
[in] current_crc Previously counted CRC value. Should be SYS_CRC_INIT for the first piece.
[in] p_data Pointer to the current piece of data.
[in] length Length of the current piece of data.
Returns
Returns the updated CRC value.