The MCUXpresso SDK provides a peripheral driver for the RTWDOG module of MCUXpresso SDK devices.
Typical use case
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/rtwdog
struct rtwdog_work_mode_t |
Data Fields |
bool | enableWait |
| Enables or disables RTWDOG in wait mode.
|
|
bool | enableStop |
| Enables or disables RTWDOG in stop mode.
|
|
bool | enableDebug |
| Enables or disables RTWDOG in debug mode.
|
|
#define FSL_RTWDOG_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
Enumerator |
---|
kRTWDOG_ClockSource0 |
Clock source 0.
|
kRTWDOG_ClockSource1 |
Clock source 1.
|
kRTWDOG_ClockSource2 |
Clock source 2.
|
kRTWDOG_ClockSource3 |
Clock source 3.
|
Enumerator |
---|
kRTWDOG_ClockPrescalerDivide1 |
Divided by 1.
|
kRTWDOG_ClockPrescalerDivide256 |
Divided by 256.
|
Enumerator |
---|
kRTWDOG_TestModeDisabled |
Test Mode disabled.
|
kRTWDOG_UserModeEnabled |
User Mode enabled.
|
kRTWDOG_LowByteTest |
Test Mode enabled, only low byte is used.
|
kRTWDOG_HighByteTest |
Test Mode enabled, only high byte is used.
|
This structure contains the settings for all of the RTWDOG interrupt configurations.
Enumerator |
---|
kRTWDOG_InterruptEnable |
Interrupt is generated before forcing a reset.
|
This structure contains the RTWDOG status flags for use in the RTWDOG functions.
Enumerator |
---|
kRTWDOG_RunningFlag |
Running flag, set when RTWDOG is enabled.
|
kRTWDOG_InterruptFlag |
Interrupt flag, set when interrupt occurs.
|
This function initializes the RTWDOG configuration structure to default values. The default values are:
* rtwdogConfig->enableRtwdog = true;
* rtwdogConfig->workMode.enableWait = true;
* rtwdogConfig->workMode.enableStop = false;
* rtwdogConfig->workMode.enableDebug = false;
* rtwdogConfig->enableUpdate = true;
* rtwdogConfig->enableInterrupt = false;
* rtwdogConfig->enableWindowMode = false;
* rtwdogConfig->windowValue = 0U;
* rtwdogConfig->timeoutValue = 0xFFFFU;
*
- Parameters
-
config | Pointer to the RTWDOG configuration structure. |
- See Also
- rtwdog_config_t
This function initializes the RTWDOG. To reconfigure the RTWDOG without forcing a reset first, enableUpdate must be set to true in the configuration.
Example:
- Parameters
-
base | RTWDOG peripheral base address. |
config | The configuration of the RTWDOG. |
void RTWDOG_Deinit |
( |
RTWDOG_Type * |
base | ) |
|
This function shuts down the RTWDOG. Ensure that the WDOG_CS.UPDATE is 1, which means that the register update is enabled.
- Parameters
-
base | RTWDOG peripheral base address. |
static void RTWDOG_Enable |
( |
RTWDOG_Type * |
base | ) |
|
|
inlinestatic |
This function writes a value into the WDOG_CS register to enable the RTWDOG. The WDOG_CS register is a write-once register. Ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | RTWDOG peripheral base address. |
static void RTWDOG_Disable |
( |
RTWDOG_Type * |
base | ) |
|
|
inlinestatic |
This function writes a value into the WDOG_CS register to disable the RTWDOG. The WDOG_CS register is a write-once register. Ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | RTWDOG peripheral base address |
static void RTWDOG_EnableInterrupts |
( |
RTWDOG_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
This function writes a value into the WDOG_CS register to enable the RTWDOG interrupt. The WDOG_CS register is a write-once register. Ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | RTWDOG peripheral base address. |
mask | The interrupts to enable. The parameter can be a combination of the following source if defined:
|
static void RTWDOG_DisableInterrupts |
( |
RTWDOG_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
This function writes a value into the WDOG_CS register to disable the RTWDOG interrupt. The WDOG_CS register is a write-once register. Ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | RTWDOG peripheral base address. |
mask | The interrupts to disabled. The parameter can be a combination of the following source if defined:
|
static uint32_t RTWDOG_GetStatusFlags |
( |
RTWDOG_Type * |
base | ) |
|
|
inlinestatic |
This function gets all status flags.
Example to get the running flag:
- Parameters
-
base | RTWDOG peripheral base address |
- Returns
- State of the status flag: asserted (true) or not-asserted (false).
- See Also
- _rtwdog_status_flags_t
- true: related status flag has been set.
- false: related status flag is not set.
void RTWDOG_ClearStatusFlags |
( |
RTWDOG_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
This function clears the RTWDOG status flag.
Example to clear an interrupt flag:
- Parameters
-
base | RTWDOG peripheral base address. |
mask | The status flags to clear. The parameter can be any combination of the following values:
|
static void RTWDOG_SetTimeoutValue |
( |
RTWDOG_Type * |
base, |
|
|
uint16_t |
timeoutCount |
|
) |
| |
|
inlinestatic |
This function writes a timeout value into the WDOG_TOVAL register. The WDOG_TOVAL register is a write-once register. Ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | RTWDOG peripheral base address |
timeoutCount | RTWDOG timeout value, count of RTWDOG clock ticks. |
static void RTWDOG_SetWindowValue |
( |
RTWDOG_Type * |
base, |
|
|
uint16_t |
windowValue |
|
) |
| |
|
inlinestatic |
This function writes a window value into the WDOG_WIN register. The WDOG_WIN register is a write-once register. Ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | RTWDOG peripheral base address. |
windowValue | RTWDOG window value. |
static void RTWDOG_Unlock |
( |
RTWDOG_Type * |
base | ) |
|
|
inlinestatic |
This function unlocks the RTWDOG register written.
Before starting the unlock sequence and following the configuration, disable the global interrupts. Otherwise, an interrupt could effectively invalidate the unlock sequence and the WCT may expire. After the configuration finishes, re-enable the global interrupts.
- Parameters
-
base | RTWDOG peripheral base address |
static void RTWDOG_Refresh |
( |
RTWDOG_Type * |
base | ) |
|
|
inlinestatic |
This function feeds the RTWDOG. This function should be called before the Watchdog timer is in timeout. Otherwise, a reset is asserted.
- Parameters
-
base | RTWDOG peripheral base address |
static uint16_t RTWDOG_GetCounterValue |
( |
RTWDOG_Type * |
base | ) |
|
|
inlinestatic |
This function gets the RTWDOG counter value.
- Parameters
-
base | RTWDOG peripheral base address. |
- Returns
- Current RTWDOG counter value.