AM263Px MCU+ SDK: MCRC

| AM263Px MCU+ SDK 26.00.00 |

MCRC

MCRC module is used to perform CRC (Cyclic Redundancy check) to verify integrity of a memory system. The MCRC controller is used to calculate the signature for a set of data and then compare the calculated signature value against a predetermined good signature value. MCRC controller provides four channels to perform CRC calculation on multiple memories.

# Features Supported

Each MCRC instance supports 4 channels. Each channel can be configured to operate in one of 3 modes

- Auto Mode: In this mode, the MCRC controller, in conjunction with DMA controller, can perform CRC totally without CPU intervention.
- Full Mode: In this mode, the CPU does the data patterns transfer and signature verification all by itself. CPU performs data patterns transfer by reading data from the memory system to the PSA signature register.
- Semi Mode: In this mode, DMA controller is used to perform data patterns transfer and signature verification.

Timeout is configured to generate timeout interrupt to ensure that the memory system is examined with predefined time frame and no loss of incoming data. A 24-bit counter per CRC channel is configured.

The module supports below API's for the application

- API to support and configure Full, Semi, and Auto MCRC mode
- API to support readback of static registers
- API to support readback of written configuration
- API to support interrupt configuration

# SysConfig Features

- None

# Features NOT Supported

- No DMA mode examples for M4

# Important Usage Guidelines

- None

# Example Usage

The following shows an example of SDL MCRC API usage by the application for Full CPU mode.

Include the below file to access the APIs

#include <sdl/sdl_mcrc.h>

Initialize an MCRC instance and channel

SDL_MCRC_InstType instance = MCRC0;

Initialize additional configuration parameters.

static SDL_MCRC_Config_t SDL_MCRC_Config[4] =
{
{
SDL_MCRC_CTRL0_CH1_CRC_SEL_64BIT,
SDL_MCRC_DATALENGTH_32BIT,
SDL_MCRC_DATA_32_BIT,
SDL_MCRC_BITSWAP_MSB,
SDL_MCRC_BYTESWAP_ENABLE
},
{
SDL_MCRC_CTRL0_CH1_CRC_SEL_64BIT,
SDL_MCRC_DATALENGTH_32BIT,
SDL_MCRC_DATA_32_BIT,
SDL_MCRC_BITSWAP_MSB,
SDL_MCRC_BYTESWAP_ENABLE
},
{
SDL_MCRC_CTRL0_CH1_CRC_SEL_64BIT,
SDL_MCRC_DATALENGTH_32BIT,
SDL_MCRC_DATA_32_BIT,
SDL_MCRC_BITSWAP_MSB,
SDL_MCRC_BYTESWAP_ENABLE
},
{
SDL_MCRC_CTRL0_CH1_CRC_SEL_64BIT,
SDL_MCRC_DATALENGTH_32BIT,
SDL_MCRC_DATA_32_BIT,
SDL_MCRC_BITSWAP_MSB,
SDL_MCRC_BYTESWAP_ENABLE
},
};
result = SDL_MCRC_init(instance, SDL_MCRC_CHANNEL_1, MCRC_DEF_WATCHDOG_PRELOAD, MCRC_DEF_BLOCK_PRELOAD);

Reset and configure the MCRC channel

result = SDL_MCRC_channelReset(instance, SDL_MCRC_CHANNEL_1);
SDL_MCRC_config(instance, SDL_MCRC_CHANNEL_1, MCRC_DEF_PATTERN_COUNT, MCRC_DEF_SECTOR_COUNT, SDL_MCRC_OPERATION_MODE_FULLCPU);
SDL_MCRC_addconfig(instance, SDL_MCRC_CHANNEL_1,&SDL_MCRC_Config[0]);

Verify the configuration

result = SDL_MCRC_verifyConfig(instance, SDL_MCRC_CHANNEL_1, MCRC_DEF_PATTERN_COUNT, MCRC_DEF_SECTOR_COUNT, SDL_MCRC_OPERATION_MODE_FULLCPU);
if (result == SDL_PASS)
{
DebugP_log("\n Configurationn verified");
}

Compute the signature

SDL_MCRC_dataConfig_t mcrcData;
SDL_MCRC_Signature_t sectSignVal;
mcrcData.pMCRCData = (uint32_t *)testParams[testCase].sourceMemory;
mcrcData.size = testParams[testCase].dataSize;
mcrcData.dataBitSize = SDL_MCRC_DATA_32_BIT;
/* Pass the data to MCRC and get the signature */
result = SDL_MCRC_computeSignCPUmode(instance, SDL_MCRC_CHANNEL_1, &mcrcData, &sectSignVal);

Check the calculated signature

/*
* Check if the generated MCRC signature value
* matches with the reference signaure vaule
*/
if ((sectSignVal.regH == testParams[testCase].mcrcSignHigh) &&
(sectSignVal.regL == testParams[testCase].mcrcSignLow))
{
result = SDL_PASS;
}
else {
result = SDL_EFAIL;
}

# API

APIs for SDL MCRC

SDL_MCRC_channelReset
int32_t SDL_MCRC_channelReset(SDL_MCRC_InstType instance, SDL_MCRC_Channel_t channel)
This API is used to reset the MCRC channel.
SDL_MCRC_config
int32_t SDL_MCRC_config(SDL_MCRC_InstType instance, SDL_MCRC_Channel_t channel, uint32_t patternCount, uint32_t sectorCount, SDL_MCRC_ModeType mode)
This API will configure MCRC mode, pattern and sector count for given channel.
SDL_MCRC_InstType
SDL_MCRC_InstType
MCRC Instance supported.
Definition: sdl_mcrc_soc.h:61
MCRC0
@ MCRC0
Definition: sdl_mcrc_soc.h:62
SDL_MCRC_Config_t
CRC Configuration.
Definition: mcrc/v0/sdl_mcrc.h:270
sdl_mcrc.h
SDL_MCRC_DATA_32_BIT
@ SDL_MCRC_DATA_32_BIT
Definition: mcrc/v0/sdl_mcrc.h:204
SDL_MCRC_BYTESWAP_ENABLE
#define SDL_MCRC_BYTESWAP_ENABLE
Definition: mcrc/v0/sdl_mcrc.h:258
SDL_MCRC_CHANNEL_1
#define SDL_MCRC_CHANNEL_1
Definition: mcrc/v0/sdl_mcrc.h:159
SDL_MCRC_init
int32_t SDL_MCRC_init(SDL_MCRC_InstType instance, SDL_MCRC_Channel_t channel, uint32_t watchdogPreload, uint32_t blockPreload)
Initialize MCRC channel and will configure watchdog and block preload value for given channel.
DebugP_log
#define DebugP_log(format,...)
Function to log a string to the enabled console.
Definition: DebugP.h:235
SDL_MCRC_Signature_t::regH
uint32_t regH
Definition: mcrc/v0/sdl_mcrc.h:290
SDL_MCRC_OPERATION_MODE_FULLCPU
#define SDL_MCRC_OPERATION_MODE_FULLCPU
Definition: mcrc/v0/sdl_mcrc.h:145
SDL_MCRC_DATALENGTH_32BIT
#define SDL_MCRC_DATALENGTH_32BIT
Definition: mcrc/v0/sdl_mcrc.h:224
SDL_MCRC_computeSignCPUmode
int32_t SDL_MCRC_computeSignCPUmode(SDL_MCRC_InstType instance, SDL_MCRC_Channel_t channel, const SDL_MCRC_DataConfig_t *pDataConfig, SDL_MCRC_Signature_t *sectSignVal)
This API is used to compute the signature for CPU-only mode and it check if the generated MCRC signat...
SDL_MCRC_Signature_t
Structure for accessing MCRC register data which are 64 bit wide.
Definition: mcrc/v0/sdl_mcrc.h:287
SDL_MCRC_verifyConfig
int32_t SDL_MCRC_verifyConfig(SDL_MCRC_InstType instance, SDL_MCRC_Channel_t channel, uint32_t patternCount, uint32_t sectorCount, SDL_MCRC_ModeType mode)
This API will verify the configure of MCRC mode, pattern and sector count for given channel.
SDL_MCRC_BITSWAP_MSB
#define SDL_MCRC_BITSWAP_MSB
Definition: mcrc/v0/sdl_mcrc.h:240
SDL_MCRC_Signature_t::regL
uint32_t regL
Definition: mcrc/v0/sdl_mcrc.h:288