Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
lfs_util.c
00001 /* 00002 * lfs util functions 00003 * 00004 * Copyright (c) 2017, Arm Limited. All rights reserved. 00005 * SPDX-License-Identifier: BSD-3-Clause 00006 */ 00007 #include "lfs_util.h" 00008 00009 00010 // Only compile if user does not provide custom config 00011 #ifndef LFS_CONFIG 00012 #ifndef __MBED__ 00013 void lfs_crc(uint32_t *restrict crc, const void *buffer, size_t size) { 00014 static const uint32_t rtable[16] = { 00015 0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 00016 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, 00017 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 00018 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c, 00019 }; 00020 00021 const uint8_t *data = buffer; 00022 for (size_t i = 0; i < size; i++) { 00023 *crc = (*crc >> 4) ^ rtable[(*crc ^ (data[i] >> 0)) & 0xf]; 00024 *crc = (*crc >> 4) ^ rtable[(*crc ^ (data[i] >> 4)) & 0xf]; 00025 } 00026 } 00027 #endif 00028 #endif
Generated on Tue Jul 12 2022 13:54:26 by
