This section describes the programming interface of the WDOG HAL driver.
|
enum | wdog_clk_src_t {
kWdogLpoClkSrc = 0U,
kWdogAlternateClkSrc = 1U
} |
| Describes WDOG clock source structure. More...
|
|
enum | wdog_clk_prescaler_t {
kWdogClkPrescalerDivide1 = 0x0U,
kWdogClkPrescalerDivide2 = 0x1U,
kWdogClkPrescalerDivide3 = 0x2U,
kWdogClkPrescalerDivide4 = 0x3U,
kWdogClkPrescalerDivide5 = 0x4U,
kWdogClkPrescalerDivide6 = 0x5U,
kWdogClkPrescalerDivide7 = 0x6U,
kWdogClkPrescalerDivide8 = 0x7U
} |
| Describes the selection of the clock prescaler. More...
|
|
enum | wdog_status_t {
kStatus_WDOG_Success = 0x0U,
kStatus_WDOG_Fail = 0x1U,
kStatus_WDOG_NotInitlialized = 0x2U,
kStatus_WDOG_NullArgument = 0x3U
} |
| WDOG status return codes. More...
|
|
Enumerator |
---|
kWdogLpoClkSrc |
WDOG clock sourced from the LPO.
|
kWdogAlternateClkSrc |
WDOG clock sourced from the alternate clock source.
|
Enumerator |
---|
kWdogClkPrescalerDivide1 |
Divided by 1.
|
kWdogClkPrescalerDivide2 |
Divided by 2.
|
kWdogClkPrescalerDivide3 |
Divided by 3.
|
kWdogClkPrescalerDivide4 |
Divided by 4.
|
kWdogClkPrescalerDivide5 |
Divided by 5.
|
kWdogClkPrescalerDivide6 |
Divided by 6.
|
kWdogClkPrescalerDivide7 |
Divided by 7.
|
kWdogClkPrescalerDivide8 |
Divided by 8.
|
Enumerator |
---|
kStatus_WDOG_Success |
WDOG operation Succeed.
|
kStatus_WDOG_Fail |
WDOG operation Failed.
|
kStatus_WDOG_NotInitlialized |
WDOG is not initialized yet.
|
kStatus_WDOG_NullArgument |
Argument is NULL.
|
static void WDOG_HAL_Enable |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function enables the WDOG. Ensure that the WDOG registers are unlocked by the WDOG_HAL_Unlock, that the WCT window is still open, and that the WDOG_STCTRLH register is not written in this WCT while this function is called.
- Parameters
-
base | The WDOG peripheral base address |
static void WDOG_HAL_Disable |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function disables the WDOG. Ensure that the WDOG registers are unlocked by the WDOG_HAL_Unlock, that the WCT window is still open, and that the WDOG_STCTRLH register is not written in this WCT while this function is called.
- Parameters
-
base | The WDOG peripheral base address |
static bool WDOG_HAL_IsEnable |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function checks whether the WDOG is enabled.
- Parameters
-
base | The WDOG peripheral base address |
- Returns
- false means WDOG is disabled, true means WODG is enabled.
void WDOG_HAL_SetConfig |
( |
WDOG_Type * |
base, |
|
|
const wdog_config_t * |
configPtr |
|
) |
| |
This function is used to set the WDOG common configuration. Ensure WDOG registers are unlocked by the WDOG_HAL_Unlock, that the WCT window is still open, and that the WDOG_STCTRLH register is not written in this WCT while this function is called. Additionally, ensure that the WDOG_STCTRLH.ALLOWUPDATE is 1, which means that the register update is enabled. The common configuration is controlled by the WDOG_STCTRLH. This is a write-once register and this interface is used to set all field of the WDOG_STCTRLH registers at the same time. If only one field needs to be set, the API can be used. These API write to the WDOG_STCTRLH register: WDOG_HAL_Enable,WDOG_HAL_Disable,WDOG_HAL_SetIntCmd,#WDOG_HAL_SetClockSourceMode,#WDOG_HAL_SetWindowModeCmd, #WDOG_HAL_SetRegisterUpdateCmd,#WDOG_HAL_SetWorkInDebugModeCmd,#WDOG_HAL_SetWorkInStopModeCmd, #WDOG_HAL_SetWorkInWaitModeCmd
- Parameters
-
base | The WDOG peripheral base address |
configPtr | The common configure of the WDOG |
static void WDOG_HAL_SetIntCmd |
( |
WDOG_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
This function enables or disables the WDOG interrupt. Ensure that the WDOG registers are unlocked by the WDOG_HAL_Unlock, that the WCT window is still open, and that the WDOG_STCTRLH register is not written in this WCT while this function is called. Additionally, ensure that the WDOG_STCTRLH.ALLOWUPDATE is 1, which means that the register update is enabled.
- Parameters
-
base | The WDOG peripheral base address |
enable | false means disable watchdog interrupt and true means enable watchdog interrupt. |
static bool WDOG_HAL_GetIntFlag |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function gets the WDOG interrupt flag.
- Parameters
-
base | The WDOG peripheral base address |
- Returns
- Watchdog interrupt status, false means interrupt not asserted, true means interrupt asserted.
static void WDOG_HAL_ClearIntStatusFlag |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function clears the WDOG interrupt flag.
- Parameters
-
base | The WDOG peripheral base address |
static void WDOG_HAL_SetTimeoutValue |
( |
WDOG_Type * |
base, |
|
|
uint32_t |
timeoutCount |
|
) |
| |
|
inlinestatic |
This function sets the WDOG_TOVAL value. Ensure that the timeout value for the Watchdog is always greater than 2xWCT time + 20 bus clock cycles. Additionally, ensure that the WDOG registers are unlocked by the WDOG_HAL_Unlock, that the WCT window is still open, and that the WDOG_STCTRLH register is not written in this WCT while this function is called. Make sure that the WDOG_STCTRLH.ALLOWUPDATE is 1, which means that the register update is enabled.
- Parameters
-
base | The WDOG peripheral base address |
timeoutCount | watchdog timeout value, count of watchdog clock tick. |
static uint32_t WDOG_HAL_GetTimerOutputValue |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function gets the WDOG_TMROUT value.
- Parameters
-
base | The WDOG peripheral base address |
- Returns
- Current value of watchdog timer counter.
static void WDOG_HAL_SetWindowValue |
( |
WDOG_Type * |
base, |
|
|
uint32_t |
windowValue |
|
) |
| |
|
inlinestatic |
This function sets the WDOG_WIN value. Ensure that the WDOG registers are unlocked by the WDOG_HAL_Unlock, that the WCT window is still open, and that the WDOG_STCTRLH register is not written in this WCT while this function is called. Additionally, ensure that the WDOG_STCTRLH.ALLOWUPDATE is 1, which means that the register update is enabled.
- Parameters
-
base | The WDOG peripheral base address |
windowValue | watchdog window value. |
static void WDOG_HAL_Unlock |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function unlocks the WDOG register written. This function must be called before any configuration is set because watchdog register is locked automatically after a WCT(256 bus cycles).
- Parameters
-
base | The WDOG peripheral base address |
static void WDOG_HAL_Refresh |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function feeds the WDOG. This function should be called before watchdog timer is in timeout. Otherwise, a reset is asserted.
- Parameters
-
base | The WDOG peripheral base address |
static void WDOG_HAL_ResetSystem |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function resets the chip using WDOG.
- Parameters
-
base | The WDOG peripheral base address |
void WDOG_HAL_Init |
( |
WDOG_Type * |
base | ) |
|
This function restores the WDOG module to reset value.
- Parameters
-
base | The WDOG peripheral base address |