3.2.22 DIAG_RTC
The DIAG_RTC module is designed to verify the correct functionality of the Watchdog (RTC) through a set of C function calls.
Note: RTC routine will initialize the main clock to be 48 MHz. The
user would need to call DIAG_OSCCTRL_Initialize to restore the clock.
The DIAG_RTC software test API is mapped to the following safety mechanisms:
| Function | Diagnostic Mechanism | Use Case | Elasped Timer (μs) ~ |
|---|---|---|---|
| DIAG_RTC_Disable() | RTC_DISABLE | POST / OnDemand | 28.25 |
| DIAG_RTC_Enable() | RTC_ENABLE | POST / OnDemand | 21.10 |
| DIAG_RTC_Interrupts() | RTC_INTERRUPTS | POST | 1081.75 |
| DIAG_RTC_SFRReset() | SFR_RESET_STATE | POST | 36.75 |
| DIAG_RTC_SFRWriteRead() | SFR_WRITE_READ | POST / OnDemand | 28.25 |
| DIAG_RTC_TimerComparison() | RTC_TIMER_COMPARISON | POST / OnDemand | 73.08 |
#define RTC_LOOP_MAX 100UConfiguring the Diagnostic
DIAG_RTC does not require additional configuration.
Run-time Pre-requisites
DIAG_RTC_SFRRead should be executed before DIAG_RTC_SFRWriteRead
Using the Diagnostic
#include "definitions.h"
DIAG_TEST_STATUS DIAG_RTC_SFRPost()
{
DIAG_TEST_STATUS result[NO_OF_RTC_SFRPOST_TESTS];
DIAG_TEST_STATUS test_status = DIAG_TEST_FAILED;
int i;
result[0] = DIAG_RTC_SFRReset(NULL,0,false);
result[1] = DIAG_RTC_SFRWriteRead(NULL,0,false);
// DO ADDITIONAL POST TESTS HERE
for(i=0; i < NO_OF_RTC_SFRPOST_TESTS; i++)
{
if (result[i] != DIAG_TEST_PASSED)
{
test_status = result[i];
break;
}
else
{
test_status = DIAG_TEST_PASSED;
}
}
return test_status;
}
DIAG_TEST_STATUS DIAG_RTC_Post()
{
DIAG_TEST_STATUS result[NO_OF_RTC_POST_TESTS];
DIAG_TEST_STATUS test_status = DIAG_TEST_FAILED;
int i;
result[0] = DIAG_RTC_Enable();
result[1] = DIAG_RTC_Disable();
result[2] = DIAG_RTC_TimerComparison();
result[3] = DIAG_RTC_Interrupts();
// DO ADDITIONAL POST TESTS HERE
for(i=0; i < NO_OF_RTC_POST_TESTS; i++)
{
if (result[i] != DIAG_TEST_PASSED)
{
test_status = result[i];
break;
}
else
{
test_status = DIAG_TEST_PASSED;
}
}
return test_status;
}
