Module to interact with the Cyclic Redundancy Check 32 (CRC32) hardware accelerator with support for CRC16 signatures. More...
Macros | |
#define | CRC16_MODE 0x00 |
#define | CRC32_MODE 0x01 |
#define | CRC32_setSeedMultipleInstance(a, b, c) CRC32_setSeed(b,c) |
#define | CRC32_set8BitDataMultipleInstance(a, b, c) CRC32_set8BitData(b,c) |
#define | CRC32_set16BitDataMultipleInstance(a, b, c) CRC32_set16BitData(b,c) |
#define | CRC32_set32BitDataMultipleInstance(a, b) CRC32_set32BitData(b) |
#define | CRC32_set8BitDataReversedMultipleInstance(a, b, c) CRC32_set8BitDataReversed(b,c) |
#define | CRC32_set16BitDataReversedMultipleInstance(a, b, c) CRC32_set16BitDataReversed(b,c) |
#define | CRC32_set32BitDataReversedMultipleInstance(a, b) CRC32_set32BitDataReversed(b) |
#define | CRC32_getResultMultipleInstance(a, b) CRC32_getResult() |
#define | CRC32_getResultReversedMultipleInstance(a, b) CRC32_getResultReversed(b) |
Functions | |
void | CRC32_setSeed (uint32_t seed, uint_fast8_t crcType) |
void | CRC32_set8BitData (uint8_t dataIn, uint_fast8_t crcType) |
void | CRC32_set16BitData (uint16_t dataIn, uint_fast8_t crcType) |
void | CRC32_set32BitData (uint32_t dataIn) |
void | CRC32_set8BitDataReversed (uint8_t dataIn, uint_fast8_t crcType) |
void | CRC32_set16BitDataReversed (uint16_t dataIn, uint_fast8_t crcType) |
void | CRC32_set32BitDataReversed (uint32_t dataIn) |
uint32_t | CRC32_getResult (uint_fast8_t crcType) |
uint32_t | CRC32_getResultReversed (uint_fast8_t crcType) |
Module to interact with the Cyclic Redundancy Check 32 (CRC32) hardware accelerator with support for CRC16 signatures.
The CRC32 module offers no interrupts and is used only to generate CRC signatures to verify against pre-made CRC signatures (Checksums).
The CRC32 module provides the capability for both 32-bit and 16-bit calculations. As such, the DriverLib API provides functionality for the user to provide variable bit-length data for either 16-bit or 32-bit calculations.
In the following very simple code example, an array of data is fed into the CRC32 module and the 32-bit calculation is retrieved:
#define CRC16_MODE 0x00 |
#define CRC32_MODE 0x01 |
#define CRC32_setSeedMultipleInstance | ( | a, | |
b, | |||
c | |||
) | CRC32_setSeed(b,c) |
#define CRC32_set8BitDataMultipleInstance | ( | a, | |
b, | |||
c | |||
) | CRC32_set8BitData(b,c) |
#define CRC32_set16BitDataMultipleInstance | ( | a, | |
b, | |||
c | |||
) | CRC32_set16BitData(b,c) |
#define CRC32_set32BitDataMultipleInstance | ( | a, | |
b | |||
) | CRC32_set32BitData(b) |
#define CRC32_set8BitDataReversedMultipleInstance | ( | a, | |
b, | |||
c | |||
) | CRC32_set8BitDataReversed(b,c) |
#define CRC32_set16BitDataReversedMultipleInstance | ( | a, | |
b, | |||
c | |||
) | CRC32_set16BitDataReversed(b,c) |
#define CRC32_set32BitDataReversedMultipleInstance | ( | a, | |
b | |||
) | CRC32_set32BitDataReversed(b) |
#define CRC32_getResultMultipleInstance | ( | a, | |
b | |||
) | CRC32_getResult() |
#define CRC32_getResultReversedMultipleInstance | ( | a, | |
b | |||
) | CRC32_getResultReversed(b) |
void CRC32_setSeed | ( | uint32_t | seed, |
uint_fast8_t | crcType | ||
) |
Sets the seed for the CRC.
seed | is the seed for the CRC to start generating a signature from. Modified bits are CRC16INIRESL0 of CRC16INIRESL0 register. CRC32INIRESL0 of CRC32INIRESL0 register |
crcType | selects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE |
This function sets the seed for the CRC to begin generating a signature with the given seed and all passed data. Using this function resets the CRC32 signature.
References ASSERT, CRC16_MODE, and CRC32_MODE.
void CRC32_set8BitData | ( | uint8_t | dataIn, |
uint_fast8_t | crcType | ||
) |
Sets the 8 Bit data to add into the CRC module to generate a new signature.
dataIn | is the data to be added, through the CRC module, to the signature. Modified bits are CRC16DIB0 of CRC16DIB0 register. CRC32DIB0 of CRC32DIB0 register. |
crcType | selects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE |
This function sets the given data into the CRC module to generate the new signature from the current signature and new data. Bit 0 is treated as LSB.
References ASSERT, CRC16_MODE, CRC32_MODE, and HWREG8.
void CRC32_set16BitData | ( | uint16_t | dataIn, |
uint_fast8_t | crcType | ||
) |
Sets the 16 Bit data to add into the CRC module to generate a new signature.
dataIn | is the data to be added, through the CRC module, to the signature. Modified bits are CRC16DIW0 of CRC16DIW0 register. CRC32DIW0 of CRC32DIW0 register. |
crcType | selects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE |
This function sets the given data into the CRC module to generate the new signature from the current signature and new data. Bit 0 is treated as LSB
References ASSERT, CRC16_MODE, and CRC32_MODE.
void CRC32_set32BitData | ( | uint32_t | dataIn | ) |
Sets the 32 Bit data to add into the CRC module to generate a new signature. Available only for CRC32_MODE and not for CRC16_MODE
dataIn | is the data to be added, through the CRC module, to the signature. Modified bits are CRC32DIL0 of CRC32DIL0 register. |
This function sets the given data into the CRC module to generate the new signature from the current signature and new data. Bit 0 is treated as LSB
References HWREG16.
void CRC32_set8BitDataReversed | ( | uint8_t | dataIn, |
uint_fast8_t | crcType | ||
) |
Translates the data by reversing the bits in each 8 bit data and then sets this data to add into the CRC module to generate a new signature.
dataIn | is the data to be added, through the CRC module, to the signature. Modified bits are CRC16DIRBB0 of CRC16DIRBB0 register. CRC32DIRBB0 of CRC32DIRBB0 register. |
crcType | selects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE |
This function first reverses the bits in each byte of the data and then generates the new signature from the current signature and new translated data. Bit 0 is treated as MSB.
References ASSERT, CRC16_MODE, CRC32_MODE, and HWREG8.
void CRC32_set16BitDataReversed | ( | uint16_t | dataIn, |
uint_fast8_t | crcType | ||
) |
Translates the data by reversing the bits in each 16 bit data and then sets this data to add into the CRC module to generate a new signature.
dataIn | is the data to be added, through the CRC module, to the signature. Modified bits are CRC16DIRBW0 of CRC16DIRBW0 register. CRC32DIRBW0 of CRC32DIRBW0 register. |
crcType | selects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE |
This function first reverses the bits in each byte of the data and then generates the new signature from the current signature and new translated data. Bit 0 is treated as MSB.
References ASSERT, CRC16_MODE, and CRC32_MODE.
void CRC32_set32BitDataReversed | ( | uint32_t | dataIn | ) |
Translates the data by reversing the bits in each 32 Bit Data and then sets this data to add into the CRC module to generate a new signature. Available only for CRC32 mode and not for CRC16 mode
dataIn | is the data to be added, through the CRC module, to the signature. Modified bits are CRC32DIRBL0 of CRC32DIRBL0 register. |
This function first reverses the bits in each byte of the data and then generates the new signature from the current signature and new translated data. Bit 0 is treated as MSB.
References HWREG16.
uint32_t CRC32_getResult | ( | uint_fast8_t | crcType | ) |
Returns the value of CRC Signature Result.
crcType | selects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE |
This function returns the value of the signature result generated by the CRC. Bit 0 is treated as LSB.
References ASSERT, CRC16_MODE, and CRC32_MODE.
uint32_t CRC32_getResultReversed | ( | uint_fast8_t | crcType | ) |
Returns the bit-wise reversed format of the 32 bit Signature Result.
crcType | selects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE |
This function returns the bit-wise reversed format of the Signature Result. Bit 0 is treated as MSB.
References ASSERT, CRC16_MODE, and CRC32_MODE.