48 lines
1.5 KiB
C
48 lines
1.5 KiB
C
/*
|
||
*
|
||
* 使用示例:crc_list.CRC_4_ITU(data, len);
|
||
* data为数据数组,len为数据长度
|
||
*
|
||
*/
|
||
#ifndef __CRC_LIB_H__
|
||
#define __CRC_LIB_H__
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
#include "stdint.h"
|
||
|
||
typedef struct {
|
||
uint8_t (*CRC_4_ITU)(uint8_t *data, uint8_t len);
|
||
uint8_t (*CRC_5_EPC)(uint8_t *data, uint8_t len);
|
||
uint8_t (*CRC_5_ITU)(uint8_t *data, uint8_t len);
|
||
uint8_t (*CRC_5_USB)(uint8_t *data, uint8_t len);
|
||
uint8_t (*CRC_6_ITU)(uint8_t *data, uint8_t len);
|
||
uint8_t (*CRC_7_MMC)(uint8_t *data, uint8_t len);
|
||
uint8_t (*CRC_8)(uint8_t *data, uint8_t len);
|
||
uint8_t (*CRC_8_ITU)(uint8_t *data, uint8_t len);
|
||
uint8_t (*CRCC_8_ROHC)(uint8_t *data, uint8_t len);
|
||
uint8_t (*CRC_8_MAXIM)(uint8_t *data, uint8_t len);
|
||
uint16_t (*CRC_16_IBM)(uint8_t *data, uint8_t len);
|
||
uint16_t (*CRC_16_MAXIM)(uint8_t *data, uint8_t len);
|
||
uint16_t (*CRC_16_USB)(uint8_t *data, uint8_t len);
|
||
uint16_t (*CRC_16_MODBUS)(uint8_t *data, uint8_t len);
|
||
uint16_t (*CRC_16_CCITT)(uint8_t *data, uint8_t len);
|
||
uint16_t (*CRC_16_CCITT_FALSE)(uint8_t *data, uint8_t len);
|
||
uint16_t (*CRC_16_X25)(uint8_t *data, uint8_t len);
|
||
uint16_t (*CRC_16_XMODEM)(uint8_t *data, uint8_t len);
|
||
uint16_t (*CRC_16_DNP)(uint8_t *data, uint8_t len);
|
||
uint32_t (*CRC_32)(uint8_t *data, uint8_t len);
|
||
uint32_t (*CRC_32_MPEG_2)(uint8_t *data, uint8_t len);
|
||
} FuncionTable;
|
||
extern FuncionTable crc_list;
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif /* __CRC_LIB_H__ */
|
||
|
||
|