Callisto4Bootloader: Wdog

Callisto4Bootloader

Data Structures | Enumerator | Variables
Wdog

## Data Structures

struct | _wdog_work_mode
| Defines WDOG work mode. More...
struct | _wdog_config
| Describes WDOG configuration structure. More...

## Variables

bool | _wdog_work_mode::enableWait
bool | _wdog_work_mode::enableStop
bool | _wdog_work_mode::enableDebug
bool | _wdog_config::enableWdog
wdog_work_mode_t | _wdog_config::workMode
bool | _wdog_config::enableInterrupt
uint16_t | _wdog_config::timeoutValue
uint16_t | _wdog_config::interruptTimeValue
bool | _wdog_config::softwareResetExtension
bool | _wdog_config::enablePowerDown
bool | _wdog_config::enableTimeOutAssert

## Driver version

#define | FSL_WDOG_DRIVER_VERSION (MAKE_VERSION(2, 1, 1))
| Defines WDOG driver version. More...

## Refresh sequence

enum | _wdog_interrupt_enable { kWDOG_InterruptEnable = WDOG_WICR_WIE_MASK }
| WDOG interrupt configuration structure, default settings all disabled. More...
enum | _wdog_status_flags { kWDOG_RunningFlag = WDOG_WCR_WDE_MASK, kWDOG_PowerOnResetFlag = WDOG_WRSR_POR_MASK, kWDOG_TimeoutResetFlag = WDOG_WRSR_TOUT_MASK, kWDOG_SoftwareResetFlag = WDOG_WRSR_SFTW_MASK, kWDOG_InterruptFlag = WDOG_WICR_WTIS_MASK }
| WDOG status flags. More...
typedef struct _wdog_work_mode | wdog_work_mode_t
| Defines WDOG work mode. More...
typedef struct _wdog_config | wdog_config_t
| Describes WDOG configuration structure. More...
#define | WDOG_REFRESH_KEY (0xAAAA5555U)

## WDOG Initialization and De-initialization.

void | WDOG_GetDefaultConfig (wdog_config_t *config)
| Initializes the WDOG configuration structure. More...
void | WDOG_Init (WDOG_Type *base, const wdog_config_t *config)
| Initializes the WDOG. More...
void | WDOG_Deinit (WDOG_Type *base)
| Shuts down the WDOG. More...
static void | WDOG_Enable (WDOG_Type *base)
| Enables the WDOG module. More...
static void | WDOG_Disable (WDOG_Type *base)
| Disables the WDOG module. More...
static void | WDOG_TriggerSystemSoftwareReset (WDOG_Type *base)
| Trigger the system software reset. More...
static void | WDOG_TriggerSoftwareSignal (WDOG_Type *base)
| Trigger an output assertion. More...
static void | WDOG_EnableInterrupts (WDOG_Type *base, uint16_t mask)
| Enables the WDOG interrupt. More...
uint16_t | WDOG_GetStatusFlags (WDOG_Type *base)
| Gets the WDOG all reset status flags. More...
void | WDOG_ClearInterruptStatus (WDOG_Type *base, uint16_t mask)
| Clears the WDOG flag. More...
static void | WDOG_SetTimeoutValue (WDOG_Type *base, uint16_t timeoutCount)
| Sets the WDOG timeout value. More...
static void | WDOG_SetInterrputTimeoutValue (WDOG_Type *base, uint16_t timeoutCount)
| Sets the WDOG interrupt count timeout value. More...
static void | WDOG_DisablePowerDownEnable (WDOG_Type *base)
| Disable the WDOG power down enable bit. More...
void | WDOG_Refresh (WDOG_Type *base)
| Refreshes the WDOG timer. More...

## Detailed Description

## Macro Definition Documentation

## ◆ FSL_WDOG_DRIVER_VERSION

#define FSL_WDOG_DRIVER_VERSION (MAKE_VERSION(2, 1, 1))

Defines WDOG driver version.

Definition at line 23 of file fsl_wdog.h.

## ◆ WDOG_REFRESH_KEY

#define WDOG_REFRESH_KEY (0xAAAA5555U)

Definition at line 27 of file fsl_wdog.h.

## Typedef Documentation

## ◆ wdog_config_t

typedef struct _wdog_config wdog_config_t

Describes WDOG configuration structure.

## ◆ wdog_work_mode_t

typedef struct _wdog_work_mode wdog_work_mode_t

Defines WDOG work mode.

## Enumeration Type Documentation

## ◆ _wdog_interrupt_enable

enum _wdog_interrupt_enable

WDOG interrupt configuration structure, default settings all disabled.

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

Enumerator
kWDOG_InterruptEnable | WDOG timeout generates an interrupt before reset

Definition at line 56 of file fsl_wdog.h.

## ◆ _wdog_status_flags

enum _wdog_status_flags

WDOG status flags.

This structure contains the WDOG status flags for use in the WDOG functions.

Enumerator
kWDOG_RunningFlag | Running flag, set when WDOG is enabled
kWDOG_PowerOnResetFlag | Power On flag, set when reset is the result of a powerOnReset
kWDOG_TimeoutResetFlag | Timeout flag, set when reset is the result of a timeout
kWDOG_SoftwareResetFlag | Software flag, set when reset is the result of a software
kWDOG_InterruptFlag | interrupt flag,whether interrupt has occurred or not

Definition at line 66 of file fsl_wdog.h.

## Function Documentation

## ◆ WDOG_ClearInterruptStatus()

void WDOG_ClearInterruptStatus | ( | WDOG_Type * | base,
|  | uint16_t | mask
| ) |  |

Clears the WDOG flag.

This function clears the WDOG status flag.

This is an example for clearing the interrupt flag.

WDOG_ClearStatusFlags(wdog_base,KWDOG_InterruptFlag);

Parameters

  base | WDOG peripheral base address
  mask | The status flags to clear. The parameter could be any combination of the following values. kWDOG_TimeoutFlag

Definition at line 303 of file bl_api.c.

References g_bootloaderTree, wdog_driver_interface_t::WDOG_GetStatusFlags, and bootloader_api_entry_t::wdogDriver.

## ◆ WDOG_Deinit()

void WDOG_Deinit | ( | WDOG_Type * | base | ) |

Shuts down the WDOG.

This function shuts down the WDOG. Watchdog Enable bit is a write one once only bit. It is not possible to clear this bit by a software write, once the bit is set. This bit(WDE) can be set/reset only in debug mode(exception).

Definition at line 293 of file bl_api.c.

References g_bootloaderTree, wdog_driver_interface_t::WDOG_Init, and bootloader_api_entry_t::wdogDriver.

## ◆ WDOG_Disable()

static void WDOG_Disable | ( | WDOG_Type * | base | ) |

inlinestatic

Disables the WDOG module.

This function writes a value into the WDOG_WCR register to disable the WDOG. This is a write one once only bit. It is not possible to clear this bit by a software write,once the bit is set. only debug mode exception

Parameters

  base | WDOG peripheral base address

Definition at line 159 of file fsl_wdog.h.

## ◆ WDOG_DisablePowerDownEnable()

static void WDOG_DisablePowerDownEnable | ( | WDOG_Type * | base | ) |

inlinestatic

Disable the WDOG power down enable bit.

This function disable the WDOG power down enable(PDE). This function writes a value into WMCR registers which are wirte-once. This field is write once only. Once software sets this bit it cannot be reset until the next system reset.

Parameters

  base | WDOG peripheral base address

Definition at line 281 of file fsl_wdog.h.

## ◆ WDOG_Enable()

static void WDOG_Enable | ( | WDOG_Type * | base | ) |

inlinestatic

Enables the WDOG module.

This function writes a value into the WDOG_WCR register to enable the WDOG. This is a write one once only bit. It is not possible to clear this bit by a software write, once the bit is set. only debug mode exception.

Parameters

  base | WDOG peripheral base address

Definition at line 146 of file fsl_wdog.h.

## ◆ WDOG_EnableInterrupts()

static void WDOG_EnableInterrupts | ( | WDOG_Type * | base,
|  | uint16_t | mask
| ) |  |

inlinestatic

Enables the WDOG interrupt.

This bit is a write once only bit. Once the software does a write access to this bit, it will get locked and cannot be reprogrammed until the next system reset assertion

Parameters

  base | WDOG peripheral base address

  mask

  The interrupts to enable The parameter can be combination of the following source if defined.
  - kWDOG_InterruptEnable

Definition at line 205 of file fsl_wdog.h.

Referenced by watchdog_test().

## ◆ WDOG_GetDefaultConfig()

void WDOG_GetDefaultConfig | ( | wdog_config_t * | config | ) |

Initializes the WDOG configuration structure.

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

wdogConfig->enableWdog = true;
wdogConfig->workMode.enableWait = true;
wdogConfig->workMode.enableStop = false;
wdogConfig->workMode.enableDebug = false;
wdogConfig->enableInterrupt = false;
wdogConfig->enablePowerdown = false;
wdogConfig->resetExtension = flase;
wdogConfig->timeoutValue = 0xFFU;
wdogConfig->interruptTimeValue = 0x04u;

Parameters

  config | Pointer to the WDOG configuration structure.

See also
  wdog_config_t

Definition at line 283 of file bl_api.c.

Referenced by watchdog_test().

## ◆ WDOG_GetStatusFlags()

uint16_t WDOG_GetStatusFlags | ( | WDOG_Type * | base | ) |

Gets the WDOG all reset status flags.

This function gets all reset status flags.

uint16_t status;
status = WDOG_GetStatusFlags (wdog_base);

Parameters

  base | WDOG peripheral base address

Returns
  State of the status flag: asserted (true) or not-asserted (false).

See also
  _wdog_status_flags
  - true: a related status flag has been set.
  - false: a related status flag is not set.

Definition at line 298 of file bl_api.c.

References g_bootloaderTree, wdog_driver_interface_t::WDOG_Deinit, and bootloader_api_entry_t::wdogDriver.

Referenced by watchdog_test().

## ◆ WDOG_Init()

void WDOG_Init | ( | WDOG_Type * | base,
|  | const wdog_config_t * | config
| ) |  |

Initializes the WDOG.

This function initializes the WDOG. When called, the WDOG runs according to the configuration.

This is an example.

wdog_config_t config;
WDOG_GetDefaultConfig(&config);
config.timeoutValue = 0xffU;
config->interruptTimeValue = 0x04u;
WDOG_Init(wdog_base,&config);

Parameters

  base | WDOG peripheral base address
  config | The configuration of WDOG

Definition at line 288 of file bl_api.c.

References g_bootloaderTree, wdog_driver_interface_t::WDOG_GetDefaultConfig, and bootloader_api_entry_t::wdogDriver.

Referenced by watchdog_test().

## ◆ WDOG_Refresh()

void WDOG_Refresh | ( | WDOG_Type * | base | ) |

Refreshes the WDOG timer.

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

Parameters

  base | WDOG peripheral base address

Definition at line 308 of file bl_api.c.

References g_bootloaderTree, wdog_driver_interface_t::WDOG_ClearInterruptStatus, and bootloader_api_entry_t::wdogDriver.

Referenced by watchdog_test().

## ◆ WDOG_SetInterrputTimeoutValue()

static void WDOG_SetInterrputTimeoutValue | ( | WDOG_Type * | base,
|  | uint16_t | timeoutCount
| ) |  |

inlinestatic

Sets the WDOG interrupt count timeout value.

This function sets the interrupt count timeout value. This function writes a value into WIC registers which are wirte-once. This field is write once only. Once the software does a write access to this field, it will get locked and cannot be reprogrammed until the next system reset assertion.

Parameters

  base | WDOG peripheral base address
  timeoutCount | WDOG timeout value; count of WDOG clock tick.

Definition at line 268 of file fsl_wdog.h.

## ◆ WDOG_SetTimeoutValue()

static void WDOG_SetTimeoutValue | ( | WDOG_Type * | base,
|  | uint16_t | timeoutCount
| ) |  |

inlinestatic

Sets the WDOG timeout value.

This function sets the timeout value. This function writes a value into WCR registers. The time-out value can be written at any point of time but it is loaded to the counter at the time when WDOG is enabled or after the service routine has been performed.

Parameters

  base | WDOG peripheral base address
  timeoutCount | WDOG timeout value; count of WDOG clock tick.

Definition at line 253 of file fsl_wdog.h.

## ◆ WDOG_TriggerSoftwareSignal()

static void WDOG_TriggerSoftwareSignal | ( | WDOG_Type * | base | ) |

inlinestatic

Trigger an output assertion.

This function will write to the WCR[WDA] bit to trigger WDOG_B signal assertion. The WDOG_B signal can be routed to external pin of the chip, the output pin will turn to assertion along with WDOG_B signal. Note: The WDOG_B signal will remain assert until a power on reset occurred, so, please take more attention while calling it.

Parameters

  base | WDOG peripheral base address

Definition at line 189 of file fsl_wdog.h.

## ◆ WDOG_TriggerSystemSoftwareReset()

static void WDOG_TriggerSystemSoftwareReset | ( | WDOG_Type * | base | ) |

inlinestatic

Trigger the system software reset.

This function will write to the WCR[SRS] bit to trigger a software system reset. This bit will automatically resets to "1" after it has been asserted to "0". Note: Calling this API will reset the system right now, please using it with more attention.

Parameters

  base | WDOG peripheral base address

Definition at line 173 of file fsl_wdog.h.

Referenced by watchdog_test().

## Variable Documentation

## ◆ enableDebug

bool _wdog_work_mode::enableDebug

continue or suspend WDOG in debug mode

Definition at line 35 of file fsl_wdog.h.

## ◆ enableInterrupt

bool _wdog_config::enableInterrupt

Enables or disables WDOG interrupt

Definition at line 43 of file fsl_wdog.h.

Referenced by watchdog_test().

## ◆ enablePowerDown

bool _wdog_config::enablePowerDown

power down enable bit

Definition at line 47 of file fsl_wdog.h.

## ◆ enableStop

bool _wdog_work_mode::enableStop

continue or suspend WDOG in stop mode

Definition at line 34 of file fsl_wdog.h.

## ◆ enableTimeOutAssert

bool _wdog_config::enableTimeOutAssert

Enable WDOG_B timeout assertion.

Definition at line 48 of file fsl_wdog.h.

## ◆ enableWait

bool _wdog_work_mode::enableWait

continue or suspend WDOG in wait mode

Definition at line 33 of file fsl_wdog.h.

## ◆ enableWdog

bool _wdog_config::enableWdog

Enables or disables WDOG

Definition at line 41 of file fsl_wdog.h.

## ◆ interruptTimeValue

uint16_t _wdog_config::interruptTimeValue

Interrupt count timeout value

Definition at line 45 of file fsl_wdog.h.

Referenced by watchdog_test().

## ◆ softwareResetExtension

bool _wdog_config::softwareResetExtension

software reset extension

Definition at line 46 of file fsl_wdog.h.

## ◆ timeoutValue

uint16_t _wdog_config::timeoutValue

Timeout value

Definition at line 44 of file fsl_wdog.h.

Referenced by watchdog_test().

## ◆ workMode

wdog_work_mode_t _wdog_config::workMode

Configures WDOG work mode in debug stop and wait mode

Definition at line 42 of file fsl_wdog.h.

WDOG_GetStatusFlags
uint16_t WDOG_GetStatusFlags(WDOG_Type *base)
Gets the WDOG all reset status flags.
Definition: bl_api.c:298
WDOG_GetDefaultConfig
void WDOG_GetDefaultConfig(wdog_config_t *config)
Initializes the WDOG configuration structure.
Definition: bl_api.c:283
_wdog_config::interruptTimeValue
uint16_t interruptTimeValue
Definition: fsl_wdog.h:45
_wdog_config::timeoutValue
uint16_t timeoutValue
Definition: fsl_wdog.h:44
_wdog_config
Describes WDOG configuration structure.
Definition: fsl_wdog.h:39
WDOG_Init
void WDOG_Init(WDOG_Type *base, const wdog_config_t *config)
Initializes the WDOG.
Definition: bl_api.c:288