1 /** 2 ****************************************************************************** 3 * @file ft32f0xx_crc.h 4 * @author FMD AE 5 * @brief This file contains all the functions prototypes for the CRC firmware 6 * library. 7 * @version V1.0.0 8 * @data 2021-07-01 9 ****************************************************************************** 10 */ 11 12 /* Define to prevent recursive inclusion -------------------------------------*/ 13 #ifndef __FT32F0XX_CRC_H 14 #define __FT32F0XX_CRC_H 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 /*!< Includes ----------------------------------------------------------------*/ 21 #include "ft32f0xx.h" 22 23 24 /** @addtogroup CRC 25 * @{ 26 */ 27 28 /* Exported types ------------------------------------------------------------*/ 29 /* Exported constants --------------------------------------------------------*/ 30 31 /** @defgroup CRC_ReverseInputData 32 * @{ 33 */ 34 #define CRC_ReverseInputData_No ((uint32_t)0x00000000) /*!< No reverse operation of Input Data */ 35 #define CRC_ReverseInputData_8bits CRC_CR_REV_IN_0 /*!< Reverse operation of Input Data on 8 bits */ 36 #define CRC_ReverseInputData_16bits CRC_CR_REV_IN_1 /*!< Reverse operation of Input Data on 16 bits */ 37 #define CRC_ReverseInputData_32bits CRC_CR_REV_IN /*!< Reverse operation of Input Data on 32 bits */ 38 39 #define IS_CRC_REVERSE_INPUT_DATA(DATA) (((DATA) == CRC_ReverseInputData_No) || \ 40 ((DATA) == CRC_ReverseInputData_8bits) || \ 41 ((DATA) == CRC_ReverseInputData_16bits) || \ 42 ((DATA) == CRC_ReverseInputData_32bits)) 43 44 /** 45 * @} 46 */ 47 48 /** @defgroup CRC_PolynomialSize 49 * @brief Only applicable for FT32F042 and FT32F072 devices 50 * @{ 51 */ 52 #define CRC_PolSize_7 CRC_CR_POLSIZE /*!< 7-bit polynomial for CRC calculation */ 53 #define CRC_PolSize_8 CRC_CR_POLSIZE_1 /*!< 8-bit polynomial for CRC calculation */ 54 #define CRC_PolSize_16 CRC_CR_POLSIZE_0 /*!< 16-bit polynomial for CRC calculation */ 55 #define CRC_PolSize_32 ((uint32_t)0x00000000)/*!< 32-bit polynomial for CRC calculation */ 56 57 #define IS_CRC_POL_SIZE(SIZE) (((SIZE) == CRC_PolSize_7) || \ 58 ((SIZE) == CRC_PolSize_8) || \ 59 ((SIZE) == CRC_PolSize_16) || \ 60 ((SIZE) == CRC_PolSize_32)) 61 62 63 /** 64 * @} 65 */ 66 67 /* Exported macro ------------------------------------------------------------*/ 68 /* Exported functions ------------------------------------------------------- */ 69 /* Configuration of the CRC computation unit **********************************/ 70 void CRC_DeInit(void); 71 void CRC_ResetDR(void); 72 //void CRC_PolynomialSizeSelect(uint32_t CRC_PolSize); /*!< Only applicable for FT32F042 and FT32F072 devices */ 73 void CRC_ReverseInputDataSelect(uint32_t CRC_ReverseInputData); 74 void CRC_ReverseOutputDataCmd(FunctionalState NewState); 75 void CRC_SetInitRegister(uint32_t CRC_InitValue); 76 void CRC_SetPolynomial(uint32_t CRC_Pol); 77 78 /* CRC computation ************************************************************/ 79 uint32_t CRC_CalcCRC(uint32_t CRC_Data); 80 uint32_t CRC_CalcCRC16bits(uint16_t CRC_Data); 81 uint32_t CRC_CalcCRC8bits(uint8_t CRC_Data); 82 uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 83 uint32_t CRC_GetCRC(void); 84 85 /* Independent register (IDR) access (write/read) *****************************/ 86 void CRC_SetIDRegister(uint8_t CRC_IDValue); 87 uint8_t CRC_GetIDRegister(void); 88 89 #ifdef __cplusplus 90 } 91 #endif 92 93 #endif /* __FT32F0XX_CRC_H */ 94 95 /** 96 * @} 97 */ 98 99 /** 100 * @} 101 */ 102 103 /************************ (C) COPYRIGHT FMD *****END OF FILE****/ 104