Cyclic Redundancy Check Function Documentation
Sys_Set_CRC_Config
void Sys_Set_CRC_Config(CRC_Type * crc, uint32_t config)
Location: crc.h:52
Parameters
Direction | Name | Description |
---|---|---|
in |
crc |
Pointer to the CRC instance |
in |
config |
CRC generator configuration; use CRC_[CCITT | 32], CRC_[BIG | LITTLE]_ENDIAN, CRC_BIT_ORDER_[STANDARD | NON_STANDARD], CRC_FINAL_REVERSE_[STANDARD | NON_STANDARD], and CRC_FINAL_XOR_[STANDARD | NON_STANDARD] |
Assumptions
Note that D_CRC supports only CRC_CCITT mode, hence no configuration is applied for this instance.
Example Code for Sys_Set_CRC_Config |
// Configure CRC block to CRC-32 (IEEE 802.3) algorithm, // using little endian and non-standard (opposite) bit order Sys_Set_CRC_Config(CRC, CRC_32 | CRC_LITTLE_ENDIAN | CRC_BIT_ORDER_NON_STANDARD); |
Sys_CRC_32InitValue
void Sys_CRC_32InitValue(CRC_Type * crc)
Location: crc.h:68
Parameters
Direction | Name | Description |
---|---|---|
in |
crc |
Pointer to the CRC instance |
Assumptions
Note that D_CRC supports only CRC_CCITT mode, hence no configuration is applied for this instance.
Example Code for Sys_CRC_32InitValue |
// Initialize the CRC block for CRC-32 Sys_CRC_32InitValue(CRC); |
Sys_CRC_CCITTInitValue
void Sys_CRC_CCITTInitValue(CRC_Type * crc)
Location: crc.h:83
Parameters
Direction | Name | Description |
---|---|---|
in |
crc |
Pointer to the CRC instance |
Assumptions
CRC is configured to work in CRC-CCITT mode.
Example Code for Sys_CRC_CCITTInitValue |
// Initialize the CRC block for CRC-CCITT Sys_CRC_CCITTInitValue(CRC); |
Sys_CRC_GetCurrentValue
uint32_t Sys_CRC_GetCurrentValue(const CRC_Type * crc)
Location: crc.h:95
Parameters
Direction | Name | Description |
---|---|---|
in |
crc |
Pointer to the CRC instance |
Return
Example Code for Sys_CRC_GetCurrentValue |
// Retrieve current value from the CRC block value = Sys_CRC_GetCurrentValue(CRC); |
Sys_CRC_GetFinalValue
uint32_t Sys_CRC_GetFinalValue(const CRC_Type * crc)
Location: crc.h:111
Parameters
Direction | Name | Description |
---|---|---|
in |
crc |
Pointer to the CRC instance |
Return
Assumptions
D_CRC only supports CRC-CCITT mode. Use Sys_CRC_GetCurrentValue instead. Returns initial value of CRC if D_CRC is passed or any other unknown instance.
Example Code for Sys_CRC_GetFinalValue |
// Retrieve final value from the CRC block Sys_CRC_GetFinalValue(CRC); |
Sys_CRC_Add
void Sys_CRC_Add(CRC_Type * crc, uint32_t data, uint32_t size)
Location: crc.h:138
Parameters
Direction | Name | Description |
---|---|---|
in |
crc |
Pointer to the CRC instance |
in |
data |
Data to add |
in |
size |
Size of data to add, 1, 8, 16, 24, 32 are valid. |
Example Code for Sys_CRC_Add |
// Add 8 bits of data to the current CRC block Sys_CRC_Add(CRC, 0xF1, 8); |