MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
EWM: External Watchdog Monitor Driver

Overview

The MCUXpresso SDK provides a peripheral driver for the External Watchdog (EWM) Driver module of MCUXpresso SDK devices.

Typical use case

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/ewm

Data Structures

struct  ewm_config_t
 Data structure for EWM configuration. More...
 

Enumerations

enum  ewm_lpo_clock_source_t {
  kEWM_LpoClockSource0 = 0U,
  kEWM_LpoClockSource1 = 1U,
  kEWM_LpoClockSource2 = 2U,
  kEWM_LpoClockSource3 = 3U
}
 Describes EWM clock source. More...
 
enum  _ewm_interrupt_enable_t { kEWM_InterruptEnable = EWM_CTRL_INTEN_MASK }
 EWM interrupt configuration structure with default settings all disabled. More...
 
enum  _ewm_status_flags_t { kEWM_RunningFlag = EWM_CTRL_EWMEN_MASK }
 EWM status flags. More...
 

Driver version

#define FSL_EWM_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))
 EWM driver version 2.0.2. More...
 

EWM initialization and de-initialization

void EWM_Init (EWM_Type *base, const ewm_config_t *config)
 Initializes the EWM peripheral. More...
 
void EWM_Deinit (EWM_Type *base)
 Deinitializes the EWM peripheral. More...
 
void EWM_GetDefaultConfig (ewm_config_t *config)
 Initializes the EWM configuration structure. More...
 

EWM functional Operation

static void EWM_EnableInterrupts (EWM_Type *base, uint32_t mask)
 Enables the EWM interrupt. More...
 
static void EWM_DisableInterrupts (EWM_Type *base, uint32_t mask)
 Disables the EWM interrupt. More...
 
static uint32_t EWM_GetStatusFlags (EWM_Type *base)
 Gets all status flags. More...
 
void EWM_Refresh (EWM_Type *base)
 Services the EWM. More...
 

Data Structure Documentation

struct ewm_config_t

This structure is used to configure the EWM.

Data Fields

bool enableEwm
 Enable EWM module.
 
bool enableEwmInput
 Enable EWM_in input.
 
bool setInputAssertLogic
 EWM_in signal assertion state.
 
bool enableInterrupt
 Enable EWM interrupt.
 
ewm_lpo_clock_source_t clockSource
 Clock source select.
 
uint8_t prescaler
 Clock prescaler value.
 
uint8_t compareLowValue
 Compare low-register value.
 
uint8_t compareHighValue
 Compare high-register value.
 

Macro Definition Documentation

#define FSL_EWM_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))

Enumeration Type Documentation

Enumerator
kEWM_LpoClockSource0 

EWM clock sourced from lpo_clk[0].

kEWM_LpoClockSource1 

EWM clock sourced from lpo_clk[1].

kEWM_LpoClockSource2 

EWM clock sourced from lpo_clk[2].

kEWM_LpoClockSource3 

EWM clock sourced from lpo_clk[3].

This structure contains the settings for all of EWM interrupt configurations.

Enumerator
kEWM_InterruptEnable 

Enable the EWM to generate an interrupt.

This structure contains the constants for the EWM status flags for use in the EWM functions.

Enumerator
kEWM_RunningFlag 

Running flag, set when EWM is enabled.

Function Documentation

void EWM_Init ( EWM_Type *  base,
const ewm_config_t config 
)

This function is used to initialize the EWM. After calling, the EWM runs immediately according to the configuration. Note that, except for the interrupt enable control bit, other control bits and registers are write once after a CPU reset. Modifying them more than once generates a bus transfer error.

This is an example.

* ewm_config_t config;
* config.compareHighValue = 0xAAU;
* EWM_Init(ewm_base,&config);
*
Parameters
baseEWM peripheral base address
configThe configuration of the EWM
void EWM_Deinit ( EWM_Type *  base)

This function is used to shut down the EWM.

Parameters
baseEWM peripheral base address
void EWM_GetDefaultConfig ( ewm_config_t config)

This function initializes the EWM configuration structure to default values. The default values are as follows.

* ewmConfig->enableEwm = true;
* ewmConfig->enableEwmInput = false;
* ewmConfig->setInputAssertLogic = false;
* ewmConfig->enableInterrupt = false;
* ewmConfig->ewm_lpo_clock_source_t = kEWM_LpoClockSource0;
* ewmConfig->prescaler = 0;
* ewmConfig->compareLowValue = 0;
* ewmConfig->compareHighValue = 0xFEU;
*
Parameters
configPointer to the EWM configuration structure.
See Also
ewm_config_t
static void EWM_EnableInterrupts ( EWM_Type *  base,
uint32_t  mask 
)
inlinestatic

This function enables the EWM interrupt.

Parameters
baseEWM peripheral base address
maskThe interrupts to enable The parameter can be combination of the following source if defined
  • kEWM_InterruptEnable
static void EWM_DisableInterrupts ( EWM_Type *  base,
uint32_t  mask 
)
inlinestatic

This function enables the EWM interrupt.

Parameters
baseEWM peripheral base address
maskThe interrupts to disable The parameter can be combination of the following source if defined
  • kEWM_InterruptEnable
static uint32_t EWM_GetStatusFlags ( EWM_Type *  base)
inlinestatic

This function gets all status flags.

This is an example for getting the running flag.

* uint32_t status;
* status = EWM_GetStatusFlags(ewm_base) & kEWM_RunningFlag;
*
Parameters
baseEWM peripheral base address
Returns
State of the status flag: asserted (true) or not-asserted (false).
See Also
_ewm_status_flags_t
  • True: a related status flag has been set.
  • False: a related status flag is not set.
void EWM_Refresh ( EWM_Type *  base)

This function resets the EWM counter to zero.

Parameters
baseEWM peripheral base address