52static fsmState_t DetermineState(
void);
53static void RunDiagSwdtExpire(
void);
54static void ResetFsm(
void);
55static void AbortFsm(
void);
62 bool isIoUnsafe = (flag !=
NO_ERROR);
89 uint8_t errInjStateVal = (uint8_t)errInjState;
95 uint8_t reasonVal = (uint8_t)reason;
119 return errorInjectionReason;
124 fsmState_t state = DetermineState();
125 bool isDiagFailure =
false;
128 if (state == FSM_STATE_START)
135 isDiagFailure =
true;
136 state = FSM_STATE_CONTINUE;
140 if (state == FSM_STATE_CONTINUE)
149 isDiagFailure =
true;
150 state = FSM_STATE_COMPLETE;
154 if (state == FSM_STATE_COMPLETE)
161 if (state == FSM_STATE_CORRUPT)
174static fsmState_t DetermineState(
void)
182 fsmState_t state = (fsmState_t)errInjReason;
189 const bool stateCorrupted = ((errInjOngoing ==
false) && (state != FSM_STATE_START));
192 if (invalidReasonVal || flagsCorrupted || stateCorrupted)
194 state = FSM_STATE_CORRUPT;
201static void RunDiagSwdtExpire(
void)
204 bool isDiagFailure =
true;
208 isDiagFailure =
false;
215static void ResetFsm(
void)
218 const uint8_t fsmResetVal = (uint8_t)fsmReset;
228static void AbortFsm(
void)
231 const uint8_t fsmAbortedVal = (uint8_t)fsmAborted;
errFlag_t
Defines the error flag used by Middleware services to indicate error detection.
Defines type for storing the reason of a device reset caused by an error injection.
errInjectReset_t
Defines possible reasons for a device reset due to an error injection.
errFlag_t MW_DiagCpuLockstep(void)
Performs error injection diagnostic to detect faults in the CPU lockstep mechanism.
errFlag_t MW_CheckIoSafe(void)
Checks if all I/O pins are floated (tri-stated).
void MW_EnableForceFloat(void)
Enables forced floating (tri-stating) of all I/O pins.
void MW_StorePersistentVal(persistentVal_t valueType, uint8_t value)
Stores a value in General Purpose Registers (GPR) for perserving data between resets.
void MW_StorePersistentFlag(persistentFlag_t flagType, bool flag)
Stores two redundant boolean flags in General Purpose Registers (GPR) for perserving data between res...
bool MW_GetPersistentFlag(persistentFlag_t flagType)
Reads two redundant bits for each boolean flags in General Purpose Registers (GPR) that is stored for...
bool MW_IsPersistentFlagsCorrupt(void)
Compares two redundant bits for each boolean flags in General Purpose Registers (GPR) and checks if a...
uint8_t MW_GetPersistentVal(persistentVal_t valueType)
Reads a value in General Purpose Registers (GPR) that is stored for preserving data between resets.
void T_DetermineResetReason(void)
Determines the reason for the last device reset and stores it for later handling.
void T_RunResetDiagnosticFsm(void)
Implements an FSM for performing error injection diagnostics leading to device resets.
void T_EnsureSafeState(void)
Ensures the device is in a Safe State by making sure io pins are floated.
resetReason_t MW_GetClearResetReason(void)
Reads and clears the reset flag registers.
resetReason_t
Type defines for all possible reset sources.
#define STRICT_SAFE_STATE
Configures whether to use a strict Safe State to Mission Mode transition in TM_PreStartup and TM_Star...
#define PRE_STARTUP_SWDT_RESET_VAL
Configures the new SWDT reset value after performing the SWDT Expire diagnostic in T_RunResetDiagnost...
#define ENABLED
Used to enable optional Task features through macro configurations.
errFlag_t MW_DiagWdtExpire(void)
Performs error injection diagnostic to detect faults in the Watchdog Timer (WDT) Expire mechanism.
errFlag_t MW_DiagSwdtExpire(uint32_t newReset)
Performs error injection diagnostic to detect faults in the Synchronous Watchdog Timer (SWDT) Expire ...
Contains API prototypes for the Watchdog Manager diagnostics.