summaryrefslogtreecommitdiff
path: root/bsp/essemi/es8p508x/libraries/Library/Include/lib_crc.h
blob: 1ab36cca7b66e6ba7c3e3b226c16ecd8fe3cb6eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/***************************************************************
 *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd.
 *�����  
 *��  ��:  Liut
 *��  ��:  V1.00
 *��  ��:  2017/07/14
 *��  ����  
 *��  ע��  ������ ES8P508xоƬ
 ����������ѧϰ����ʾʹ�ã����û�ֱ�����ô����������ķ��ջ������е��κη������Ρ�
 ***************************************************************/
#ifndef __LIBCRC_H
#define __LIBCRC_H

#include "ES8P508x.h"
#include "type.h"

#ifdef __cplusplus
extern "C" {
#endif

#define CRC_EmptayCheck_addr    0x10000010
#define CRC_FlashVerify_addr    0x10000014
#define CRC_UserCal_addr        0x10000018
#define CRC_CheckReset_addr     0x1000001C

typedef uint32_t (*CRC_EM)(void* address, uint32_t data_len);
typedef uint32_t (*CRC_FL)(void* address, uint32_t data_len, uint32_t type);
typedef uint32_t (*CRC_US)(void* address, uint32_t data_len, uint32_t type);
typedef uint32_t (*CRC_CH)(void);
	

typedef enum
{
    CRC_XOROUT_NORMAL = 0x0,   //���������ȡ��
    CRC_XOROUT_ANTI = (1U<<14),   //�������ȡ��
} CRC_XOROUT;

typedef enum
{
    CRC_REFOUT_NORMAL = 0x0,   //�����������
    CRC_REFOUT_REVERSE = (1U<<13),   //�����������
} CRC_REFOUT;

typedef enum
{
    CRC_REFIN_NORMAL = 0x0,   //������������
    CRC_REFIN_REVERSE = (1U<<12),   //�������뵹��
} CRC_REFIN;


typedef enum
{
    CRC_MOD_CRC32 = 0x0,	     //CRCλ��Ϊ�ֽ�
    CRC_MOD_CRC16 = (2U<<8),   //CRC�����
    CRC_MOD_CRC16_CCITT = (3U<<8),   //CRC���
} CRC_MOD_TYPE;

typedef enum
{
    CRC_INIT_DATA_ALL_0 = 0x0,	     //CRC��ʼ������ȫΪ0
    CRC_INIT_DATA_ALL_1 = (1U<<3),   //CRC��ʼ������ȫΪ1
} CRC_INIT_DATA;

typedef enum
{
    CRC_HS_TYPE_DISABLE = 0x0,	     //CRC����ģʽ��ֹ
    CRC_HS_TYPE_ENABLE = (1U<<2),   //CRC����ģʽʹ�ܣ���CRCʱ��С��24Mʱ����ʹ��
} CRC_HS_TYPE;


/*CRC_CON ��������ֵ�ṹ���ʼ��*/
typedef struct 
{
	CRC_XOROUT xorout;
	CRC_REFOUT refout;
	CRC_REFIN  refin;
	CRC_MOD_TYPE mode;
	CRC_INIT_DATA init_data_type;
	CRC_HS_TYPE hs_type;
} CRC_CONValueStruType;

uint32_t CRC_getTypeValue(CRC_CONValueStruType con_value);
uint32_t CRC_EmptayCheck(void* address, uint32_t data_len);
uint32_t CRC_FlashVerify(void* address, uint32_t data_len, uint32_t type);
uint32_t CRC_UserCal(void* address, uint32_t data_len, uint32_t type);
uint32_t CRC_CheckReset(void);

#ifdef __cplusplus
}
#endif

#endif
/*************************END OF FILE**********************/