123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- #ifndef _FSL_CRC_H_
- #define _FSL_CRC_H_
- #include "fsl_common.h"
- #define FSL_CRC_DRIVER_VERSION (MAKE_VERSION(2, 0, 1))
- #ifndef CRC_DRIVER_CUSTOM_DEFAULTS
- #define CRC_DRIVER_USE_CRC16_CCIT_FALSE_AS_DEFAULT 1
- #endif
- typedef enum _crc_bits
- {
- kCrcBits16 = 0U,
- kCrcBits32 = 1U
- } crc_bits_t;
- typedef enum _crc_result
- {
- kCrcFinalChecksum = 0U,
- kCrcIntermediateChecksum = 1U
- } crc_result_t;
- typedef struct _crc_config
- {
- uint32_t polynomial;
- uint32_t seed;
- bool reflectIn;
- bool reflectOut;
- bool complementChecksum;
- crc_bits_t crcBits;
- crc_result_t crcResult;
- } crc_config_t;
- #if defined(__cplusplus)
- extern "C" {
- #endif
- void CRC_Init(CRC_Type *base, const crc_config_t *config);
- static inline void CRC_Deinit(CRC_Type *base)
- {
- #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
-
- CLOCK_DisableClock(kCLOCK_Crc0);
- #endif
- }
- void CRC_GetDefaultConfig(crc_config_t *config);
- void CRC_WriteData(CRC_Type *base, const uint8_t *data, size_t dataSize);
- uint32_t CRC_Get32bitResult(CRC_Type *base);
- uint16_t CRC_Get16bitResult(CRC_Type *base);
- #if defined(__cplusplus)
- }
- #endif
- #endif
|