1 /* Define to prevent recursive inclusion -------------------------------------*/
2 #ifndef __AIR32F10x_CRC_H
3 #define __AIR32F10x_CRC_H
4 
5 #ifdef __cplusplus
6  extern "C" {
7 #endif
8 
9 /* Includes ------------------------------------------------------------------*/
10 #include "air32f10x.h"
11 
12 /** @addtogroup air32f10x_StdPeriph_Driver
13   * @{
14   */
15 
16 /* Exported types ------------------------------------------------------------*/
17 #define CRC_32_BYTE_NUM         ((uint32_t)0xC0)
18 #define CRC_16_BYTE_NUM         ((uint32_t)0x40)
19 #define XOR_OUT_SEL_SET         ((uint32_t)0x20)
20 #define REV_OUT_SEL_SET         ((uint32_t)0x10)
21 #define REV_IN_SEL_SET          ((uint32_t)0x04)
22 #define TYPE_SEL_SET            ((uint32_t)0x02)
23 #define POLY_SEL_SET            ((uint32_t)0x01)
24 
25 #define CRC_INIT_VALUE_0        ((uint32_t)0)
26 #define CRC16_INIT_VALUE_FF     ((uint32_t)0xffff)
27 #define CRC32_INIT_VALUE_FF     ((uint32_t)0xffffffff)
28 
29 typedef enum
30 {
31     CRC_16_IBM = 0x01,
32     CRC_16_MAXIM = 0x02,
33     CRC_16_USB   = 0x03,
34     CRC_16_MODBUS= 0x04,
35     CRC_16_CCITT = 0x05,
36     CRC_16_CCITT_FALSE = 0x06,
37     CRC_16_X25    = 0x07,
38     CRC_16_XMODEM = 0x08,
39     CRC_32        = 0x09,
40     CRC_32_MPEG_2 = 0x0A
41 }CRC_Param_TypeDef;
42 
43 typedef enum
44 {
45     CRC_Poly_16_1021 = 0x01,
46     CRC_Poly_16_8005 = 0x02,
47     CRC_Poly_32_04C11DB7 = 0x03
48 }CRC_Poly_TypeDef;
49 
50 
51 void CRC_ResetDR(void);
52 uint32_t CRC_CalcCRC(uint32_t Data);
53 uint32_t CRC_CalcBlockCRC(uint32_t Type,uint32_t pBuffer[], uint32_t BufferLength);
54 uint32_t CRC_GetCRC(void);
55 void CRC_SetIDRegister(uint8_t IDValue);
56 uint8_t CRC_GetIDRegister(void);
57 
58 #ifdef __cplusplus
59 }
60 #endif
61 
62 #endif /* __AIR32F10x_CRC_H */
63 /**
64   * @}
65   */
66 
67 /**
68   * @}
69   */
70 
71 /**
72   * @}
73   */
74 
75