![]() |
FuSa 8-Bit Libraries Safety Framework
|
Contains API prototypes for the Watchdog Manager. More...
Files | |
| file | midware_watchdog_manager.c |
| Implements APIs for the Watchdog Manager. | |
| file | midware_watchdog_manager_asm.h |
| Contains assembly API for the Watchdog Manager. | |
| file | midware_watchdog_manager_diag.c |
| Implements APIs for the Watchdog Manager diagnostics. | |
| file | midware_watchdog_manager_diag.h |
| Contains API prototypes for the Watchdog Manager diagnostics. | |
Macros | |
| #define | UINT24_MAX 0x00FFFFFFUL |
| Defines max value for 24-bit registers. | |
| #define | UINT24_MAX 0x00FFFFFFUL |
| Defines max value for 24-bit registers. | |
Enumerations | |
| enum | wdtTimeout_t { WDT_TIMEOUT_OFF = 0U , WDT_TIMEOUT_CLK8 , WDT_TIMEOUT_CLK16 , WDT_TIMEOUT_CLK32 , WDT_TIMEOUT_CLK64 , WDT_TIMEOUT_CLK128 , WDT_TIMEOUT_CLK256 , WDT_TIMEOUT_CLK512 , WDT_TIMEOUT_CLK1K , WDT_TIMEOUT_CLK2K , WDT_TIMEOUT_CLK4K , WDT_TIMEOUT_CLK8K , WDT_TIMEOUT_MAX } |
| Defines available timeout configurations for the Watchdog Timer. More... | |
Functions | |
| errFlag_t | MW_GetSwdtPreclearError (void) |
| Reads the error flag indicating a non-preclear command received while expecting a preclear command in the Synchronous Watchdog. | |
| errFlag_t | MW_GetSwdtClearError (void) |
| Reads the error flag indicating a non-clear command received while expecting a clear command in the Synchronous Watchdog. | |
| errFlag_t | MW_GetSwdtUnexpectedCmdError (void) |
| Reads the error flag indicating a clear command received in the closed window after a preclear command in the Synchronous Watchdog. | |
| errFlag_t | MW_GetSwdtCounterExpiredError (void) |
| Reads the error flag indicating that the Synchronous Watchdog counter expired. | |
| void | MW_ClearSwdtErrors (void) |
| Clears all the error flags in the Synchronous Watchdog. | |
| void | MW_PreClearSwdt (void) |
| Sends a PRECLEAR command to the Synchronous Watchdog. | |
| void | MW_ClearSwdt (void) |
| Sends a CLEAR command to the Synchronous Watchdog. | |
| errFlag_t | MW_SetSwdtResetValue (uint32_t resetVal) |
| Sets the Synchronous Watchdog Timer countdown reset value. | |
| errFlag_t | MW_SetSwdtWindowValue (uint16_t window) |
| Sets the Synchronous Watchdog Timer open window value. | |
| void | MW_EnableSwdtInterrupts (void) |
| Enables all Synchronous Watchdog error interrupts. | |
| void | MW_EnableSwdt (bool useCcp, bool useLock, bool useInstrMode) |
| Enables the Synchronous Watchdog Timer with the provided configurations. | |
| void | MW_ClearWdt (void) |
| Clears the Watchdog Timer by issuing a Watchdog Reset (WDR) instruction. | |
| errFlag_t | MW_SetWdtTimeout (wdtTimeout_t window, wdtTimeout_t period) |
| Configures and enables the Watchdog Timer in either Normal or Window mode. | |
| void | ASM_IssueWdrInstruction (void) |
| Issues a Watchdog Reset instruction (WDR) to clear the WDT using assembly. | |
| errFlag_t | MW_DiagSwdtCount (void) |
| Performs diagnostic to detect faults in the Synchronous Watchdog Timer (SWDT) Counter mechanism. | |
| errFlag_t | MW_DiagSwdtExpire (uint32_t newReset) |
| Performs error injection diagnostic to detect faults in the Synchronous Watchdog Timer (SWDT) Expire mechanism. | |
| void | MW_DiagWdtCountBegin (void) |
| Begins diagnostic to detect faults in the Watchdog Timer (WDT) Counter mechanism. | |
| bool | MW_IsDiagWdtCountOngoing (void) |
| Checks whether the Watchdog Timer (WDT) Count diagnostic is ongoing. | |
| errFlag_t | MW_DiagWdtCountEnd (void) |
| Completes diagnostic to detect faults in the Watchdog Timer (WDT) Counter mechanism. | |
| errFlag_t | MW_DiagWdtExpire (void) |
| Performs error injection diagnostic to detect faults in the Watchdog Timer (WDT) Expire mechanism. | |
Contains API prototypes for the Watchdog Manager.
The Watchdog Manager provides services to Tasks to ensure correct interaction with features of the WDT and SWDT peripherals.
| enum wdtTimeout_t |
Defines available timeout configurations for the Watchdog Timer.
Definition at line 43 of file midware_watchdog_manager.h.
| void MW_ClearSwdt | ( | void | ) |
Sends a CLEAR command to the Synchronous Watchdog.
Definition at line 119 of file midware_watchdog_manager.c.
| void MW_ClearSwdtErrors | ( | void | ) |
Clears all the error flags in the Synchronous Watchdog.
This function clears all Synchronous Watchdog interrupt flags. Use MW_GetSwdtPreclearError, MW_GetSwdtClearError, MW_GetSwdtUnexpectedCmdError and MW_GetSwdtCounterExpiredError to read the error flags before they are cleared simultaneously in this function.
Definition at line 104 of file midware_watchdog_manager.c.
| errFlag_t MW_DiagSwdtCount | ( | void | ) |
Performs diagnostic to detect faults in the Synchronous Watchdog Timer (SWDT) Counter mechanism.
This function reads and compares two samples of the SWDT counter. If the sampled counter values are different, the counter is counting and the diagnostic returns no error.
| ERROR | Fault detected in SWDT count functionality. |
| NO_ERROR | No fault detected in SWDT count functionality. |
Definition at line 57 of file midware_watchdog_manager_diag.c.
| errFlag_t MW_DiagSwdtExpire | ( | uint32_t | newReset | ) |
Performs error injection diagnostic to detect faults in the Synchronous Watchdog Timer (SWDT) Expire mechanism.
This function performs a diagnostic of the SWDT Expire mechanism by starting an error injection and observing the response. The error injection makes the countdown skip to zero, which normally triggers the expire error mechanism. If an expire error is reported, the diagnostic returns no error.
| newReset | The 24-bit reset value to be loaded after completing the error injection. |
| ERROR | Fault detected in the SWDT expire mechanism, or error injection did not start. |
| NO_ERROR | No fault detected in the SWDT expire mechanism. |
Definition at line 78 of file midware_watchdog_manager_diag.c.
| void MW_DiagWdtCountBegin | ( | void | ) |
Begins diagnostic to detect faults in the Watchdog Timer (WDT) Counter mechanism.
This function reads and stores the current counter register value of the WDT for later comparison. If the counter register value has not changed when calling MW_DiagWdtCountEnd(), the diagnostic will report an error. After calling this function, MW_IsDiagWdtCountOngoing will return true until MW_DiagWdtCountEnd() is called.
Definition at line 124 of file midware_watchdog_manager_diag.c.
| errFlag_t MW_DiagWdtCountEnd | ( | void | ) |
Completes diagnostic to detect faults in the Watchdog Timer (WDT) Counter mechanism.
This function reads and stores the current counter register value of the WDT and compares it to the previous sample stored when calling MW_DiagWdtCountBegin. If the two samples are identical, it indicates that the WDT counter is stuck and the diagnostic returns an error. If the diagnostic was not started by calling MW_DiagWdtCountBegin, the diagnostic will automatically fail. It is recommended to call MW_IsDiagWdtCountOngoing to check this before calling this function.
| ERROR | WDT Counter is stuck or diagnostic was not started. |
| NO_ERROR | WDT Counter is not stuck. |
Definition at line 141 of file midware_watchdog_manager_diag.c.
| errFlag_t MW_DiagWdtExpire | ( | void | ) |
Performs error injection diagnostic to detect faults in the Watchdog Timer (WDT) Expire mechanism.
This function performs a diagnostic of the WDT Expire reset mechanism by setting the watchdog timeout period to the lowest possible value and waiting for it to expire and reset the device. If the WDT expire reset was not successful, an error is returned.
| ERROR | Fault detected in the WDT expire mechanism. |
Definition at line 167 of file midware_watchdog_manager_diag.c.
| void MW_EnableSwdt | ( | bool | useCcp, |
| bool | useLock, | ||
| bool | useInstrMode ) |
Enables the Synchronous Watchdog Timer with the provided configurations.
| useCcp | Enable Configuration Change Protection for all SWDT registers |
| useLock | Enable locking of certain SWDT registers, preventing modification of the Reset and Window values, performing error injection and enabling/disabling error interrupts. |
| useInstrMode | Enable counting executed CPU instructions instead of number of main clock cycles. |
Definition at line 173 of file midware_watchdog_manager.c.
| void MW_EnableSwdtInterrupts | ( | void | ) |
Enables all Synchronous Watchdog error interrupts.
Definition at line 168 of file midware_watchdog_manager.c.
| errFlag_t MW_GetSwdtClearError | ( | void | ) |
Reads the error flag indicating a non-clear command received while expecting a clear command in the Synchronous Watchdog.
| ERROR | Bad clear error flag is set. |
| NO_ERROR | Bad clear error flag is not set. |
Definition at line 59 of file midware_watchdog_manager.c.
| errFlag_t MW_GetSwdtCounterExpiredError | ( | void | ) |
Reads the error flag indicating that the Synchronous Watchdog counter expired.
| ERROR | Counter expired error flag is set. |
| NO_ERROR | Counter expired error flag is not set. |
Definition at line 89 of file midware_watchdog_manager.c.
| errFlag_t MW_GetSwdtPreclearError | ( | void | ) |
Reads the error flag indicating a non-preclear command received while expecting a preclear command in the Synchronous Watchdog.
| ERROR | Bad preclear error flag is set. |
| NO_ERROR | Bad preclear error flag is not set. |
Definition at line 44 of file midware_watchdog_manager.c.
| errFlag_t MW_GetSwdtUnexpectedCmdError | ( | void | ) |
Reads the error flag indicating a clear command received in the closed window after a preclear command in the Synchronous Watchdog.
| ERROR | Unexpected command error flag is set. |
| NO_ERROR | Unexpected command flag is not set. |
Definition at line 74 of file midware_watchdog_manager.c.
| bool MW_IsDiagWdtCountOngoing | ( | void | ) |
Checks whether the Watchdog Timer (WDT) Count diagnostic is ongoing.
This function returns true if MW_DiagWdtCountBegin was called and MW_DiagWdtCountEnd has not yet been called, and false otherwise. It does not check whether sufficiently long time has passed to complete the diagnostic, just that it has been started.
| true | WDT Count diagnostic is ongoing. |
| false | WDT Count diagnostic is not ongoing. |
Definition at line 136 of file midware_watchdog_manager_diag.c.
| void MW_PreClearSwdt | ( | void | ) |
Sends a PRECLEAR command to the Synchronous Watchdog.
Definition at line 110 of file midware_watchdog_manager.c.
| errFlag_t MW_SetSwdtResetValue | ( | uint32_t | resetVal | ) |
Sets the Synchronous Watchdog Timer countdown reset value.
This function sets the 24-bit reset value that is loaded into the countdown register after each SWDT clear.
| resetVal | The 24-bit reset value to be set. |
| ERROR | Provided reset value larger than 24-bit or zero, reset value not set. |
| NO_ERROR | Provided reset value successfully set. |
Definition at line 135 of file midware_watchdog_manager.c.
| errFlag_t MW_SetSwdtWindowValue | ( | uint16_t | window | ) |
Sets the Synchronous Watchdog Timer open window value.
This function sets the 16-bit open window value for the SWDT. The value represents the maximum countdown register value where a clear command can be received. The SWDT is in the closed window when the countdown register value is higher than the window value and in the open window when below. The countdown register starts counting from the set reset value, see MW_SetSwdtResetValue.
| window | The 16-bit open window value to be set. |
| ERROR | Provided window value is set to 0, window value not set. |
| NO_ERROR | Provided window value successfully set. |
Definition at line 155 of file midware_watchdog_manager.c.
| errFlag_t MW_SetWdtTimeout | ( | wdtTimeout_t | window, |
| wdtTimeout_t | period ) |
Configures and enables the Watchdog Timer in either Normal or Window mode.
This function enables the WDT by setting the provided window and period value. If already enabled, the new values are used after the next WDT clear. The provided values determine whether to use Normal mode (where it can be cleared anytime before it expires) or Window mode (where it can only be cleared inside the open window). In Window mode, the window and period value is combined to get the total timeout duration.
| window | Closed window duration in windowed mode, set to WDT_TIMEOUT_OFF to disable windowed mode. |
| period | Open window duration in Windowed mode. Total duration / timeout in Normal mode. |
| ERROR | Provided window or period value invalid, window and period not set. |
| NO_ERROR | Provided window or period value set (assumes register lock is disabled). |
Definition at line 201 of file midware_watchdog_manager.c.