API Reference

Normative

The watchdog driver API contract. A conformant driver MUST provide these types and functions with the behavior described. Function and type signatures are extracted from the driver headers with Doxygen/Breathe. Keywords per Requirement Keywords; behavioral rules in Wdg — Requirements; error codes in Errors.

Data types at a glance

Type

Kind

Purpose

Wdg_ConfigType

struct

Root configuration structure (build-time; Wdg_Init takes NULL_PTR).

Wdg_ModeType

enum

Watchdog mode (OFF / NORMAL / ALTERNATIVE).

API at a glance

Function

Group

Purpose

Wdg_Init

Initialization

Initialize the driver and watchdog HW in the default mode.

Wdg_SetMode

Mode and timeout

Switch the watchdog mode.

Wdg_UpdateTimeout

Mode and timeout

Refresh the reset timeout.

Wdg_FeedHw

Mode and timeout

Trigger the HW periodically (logical strategy only).

Expected interfaces at a glance

Integration interfaces the integrator MUST provide where applicable (CHI-WDG-MUST-06); all are documented in the general reference. Interface names are configurable via the driver configuration.

Function

Kind

Purpose

LogM_Report

Common (optional)

Reports development errors with a log level.

<Mip>_EnterCriticalSection / <Mip>_ExitCriticalSection

Common (optional)

Bracket sections requiring exclusive access — see critical sections.

For an external watchdog the driver may additionally depend on a bus interface driver (e.g. SPI or I2C) it is configured to control the hardware through.

Data types
Wdg_ConfigType
struct Wdg_ConfigType

Configuration structure type.

Configuration variants are selected at build time; Wdg_Init currently takes NULL_PTR. Available via: Wdg.h

Wdg_ModeType
enum Wdg_ModeType

Mode type of watchdog hardware.

Values:

enumerator WDG_MODE_OFF = 0x00

Watchdog hardware is disabled (switched off)

enumerator WDG_MODE_NORMAL = 0x01

Watchdog hardware is in normal mode. Typically used during application running.

enumerator WDG_MODE_ALTERNATIVE = 0x02

Watchdog hardware is in alternative mode. Typically used during startup or standby sequence.

Available via: WdgIf_DriverTypes.h

Initialization
Wdg_Init
void Wdg_Init(const Wdg_ConfigType *configPtr)

Initializes the module.

Sync/Async:

Synchronous

Reentrancy:

Non Reentrant

Service ID [hex]:

0x00

Development error(s):

Parameters:

configPtr[in] Pointer to the configuration structure. This parameter is intended for future extensions to support runtime-selectable configuration variants, which allow the selection and initialization of specific variants during runtime. As this functionality is not currently supported, a NULL_PTR SHALL be provided.

Returns:

None.

When to call: once, before any other watchdog function. configPtr MUST be NULL_PTR.

Effect: initialises the driver and watchdog hardware, applying the configured default mode and initial timeout. Errors: see Errors. Available via: Wdg.h

Mode and timeout
Wdg_SetMode
Std_ReturnType Wdg_SetMode(Wdg_ModeType mode)

Switches the watchdog into the specified mode.

Sync/Async:

Synchronous

Reentrancy:

Non Reentrant

Service ID [hex]:

0x01

Development error(s):

Parameters:

mode[in] Watchdog mode to be switched to

Return values:
  • E_OK – Other than development error

  • E_NOT_OK – In case of development error.

Returns:

Std_ReturnType.

Effect: switches the watchdog to mode, applies its hardware settings, and resets the timeout to the mode’s default. Returns: E_OK if accepted, else E_NOT_OK (development error). For the logical strategy, if the previous timeout has already expired the mode is not changed. Errors: see Errors. Available via: Wdg.h

Wdg_UpdateTimeout
void Wdg_UpdateTimeout(uint16 timeout)

Specifies how long watchdog reset is suspended. Watchdog reset gets delayed till the new timeout has been expired.

Sync/Async:

Synchronous

Reentrancy:

Non Reentrant

Service ID [hex]:

0x03

Development error(s):

Parameters:

timeout[in] Timeout value (milliseconds) for watchdog hardware timeout.

Returns:

None.

Effect: delays the watchdog reset until timeout milliseconds elapse (bounded by the configured maximum_timeout). timeout = 0 requests an (almost) immediate reset. For the logical strategy, an already-expired previous timeout is not overwritten. Errors: see Errors. Available via: Wdg.h

Wdg_FeedHw
void Wdg_FeedHw(void)

Trigger watchdog hardware. Intended to be called from periodic timer handler. This interface is only required for “logical timeout management”. “Direct timeout management” does not use this interface.

Sync/Async:

Synchronous

Reentrancy:

Non Reentrant

Service ID [hex]:

0x05

Development error(s):

Parameters:

None

Returns:

None.

When to call: periodically, from the upper layer’s timer handler — logical strategy only (the direct strategy does not use it). It decrements the logical timeout by the call interval and re-triggers the hardware only while the timeout has not expired. Setting up the timer is the upper layer’s responsibility. Errors: see Errors. Available via: Wdg.h