/**************************************************************************//** * @file crc.h * @version V1.00 * $Date: 20/05/28 2:08p $ * @brief M2L31 series CRC driver header file * * SPDX-License-Identifier: Apache-2.0 * @copyright (C) 2016-2020 Nuvoton Technology Corp. All rights reserved. *****************************************************************************/ #ifndef __CRC_H__ #define __CRC_H__ #ifdef __cplusplus extern "C" { #endif /** @addtogroup Standard_Driver Standard Driver @{ */ /** @addtogroup CRC_Driver CRC Driver @{ */ /** @addtogroup CRC_EXPORTED_CONSTANTS CRC Exported Constants @{ */ /*---------------------------------------------------------------------------------------------------------*/ /* CRC Polynomial Mode Constant Definitions */ /*---------------------------------------------------------------------------------------------------------*/ #define CRC_CCITT (0UL << CRC_CTL_CRCMODE_Pos) /*!SEED = (u32Seed); CRC->CTL |= CRC_CTL_CHKSINIT_Msk; }while(0) /** * @brief Get CRC Seed Value * * @param None * * @return CRC seed value * * @details This macro gets the current CRC seed value. * \hideinitializer */ #define CRC_GET_SEED() (CRC->SEED) /** * @brief CRC Write Data * * @param[in] u32Data Write data * * @return None * * @details User can write data directly to CRC Write Data Register(CRC_DAT) by this macro to perform CRC operation. * \hideinitializer */ #define CRC_WRITE_DATA(u32Data) (CRC->DAT = (u32Data)) /** * @brief Set CRC Polynomial Value * * @param[in] u32Polynomial Polynomial Value * * @return None * * @details This macro is used to set CRC Polynomial value. * * @note User can write Polynomial value directly to CRC Polynomial Register(CRC_POLYNOMIAL) by this macro to perform CRC operation. * \hideinitializer */ #define CRC_SET_POLYNOMIAL(u32Polynomial) (CRC->POLYNOMIAL = (u32Polynomial)) void CRC_Open(uint32_t u32Mode, uint32_t u32Attribute, uint32_t u32Seed, uint32_t u32DataLen); uint32_t CRC_GetChecksum(void); /*@}*/ /* end of group CRC_EXPORTED_FUNCTIONS */ /*@}*/ /* end of group CRC_Driver */ /*@}*/ /* end of group Standard_Driver */ #ifdef __cplusplus } #endif #endif /*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/