See Quick Start Guide for CRC-32.
This service enables the user to calculate 32-bit CRC using the polynomial defined in the IEEE 802.3 standard, with support for multiple data blocks of arbitrary sizes, and any alignment in memory.
Modules | |
Quick Start Guide(s) | |
In this section you can find a list of all Quick Start guides related to the CRC-32 calculation service. | |
Typedefs | |
typedef uint32_t | crc32_t |
Type to contain 32-bit CRC. More... | |
Functions | |
static enum status_code | crc32_calculate (const void *data, size_t length, crc32_t *crc) |
Calculate 32-bit CRC for initial block. More... | |
enum status_code | crc32_recalculate (const void *data, size_t length, crc32_t *crc) |
Recalculate 32-bit CRC for another block. More... | |
typedef uint32_t crc32_t |
Type to contain 32-bit CRC.
|
inlinestatic |
Calculate 32-bit CRC for initial block.
This function calculates the CRC for the specified data block, which may be first of an arbitrary number of blocks.
The actual calculation is done in crc32_recalculate(), while this function just sets up the initial CRC value.
[in] | data | Address of data. |
[in] | length | Length of data. |
[out] | crc | Address of variable to store the calculated CRC in. |
STATUS_OK | if calculation succeeded. |
<other> | if calculation failed somehow. |
References crc32_recalculate().
enum status_code crc32_recalculate | ( | const void * | data, |
size_t | length, | ||
crc32_t * | crc | ||
) |
Recalculate 32-bit CRC for another block.
This function recalculates the CRC according to the polynomial CRC32_POLYNOMIAL for the specified data block and initial CRC value.
To reduce the number of databus accesses and thus speed up the calculation, the algorithm is tuned to work with words as much as possible.
[in] | data | Address of data. |
[in] | length | Length of data. |
[in,out] | crc | Address of variable containing current CRC, and to store recalculated CRC in. |
STATUS_OK | if calculation succeeded. |
<other> | if calculation failed or could not be started. |
References _crc32_recalculate_bytes_helper(), COMPLEMENT_CRC, length, STATUS_OK, WORD_ALIGNMENT_MASK, and WORD_SIZE.
Referenced by crc32_calculate().