2.7 Interfacing with the Library

The Diagnostic Library API is written in C language. The context under which functions can be called, are,

  • POST Diagnostic - Power On Self Test

    It is possible to scan for faults at power-on. POST testing allows the Integrator application to determine safe operation before application start.

    Usage Example:
    DIAG_TEST_STATUS status = DIAG_RTC_Enable();
  • On Demand Diagnostic - During runtime.

    On Demand functions allow the caller to break the flow of application to execute a diagnostic test. The structure has two forms:

    • Synchronous Call/Return. Allows the caller to receive an immediate feedback on a diagnostic. The result is: DIAG_TEST_PASSED or DIAG_TEST_FAILED.
    • Asynchronous Call/Return/Callback. Allows the caller to receive immediate return and then subsequent callback.
    Usage Example:
    EIC_CallbackRegister(my_EIC_InterruptCallback,(uintptr_t)NULL);
    DIAG_TEST_STATUS status = DIAG_EIC_Interrupts();
    Note: System Integrator should re-register the interrupt call back and re-enable the required interrupts after calling the DIAG_Interrupt API.
  • In Use Diagnostic

    Some faults may be discovered asynchronously with the use of internal hardware support. In-Use testing allows the System Integrator application to determine safe operation using callback notifications while the application is running. The caller establishes a callback routine and then calls an On Demand function to register the callback. In this case, the On Demand routine does not perform detection.

    Note: For this release, InUSE diagnostics are not implemented.
    Usage Example:
    // Call the routine to initiate diagnostic
    DIAG_TEST_STATUS result = DIAG_RTC_TimerComparison();