3.2.21 DIAG_RSTC
The DIAG_RSTC module is designed to verify the correct functionality of the Reset Controller (RSTC) through a set of C function calls.
The DIAG_RSTC software test API is mapped to the following safety mechanisms:
| Function | Diagnostic Mechanism | Use Case | Elapsed Time (μs)~ |
|---|---|---|---|
| DIAG_RSTC_Functional() | RSTC_FUNCTIONAL | POST | 7535 |
#define RSTC_LOOP_MAX 0x10000
typedef enum {
DIAG_RSTC_STATE_0,
DIAG_RSTC_STATE_1,
DIAG_RSTC_STATE_2,
DIAG_RSTC_STATE_3,
} DIAG_RSTC_STATES;
Configuring the Diagnostic
DIAG_RSTC does not require additional configuration.
Using the Diagnostic
The DIAG_RSTC_Functional API implements an internal state machine. Therefore it must be initialized with the following lines below, followed by a software reset and a state change in the controlling software.
Example reset logic:
rstc_state = DIAG_RSTC_STATE_0;
reset_state = RESET_STATE_RSTC;
NVIC_SystemReset(); // do a software reset
case RESET_STATE_RSTC:
{
// do RSTC tests here
#include "definitions.h"
DIAG_TEST_STATUS DIAG_RSTC_Post( void )
{
DIAG_TEST_STATUS result;
result = DIAG_RSTC_Functional();
if( result == DIAG_TEST_PASSED )
{
result = DIAG_POR_Status();
if( result == DIAG_TEST_FAILED )
{
result = DIAG_TEST_PASSED;
}
else if( result == DIAG_TEST_PASSED )
{
result = DIAG_TEST_FAILED;
}
// else return result
}
return result;
}
