/**************************************************************************//** * @file nu_crc.h * @version V3.00 * @brief Cyclic Redundancy Check(CRC) driver header file * * @copyright SPDX-License-Identifier: Apache-2.0 * @copyright Copyright (C) 2020 Nuvoton Technology Corp. All rights reserved. *****************************************************************************/ #ifndef __NU_CRC_H__ #define __NU_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[in] crc The pointer of CRC module. * * @return CRC seed value * * @details This macro gets the current CRC seed value. * \hideinitializer */ #define CRC_GET_SEED(crc) ((crc)->SEED) /** * @brief CRC Write Data * * @param[in] crc The pointer of CRC module. * @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(crc, u32Data) ((crc)->DAT = (u32Data)) 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 /* __NU_CRC_H__ */