CRC
7.2.1 Function Documentation
7.2.1.1 ROM_Crc16
Calculates the CRC-16 of an array of bytes.
Prototype:
uint16_t
ROM_Crc16(uint16_t ui16Crc,
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_Crc16 is a function pointer located at ROM_SOFTWARETABLE[3].
Parameters:
ui16Crc is the starting CRC-16 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-16 of the input buffer. The CRC-16 is computed in a
running fashion, meaning that the entire data block that is to have its CRC-16 computed does
not need to be supplied all at once. If the input buffer contains the entire block of data, then
ui16Crc should be set to 0. If, however, the entire block of data is not available, then ui16Crc
should be set to 0 for the first portion of the data, and then the returned value should be passed
back in as ui16Crc for the next portion of the data.
For example, to compute the CRC-16 of a block that has been split into three pieces, use the
following:
ui16Crc = ROM_Crc16(0, pui8Data1, ui32Len1);
ui16Crc = ROM_Crc16(ui16Crc, pui8Data2, ui32Len2);
ui16Crc = ROM_Crc16(ui16Crc, pui8Data3, ui32Len3);
Computing a CRC-16 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-16 of the input data.
7.2.1.2 ROM_Crc16Array
Calculates the CRC-16 of an array of words.
Prototype:
uint16_t
ROM_Crc16Array(uint32_t ui32WordLen,
uint32_t
*
pui32Data)
70 April 8, 2013