crc8.h 926 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * crc8.h
  3. *
  4. * Change Logs:
  5. * Date Author Notes
  6. * 2020-07-02 qiyongzhong first version
  7. */
  8. #ifndef __CRC8_H__
  9. #define __CRC8_H__
  10. #include <typedef.h>
  11. #include "crc_cfg.h"
  12. #ifdef CRCLIB_USING_CRC8
  13. #if (!defined(CRC8_USING_CONST_TABLE) || ((CRC8_POLY != 0x8C) && (CRC8_POLY != 0xD9)))
  14. /*
  15. * @brief cyclic initialize crc table
  16. * @param none
  17. * @retval none
  18. */
  19. void crc8_table_init(void);
  20. #endif
  21. /*
  22. * @brief cyclic calculation crc check value
  23. * @param init_val - initial value
  24. * @param pdata - datas pointer
  25. * @param len - datas len
  26. * @retval calculated result
  27. */
  28. u8 crc8_cyc_cal(u8 init_val, u8 *pdata, u32 len);
  29. /*
  30. * @brief calculation crc check value, initial is CRC8_INIT_VOL
  31. * @param pdata - datas pointer
  32. * @param len - datas len
  33. * @retval calculated result
  34. */
  35. u8 crc8_cal(u8 *pdata, u32 len);
  36. #endif
  37. #endif