Use the same API name to add mbed CRC: lfs_crc

pull/8083/head
Deepika 2018-08-21 17:18:34 -05:00 committed by adbridge
parent 8d31fc144e
commit a0ad63b47e
2 changed files with 2 additions and 12 deletions

View File

@ -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);

View File

@ -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