RA Flexible Software Package Documentation
Release v5.6.0
|
|
Functions | |
fsp_err_t | R_CRC_Open (crc_ctrl_t *const p_ctrl, crc_cfg_t const *const p_cfg) |
fsp_err_t | R_CRC_Close (crc_ctrl_t *const p_ctrl) |
fsp_err_t | R_CRC_Calculate (crc_ctrl_t *const p_ctrl, crc_input_t *const p_crc_input, uint32_t *calculatedValue) |
fsp_err_t | R_CRC_CalculatedValueGet (crc_ctrl_t *const p_ctrl, uint32_t *calculatedValue) |
fsp_err_t | R_CRC_SnoopEnable (crc_ctrl_t *const p_ctrl, uint32_t crc_seed) |
fsp_err_t | R_CRC_SnoopDisable (crc_ctrl_t *const p_ctrl) |
Driver for the CRC peripheral on RA MCUs. This module implements the CRC Interface.
The CRC module provides a API to calculate 8, 16 and 32-bit CRC values on a block of data in memory or a stream of data over a Serial Communication Interface (SCI) channel using industry-standard polynomials.
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Name must be a valid C symbol | g_crc0 | Module name. |
CRC Polynomial | MCU Specific Options | Select the CRC polynomial. | |
Bit Order | MCU Specific Options | Select the CRC bit order. | |
Snoop Address | MCU Specific Options | Select the SCI register address CRC snoop |
There is no clock configuration for the CRC module.
This module does not use I/O pins.
The CRC snoop function monitors reads from and writes to a specified I/O register address and performs CRC calculation on the data read from and written to the register address automatically. Instead of calling R_CRC_Calculate on a block of data, R_CRC_SnoopEnable is called to start monitoring reads/writes and R_CRC_CalculatedValueGet is used to obtain the current CRC.
When using CRC32 polynomial functions the CRC module produces the same results as popular online CRC32 calculators, but it is important to remember a few important points.
This is a basic example of minimal use of the CRC module in an application.
This example demonstrates CRC snoop operation.
Data Structures | |
struct | crc_instance_ctrl_t |
struct crc_instance_ctrl_t |
Driver instance control structure.
fsp_err_t R_CRC_Open | ( | crc_ctrl_t *const | p_ctrl, |
crc_cfg_t const *const | p_cfg | ||
) |
Open the CRC driver module
Implements crc_api_t::open
Open the CRC driver module and initialize the driver control block according to the passed-in configuration structure.
FSP_SUCCESS | Configuration was successful. |
FSP_ERR_ASSERTION | p_ctrl or p_cfg is NULL. |
FSP_ERR_ALREADY_OPEN | Module already open |
FSP_ERR_UNSUPPORTED | Hardware not support this feature. |
fsp_err_t R_CRC_Close | ( | crc_ctrl_t *const | p_ctrl | ) |
Close the CRC module driver.
Implements crc_api_t::close
FSP_SUCCESS | Configuration was successful. |
FSP_ERR_ASSERTION | p_ctrl is NULL. |
FSP_ERR_NOT_OPEN | The driver is not opened. |
fsp_err_t R_CRC_Calculate | ( | crc_ctrl_t *const | p_ctrl, |
crc_input_t *const | p_crc_input, | ||
uint32_t * | calculatedValue | ||
) |
Perform a CRC calculation on a block of 8-bit/32-bit (for 32-bit polynomial) data.
Implements crc_api_t::calculate
This function performs a CRC calculation on an array of 8-bit/32-bit (for 32-bit polynomial) values and returns an 8-bit/32-bit (for 32-bit polynomial) calculated value
FSP_SUCCESS | Calculation successful. |
FSP_ERR_ASSERTION | Either p_ctrl, inputBuffer, or calculatedValue is NULL. |
FSP_ERR_INVALID_ARGUMENT | length value is NULL, or not 4-byte aligned when 32-bit CRC polynomial function is configured. |
FSP_ERR_NOT_OPEN | The driver is not opened. |
fsp_err_t R_CRC_CalculatedValueGet | ( | crc_ctrl_t *const | p_ctrl, |
uint32_t * | calculatedValue | ||
) |
Return the current calculated value.
Implements crc_api_t::crcResultGet
CRC calculation operates on a running value. This function returns the current calculated value.
FSP_SUCCESS | Return of calculated value successful. |
FSP_ERR_ASSERTION | Either p_ctrl or calculatedValue is NULL. |
FSP_ERR_NOT_OPEN | The driver is not opened. |
fsp_err_t R_CRC_SnoopEnable | ( | crc_ctrl_t *const | p_ctrl, |
uint32_t | crc_seed | ||
) |
Configure the snoop channel and set the CRC seed.
Implements crc_api_t::snoopEnable
The CRC calculator can operate on reads and writes over any of the first ten SCI channels. For example, if set to channel 0, transmit, every byte written out SCI channel 0 is also sent to the CRC calculator as if the value was explicitly written directly to the CRC calculator.
FSP_SUCCESS | Snoop configured successfully. |
FSP_ERR_ASSERTION | Pointer to control stucture is NULL |
FSP_ERR_NOT_OPEN | The driver is not opened. |
FSP_ERR_UNSUPPORTED | SNOOP operation is not supported. |
fsp_err_t R_CRC_SnoopDisable | ( | crc_ctrl_t *const | p_ctrl | ) |
Disable snooping.
Implements crc_api_t::snoopDisable
FSP_SUCCESS | Snoop disabled. |
FSP_ERR_ASSERTION | p_ctrl is NULL. |
FSP_ERR_NOT_OPEN | The driver is not opened. |
FSP_ERR_UNSUPPORTED | SNOOP operation is not supported. |