shellmatta_crc.h 968 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2019 - 2021 Stefan Strobel <stefan.strobel@shimatta.net>
  3. *
  4. * This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file shellmatta_crc.h
  10. * @brief cyclic redundancy check functions of shellmatta
  11. * @author Simon Fischer <fischer.simon.1991@gmail.com>
  12. */
  13. #ifndef _SHELLMATTA_CRC_H_
  14. #define _SHELLMATTA_CRC_H_
  15. #include <stdint.h>
  16. #define CRC32_POLYNOM 0x04c11db7u /**< crc-32 ethernet 802.3 */
  17. #define CRC16_XMODEM_POLYNOM 0x1021u /**< crc16 xmodem */
  18. #define BITS_PER_BYTE ((uint8_t)8) /**< amount of bits per byte; to avoid magic number */
  19. uint32_t crc32Calc(const char* data, uint32_t size);
  20. uint16_t crc16Calc(const char* data, uint32_t size);
  21. #endif /* _SHELLMATTA_CRC_H_ */