wdttb
Vitis Drivers API Documentation
xwdttb_gwdt_intr_example.c File Reference

Overview

This file contains a design example using the Generic Watchdog Timer Device (Gwdt) driver and hardware device using interrupt mode (for the GWDT interrupt).

Note

This example assumes that the reset output of the GWDT device is not connected to the reset of the processor. This example will not return if the interrupts are not working.

MODIFICATION HISTORY:
Ver   Who  Date     Changes


5.0 sne 03/26/20 First release 5.1 sne 06/01/20 Configured Generic watchdog offset value. 5.7 sb 06/27/23 Correct the interrupt ID for Versal-net platform. 5.7 sb 07/12/23 Added support for system device-tree flow.

 

Functions

int GWdtIntrExample (XScuGic *IntcInstancePtr, XWdtTb *GWdtInstancePtr, u16 GWdtDeviceId, u16 GWdtIntrId)
 This function tests the functioning of the Generic WatchDog Timer module in the Interrupt mode (for the gwdt_ws0 interrupt). More...
 
int main (void)
 Main function to call the Generic Wdt interrupt example. More...
 

Function Documentation

int GWdtIntrExample ( XScuGic *  IntcInstancePtr,
XWdtTb GWdtInstancePtr,
u16  GWdtDeviceId,
u16  GWdtIntrId 
)

This function tests the functioning of the Generic WatchDog Timer module in the Interrupt mode (for the gwdt_ws0 interrupt).

After one expiration of the GWDT timeout interval, an interrupt is generated and the GWS[1] state bit is set to one in the Generic Watchdog Control and Status Register register. If the system can attempt to take corrective action that includes refreshing the watchdog within the second watch period. If the refresh is successful, the system returns to the previous normal operation. If it fails, then the second watch period expires and a second signal is generated. A GWDT reset sets the GWS[2] reset status bit in the status register so that the application code can determine if the last system reset was a WDT reset.

This function assumes that the reset output of the GWDT device is not connected to the reset of the processor. The function allows the watchdog timer to timeout such that a reset will occur if it is connected.

Parameters
IntcInstancePtris a pointer to the instance of the XScuGic driver.
GWdtInstancePtris a pointer to the instance of WdtTb driver.
GWdtDeviceIdis the Device ID of the GWDT Device and is typically XPAR_<GWDT_instance>_DEVICE_ID value from xparameters.h.
GWdtIntrIdis the Interrupt Id of the WatchDog and is typically XPAR_<FABRIC_instance>_<GWDT_instance>_INTERRUPT_VEC_ID value from xparameters.h.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE, otherwise.
Note
This example will not return if the interrupts are not working.

References XWdtTb_Config::BaseAddr, XWdtTb_CfgInitialize(), XWdtTb_LookupConfig(), XWdtTb_SelfTest(), XWdtTb_SetGenericWdtWindow(), XWdtTb_Start(), and XWdtTb_Stop().

Referenced by main().

int main ( void  )

Main function to call the Generic Wdt interrupt example.

Returns
  • XST_SUCCESS if successful
  • XST_FAILURE, otherwise.
Note
None.

References GWdtIntrExample(), and WdtTbIntrExample().