/* *========================================================================== * * crc.h * * Interface for the CRC algorithms. * *========================================================================== * SPDX-License-Identifier: eCos-2.0 *========================================================================== *#####DESCRIPTIONBEGIN#### * * Author(s): Andrew Lunn * Contributors: Andrew Lunn * Date: 2002-08-06 * Purpose: * Description: * * This code is part of eCos (tm). * *####DESCRIPTIONEND#### * *========================================================================== */ #ifndef _SERVICES_CRC_CRC_H_ #define _SERVICES_CRC_CRC_H_ #include "../base/basicTypes.h" #define DYNAMIC_CRC_TABLE __externC const uint8_t crc7_syndrome_table[256]; static inline uint8_t crc7_byte( uint8_t crc, uint8_t data ){ return crc7_syndrome_table[(crc << 1) ^ data]; } __externC uint8_t crc7( uint8_t crc, uint8_t const *buffer, size_t len); #if __BYTE_ORDER == __LITTLE_ENDIAN //__externC uint32_t crc32_le( uint32_t crc, uint8_t const *buffer, size_t len ); //#define crc32( seed, data, length ) crc32_le( seed, (uint8_t const *) data, length ) #else //__externC uint32_t crc32_be( uint32_t crc, uint8_t const *buffer, size_t len ); //#define crc32( seed, data, length ) crc32_be( seed, (uint8_t const *) data, length ) #endif __externC uint32_t crc32( uint32_t crc, const uint8_t *p, uint32_t len ); #endif /* _SERVICES_CRC_CRC_H_ */