Dear Team
I refer the safety library 2.4 demo code.
in the sys_startup.c I have some problems
——————————————————————————————————————————————————————
else if (RESET_TYPE_CPU == resetReason)
{
SYS_EXCEPTION = CPU_RESET;
/* reset could be caused by stcSelfCheck run or by an actual CPU self-test run */
/* check if this was an stcSelfCheck run */
if ((stcREG->STCSCSCR & 0xFU) == 0xAU)
{
/* check if the self-test fail bit is set */
if ((stcREG->STCGSTAT & 0x3U) != 0x3U)
{
/* STC self-check has failed */
stcSelfCheckFail();
}
/* STC self-check has passed */
else
{
/* clear self-check mode */
stcREG->STCSCSCR = 0x05U;
/* clear STC global status flags */
stcREG->STCGSTAT = 0x3U;
/* clear ESM group1 channel 27 status flag */
esmREG->SR1[0U] = 0x08000000U;
/* Start CPU Self-Test */
cpuSelfTest(STC_INTERVAL, STC_MAX_TIMEOUT, TRUE);
}
}
/* CPU reset caused by CPU self-test completion */
else if ((stcREG->STCGSTAT & 0x1U) == 0x1U)
{
/* Self-Test Fail flag is set */
if ((stcREG->STCGSTAT & 0x2U) == 0x2U)
{
/* Call CPU self-test failure handler */
cpuSelfTestFail();
}
/* CPU self-test completed successfully */
else
{
/* clear STC global status flag */
stcREG->STCGSTAT = 0x1U;
/* Continue start-up sequence after CPU STC completed */
afterSTC();
}
}
/* CPU reset caused by software writing to CPU RESET bit */
else
{
/* Add custom routine here to handle the case where software causes CPU reset */
}
}
————————————————————————————————————————————————————
I think the cpu be able to enter here after the CPU self-test (“SL_Self_Test_STC”)reset.
if ((stcREG->STCSCSCR & 0xFU) == 0xAU)
what does this code means?Does it mean self-checking? What is the situation to enter here
and this code
cpuSelfTest(STC_INTERVAL, STC_MAX_TIMEOUT, TRUE);
What's the difference between SL_Self_Test_STC