ChibiOS/HAL 9.0.0
WDG Driver

Generic WDG Driver. More...

Detailed Description

Generic WDG Driver.

This module defines an abstract interface for a watchdog timer.

Precondition
In order to use the WDG driver the HAL_USE_WDG option must be enabled in halconf.h.
Collaboration diagram for WDG Driver:

Configuration options

#define PLATFORM_WDG_USE_WDG1   FALSE
 WDG1 driver enable switch.

Data Structures

struct  WDGConfig
 Driver configuration structure. More...
struct  WDGDriver
 Structure representing an WDG driver. More...

Macros

#define wdgResetI(wdgp)
 Resets WDG's counter.

Typedefs

typedef struct WDGDriver WDGDriver
 Type of a structure representing an WDG driver.

Enumerations

enum  wdgstate_t { WDG_UNINIT = 0 , WDG_STOP = 1 , WDG_READY = 2 }
 Driver state machine possible states. More...

Functions

void wdgInit (void)
 WDG Driver initialization.
msg_t wdgStart (WDGDriver *wdgp, const WDGConfig *config)
 Configures and activates the WDG peripheral.
void wdgStop (WDGDriver *wdgp)
 Deactivates the WDG peripheral.
void wdgReset (WDGDriver *wdgp)
 Resets WDG's counter.
void wdg_lld_init (void)
 Low level WDG driver initialization.
void wdg_lld_start (WDGDriver *wdgp)
 Configures and activates the WDG peripheral.
void wdg_lld_stop (WDGDriver *wdgp)
 Deactivates the WDG peripheral.
void wdg_lld_reset (WDGDriver *wdgp)
 Reloads WDG's counter.

Variables

WDGDriver WDGD1

Macro Definition Documentation

◆ wdgResetI

#define wdgResetI ( wdgp)
Value:
void wdg_lld_reset(WDGDriver *wdgp)
Reloads WDG's counter.
Definition hal_wdg_lld.c:97

Resets WDG's counter.

Parameters
[in]wdgppointer to the WDGDriver object
Function Class:
This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 68 of file hal_wdg.h.

Referenced by wdgReset().

◆ PLATFORM_WDG_USE_WDG1

#define PLATFORM_WDG_USE_WDG1   FALSE

WDG1 driver enable switch.

Note
The default is FALSE.

Definition at line 47 of file hal_wdg_lld.h.

Typedef Documentation

◆ WDGDriver

typedef struct WDGDriver WDGDriver

Type of a structure representing an WDG driver.

Definition at line 62 of file hal_wdg_lld.h.

Enumeration Type Documentation

◆ wdgstate_t

enum wdgstate_t

Driver state machine possible states.

Enumerator
WDG_UNINIT 

Not initialized.

WDG_STOP 

Stopped.

WDG_READY 

Ready.

Definition at line 49 of file hal_wdg.h.

Function Documentation

◆ wdgInit()

void wdgInit ( void )

WDG Driver initialization.

Note
This function is implicitly invoked by halInit(), there is no need to explicitly initialize the driver.
Function Class:
Object or module nitializer function.

Definition at line 56 of file hal_wdg.c.

References wdg_lld_init().

Referenced by halInit().

Here is the call graph for this function:

◆ wdgStart()

msg_t wdgStart ( WDGDriver * wdgp,
const WDGConfig * config )

Configures and activates the WDG peripheral.

Parameters
[in]wdgppointer to the WDGDriver object
[in]configpointer to the WDGConfig object
Returns
The operation status.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 70 of file hal_wdg.c.

References WDGDriver::config, HAL_RET_SUCCESS, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), WDGDriver::state, wdg_lld_start(), WDG_READY, and WDG_STOP.

Here is the call graph for this function:

◆ wdgStop()

void wdgStop ( WDGDriver * wdgp)

Deactivates the WDG peripheral.

Parameters
[in]wdgppointer to the WDGDriver object
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 107 of file hal_wdg.c.

References WDGDriver::config, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), WDGDriver::state, wdg_lld_stop(), WDG_READY, and WDG_STOP.

Here is the call graph for this function:

◆ wdgReset()

void wdgReset ( WDGDriver * wdgp)

Resets WDG's counter.

Parameters
[in]wdgppointer to the WDGDriver object
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 130 of file hal_wdg.c.

References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), WDGDriver::state, WDG_READY, and wdgResetI.

Here is the call graph for this function:

◆ wdg_lld_init()

void wdg_lld_init ( void )

Low level WDG driver initialization.

Function Class:
Not an API, this function is for internal use only.

Definition at line 62 of file hal_wdg_lld.c.

Referenced by wdgInit().

◆ wdg_lld_start()

void wdg_lld_start ( WDGDriver * wdgp)

Configures and activates the WDG peripheral.

Parameters
[in]wdgppointer to the WDGDriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 73 of file hal_wdg_lld.c.

Referenced by wdgStart().

◆ wdg_lld_stop()

void wdg_lld_stop ( WDGDriver * wdgp)

Deactivates the WDG peripheral.

Parameters
[in]wdgppointer to the WDGDriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 85 of file hal_wdg_lld.c.

Referenced by wdgStop().

◆ wdg_lld_reset()

void wdg_lld_reset ( WDGDriver * wdgp)

Reloads WDG's counter.

Parameters
[in]wdgppointer to the WDGDriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 97 of file hal_wdg_lld.c.

Variable Documentation

◆ WDGD1

WDGDriver WDGD1

Definition at line 38 of file hal_wdg_lld.c.