Synergy Software Package User's Manual

Driver for the CRC Calculator (CRC). More...

Data Structures

struct  crc_instance_ctrl_t
 

Functions

ssp_err_t R_CRC_Open (crc_ctrl_t *const p_api_ctrl, crc_cfg_t const *const p_cfg)
 Open the CRC driver module. More...
 
ssp_err_t R_CRC_Close (crc_ctrl_t *const p_api_ctrl)
 Close the CRC module driver. More...
 
ssp_err_t R_CRC_CalculatedValueGet (crc_ctrl_t *const p_api_ctrl, uint32_t *calculatedValue)
 Return the current calculated value. More...
 
ssp_err_t R_CRC_SnoopEnable (crc_ctrl_t *const p_api_ctrl, uint32_t crc_seed)
 Enable snooping. More...
 
ssp_err_t R_CRC_SnoopDisable (crc_ctrl_t *const p_api_ctrl)
 Disable snooping. More...
 
ssp_err_t R_CRC_SnoopCfg (crc_ctrl_t *const p_api_ctrl, crc_snoop_cfg_t *const p_snoop_cfg)
 Configure the snoop channel and direction. More...
 
ssp_err_t R_CRC_Calculate (crc_ctrl_t *const p_api_ctrl, void *inputBuffer, uint32_t length, uint32_t crc_seed, uint32_t *calculatedValue)
 Perform a CRC calculation on a block of 8-bit/32-bit(for 32-bit polynomial) data. More...
 
ssp_err_t R_CRC_VersionGet (ssp_version_t *const p_version)
 Get the driver version based on compile time macros. More...
 

Detailed Description

Driver for the CRC Calculator (CRC).

This module supports the CRC Calculator (CRC). It implements the following interface:

Function Documentation

◆ R_CRC_Calculate()

ssp_err_t R_CRC_Calculate ( crc_ctrl_t *const  p_api_ctrl,
void *  inputBuffer,
uint32_t  length,
uint32_t  crc_seed,
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

Return values
SSP_SUCCESSCalculation successful.
SSP_ERR_ASSERTIONEither p_ctrl, inputBuffer, or calculatedValue is NULL.
SSP_ERR_INVALID_ARGUMENTlength value is NULL.
SSP_ERR_NOT_OPENThe driver is not opened.
SSP_ERR_IN_USECRC peripheral is currently in use by another instance of the driver.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

Lock the peripheral during calculation

Set the bit order

Set CRC polynomial

Calculate CRC value for the input buffer

Release the hardware lock

◆ R_CRC_CalculatedValueGet()

ssp_err_t R_CRC_CalculatedValueGet ( crc_ctrl_t *const  p_api_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.

Return values
SSP_SUCCESSReturn of calculated value successful.
SSP_ERR_ASSERTIONEither p_ctrl or calculatedValue is NULL.
SSP_ERR_NOT_OPENThe driver is not opened.

Based on the selected polynomial, return the calculated CRC value

◆ R_CRC_Close()

ssp_err_t R_CRC_Close ( crc_ctrl_t *const  p_api_ctrl)

Close the CRC module driver.

Implements crc_api_t::close

Return values
SSP_SUCCESSConfiguration was successful.
SSP_ERR_ASSERTIONp_ctrl is NULL.
SSP_ERR_NOT_OPENThe driver is not opened.

Release the CRC Hardware Resource

Mark driver as closed

◆ R_CRC_Open()

ssp_err_t R_CRC_Open ( crc_ctrl_t *const  p_api_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.

Return values
SSP_SUCCESSConfiguration was successful.
SSP_ERR_ASSERTIONp_ctrl or p_cfg is NULL.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

Mark driver as initialized by setting the open value to the ASCII equivalent of "CRC"

Enable clocks to the CRC peripheral.

◆ R_CRC_SnoopCfg()

ssp_err_t R_CRC_SnoopCfg ( crc_ctrl_t *const  p_api_ctrl,
crc_snoop_cfg_t *const  p_snoop_cfg 
)

Configure the snoop channel and direction.

Implements crc_api_t::snoopCfg

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.

Return values
SSP_SUCCESSSnoop configured successfully.
SSP_ERR_ASSERTION- This is due to below conditions
  • Either p_ctrl or p_snoop_cfg is NULL
  • snoop_channel is greater than or equal to CRC_SNOOP_MAX_CHANNEL.
SSP_ERR_NOT_OPENThe driver is not opened.

Set the bit order

Set CRC polynomial

Set CRC snoop channel and direction

◆ R_CRC_SnoopDisable()

ssp_err_t R_CRC_SnoopDisable ( crc_ctrl_t *const  p_api_ctrl)

Disable snooping.

Implements crc_api_t::snoopDisable

Return values
SSP_SUCCESSSnoop disabled.
SSP_ERR_ASSERTIONp_ctrl is NULL.
SSP_ERR_NOT_OPENThe driver is not opened.

Disable the snoop operation

◆ R_CRC_SnoopEnable()

ssp_err_t R_CRC_SnoopEnable ( crc_ctrl_t *const  p_api_ctrl,
uint32_t  crc_seed 
)

Enable snooping.

Implements crc_api_t::snoopEnable

Return values
SSP_SUCCESSSnoop enabled.
SSP_ERR_ASSERTIONEither p_ctrl or crc_seed is NULL.
SSP_ERR_NOT_OPENThe driver is not opened.

Based on the selected polynomial, set the initial CRC seed value

Enable the snoop operation

◆ R_CRC_VersionGet()

ssp_err_t R_CRC_VersionGet ( ssp_version_t *const  p_version)

Get the driver version based on compile time macros.

Implements crc_api_t::versionGet

Return values
SSP_SUCCESSSuccessful close.
SSP_ERR_ASSERTIONp_version is NULL.