5.6. WDG

5.6.1. Types

Base type

Type Name

Brief

enum

Wdg_StatusType

This is a Watchdog status type value.

enum

Wdg_Reaction

Watchdog module Reaction if watchdog counter reaches the maximum value.

enum

Wdg_PreDivider

Wdg_PreDivider determines the watchdog clock pre-divider, which is the first of the two dividers between INTOSC1 and the watchdog counter clock (WDCLK)

enum

Wdg_PreScaler

Wdg_PreScaler determines the watchdog clock prescaler, which is the second of the two dividers between INTOSC1 and the watchdog counter clock (WDCLK).

5.6.1.1. enum Wdg_StatusType

Enumerator

Value

Description

WDG_UNINIT

0U

Watchdog driver is uninitialized. State on power on before invoking Wdg_Init()

WDG_IDLE

1U

Watchdog driver is in idle state. Default state when WDG timer regs are not being programmed.

WDG_BUSY

2U

Watchdog driver is reprogramming the WD to trigger the watchdog.

Brief: This is a Watchdog status type value.

5.6.1.2. enum Wdg_Reaction

Enumerator

Value

Description

WDG_GENERATE_RESET

0U

Watchdog can generate a reset signal.

WDG_GENERATE_INTERRUPT

1U

Watchdog can generate an interrupt signal; reset signal is disabled.

Brief: Watchdog module Reaction if watchdog counter reaches the maximum value.

5.6.1.3. enum Wdg_PreDivider

Enumerator

Value

Description

WDG_PREDIV_2

0x800

PREDIVCLK = INTOSC1 / 2.

WDG_PREDIV_4

0x900

PREDIVCLK = INTOSC1 / 4.

WDG_PREDIV_8

0xA00

PREDIVCLK = INTOSC1 / 8.

WDG_PREDIV_16

0xB00

PREDIVCLK = INTOSC1 / 16.

WDG_PREDIV_32

0xC00

PREDIVCLK = INTOSC1 / 32.

WDG_PREDIV_64

0xD00

PREDIVCLK = INTOSC1 / 64.

WDG_PREDIV_128

0xE00

PREDIVCLK = INTOSC1 / 128.

WDG_PREDIV_256

0xF00

PREDIVCLK = INTOSC1 / 256.

WDG_PREDIV_512

0x000

PREDIVCLK = INTOSC1 / 512.

WDG_PREDIV_1024

0x100

PREDIVCLK = INTOSC1 / 1024.

WDG_PREDIV_2048

0x200

PREDIVCLK = INTOSC1 / 2048.

WDG_PREDIV_4096

0x300

PREDIVCLK = INTOSC1 / 4096.

Brief: Wdg_PreDivider determines the watchdog clock pre-divider, which is the first of the two dividers between INTOSC1 and the watchdog counter clock (WDCLK)

5.6.1.4. enum Wdg_PreScaler

Enumerator

Value

Description

WDG_PRESCALE_1

1U

WDCLK = PREDIVCLK / 1.

WDG_PRESCALE_2

2U

WDCLK = PREDIVCLK / 2.

WDG_PRESCALE_4

3U

WDCLK = PREDIVCLK / 4.

WDG_PRESCALE_8

4U

WDCLK = PREDIVCLK / 8.

WDG_PRESCALE_16

5U

WDCLK = PREDIVCLK / 16.

WDG_PRESCALE_32

6U

WDCLK = PREDIVCLK / 32.

WDG_PRESCALE_64

7U

WDCLK = PREDIVCLK / 64.

Brief: Wdg_PreScaler determines the watchdog clock prescaler, which is the second of the two dividers between INTOSC1 and the watchdog counter clock (WDCLK).

5.6.2. Structures

Name

Brief

Wdg_DriverObjType

WDG driver object structure.

Wdg_ModeInfoType

Mode Information Type.

Wdg_ConfigType

WDG config root structure.

5.6.3. Defines

Name

Brief

WDG_SW_MAJOR_VERSION

Driver Implementation Major Version.

WDG_SW_MINOR_VERSION

Driver Implementation Minor Version.

WDG_SW_PATCH_VERSION

Driver Implementation Patch Version.

WDG_AR_RELEASE_MAJOR_VERSION

AUTOSAR Major version specification implemented by WDG Driver.

WDG_AR_RELEASE_MINOR_VERSION

AUTOSAR Minor version specification implemented by WDG Driver.

WDG_AR_RELEASE_REVISION_VERSION

AUTOSAR Patch version specification implemented by WDG Driver.

WDG_VENDOR_ID

Texas Instruments Vendor ID.

WDG_MODULE_ID

WDG Driver Module ID.

WDG_INSTANCE_ID

WDG Instance ID.

WDG_SID_INIT

Service ID for Wdg_Init.

WDG_SID_SET_MODE

Service ID for Wdg_SetMode.

WDG_SID_SET_TRIGGER_CONDITION

Service ID for Wdg_SetTriggerCondition.

WDG_SID_GET_VERSION_INFO

Service ID for Wdg_GetVersionInfo.

WDG_E_DRIVER_STATE

Invalid driver state.

WDG_E_PARAM_MODE

Invalid mode param.

WDG_E_PARAM_CONFIG

Invalid config param.

WDG_E_PARAM_TIMEOUT

Invalid timeout value.

WDG_E_PARAM_POINTER

Invalid NULL ptr param.

WDG_E_INIT_FAILED

Invalid Configuration set selection.

WDG_CHKBITS

Shifted pattern for WDCR register’s WDCHK field.

WDG_ENRSTKEY

Keys for WDKEY field. This key is to enable reset.

WDG_RSTKEY

Keys for WDKEY field. This key is to reset .

WDG_CHKBITS_RESET

Reset pattern for WDCR register’s WDCHK field.

5.6.4. Functions

Return type

Function Name

Brief

void

Wdg_GetVersionInfo(Std_VersionInfoType * Versioninfo)

This service returns the version information of WDG module.

void

Wdg_Init(const Wdg_ConfigType * CfgPtr)

This service initializes the WDG driver.

Std_ReturnType

Wdg_SetMode(WdgIf_ModeType Mode)

Switches the watchdog into Mode type off mode, slow mode, fast mode.

void

Wdg_SetTriggerCondition(uint16 Timeout)

Sets the timeout value for the trigger counter.

Std_ReturnType

Wdg_PlatformInit(const Wdg_ConfigType * ConfigPtr)

Initialize the configuration settings.

Std_ReturnType

Wdg_SetModeConfig(const Wdg_ModeInfoType * ModeCfg)

Sets the requested Mode configuration settings into Watchdog registers.

void

Wdg_EnableWatchdog(void )

Enables the watchdog.

void

Wdg_DisableWatchdog(void )

Disables the watchdog.

void

Wdg_ServiceWatchdog(void )

Services the watchdog.

void

Wdg_GenerateImmediateEvent(void )

Generates the immediate watchdog reset/interrupt.

5.6.4.1. function Wdg_GetVersionInfo

void Wdg_GetVersionInfo(
    Std_VersionInfoType * Versioninfo
)

Brief: This service returns the version information of WDG module.

Parameters:

  • versioninfo - Pointer to store the WDG driver version information.

Returns:

  • None

Return: None

Precondition: This API is available only if WDG_GET_VERSION_INFO_API is STD_ON

Postcondition: None

5.6.4.2. function Wdg_Init

void Wdg_Init(
    const Wdg_ConfigType * CfgPtr
)

Brief: This service initializes the WDG driver.

This API is used to configure WDG Mode settings Pre-divider and Pre-scalers etc.

Parameters:

  • CfgPtr - Pointer to WDG driver configuration set.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.6.4.3. function Wdg_SetMode

Std_ReturnType Wdg_SetMode(
    WdgIf_ModeType Mode
)

Brief: Switches the watchdog into Mode type off mode, slow mode, fast mode.

Parameters:

  • Mode One of the following statically configured modes OFF_MODE, SLOW_MODE, FAST_MODE

Returns:

  • E_OK command has been accepted.

  • E_NOT_OK command has not been accepted

Return: Std_ReturnType

Precondition: None

Postcondition: None

5.6.4.4. function Wdg_SetTriggerCondition

void Wdg_SetTriggerCondition(
    uint16 Timeout
)

Brief: Sets the timeout value for the trigger counter.

Parameters:

  • Timeout Timeout value (milliseconds) for setting the trigger counter

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.6.4.5. function Wdg_PlatformInit

Std_ReturnType Wdg_PlatformInit(
    const Wdg_ConfigType * ConfigPtr
)

Brief: Initialize the configuration settings.

Parameters:

  • ConfigPtr pointer to the Watchdog configuration

Returns:

  • E_OK command has been accepted

  • E_NOT_OK command has not been accepted

Return: Std_ReturnType

Precondition: None

Postcondition: None

5.6.4.6. function Wdg_SetModeConfig

Std_ReturnType Wdg_SetModeConfig(
    const Wdg_ModeInfoType * ModeCfg
)

Brief: Sets the requested Mode configuration settings into Watchdog registers.

Parameters:

  • ModeCfg pointer to the Watchdog Mode settings

Returns:

  • E_OK command has been accepted

  • E_NOT_OK command has not been accepted

Return: Std_ReturnType

Precondition: None

Postcondition: None

5.6.4.7. function Wdg_EnableWatchdog

void Wdg_EnableWatchdog(
    void 
)

Brief: Enables the watchdog.

This function enables the watchdog timer.

Returns:

  • None

Return: None

Postcondition: None

5.6.4.8. function Wdg_DisableWatchdog

void Wdg_DisableWatchdog(
    void 
)

Brief: Disables the watchdog.

This function disables the watchdog timer.

Parameters:

  • None

Returns:

  • None

Return: None

Postcondition: None

5.6.4.9. function Wdg_ServiceWatchdog

void Wdg_ServiceWatchdog(
    void 
)

Brief: Services the watchdog.

This function resets the watchdog counter

Returns:

  • None

Return: None

Postcondition: None

5.6.4.10. function Wdg_GenerateImmediateEvent

void Wdg_GenerateImmediateEvent(
    void 
)

Brief: Generates the immediate watchdog reset/interrupt.

This function generates the immediate watchdog event

Parameters:

  • None

  • None

Returns:

  • None

Return: None

Postcondition: None