55 #if defined(WDG_OVER_WDOG)
59 #if defined(WDG_OVER_EWM)
60 #include "ewm_driver.h"
63 #if defined(WDG_OVER_SWT)
64 #include "swt_driver.h"
89 uint32_t windowValue = 0U;
101 #if defined (WDG_OVER_WDOG)
114 .updateEnable =
true,
117 .windowValue = (uint16_t)((configPtr->
timeoutValue - windowValue) & 0xFFFFU),
118 .timeoutValue = (uint16_t)(configPtr->
timeoutValue & 0xFFFFU),
128 #if defined (WDG_OVER_EWM)
129 if (WDG_INST_TYPE_EWM == instance->instType)
132 ewm_init_config_t ewmConfig;
135 ewmConfig.interruptEnable = configPtr->intEnable;
138 if (NULL == configPtr->extension)
140 ewmConfig.assertLogic = EWM_IN_ASSERT_ON_LOGIC_ZERO;
141 ewmConfig.prescaler = 0xFFU;
145 ewmConfig.assertLogic = (ewm_in_assert_logic_t)((extension_ewm_for_wdg_t*)(configPtr->extension))->assertLogic;
146 ewmConfig.prescaler = ((extension_ewm_for_wdg_t*)(configPtr->extension))->prescalerValue;
150 if (
true == configPtr->winEnable)
152 ewmConfig.compareLow = (uint8_t)((configPtr->timeoutValue - windowValue) & 0xFFU);
156 ewmConfig.compareLow = FEATURE_EWM_CMPL_MIN_VALUE;
160 if (configPtr->timeoutValue > FEATURE_EWM_CMPH_MAX_VALUE)
162 ewmConfig.compareHigh = FEATURE_EWM_CMPH_MAX_VALUE;
166 ewmConfig.compareHigh = (uint8_t)(configPtr->timeoutValue & 0xFFU);
170 status = EWM_DRV_Init(instance->instIdx, &ewmConfig);
175 #if defined (WDG_OVER_SWT)
176 if (WDG_INST_TYPE_SWT == instance->instType)
179 swt_user_config_t swtConfig =
182 .invalidReset =
false,
183 .winEnable = configPtr->winEnable,
184 .intEnable = configPtr->intEnable,
185 .stop = configPtr->opMode.stop,
186 .debug = configPtr->opMode.debug,
187 .serviceMode = SWT_FS_SEQ_MODE,
188 .lockConfig = SWT_UNLOCK,
189 .timeoutValue = configPtr->timeoutValue,
190 .windowValue = windowValue,
195 status = SWT_DRV_Init(instance->instIdx, &swtConfig);
222 #if (defined(WDG_OVER_WDOG) || defined(WDG_OVER_EWM))
228 #if (defined(WDG_OVER_EWM))
229 config->extension = NULL;
233 #if defined(WDG_OVER_SWT)
251 #if defined(WDG_OVER_WDOG)
260 #if defined(WDG_OVER_EWM)
261 if (WDG_INST_TYPE_EWM == instance->
instType)
264 EWM_DRV_Refresh(instance->
instIdx);
269 #if defined(WDG_OVER_SWT)
270 if (WDG_INST_TYPE_SWT == instance->
instType)
273 SWT_DRV_Service(instance->
instIdx);
292 #if defined(WDG_OVER_WDOG)
301 #if defined(WDG_OVER_SWT)
302 if (WDG_INST_TYPE_SWT == instance->
instType)
305 status = SWT_DRV_Deinit(instance->
instIdx);
327 #if defined(WDG_OVER_WDOG)
336 #if defined(WDG_OVER_SWT)
337 if (WDG_INST_TYPE_SWT == instance->
instType)
340 status = SWT_DRV_SetIntConfig(instance->
instIdx, enable);
362 #if defined(WDG_OVER_WDOG)
371 #if defined(WDG_OVER_SWT)
372 if (WDG_INST_TYPE_SWT == instance->
instType)
375 status = SWT_DRV_SetTimeoutValue(instance->
instIdx, value);
398 #if defined(WDG_OVER_WDOG)
407 #if defined(WDG_OVER_SWT)
408 if (WDG_INST_TYPE_SWT == instance->
instType)
411 status = SWT_DRV_SetWindowConfig(instance->
instIdx, enable, value);
435 #if defined(WDG_OVER_WDOG)
445 #if defined(WDG_OVER_SWT)
446 if (WDG_INST_TYPE_SWT == instance->
instType)
449 status = SWT_DRV_StopTimer(instance->
instIdx);
454 (void)SWT_DRV_GetCounterValue(instance->
instIdx, value);
456 (void)SWT_DRV_StartTimer(instance->
instIdx);
476 #if defined(WDG_OVER_WDOG)
485 #if defined(WDG_OVER_SWT)
486 if (WDG_INST_TYPE_SWT == instance->
instType)
489 SWT_DRV_ClearIntFlag(instance->
instIdx);
void WDG_Refresh(const wdg_instance_t *const instance)
Refreshes the WDG PAL counter.
WDG PAL configuration structure Implements : wdg_config_t_Class.
wdg_clock_source_t clkSource
status_t WDOG_DRV_Deinit(uint32_t instance)
De-initializes the WDOG driver.
status_t WDOG_DRV_Init(uint32_t instance, const wdog_user_config_t *userConfigPtr)
Initializes the WDOG driver.
void WDOG_DRV_ClearIntFlag(uint32_t instance)
Clear interrupt flag of the WDOG.
Structure storing PAL instance information.
status_t WDG_SetInt(const wdg_instance_t *const instance, bool enable)
Set interrupt for WDG PAL.
#define FEATURE_WDOG_TO_RESET_VALUE
status_t WDG_Deinit(const wdg_instance_t *const instance)
De-initializes the WDG PAL.
status_t WDG_SetWindow(const wdg_instance_t *const instance, bool enable, uint32_t value)
Set window mode and window value of the WDG PAL.
WDOG user configuration structure Implements : wdog_user_config_t_Class.
wdog_clk_source_t clkSource
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
uint16_t WDOG_DRV_GetCounter(uint32_t instance)
Gets the value of the WDOG counter.
status_t WDG_GetCounter(const wdg_instance_t *const instance, uint32_t *value)
Gets the value of the WDG PAL counter.
status_t WDG_Init(const wdg_instance_t *const instance, const wdg_config_t *configPtr)
Initializes the WDG PAL.
status_t WDG_SetTimeout(const wdg_instance_t *const instance, uint32_t value)
Sets the value of the WDG PAL timeout.
void WDG_ClearIntFlag(const wdg_instance_t *const instance)
Clears the Timeout Interrupt Flag.
wdog_clk_source_t
Clock sources for the WDOG. Implements : wdog_clk_source_t_Class.
void WDG_GetDefaultConfig(wdg_config_t *const config)
Gets default configuration of the WDG PAL.
status_t WDOG_DRV_SetWindow(uint32_t instance, bool enable, uint16_t windowvalue)
Set window mode and window value of the WDOG.
void WDOG_DRV_Trigger(uint32_t instance)
Refreshes the WDOG counter.
status_t WDOG_DRV_SetTimeout(uint32_t instance, uint16_t timeout)
Sets the value of the WDOG timeout.
status_t WDOG_DRV_SetInt(uint32_t instance, bool enable)
Enables/Disables the WDOG timeout interrupt and sets a function to be called when a timeout interrupt...