crc.h 627 B

123456789101112131415161718192021
  1. #ifndef __CRC_H__
  2. #define __CRC_H__
  3. #ifndef uint8_t
  4. #define uint8_t unsigned char
  5. #define uint16_t unsigned short
  6. #define uint32_t unsigned int
  7. #define BOOL unsigned char
  8. #define TRUE 1
  9. #define FALSE 0
  10. #endif
  11. #include "string.h"
  12. //uint16_t calcCRC16(const uint8_t *data, uint32_t length);
  13. uint32_t calcCRC32(const uint8_t* buf, uint32_t len);
  14. uint8_t calcCRC8(const uint8_t *buf, uint32_t len);
  15. uint16_t calcCRC16(const uint8_t *data, const char *cmd, int length, uint16_t poly, uint16_t initial, uint16_t finally, BOOL bInReverse, BOOL bOutReverse);
  16. uint16_t calcCRC16_modbus(const uint8_t *data, uint32_t length);
  17. #endif