Cyclic Redundancy Check#
Introduction#
The Cyclic Redundancy Check (CRC) in embedded systems identifies inadvertent data changes. It generates a checksum, which is applied to the data before transmission or storage. When data is received or retrieved, the CRC is recalculated and compared to the original checksum to confirm its integrity.
Configuration#
Configuring CRC typically involves several parameters like below:
Modify
SL_CRC_POLYNOMIAL
to set the desired polynomial value.Modify
SL_CRC_POLY_WIDTH
to set the desired polynomial width.
Usage#
The common CRC functions can be used after the CRC Structures are specified, passing an instance of sl_crc_params_t. The following functions will initiate and configure the CRC below, which is the flow for implementation.
sl_si91x_crc_set_gen_control
sl_si91x_crc_polynomial
sl_si91x_crc_polynomial_width
sl_si91x_crc_lfsr_init
sl_si91x_crc_use_swapped_init
sl_si91x_crc_set_data_width_type
sl_si91x_crc_set_fifo_thresholds
sl_si91x_crc_monitor_crc_calc
Typedefs#
Renamed CRC param structure.
Functions#
Enables the CRC peripheral.
Disable the CRC peripheral.
Macros#
Polynomial used for CRC calculation.
Width of the polynomial.
Initial LFSR value.
Width type of the CRC.
Width of the input data.
Number of bytes to be written to the CRC.
Almost empty threshold level.
Almost full threshold level.
Whether to swap the input data.
Whether to use uDMA for CRC calculation.
Whether to swap the LFSR value.
Typedef Documentation#
sl_crc_params_t#
typedef RSI_CRC_PARAMS_T sl_crc_params_t
Renamed CRC param structure.
49
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
Function Documentation#
sl_si91x_crc_set_gen_control#
sl_status_t sl_si91x_crc_set_gen_control (void )
N/A |
114
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_get_general_status#
sl_status_t sl_si91x_crc_get_general_status (uint32_t * reg_status)
N/A | reg_status |
126
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_polynomial#
sl_status_t sl_si91x_crc_polynomial (sl_crc_params_t * pCRCParams)
N/A | pCRCParams |
139
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_polynomial_width#
sl_status_t sl_si91x_crc_polynomial_width (sl_crc_params_t * pCRCParams, uint32_t * reg_status)
N/A | pCRCParams | |
N/A | reg_status |
155
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_lfsr_init#
sl_status_t sl_si91x_crc_lfsr_init (sl_crc_params_t * pCRCParams)
N/A | pCRCParams |
167
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_use_swapped_init#
sl_status_t sl_si91x_crc_use_swapped_init (sl_crc_params_t * pCRCParams, uint32_t * reg_status)
N/A | pCRCParams | |
N/A | reg_status |
180
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_set_data_width_type#
sl_status_t sl_si91x_crc_set_data_width_type (sl_crc_params_t * pCRCParams, uint32_t * oper_status)
N/A | pCRCParams | |
N/A | oper_status |
195
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_set_fifo_thresholds#
sl_status_t sl_si91x_crc_set_fifo_thresholds (sl_crc_params_t * pCRCParams, uint32_t * oper_status)
N/A | pCRCParams | |
N/A | oper_status |
208
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_write_data#
sl_status_t sl_si91x_crc_write_data (sl_crc_params_t * pCRCParams, uint32_t data, uint32_t * oper_status)
N/A | pCRCParams | |
N/A | data | |
N/A | oper_status |
224
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_monitor_crc_calc#
sl_status_t sl_si91x_crc_monitor_crc_calc (sl_crc_params_t * pCRCParams, uint32_t * crc)
N/A | pCRCParams | |
N/A | crc |
237
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_lfsr_dynamic_write#
sl_status_t sl_si91x_crc_lfsr_dynamic_write (sl_crc_params_t * pCRCParams)
N/A | pCRCParams |
248
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_reset_fifo#
sl_status_t sl_si91x_crc_reset_fifo (void )
N/A |
258
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_get_fifo_status#
sl_status_t sl_si91x_crc_get_fifo_status (uint32_t * reg_status)
N/A | reg_status |
268
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_enable#
sl_status_t sl_si91x_crc_enable (void )
Enables the CRC peripheral.
N/A |
This function enables the CRC peripheral by enabling its clock.
Returns
status 0 if successful, else error code as follow
SL_STATUS_OK (0x0000) - Success
SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.
279
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
sl_si91x_crc_disable#
sl_status_t sl_si91x_crc_disable (void )
Disable the CRC peripheral.
N/A |
This function Disables the CRC peripheral by disabling its clock.
Returns
status 0 if successful, else error code as follow
SL_STATUS_OK (0x0000) - Success
SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.
292
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
Macro Definition Documentation#
SL_CRC_POLYNOMIAL#
#define SL_CRC_POLYNOMIALValue:
0x04C11DB7
Polynomial used for CRC calculation.
54
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
SL_CRC_POLY_WIDTH#
#define SL_CRC_POLY_WIDTHValue:
31
Width of the polynomial.
59
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
SL_CRC_LFSR_VAL#
#define SL_CRC_LFSR_VALValue:
0x0000
Initial LFSR value.
64
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
SL_CRC_WIDTH_TYPE#
#define SL_CRC_WIDTH_TYPEValue:
0
Width type of the CRC.
69
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
SL_CRC_DIN_WIDTH#
#define SL_CRC_DIN_WIDTHValue:
31
Width of the input data.
74
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
SL_CRC_NUM_BYTES#
#define SL_CRC_NUM_BYTESValue:
3
Number of bytes to be written to the CRC.
79
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
SL_CRC_AEMPTY#
#define SL_CRC_AEMPTYValue:
6
Almost empty threshold level.
84
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
SL_CRC_AFULL#
#define SL_CRC_AFULLValue:
2
Almost full threshold level.
89
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
SL_CRC_SWAP_DIN#
#define SL_CRC_SWAP_DINValue:
0
Whether to swap the input data.
94
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
SL_CRC_USE_UDMA#
#define SL_CRC_USE_UDMAValue:
1
Whether to use uDMA for CRC calculation.
99
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h
SL_CRC_SWAP_LFSR#
#define SL_CRC_SWAP_LFSRValue:
1
Whether to swap the LFSR value.
104
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_crc.h