iOBC Checksum API

group iOBC-Checksum

Functions

void checksum_prepare_LUTCRC8(uint8_t polynomial, uint8_t *LUT)

Generate a LUT for CRC 8 calculations with a certain polynomial.

Parameters
  • polynomial[in] 8-bit CRC polynomial to be used

  • LUT[out] Pointer to memory block where LUT can be stored, needs to be at least 256 * sizeof(uint8_t)

uint8_t checksum_calculate_CRC8LUT(const uint8_t *data, unsigned int length, const uint8_t *LUT, uint8_t start_remainder, bool endofdata)

Calculates a CRC 8 checksum according to CRC-8 CCITT, using a LUT.

Parameters
  • data[in] Pointer to data to calculate the checksum for.

  • length[in] Length of the data in bytes.

  • LUT[in] Pointer to LUT to use for CRC calculations, prepared using checksum_prepareLUTCRC8()

  • start_remainder[in] Remainder to start CRC calculation with

  • endofdata[in] Indicates whether this is the end of larger datablock (TRUE) or not yet (FALSE)

Returns

uint8_t 8-bit CRC checksum.

uint8_t checksum_calculate_CRC8(const uint8_t *data, unsigned int length, uint8_t polynomial, uint8_t start_remainder, bool endofdata)

Calculates a CRC 8 checksum according to CRC-8 CCITT, using bitwise calculation.

Parameters
  • data[in] Pointer to data to calculate the checksum for.

  • length[in] Length of the data in bytes.

  • polynomial[in] 8-bit CRC polynomial to be used.

  • start_remainder[in] Remainder to start CRC calculation with

  • endofdata[in] Indicates whether this is the end of larger datablock (TRUE) or not yet (FALSE)

Returns

uint8_t 8-bit CRC checksum.

uint8_t supervisor_calculate_CRC(const uint8_t *data, unsigned int length)

Calculates a CRC checksum according to the algorithm used in the iOBC supervisor.

Parameters
  • data[in] Pointer to data to calculate the checksum for.

  • length[in] Length of the data in bytes

Returns

uint8_t 8-bit CRC checksum.