97 lines
3.1 KiB
C
97 lines
3.1 KiB
C
|
/***************************************************************
|
|||
|
*Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd.
|
|||
|
*<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: Liut
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: V1.00
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: 2017/07/14
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*<EFBFBD><EFBFBD> ע<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ES8P508xоƬ
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧϰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾʹ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>κη<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ρ<EFBFBD>
|
|||
|
***************************************************************/
|
|||
|
#include "lib_crc.h"
|
|||
|
|
|||
|
/***************************************************************
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CRC_getTypeValue
|
|||
|
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>CRC_CON<EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>con_value CRC_CON <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ṹ<EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>CRC_CON<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
***************************************************************/
|
|||
|
uint32_t CRC_getTypeValue(CRC_CONValueStruType con_value)
|
|||
|
{
|
|||
|
uint32_t type =0;
|
|||
|
type = (con_value.xorout | con_value.refout | con_value.refin |\
|
|||
|
con_value.mode|con_value.hs_type|con_value.init_data_type);
|
|||
|
return type;
|
|||
|
}
|
|||
|
|
|||
|
/***************************************************************
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CRC_EmptayCheck
|
|||
|
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>պ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>address: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD> data_len<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
|||
|
***************************************************************/
|
|||
|
uint32_t CRC_EmptayCheck(void* address, uint32_t data_len)
|
|||
|
{
|
|||
|
CRC_EM CRC_EmptayCheck = (CRC_EM)(*(uint32_t *)CRC_EmptayCheck_addr);
|
|||
|
|
|||
|
uint32_t result;
|
|||
|
__ASM("CPSID i");
|
|||
|
result = (*CRC_EmptayCheck)(address, data_len);
|
|||
|
__ASM("CPSIE i");
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/***************************************************************
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CRC_FlashVerify
|
|||
|
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>FLASHУ<EFBFBD>麯<EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>address: У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD> data_len<EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڳ<EFBFBD><EFBFBD>ȣ<EFBFBD> type:У<EFBFBD>鷽ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>CRCУ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
***************************************************************/
|
|||
|
uint32_t CRC_FlashVerify(void* address, uint32_t data_len, uint32_t type)
|
|||
|
{
|
|||
|
CRC_FL CRC_FlashVerify = (CRC_FL)(*(uint32_t *)CRC_FlashVerify_addr);
|
|||
|
|
|||
|
uint32_t result;
|
|||
|
__ASM("CPSID i");
|
|||
|
result = (*CRC_FlashVerify)(address, data_len, type);
|
|||
|
__ASM("CPSIE i");
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/***************************************************************
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CRC_UserCal
|
|||
|
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>麯<EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>address: <EFBFBD>û<EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD> data_len<EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڳ<EFBFBD><EFBFBD>ȣ<EFBFBD> type:У<EFBFBD>鷽ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>CRCУ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
***************************************************************/
|
|||
|
uint32_t CRC_UserCal(void* address, uint32_t data_len, uint32_t type)
|
|||
|
{
|
|||
|
CRC_US CRC_UserCal = (CRC_US)(*(uint32_t *)CRC_UserCal_addr);
|
|||
|
|
|||
|
uint32_t result;
|
|||
|
__ASM("CPSID i");
|
|||
|
result = (*CRC_UserCal)(address, data_len, type);
|
|||
|
__ASM("CPSIE i");
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/***************************************************************
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CRC_CheckReset
|
|||
|
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>CRC<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>־<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD>и<EFBFBD>λ<EFBFBD><EFBFBD>־<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>־
|
|||
|
***************************************************************/
|
|||
|
uint32_t CRC_CheckReset(void)
|
|||
|
{
|
|||
|
CRC_CH CRC_CheckReset = (CRC_CH)(*(uint32_t *)CRC_CheckReset_addr);
|
|||
|
|
|||
|
uint32_t result;
|
|||
|
__ASM("CPSID i");
|
|||
|
result = (*CRC_CheckReset)();
|
|||
|
__ASM("CPSIE i");
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/************************END OF FILE**************************/
|
|||
|
|