CRC32 Support

File: csp/csp_crc32.h

Description: CRC32 support.

Interface Functions

int csp_crc32_append(csp_packet_t *packet)
[source]

Append CRC32 checksum to packet

Parameters:
  • packet – CSP packet, must be valid.

Returns:

#CSP_ERR_NONE on success, otherwise an error code.

int csp_crc32_verify(csp_packet_t *packet)
[source]

Verify CRC32 checksum on packet.

Parameters:
  • packet – CSP packet, must be valid.

Returns:

#CSP_ERR_NONE on success, otherwise an error code.

uint32_t csp_crc32_memory(const void *addr, uint32_t length)
[source]

Calculate checksum for a given memory area.

Parameters:
  • addr – memory address

  • length – length of memory to do checksum on

Returns:

checksum

void csp_crc32_init(csp_crc32_t *crc)
[source]

Initialize the CRC32 object prior to calculating checksum.

Parameters:
  • crc – CRC32 object previously created by the caller

void csp_crc32_update(csp_crc32_t *crc, const void *data, uint32_t length)
[source]

Update the CRC32 calculation with a chunk of data

Parameters:
  • crc – CRC32 object previously created, and init’ed by the caller

  • data – pointer to data for which to update checksum on

  • length – number of bytes in the array pointed to by data

uint32_t csp_crc32_final(csp_crc32_t *crc)
[source]

Finalize the CRC32 checksum calculation.

Parameters:
  • crc – CRC32 object previously created, init’ed and updated by the caller

Returns:

checksum