M480 BSP V3.05.005
The Board Support Package for M480 Series
crc.h
Go to the documentation of this file.
1/**************************************************************************/
9#ifndef __CRC_H__
10#define __CRC_H__
11
12#ifdef __cplusplus
13extern "C"
14{
15#endif
16
17
29/*---------------------------------------------------------------------------------------------------------*/
30/* CRC Polynomial Mode Constant Definitions */
31/*---------------------------------------------------------------------------------------------------------*/
32#define CRC_CCITT (0UL << CRC_CTL_CRCMODE_Pos)
33#define CRC_8 (1UL << CRC_CTL_CRCMODE_Pos)
34#define CRC_16 (2UL << CRC_CTL_CRCMODE_Pos)
35#define CRC_32 (3UL << CRC_CTL_CRCMODE_Pos)
37/*---------------------------------------------------------------------------------------------------------*/
38/* Checksum, Write data Constant Definitions */
39/*---------------------------------------------------------------------------------------------------------*/
40#define CRC_CHECKSUM_COM (CRC_CTL_CHKSFMT_Msk)
41#define CRC_CHECKSUM_RVS (CRC_CTL_CHKSREV_Msk)
42#define CRC_WDATA_COM (CRC_CTL_DATFMT_Msk)
43#define CRC_WDATA_RVS (CRC_CTL_DATREV_Msk)
45/*---------------------------------------------------------------------------------------------------------*/
46/* CPU Write Data Length Constant Definitions */
47/*---------------------------------------------------------------------------------------------------------*/
48#define CRC_CPU_WDATA_8 (0UL << CRC_CTL_DATLEN_Pos)
49#define CRC_CPU_WDATA_16 (1UL << CRC_CTL_DATLEN_Pos)
50#define CRC_CPU_WDATA_32 (2UL << CRC_CTL_DATLEN_Pos) /* end of group CRC_EXPORTED_CONSTANTS */
53
54
72#define CRC_SET_SEED(u32Seed) do{ CRC->SEED = (u32Seed); CRC->CTL |= CRC_CTL_CHKSINIT_Msk; }while(0)
73
84#define CRC_GET_SEED() (CRC->SEED)
85
96#define CRC_WRITE_DATA(u32Data) (CRC->DAT = (u32Data))
97
98void CRC_Open(uint32_t u32Mode, uint32_t u32Attribute, uint32_t u32Seed, uint32_t u32DataLen);
99uint32_t CRC_GetChecksum(void);
100 /* end of group CRC_EXPORTED_FUNCTIONS */
102 /* end of group CRC_Driver */
104 /* end of group Standard_Driver */
106
107#ifdef __cplusplus
108}
109#endif
110
111#endif
112
113/*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/
void CRC_Open(uint32_t u32Mode, uint32_t u32Attribute, uint32_t u32Seed, uint32_t u32DataLen)
CRC Open.
Definition: crc.c:47
uint32_t CRC_GetChecksum(void)
Get CRC Checksum.
Definition: crc.c:65