Move crc16.[ch] to shared

This commit is contained in:
László Monda
2017-05-30 17:20:06 +02:00
parent 8c96d2a042
commit 8b69dd7d90
2 changed files with 2 additions and 10 deletions

25
shared/crc16.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef __CRC16_H__
#define __CRC16_H__
#include <stdint.h>
typedef struct Crc16Data {
uint16_t currentCrc;
} crc16_data_t;
//! @brief Initializes the parameters of the crc function, must be called first.
//! @param crc16Config Instantiation of the data structure of type crc16_data_t.
void crc16_init(crc16_data_t *crc16Config);
//! @brief A "running" crc calculator that updates the crc value after each call.
//! @param crc16Config Instantiation of the data structure of type crc16_data_t.
//! @param src Pointer to the source buffer of data.
//! @param lengthInBytes The length, given in bytes (not words or long-words).
void crc16_update(crc16_data_t *crc16Config, const uint8_t *src, uint32_t lengthInBytes);
//! @brief Calculates the final crc value, padding with zeros if necessary, must be called last.
//! @param crc16Config Instantiation of the data structure of type crc16_data_t.
//! @param hash Pointer to the value returned for the final calculated crc value.
void crc16_finalize(crc16_data_t *crc16Config, uint16_t *hash);
#endif