CRC
Prototype:
uint8_t
ROM_Crc8CCITT(uint8_t ui8Crc,
const uint8_t
*
pui8Data,
uint32_t ui32Count)
ROM Location:
ROM_APITABLE is an array of pointers located at 0x0100.0010.
ROM_SOFTWARETABLE is an array of pointers located at ROM_APITABLE[21].
ROM_Crc8CCITT is a function pointer located at ROM_SOFTWARETABLE[4].
Parameters:
ui8Crc is the starting CRC-8-CCITT value.
pui8Data is a pointer to the data buffer.
ui32Count is the number of bytes in the data buffer.
Description:
This function is used to calculate the CRC-8-CCITT of the input buffer. The CRC-8-CCITT is
computed in a running fashion, meaning that the entire data block that is to have its CRC-8-
CCITT computed does not need to be supplied all at once. If the input buffer contains the
entire block of data, then ui8Crc should be set to 0. If, however, the entire block of data is not
available, then ui8Crc should be set to 0 for the first portion of the data, and then the returned
value should be passed back in as ui8Crc for the next portion of the data.
For example, to compute the CRC-8-CCITT of a block that has been split into three pieces, use
the following:
ui8Crc = ROM_Crc8CCITT(0, pui8Data1, ui32Len1);
ui8Crc = ROM_Crc8CCITT(ui8Crc, pui8Data2, ui32Len2);
ui8Crc = ROM_Crc8CCITT(ui8Crc, pui8Data3, ui32Len3);
Computing a CRC-8-CCITT in a running fashion is useful in cases where the data is arriving
via a serial link (for example) and is therefore not all available at one time.
Returns:
The CRC-8-CCITT of the input data.
72 April 8, 2013