RA Flexible Software Package Documentation  Release v5.5.0

 
CRC Interface

Detailed Description

Interface for cyclic redundancy checking.

Summary

The CRC (Cyclic Redundancy Check) calculator generates CRC codes using five different polynomials including 8 bit, 16 bit, and 32 bit variations. Calculation can be performed by sending data to the block using the CPU or by snooping on read or write activity on one of SCI channels.

Data Structures

struct  crc_input_t
 
struct  crc_cfg_t
 
struct  crc_api_t
 
struct  crc_instance_t
 

Typedefs

typedef void crc_ctrl_t
 

Enumerations

enum  crc_polynomial_t
 
enum  crc_bit_order_t
 
enum  crc_snoop_direction_t
 

Data Structure Documentation

◆ crc_input_t

struct crc_input_t

Structure for CRC inputs

Data Fields
uint32_t num_bytes Length of input buffer. It must be 4-byte aligned when a 32-bit CRC polynomial function is used.
uint32_t crc_seed CRC seed value.
const void * p_input_buffer Pointer to input buffer.

◆ crc_cfg_t

struct crc_cfg_t

User configuration structure, used in open function

Data Fields
uint8_t channel Channel number.
crc_polynomial_t polynomial CRC Generating Polynomial Switching (GPS)
crc_bit_order_t bit_order CRC Calculation Switching (LMS)
uint32_t snoop_address Register Snoop Address (CRCSA)
void const * p_extend CRC Hardware Dependent Configuration.

◆ crc_api_t

struct crc_api_t

CRC driver structure. General CRC functions implemented at the HAL layer will follow this API.

Data Fields

fsp_err_t(* open )(crc_ctrl_t *const p_ctrl, crc_cfg_t const *const p_cfg)
 
fsp_err_t(* close )(crc_ctrl_t *const p_ctrl)
 
fsp_err_t(* crcResultGet )(crc_ctrl_t *const p_ctrl, uint32_t *crc_result)
 
fsp_err_t(* snoopEnable )(crc_ctrl_t *const p_ctrl, uint32_t crc_seed)
 
fsp_err_t(* snoopDisable )(crc_ctrl_t *const p_ctrl)
 
fsp_err_t(* calculate )(crc_ctrl_t *const p_ctrl, crc_input_t *const p_crc_input, uint32_t *p_crc_result)
 

Field Documentation

◆ open

fsp_err_t(* crc_api_t::open) (crc_ctrl_t *const p_ctrl, crc_cfg_t const *const p_cfg)

Open the CRC driver module.

Parameters
[in]p_ctrlPointer to CRC device handle.
[in]p_cfgPointer to a configuration structure.

◆ close

fsp_err_t(* crc_api_t::close) (crc_ctrl_t *const p_ctrl)

Close the CRC module driver

Parameters
[in]p_ctrlPointer to CRC device handle
Return values
FSP_SUCCESSConfiguration was successful.

◆ crcResultGet

fsp_err_t(* crc_api_t::crcResultGet) (crc_ctrl_t *const p_ctrl, uint32_t *crc_result)

Return the current calculated value.

Parameters
[in]p_ctrlPointer to CRC device handle.
[out]crc_resultThe calculated value from the last CRC calculation.

◆ snoopEnable

fsp_err_t(* crc_api_t::snoopEnable) (crc_ctrl_t *const p_ctrl, uint32_t crc_seed)

Configure and Enable snooping.

Parameters
[in]p_ctrlPointer to CRC device handle.
[in]crc_seedCRC seed.

◆ snoopDisable

fsp_err_t(* crc_api_t::snoopDisable) (crc_ctrl_t *const p_ctrl)

Disable snooping.

Parameters
[in]p_ctrlPointer to CRC device handle.

◆ calculate

fsp_err_t(* crc_api_t::calculate) (crc_ctrl_t *const p_ctrl, crc_input_t *const p_crc_input, uint32_t *p_crc_result)

Perform a CRC calculation on a block of data.

Parameters
[in]p_ctrlPointer to CRC device handle.
[in]p_crc_inputA pointer to structure for CRC inputs
[out]crc_resultThe calculated value of the CRC calculation.

◆ crc_instance_t

struct crc_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
crc_ctrl_t * p_ctrl Pointer to the control structure for this instance.
crc_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
crc_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ crc_ctrl_t

typedef void crc_ctrl_t

CRC control block. Allocate an instance specific control block to pass into the CRC API calls.

Enumeration Type Documentation

◆ crc_polynomial_t

CRC Generating Polynomial Switching (GPS).

Enumerator
CRC_POLYNOMIAL_CRC_8 

8-bit CRC-8 (X^8 + X^2 + X + 1)

CRC_POLYNOMIAL_CRC_16 

16-bit CRC-16 (X^16 + X^15 + X^2 + 1)

CRC_POLYNOMIAL_CRC_CCITT 

16-bit CRC-CCITT (X^16 + X^12 + X^5 + 1)

CRC_POLYNOMIAL_CRC_32 

32-bit CRC-32 (X^32 + X^26 + X^23 + X^22 + X^16 + X^12 + X^11 + X^10 + X^8 + X^7 + X^5 + X^4 + X^2 + X + 1)

CRC_POLYNOMIAL_CRC_32C 

32-bit CRC-32C (X^32 + X^28 + X^27 + X^26 + X^25 + X^23 + X^22 + X^20 + X^19 + X^18 + X^14 + X^13 + X^11 + X^10 + X^9 + X^8 + X^6 + 1)

◆ crc_bit_order_t

CRC Calculation Switching (LMS)

Enumerator
CRC_BIT_ORDER_LMS_LSB 

Generates CRC for LSB first communication.

CRC_BIT_ORDER_LMS_MSB 

Generates CRC for MSB first communication.

◆ crc_snoop_direction_t

Snoop-On-Write/Read Switch (CRCSWR)

Enumerator
CRC_SNOOP_DIRECTION_RECEIVE 

Snoop-on-read.

CRC_SNOOP_DIRECTION_TRANSMIT 

Snoop-on-write.