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: 8-bit CRC polynomial to be used
  • LUT: 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.

Return
uint8_t 8-bit CRC checksum.
Parameters
  • data: Pointer to data to calculate the checksum for.
  • length: Length of the data in bytes.
  • LUT: Pointer to LUT to use for CRC calculations, prepared using checksum_prepareLUTCRC8()
  • start_remainder: Remainder to start CRC calculation with
  • endofdata: Indicates whether this is the end of larger datablock (TRUE) or not yet (FALSE)

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.

Return
uint8_t 8-bit CRC checksum.
Parameters
  • data: Pointer to data to calculate the checksum for.
  • length: Length of the data in bytes.
  • polynomial: 8-bit CRC polynomial to be used.
  • start_remainder: Remainder to start CRC calculation with
  • endofdata: Indicates whether this is the end of larger datablock (TRUE) or not yet (FALSE)

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.

Return
uint8_t 8-bit CRC checksum.
Parameters
  • data: Pointer to data to calculate the checksum for.
  • length: Length of the data in bytes