4.16.1. Module Files
The CRC module uses the hardware of the MCU to compute the CRC of a data flow.
The CRC hardware is based on a 64 bit polynomial. The data is written
in 64 bit chunks to the registers
The data flow does not need to be aligned on 64 bit: if is is not the case,
the last chunks of data will be padded with zeros to reach a size of 64 bit.
The seed for the CRC computation is defined in
CRC_SEED_HIGH, low referring to the LSB and high
to the MSB.
CRC_CalculateCrc() takes three arguments:
uint64_t *pointer where the calculated 64 bit CRC is written
uint8_t *pointer to the data
the length in bytes of the data
This function is not re-entrant: as it uses hardware registers, it must only be called once before its execution has finished, otherwise the CRC computation will be wrong. Currently it is only used with the FRAM, which only makes one access at the same time, ensuring that the function is only called once. If the function is to be used elsewhere, this point must be taken into account.
An internal re-entrance counter is used. If the function was only called
once, it returns
STD_OK, otherwise it returns
STD_NOT_OK and the
CRC value is set to zero.