crc_cfg.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * crc_cfg.h
  3. *
  4. * Change Logs:
  5. * Date Author Notes
  6. * 2020-07-02 qiyongzhong first version
  7. */
  8. #ifndef __CRC_CFG_H__
  9. #define __CRC_CFG_H__
  10. #include <rtconfig.h>
  11. //#define CRCLIB_USING_CRC8
  12. //#define CRCLIB_USING_CRC16
  13. //#define CRCLIB_USING_CRC32
  14. //#define CRCLIB_USING_CRC8_EX
  15. //#define CRCLIB_USING_CRC16_EX
  16. //#define CRCLIB_USING_CRC32_EX
  17. //#define CRCLIB_USING_CRC16_EX_SAMPLE
  18. #ifdef CRCLIB_USING_CRC8
  19. //#define CRC8_USING_CONST_TABLE //using const table in flash memory, nodefined using table in ram
  20. #ifndef CRC8_POLY
  21. #define CRC8_POLY 0x8C //crc8 polynome, Poly = x8+x5+x4+1
  22. //#define CRC8_POLY 0xD9 //crc8 polynome, Poly = x8+x7+x4+x3+x+1
  23. #endif
  24. #ifndef CRC8_INIT_VAL
  25. #define CRC8_INIT_VAL 0xFF
  26. #endif
  27. #endif
  28. #ifdef CRCLIB_USING_CRC16
  29. //#define CRC16_USING_CONST_TABLE //using const table in flash memory, nodefined using table in ram
  30. #ifndef CRC16_POLY
  31. #define CRC16_POLY 0xA001 //crc16 polynome, Poly = x16+x15+x2+1 (IBM,SDLC)
  32. //#define CRC16_POLY 0x8408 //crc16 polynome, Poly = x16+x12+x5+1 (CCITT,ISO,HDLC,ITUX25,PPP-FCS)
  33. #endif
  34. #ifndef CRC16_INIT_VAL
  35. #define CRC16_INIT_VAL 0xFFFF
  36. #endif
  37. #endif
  38. #ifdef CRCLIB_USING_CRC32
  39. //#define CRC32_USING_CONST_TABLE //using const table in flash memory, nodefined using table in ram
  40. #ifndef CRC32_POLY
  41. #define CRC32_POLY 0xEDB88320 //crc32 polynome, Poly = x32+x26+x23+...+x2+x+1 (ZIP,RAR,IEEE,LAN/FDDI,PPP-FCS)
  42. //#define CRC32_POLY 0x82F63B78 //crc32 polynome, Poly = x32+x28+x27+...+x8+x6+1 (SCTP)
  43. #endif
  44. #ifndef CRC32_INIT_VAL
  45. #define CRC32_INIT_VAL 0xFFFFFFFF
  46. #endif
  47. #endif
  48. #endif