Move crc16.[ch] to shared
This commit is contained in:
@@ -1,19 +1,12 @@
|
|||||||
#include "bootloader_common.h"
|
|
||||||
#include "crc16.h"
|
#include "crc16.h"
|
||||||
|
|
||||||
void crc16_init(crc16_data_t *crc16Config)
|
void crc16_init(crc16_data_t *crc16Config)
|
||||||
{
|
{
|
||||||
assert(crc16Config);
|
|
||||||
|
|
||||||
// initialize running crc and byte count
|
|
||||||
crc16Config->currentCrc = 0;
|
crc16Config->currentCrc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void crc16_update(crc16_data_t *crc16Config, const uint8_t *src, uint32_t lengthInBytes)
|
void crc16_update(crc16_data_t *crc16Config, const uint8_t *src, uint32_t lengthInBytes)
|
||||||
{
|
{
|
||||||
assert(crc16Config);
|
|
||||||
assert(src);
|
|
||||||
|
|
||||||
uint32_t crc = crc16Config->currentCrc;
|
uint32_t crc = crc16Config->currentCrc;
|
||||||
|
|
||||||
uint32_t j;
|
uint32_t j;
|
||||||
@@ -38,8 +31,5 @@ void crc16_update(crc16_data_t *crc16Config, const uint8_t *src, uint32_t length
|
|||||||
|
|
||||||
void crc16_finalize(crc16_data_t *crc16Config, uint16_t *hash)
|
void crc16_finalize(crc16_data_t *crc16Config, uint16_t *hash)
|
||||||
{
|
{
|
||||||
assert(crc16Config);
|
|
||||||
assert(hash);
|
|
||||||
|
|
||||||
*hash = crc16Config->currentCrc;
|
*hash = crc16Config->currentCrc;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef __CRC16_H__
|
#ifndef __CRC16_H__
|
||||||
#define __CRC16_H__
|
#define __CRC16_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef struct Crc16Data {
|
typedef struct Crc16Data {
|
||||||
uint16_t currentCrc;
|
uint16_t currentCrc;
|
||||||
} crc16_data_t;
|
} crc16_data_t;
|
||||||
Reference in New Issue
Block a user