mirror of https://github.com/ARMmbed/mbed-os.git
Use the same API name to add mbed CRC: lfs_crc
parent
8d31fc144e
commit
a0ad63b47e
|
@ -20,7 +20,7 @@
|
||||||
#include "lfs_util.h"
|
#include "lfs_util.h"
|
||||||
#include "MbedCRC.h"
|
#include "MbedCRC.h"
|
||||||
|
|
||||||
extern "C" void mbed_lfs_crc(uint32_t *crc, const void *buffer, size_t size)
|
extern "C" void lfs_crc(uint32_t *crc, const void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
uint32_t initial_xor = *crc;
|
uint32_t initial_xor = *crc;
|
||||||
MbedCRC<POLY_32BIT_REV_ANSI, 32> ct(initial_xor, 0x0, true, false);
|
MbedCRC<POLY_32BIT_REV_ANSI, 32> ct(initial_xor, 0x0, true, false);
|
||||||
|
|
|
@ -9,16 +9,7 @@
|
||||||
|
|
||||||
// Only compile if user does not provide custom config
|
// Only compile if user does not provide custom config
|
||||||
#ifndef LFS_CONFIG
|
#ifndef LFS_CONFIG
|
||||||
|
#ifndef __MBED__
|
||||||
#ifdef __MBED__
|
|
||||||
extern void mbed_lfs_crc(uint32_t *crc, const void *buffer, size_t size);
|
|
||||||
|
|
||||||
// Software CRC implementation with small lookup table
|
|
||||||
void lfs_crc(uint32_t *restrict crc, const void *buffer, size_t size) {
|
|
||||||
mbed_lfs_crc(crc, buffer, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
void lfs_crc(uint32_t *restrict crc, const void *buffer, size_t size) {
|
void lfs_crc(uint32_t *restrict crc, const void *buffer, size_t size) {
|
||||||
static const uint32_t rtable[16] = {
|
static const uint32_t rtable[16] = {
|
||||||
0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
|
0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
|
||||||
|
@ -34,5 +25,4 @@ void lfs_crc(uint32_t *restrict crc, const void *buffer, size_t size) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue