/** ########################################################################## ** Filename : ** Project : ** Module : ** Processor : ** Version : 1.0 ** Compiler : ** Date/Time : ** Abstract : ** Contents : ** Note : ** ** (c) Copyright dmdz Co.,Ltd ** -------------------------------------------------------------------------- ** R E V I S I O N H I S T O R Y ** -------------------------------------------------------------------------- ** Date Ver Author Description ** -20230602- --V1.0-- --mingyea--- --修改-- ** #########################################################################*/ #ifndef CRC_H_ #define CRC_H_ /*--------------------------------------------------------------------------- - I N C L U D E F I L E S ----------------------------------------------------------------------------*/ #include "common_types.h" #include "common_cfg.h" /*--------------------------------------------------------------------------- - D E F I N E S / M A C R O S ----------------------------------------------------------------------------*/ //#define CRC8_ID_FOR_SBC 0 #define CRC8_ID_FOR_E2E_L1 0u #define CRC8_ID_FOR_E2E_L2 1u #define CRC8_ID_MAX 2u //{8, 0x1d, 0x00, 0, 0, 0x00}, //CRC8_SAE J1850 #define CRC8_L1_INIT_VALUE 0XFFu //调试的板子是H #define CRC8_L1_POLY_VALUE 0x1Du #define CRC8_L1_XOR_VALUE 0XFFu #define CRC8_L2_INIT_VALUE 0X00u //调试的板子是H #define CRC8_L2_POLY_VALUE 0x1Du #define CRC8_L2_XOR_VALUE 0X00u #define CRC_TABLE_IS_CONST 1u //crc 表,固定数组值 /*--------------------------------------------------------------------------- - T Y P E D E F I N I T I O N S ----------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- - G L O B A L V A R I A B L E S - only configuration table allowed here,variables are not allowed! ----------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- - C O N S T A N T S ----------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- - F U N C T I O N P R O T O T Y P E ----------------------------------------------------------------------------*/ #define CRC_USE_TABLE 1 //利用生成表格 void crc8_table_init(u8 id); u8 crc8_make_by_table(u8 id,u8 *p_data,u8 len); u8 crc8_table_set_init_value(u8 id,u8 value); #if 0 void crc_init(void); #endif MEMORY_MAP_ROM_FOR_ASIL u8 crc_8_make_l2(u8 *u8_data,u8 u8_len); #define crc_8_make crc_8_make_l2 #endif