mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Use the same API name to add mbed CRC: lfs_crc
							parent
							
								
									4d7fdfc2a9
								
							
						
					
					
						commit
						683034db8a
					
				| 
						 | 
				
			
			@ -20,7 +20,7 @@
 | 
			
		|||
#include "lfs_util.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;    
 | 
			
		||||
    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
 | 
			
		||||
#ifndef LFS_CONFIG
 | 
			
		||||
 | 
			
		||||
#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
 | 
			
		||||
#ifndef __MBED__
 | 
			
		||||
void lfs_crc(uint32_t *restrict crc, const void *buffer, size_t size) {
 | 
			
		||||
    static const uint32_t rtable[16] = {
 | 
			
		||||
        0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
 | 
			
		||||
| 
						 | 
				
			
			@ -34,5 +25,4 @@ void lfs_crc(uint32_t *restrict crc, const void *buffer, size_t size) {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
		Loading…
	
		Reference in New Issue