NUC472_NUC442_BSP V3.03.005
The Board Support Package for NUC472/NUC442
crc.h
Go to the documentation of this file.
1/**************************************************************************/
12#ifndef __CRC_H__
13#define __CRC_H__
14
15#ifdef __cplusplus
16extern "C"
17{
18#endif
19
20
32/*---------------------------------------------------------------------------------------------------------*/
33/* CRC Polynomial Mode Constant Definitions */
34/*---------------------------------------------------------------------------------------------------------*/
35#define CRC_CCITT 0x00000000UL
36#define CRC_8 0x40000000UL
37#define CRC_16 0x80000000UL
38#define CRC_32 0xC0000000UL
40/*---------------------------------------------------------------------------------------------------------*/
41/* Checksum, Write data Constant Definitions */
42/*---------------------------------------------------------------------------------------------------------*/
43#define CRC_CHECKSUM_COM 0x08000000UL
44#define CRC_CHECKSUM_RVS 0x02000000UL
45#define CRC_WDATA_COM 0x04000000UL
46#define CRC_WDATA_RVS 0x01000000UL
48/*---------------------------------------------------------------------------------------------------------*/
49/* CPU Write Data Length Constant Definitions */
50/*---------------------------------------------------------------------------------------------------------*/
51#define CRC_CPU_WDATA_8 0x00000000UL
52#define CRC_CPU_WDATA_16 0x10000000UL
53#define CRC_CPU_WDATA_32 0x20000000UL /* end of group NUC472_442_CRC_EXPORTED_CONSTANTS */
56
57
74#define CRC_SET_SEED(u32Seed) { CRC->SEED = (u32Seed); CRC->CTL |= CRC_CTL_CRCRST_Msk; }
75
85#define CRC_GET_SEED() (CRC->SEED)
86
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 NUC472_442_CRC_EXPORTED_FUNCTIONS */
102 /* end of group NUC472_442_CRC_Driver */
104 /* end of group NUC472_442_Device_Driver */
106
107#ifdef __cplusplus
108}
109#endif
110
111#endif //__CRC_H__
112
113/*** (C) COPYRIGHT 2015 Nuvoton Technology Corp. ***/
void CRC_Open(uint32_t u32Mode, uint32_t u32Attribute, uint32_t u32Seed, uint32_t u32DataLen)
CRC Open.
Definition: crc.c:50
uint32_t CRC_GetChecksum(void)
Get CRC Checksum.
Definition: crc.c:68