4.10. MCRC : Cyclic Redundancy Check¶
4.10.1. Introduction¶
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.
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
MCU_NAVSS_MCRC0 and NAVSS_MCRC0 are supported for J721E.
4.10.2. Example Usage¶
The following shows an example of SDL MCRC API usage by the application for Full CPU mode.
Initialize an MCRC instance and channel
result = SDL_MCRC_init(MCRC_MCU_NAVSS, SDL_MCRC_CHANNEL_1, MCRC_DEF_WATCHDOG_PRELOAD, MCRC_DEF_BLOCK_PRELOAD);
Reset and configure the MCRC channel
result = SDL_MCRC_channelReset(MCRC_MCU_NAVSS, SDL_MCRC_CHANNEL_1); SDL_MCRC_config(MCRC_MCU_NAVSS, SDL_MCRC_CHANNEL_1, MCRC_DEF_PATTERN_COUNT, MCRC_DEF_SECTOR_COUNT, SDL_MCRC_OPERATION_MODE_FULLCPU);
Verify the configuration:
result = SDL_MCRC_verifyConfig(MCRC_MCU_NAVSS, SDL_MCRC_CHANNEL_1, MCRC_DEF_PATTERN_COUNT, MCRC_DEF_SECTOR_COUNT, SDL_MCRC_OPERATION_MODE_FULLCPU); if (result == SDL_PASS) { UART_printf("\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(MCRC_MCU_NAVSS, SDL_MCRC_CHANNEL_1, &mcrcData, §SignVal);
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; }
4.10.3. Examples¶
Test apps that are meant for verifying the functionality of the module are also provided.
Test App Name |
Description |
Location |
Build Command |
---|---|---|---|
mcrc_test_app |
|
[sdl_install_dir]/test/mcrc/mcrcFuncTest |
make mcrc_test_app PROFILE=release |