Sony PlayStation2 Study
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.5 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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 "../base/basicTypes.h"
  28. #define DYNAMIC_CRC_TABLE
  29. __externC const uint8_t crc7_syndrome_table[256];
  30. static inline uint8_t crc7_byte( uint8_t crc, uint8_t data ){ return crc7_syndrome_table[(crc << 1) ^ data]; }
  31. __externC uint8_t crc7( uint8_t crc, uint8_t const *buffer, size_t len);
  32. #if __BYTE_ORDER == __LITTLE_ENDIAN
  33. //__externC uint32_t crc32_le( uint32_t crc, uint8_t const *buffer, size_t len );
  34. //#define crc32( seed, data, length ) crc32_le( seed, (uint8_t const *) data, length )
  35. #else
  36. //__externC uint32_t crc32_be( uint32_t crc, uint8_t const *buffer, size_t len );
  37. //#define crc32( seed, data, length ) crc32_be( seed, (uint8_t const *) data, length )
  38. #endif
  39. __externC uint32_t crc32( uint32_t crc, const uint8_t *p, uint32_t len );
  40. #endif /* _SERVICES_CRC_CRC_H_ */