CRC16
CRC

16-bit CRC More...

Collaboration diagram for CRC16:

## Data Structures

struct | crc16_data_t
| State information for the CRC16 algorithm. More...

## CRC16

void | crc16_init (crc16_data_t *crc16Config)
| Initializes the parameters of the crc function, must be called first. More...
void | crc16_update (crc16_data_t *crc16Config, const uint8_t *src, uint32_t lengthInBytes)
| A "running" crc calculator that updates the crc value after each call. More...
void | crc16_finalize (crc16_data_t *crc16Config, uint16_t *hash)
| Calculates the final crc value, padding with zeros if necessary, must be called last. More...

## Usage Information

16-bit CRC

## Data Structure Documentation

struct crc16_data_t

State information for the CRC16 algorithm.

Data Fields
uint16_t | currentCrc | Current CRC value.

## Function Documentation

void crc16_finalize | ( | crc16_data_t * | crc16Config,
|  | uint16_t * | hash
| ) |  |

Calculates the final crc value, padding with zeros if necessary, must be called last.

Parameters

  crc16Config | Instantiation of the data structure of type crc16_data_t.
  hash | Pointer to the value returned for the final calculated crc value.

void crc16_init | ( | crc16_data_t * | crc16Config | ) |

Initializes the parameters of the crc function, must be called first.

Parameters

  crc16Config | Instantiation of the data structure of type crc16_data_t.

void crc16_update | ( | crc16_data_t * | crc16Config,
|  | const uint8_t * | src,
|  | uint32_t | lengthInBytes
| ) |  |

A "running" crc calculator that updates the crc value after each call.

Parameters

  crc16Config | Instantiation of the data structure of type crc16_data_t.
  src | Pointer to the source buffer of data.
  lengthInBytes | The length, given in bytes (not words or long-words).

Note: We must init CRC module here, As we may seperate one crc calculation into several times Note: It is better to use lock to ensure the integrity of current updating operation of crc calculation