MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
WDOG8: 8-bit Watchdog Timer

Overview

The MCUXpresso SDK provides a peripheral driver for the WDOG8 module of MCUXpresso SDK devices.

Typical use case

config.timeoutValue = 0xffffU;
config.enableWindowMode = true;
config.windowValue = 0x1ffU;
WDOG8_Init(wdog_base,&config);

WDOG8 Initialization and De-initialization

void WDOG8_GetDefaultConfig (wdog8_config_t *config)
 Initializes the WDOG8 configuration structure. More...
 
void WDOG8_Init (WDOG_Type *base, const wdog8_config_t *config)
 Initializes the WDOG8 module. More...
 
void WDOG8_Deinit (WDOG_Type *base)
 De-initializes the WDOG8 module. More...
 

WDOG8 functional Operation

static void WDOG8_Enable (WDOG_Type *base)
 Enables the WDOG8 module. More...
 
static void WDOG8_Disable (WDOG_Type *base)
 Disables the WDOG8 module. More...
 
static void WDOG8_EnableInterrupts (WDOG_Type *base, uint8_t mask)
 Enables the WDOG8 interrupt. More...
 
static void WDOG8_DisableInterrupts (WDOG_Type *base, uint8_t mask)
 Disables the WDOG8 interrupt. More...
 
static uint8_t WDOG8_GetStatusFlags (WDOG_Type *base)
 Gets the WDOG8 all status flags. More...
 
void WDOG8_ClearStatusFlags (WDOG_Type *base, uint8_t mask)
 Clears the WDOG8 flag. More...
 
static void WDOG8_SetTimeoutValue (WDOG_Type *base, uint16_t timeoutCount)
 Sets the WDOG8 timeout value. More...
 
static void WDOG8_SetWindowValue (WDOG_Type *base, uint16_t windowValue)
 Sets the WDOG8 window value. More...
 
static void WDOG8_Unlock (WDOG_Type *base)
 Unlocks the WDOG8 register written. More...
 
static void WDOG8_Refresh (WDOG_Type *base)
 Refreshes the WDOG8 timer. More...
 
static uint16_t WDOG8_GetCounterValue (WDOG_Type *base)
 Gets the WDOG8 counter value. More...
 

Function Documentation

void WDOG8_GetDefaultConfig ( wdog8_config_t config)

This function initializes the WDOG8 configuration structure to default values. The default values are:

* wdog8Config->enableWdog8 = true;
* wdog8Config->clockSource = kWDOG8_ClockSource1;
* wdog8Config->prescaler = kWDOG8_ClockPrescalerDivide1;
* wdog8Config->workMode.enableWait = true;
* wdog8Config->workMode.enableStop = false;
* wdog8Config->workMode.enableDebug = false;
* wdog8Config->testMode = kWDOG8_TestModeDisabled;
* wdog8Config->enableUpdate = true;
* wdog8Config->enableInterrupt = false;
* wdog8Config->enableWindowMode = false;
* wdog8Config->windowValue = 0U;
* wdog8Config->timeoutValue = 0xFFFFU;
*
Parameters
configPointer to the WDOG8 configuration structure.
See Also
wdog8_config_t
void WDOG8_Init ( WDOG_Type *  base,
const wdog8_config_t config 
)

This function initializes the WDOG8. To reconfigure the WDOG8 without forcing a reset first, enableUpdate must be set to true in the configuration.

Example:

* wdog8_config_t config;
* config.timeoutValue = 0x7ffU;
* config.enableUpdate = true;
* WDOG8_Init(wdog_base,&config);
*
Parameters
baseWDOG8 peripheral base address.
configThe configuration of the WDOG8.
void WDOG8_Deinit ( WDOG_Type *  base)

This function shuts down the WDOG8. Ensure that the WDOG_CS1.UPDATE is 1, which means that the register update is enabled.

Parameters
baseWDOG8 peripheral base address.
static void WDOG8_Enable ( WDOG_Type *  base)
inlinestatic

This function writes a value into the WDOG_CS1 register to enable the WDOG8. The WDOG_CS1 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
baseWDOG8 peripheral base address.
static void WDOG8_Disable ( WDOG_Type *  base)
inlinestatic

This function writes a value into the WDOG_CS1 register to disable the WDOG8. The WDOG_CS1 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
baseWDOG8 peripheral base address
static void WDOG8_EnableInterrupts ( WDOG_Type *  base,
uint8_t  mask 
)
inlinestatic

This function writes a value into the WDOG_CS1 register to enable the WDOG8 interrupt. The WDOG_CS1 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
baseWDOG8 peripheral base address.
maskThe interrupts to enable. The parameter can be a combination of the following source if defined:
  • kWDOG8_InterruptEnable
static void WDOG8_DisableInterrupts ( WDOG_Type *  base,
uint8_t  mask 
)
inlinestatic

This function writes a value into the WDOG_CS register to disable the WDOG8 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
baseWDOG8 peripheral base address.
maskThe interrupts to disabled. The parameter can be a combination of the following source if defined:
  • kWDOG8_InterruptEnable
static uint8_t WDOG8_GetStatusFlags ( WDOG_Type *  base)
inlinestatic

This function gets all status flags.

Example to get the running flag:

* uint32_t status;
* status = WDOG8_GetStatusFlags(wdog_base) & kWDOG8_RunningFlag;
*
Parameters
baseWDOG8 peripheral base address
Returns
State of the status flag: asserted (true) or not-asserted (false).
See Also
_wdog8_status_flags_t
  • true: related status flag has been set.
  • false: related status flag is not set.
void WDOG8_ClearStatusFlags ( WDOG_Type *  base,
uint8_t  mask 
)

This function clears the WDOG8 status flag.

Example to clear an interrupt flag:

* WDOG8_ClearStatusFlags(wdog_base,kWDOG8_InterruptFlag);
*
Parameters
baseWDOG8 peripheral base address.
maskThe status flags to clear. The parameter can be any combination of the following values:
  • kWDOG8_InterruptFlag
static void WDOG8_SetTimeoutValue ( WDOG_Type *  base,
uint16_t  timeoutCount 
)
inlinestatic

This function writes a timeout value into the WDOG_TOVALH/L register. The WDOG_TOVALH/L 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
baseWDOG8 peripheral base address
timeoutCountWDOG8 timeout value, count of WDOG8 clock ticks.
static void WDOG8_SetWindowValue ( WDOG_Type *  base,
uint16_t  windowValue 
)
inlinestatic

This function writes a window value into the WDOG_WINH/L register. The WDOG_WINH/L 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
baseWDOG8 peripheral base address.
windowValueWDOG8 window value.
static void WDOG8_Unlock ( WDOG_Type *  base)
inlinestatic

This function unlocks the WDOG8 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
baseWDOG8 peripheral base address
static void WDOG8_Refresh ( WDOG_Type *  base)
inlinestatic

This function feeds the WDOG8. This function should be called before the Watchdog timer is in timeout. Otherwise, a reset is asserted.

Parameters
baseWDOG8 peripheral base address
static uint16_t WDOG8_GetCounterValue ( WDOG_Type *  base)
inlinestatic

This function gets the WDOG8 counter value.

Parameters
baseWDOG8 peripheral base address.
Returns
Current WDOG8 counter value.