3.2.4 DIAG_BUSSES

The DIAG_BUSSES module is designed to verify the correct functionality of the Busses through a set of C function calls.

The DIAG_BUSSES software test API is mapped to the following safety mechanisms:

Table 3-5. 
FunctionDiagnostic MechanismUse CaseElapsed Time (μs)~
DIAG_BUSSES_Fault()EXCEPTION_HANDLERPOST3.18
#define MAGIC_HARD_FAULT_NUMBER1 0x12345678U
#define MAGIC_HARD_FAULT_NUMBER2 0x87654321U

Exception Handling

Busses diagnostic related exception code is added in stl_exception.c file.

Note: If System integrator is using their own exception handler, an exception handler needs to be registered in vector table.

The following code should be place in the handler:

    if(busfault == MAGIC_HARD_FAULT_NUMBER2)
    {
        busfault = MAGIC_HARD_FAULT_NUMBER1;

        NVIC_SystemReset();    /* do a software reset */
    }

Configuring the Diagnostic

DIAG_BUSSES does not require additional configuration.

Using the Diagnostic

#include "definitions.h" 

DIAG_TEST_STATUS DIAG_BUSSES_Example()
{   
    DIAG_TEST_STATUS ret_value = DIAG_TEST_NOT_EXECUTED;
                      
    ret_value = DIAG_TEST_FAILED;
    
    if (DIAG_TEST_PASSED == DIAG_BUSSES_Fault(DIAG_ADC0))
    {               
        ret_value = DIAG_TEST_PASSED;
    }
       
    return ret_value; 
}