crc.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. *==========================================================================
  3. *
  4. * crc.h
  5. *
  6. * Interface for the CRC algorithms.
  7. *
  8. *==========================================================================
  9. * SPDX-License-Identifier: eCos-2.0
  10. *==========================================================================
  11. *#####DESCRIPTIONBEGIN####
  12. *
  13. * Author(s): Andrew Lunn
  14. * Contributors: Andrew Lunn
  15. * Date: 2002-08-06
  16. * Purpose:
  17. * Description:
  18. *
  19. * This code is part of eCos (tm).
  20. *
  21. *####DESCRIPTIONEND####
  22. *
  23. *==========================================================================
  24. */
  25. #ifndef _SERVICES_CRC_CRC_H_
  26. #define _SERVICES_CRC_CRC_H_
  27. #include <linux/types.h>
  28. #ifndef __externC
  29. # ifdef __cplusplus
  30. # define __externC extern "C"
  31. # else
  32. # define __externC extern
  33. # endif
  34. #endif
  35. /* Compute a CRC, using the POSIX 1003 definition */
  36. extern uint32_t
  37. cyg_posix_crc32(unsigned char *s, int len);
  38. /* Gary S. Brown's 32 bit CRC */
  39. extern uint32_t
  40. cyg_crc32(unsigned char *s, int len);
  41. /* Gary S. Brown's 32 bit CRC, but accumulate the result from a */
  42. /* previous CRC calculation */
  43. extern uint32_t
  44. cyg_crc32_accumulate(uint32_t crc, unsigned char *s, int len);
  45. /* Ethernet FCS Algorithm */
  46. extern uint32_t
  47. cyg_ether_crc32(unsigned char *s, int len);
  48. /* Ethernet FCS algorithm, but accumulate the result from a previous */
  49. /* CRC calculation. */
  50. extern uint32_t
  51. cyg_ether_crc32_accumulate(uint32_t crc, unsigned char *s, int len);
  52. /* 16 bit CRC with polynomial x^16+x^12+x^5+1 */
  53. extern uint16_t cyg_crc16(unsigned char *s, int len);
  54. #endif /* _SERVICES_CRC_CRC_H_ */