MCUSW
WDG Driver API

Introduction

The WDG driver provides services for handlign the watch dog timer on the SOC.

*        Digital Windowed Watchdog(DWWD) Overview :
*        The Digital Watchdog Timer(DWT) generates reset after a programmable
*        period, if not serviced within that period. In DWT, time-out
*        boundary is configurable.
*        In DWWD, along with configurable time-out boundary, the start time
*        boundary is also configurable. The DWWD can generate Reset or
*        Interrupt, if not serviced within window(Open Window) defined by
*        start time and time-out boundary. Also the DWWD can generate Reset or
*        Interrupt if serviced outside Open Window (within Closed Window).
*        Generation of Reset or Interrupt depends on the DWWD Reaction
*        configuration.
*
*        DWWD Down Counter Overview :
*        Upper 12 bit part of the down counter is configurable and
*        remaining 13 bit are always 1.
*        Minimum possible time-out value is 2^13 RTI clock cycles.
*        Maximum possible time-out value is 2^25 RTI clock cycles.
*        Example :
*        RTI frequency : 32kHz
*        12 bit preload value : 0x004
*        25 bit preload value : 0x0009FFF
*        time-out value(in RTI clock cycles) : 40959.
*        time-out value(in seconds) : 40959 + 1 / 32000 = 1.28 seconds.
*
*
*        DWWD Window Sizes Overview :
*         time-out value...........................................3 2 1 0
*   (100%)|___________________________Open Window________________________|
*    (50%)|         Closed Window         |________Open Window___________|
*    (25%)|            Closed Window                      |___OW_________|
*  (12.5%)|                 Closed Window                         |_OW___|
*  (6.25%)|                     Closed Window                        |OW |
* (3.125%)|                         Closed Window                     |OW|
*        For time-out value calculation refer DWWD Down Counter Overview.
*
*
*  
See also
WDG Configuration

Sub Modules

 WDG Configuration
 

Functions

void Wdg_GetVersionInfo (Std_VersionInfoType *versioninfo)
 This service returns the version information of this module. More...
 
void Wdg_Init (const Wdg_ConfigType *CfgPtr)
 This service initializes the WDG driver. More...
 
void Wdg_SetTriggerCondition (uint16 timeout)
 Sets the timeout value for the trigger counter. More...
 
void Wdg_Trigger (void)
 This function triggers the servicing of the watchdog. More...
 
Std_ReturnType Wdg_SetMode (WdgIf_ModeType Mode)
 This function triggers the servicing of the watchdog. More...
 
Std_ReturnType Wdg_RegisterReadback (Wdg_RegisterReadbackType *regRbPtr)
 This function reads the important registers of the hardware unit and returns the value in the structure. More...
 

WDG Driver Module SW Version Info

Defines for WDG Driver version used for compatibility checks

#define WDG_SW_MAJOR_VERSION   (1U)
 Driver Implementation Major Version. More...
 
#define WDG_SW_MINOR_VERSION   (3U)
 Driver Implementation Minor Version. More...
 
#define WDG_SW_PATCH_VERSION   (4U)
 Driver Implementation Patch Version. More...
 

WDG Driver Module AUTOSAR Version Info

Defines for WDG Driver AUTOSAR version used for compatibility checks

#define WDG_AR_RELEASE_MAJOR_VERSION   (4U)
 AUTOSAR Major version specification implemented by WDG Driver. More...
 
#define WDG_AR_RELEASE_MINOR_VERSION   (3U)
 AUTOSAR Minor version specification implemented by WDG Driver. More...
 
#define WDG_AR_RELEASE_REVISION_VERSION   (1U)
 AUTOSAR Patch version specification implemented by WDG Driver. More...
 

WDG Driver ID Info

#define WDG_VENDOR_ID   ((uint16) 44U)
 Texas Instruments Vendor ID. More...
 
#define WDG_MODULE_ID   ((uint16) 102U)
 WDG Driver Module ID. More...
 
#define WDG_INSTANCE_ID   ((uint8) 0U)
 WDG Driver Instance ID. More...
 

WDG Error Codes

Error codes returned by Driver functions

#define WDG_E_DRIVER_STATE   ((uint8) 0x10U)
 ERROR:Invalid driver state. More...
 
#define WDG_E_PARAM_MODE   ((uint8) 0x11U)
 ERROR:Invalid mode param. More...
 
#define WDG_E_PARAM_CONFIG   ((uint8) 0x12U)
 ERROR:Invalid config param. More...
 
#define WDG_E_PARAM_TIMEOUT   ((uint8) 0x13U)
 ERROR:Invalid timeout value. More...
 
#define WDG_E_PARAM_POINTER   ((uint8) 0x14U)
 ERROR:Invalid NULL ptr param. More...
 
#define WDG_E_INIT_FAILED   ((uint8) 0x15U)
 ERROR:Invalid configuration set selection. More...
 

WDG Service Ids

The Service Id is one of the argument to Det_ReportError function and is used to identify the source of the error

#define WDG_API_INIT   ((uint8) 0x00U)
 Wdg_Init() More...
 
#define WDG_API_SET_MODE   ((uint8) 0x01U)
 Wdg_SetMode() More...
 
#define WDG_SET_TRIGGER_CONDITION   ((uint8) 0x03U)
 Wdg_SetTriggerCondition() More...
 
#define WDG_API_GET_VERSION_INFO   ((uint8) 0x04U)
 Wdg_GetVersionInfo() More...
 
#define WDG_API_TRIGGER   ((uint8) 0x05U)
 Wdg_Trigger() More...
 
#define WDG_API_REGISTER_READBACK   ((uint8) 0x06U)
 Wdg_RegisterReadback() More...
 

Watchdog Window Size

Windowed watchdog trigger window size define

#define WDG_WINDOW_100_PERCENT   ((uint32) 0x00000005U)
 Window open 100% of interval. More...
 
#define WDG_WINDOW_50_PERCENT   ((uint32) 0x00000050U)
 Window open 50% of interval. More...
 
#define WDG_WINDOW_25_PERCENT   ((uint32) 0x00000500U)
 Window open 25% of interval. More...
 
#define WDG_WINDOW_12P5_PERCENT   ((uint32) 0x00005000U)
 Window open 12.5% of interval. More...
 
#define WDG_WINDOW_6P25_PERCENT   ((uint32) 0x00050000U)
 Window open 6.25% of interval. More...
 
#define WDG_WINDOW_3P125_PERCENT   ((uint32) 0x00500000U)
 Window open 3.125% of interval. More...
 

Macro Definition Documentation

◆ WDG_SW_MAJOR_VERSION

#define WDG_SW_MAJOR_VERSION   (1U)

Driver Implementation Major Version.

◆ WDG_SW_MINOR_VERSION

#define WDG_SW_MINOR_VERSION   (3U)

Driver Implementation Minor Version.

◆ WDG_SW_PATCH_VERSION

#define WDG_SW_PATCH_VERSION   (4U)

Driver Implementation Patch Version.

◆ WDG_AR_RELEASE_MAJOR_VERSION

#define WDG_AR_RELEASE_MAJOR_VERSION   (4U)

AUTOSAR Major version specification implemented by WDG Driver.

◆ WDG_AR_RELEASE_MINOR_VERSION

#define WDG_AR_RELEASE_MINOR_VERSION   (3U)

AUTOSAR Minor version specification implemented by WDG Driver.

◆ WDG_AR_RELEASE_REVISION_VERSION

#define WDG_AR_RELEASE_REVISION_VERSION   (1U)

AUTOSAR Patch version specification implemented by WDG Driver.

◆ WDG_VENDOR_ID

#define WDG_VENDOR_ID   ((uint16) 44U)

Texas Instruments Vendor ID.

◆ WDG_MODULE_ID

#define WDG_MODULE_ID   ((uint16) 102U)

WDG Driver Module ID.

◆ WDG_INSTANCE_ID

#define WDG_INSTANCE_ID   ((uint8) 0U)

WDG Driver Instance ID.

◆ WDG_E_DRIVER_STATE

#define WDG_E_DRIVER_STATE   ((uint8) 0x10U)

ERROR:Invalid driver state.

◆ WDG_E_PARAM_MODE

#define WDG_E_PARAM_MODE   ((uint8) 0x11U)

ERROR:Invalid mode param.

◆ WDG_E_PARAM_CONFIG

#define WDG_E_PARAM_CONFIG   ((uint8) 0x12U)

ERROR:Invalid config param.

◆ WDG_E_PARAM_TIMEOUT

#define WDG_E_PARAM_TIMEOUT   ((uint8) 0x13U)

ERROR:Invalid timeout value.

◆ WDG_E_PARAM_POINTER

#define WDG_E_PARAM_POINTER   ((uint8) 0x14U)

ERROR:Invalid NULL ptr param.

◆ WDG_E_INIT_FAILED

#define WDG_E_INIT_FAILED   ((uint8) 0x15U)

ERROR:Invalid configuration set selection.

◆ WDG_API_INIT

#define WDG_API_INIT   ((uint8) 0x00U)

◆ WDG_API_SET_MODE

#define WDG_API_SET_MODE   ((uint8) 0x01U)

◆ WDG_SET_TRIGGER_CONDITION

#define WDG_SET_TRIGGER_CONDITION   ((uint8) 0x03U)

◆ WDG_API_GET_VERSION_INFO

#define WDG_API_GET_VERSION_INFO   ((uint8) 0x04U)

◆ WDG_API_TRIGGER

#define WDG_API_TRIGGER   ((uint8) 0x05U)

◆ WDG_API_REGISTER_READBACK

#define WDG_API_REGISTER_READBACK   ((uint8) 0x06U)

◆ WDG_WINDOW_100_PERCENT

#define WDG_WINDOW_100_PERCENT   ((uint32) 0x00000005U)

Window open 100% of interval.

◆ WDG_WINDOW_50_PERCENT

#define WDG_WINDOW_50_PERCENT   ((uint32) 0x00000050U)

Window open 50% of interval.

◆ WDG_WINDOW_25_PERCENT

#define WDG_WINDOW_25_PERCENT   ((uint32) 0x00000500U)

Window open 25% of interval.

◆ WDG_WINDOW_12P5_PERCENT

#define WDG_WINDOW_12P5_PERCENT   ((uint32) 0x00005000U)

Window open 12.5% of interval.

◆ WDG_WINDOW_6P25_PERCENT

#define WDG_WINDOW_6P25_PERCENT   ((uint32) 0x00050000U)

Window open 6.25% of interval.

◆ WDG_WINDOW_3P125_PERCENT

#define WDG_WINDOW_3P125_PERCENT   ((uint32) 0x00500000U)

Window open 3.125% of interval.

Function Documentation

◆ Wdg_GetVersionInfo()

void Wdg_GetVersionInfo ( Std_VersionInfoType *  versioninfo)

This service returns the version information of this module.

*  Service name      : Wdg_GetVersionInfo
*  Syntax            : void Wdg_GetVersionInfo(Std_VersionInfoType*
*                                  versioninfo)
*  Mode              : User Mode (Non-Privileged Mode)
*  Service ID[hex]   : 0x04U
*  Sync/Async        : Synchronous
*  Reentrancy        : Reentrant
*  Parameters (in)   : None
*  Parameters (inout): None
*  Parameters (out)  : versioninfo - Pointer to where to store the version
*                      information of this module.
*  Return value      : None
*  Description       : This service returns the version information of this
*                      module
*  

◆ Wdg_Init()

void Wdg_Init ( const Wdg_ConfigType CfgPtr)

This service initializes the WDG driver.

*  Service name      : Wdg_Init
*  Syntax            : void Wdg_Init(const Wdg_ConfigType* CfgPtr)
*  Mode              : Supervisor Mode (Privileged Mode)
*  Service ID[hex]   : 0x0
*  Sync/Async        : Synchronous
*  Reentrancy        : Non Reentrant
*  Parameters (in)   : CfgPtr - Pointer to WDG driver configuration set.
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : None
*  Description       : This service initializes the WDG driver
*  

◆ Wdg_SetTriggerCondition()

void Wdg_SetTriggerCondition ( uint16  timeout)

Sets the timeout value for the trigger counter.

*  Service name      : Wdg_SetTriggerCondition
*  Syntax            : void Wdg_SetTriggerCondition( uint16 timeout )
*  Mode              : Supervisor Mode (Privileged Mode)
*  Service ID[hex]   : 0x03
*  Sync/Async        : Synchronous
*  Reentrancy        : Non Reentrant
*  Parameters (in)   : timeout - Timeout value (milliseconds) for setting the
*                      trigger counter
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : None
*  Description       : Sets the timeout value for the trigger counter
*  

◆ Wdg_Trigger()

void Wdg_Trigger ( void  )

This function triggers the servicing of the watchdog.

*   Function name     : Wdg_Trigger
*   Syntax            : void Wdg_Trigger( void )
*   Mode              : Supervisor Mode (Privileged Mode)
*   Service ID[hex]   : 0x05
*   Sync/Async        : Synchronous
*   Reentrancy        : Non-Reentrant
*   Parameters (in)   : None
*   Parameters (inout): None
*   Parameters (out)  : None
*   Return value      : None
*   Description       : This function is the watchdog trigger
*                       This function is invoked from WdgIsr
*  

◆ Wdg_SetMode()

Std_ReturnType Wdg_SetMode ( WdgIf_ModeType  Mode)

This function triggers the servicing of the watchdog.

*   Function name     : Wdg_SetMode
*   Syntax            : Std_ReturnType Wdg_SetMode(WdgIf_ModeType Mode)
*   Mode              : User Mode (Non-Privileged Mode)
*   Service ID[hex]   : 0x01
*   Sync/Async        : Synchronous
*   Reentrancy        : Non-Reentrant
*   Parameters (in)   : Mode
*   Parameters (inout): None
*   Parameters (out)  : None
*   Return value      : E_OK
*   Description       : This function is not supported.
*                       Always returns E_OK, Wdg_SetMode is made available because
*                       WDG Interface layer expects this function to be present.
*  

◆ Wdg_RegisterReadback()

Std_ReturnType Wdg_RegisterReadback ( Wdg_RegisterReadbackType regRbPtr)

This function reads the important registers of the hardware unit and returns the value in the structure.

This API should be called after Wdg_Init is called. Otherwise this API will return E_NOT_OK.

This API could be used to readback the register contents after Wdg_Init and then the readback value could be compared during WDG execution to check the correctness of the HW unit. Since this API is used for this purpose, register returned are the ones which doesn't change after init.

*  Service name        : Wdg_RegisterReadback
*  Mode                : Supervisor Mode (Privileged Mode)
*  Sync/Async          : Synchronous
*  Service ID[hex]     : 0x06
*  Reentrancy          : Reentrant
*  Parameters (inout)  : regRbPtr - Pointer to where to store the readback
*                        values. If this pointer is NULL_PTR, then the API
*                        will return E_NOT_OK.
*  Return value        : Std_ReturnType
*                        E_OK: Register read back has been done
*                        E_NOT_OK: Register read back failed
*