wdttb
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
xwdttb_winwdt_intr_example.c File Reference

Overview

This file contains a design example using the TimeBase Watchdog Timer Device (WdtTb) driver and hardware device using interrupt mode (for the WDT interrupt).

This file contains an example that demonstrates Q&A functionality of the Window Watchdog.

Note

This example assumes that the reset output of the WdtTb 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


4.0 sha 02/04/16 First release 5.0 sne 03/26/20 Updated example to support versal platform. 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. 5.9 ht 07/22/24 Add support for peripheral tests in SDT flow 5.12 vlt 12/18/25 Update Doxygen comments to include SDT flow details.

Note

This example assumes that the reset output of the WdtTb 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.6 asa 01/13/23 First release of Q&A mode example. 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. 5.12 vlt 12/18/25 Update Doxygen comments to include SDT flow details.

 
#include "xparameters.h"
#include "xwdttb.h"
#include "xil_exception.h"
#include "xinterrupt_wrap.h"

Macros

#define WIN_WDT_SW_COUNT   0xF00000
 Number of clock cycles for second window. More...
 
#define WIN_WDT_SBC_COUNT   16
 Selected byte count. More...
 
#define WIN_WDT_BSS_COUNT   2
 Byte segment selected. More...
 

Functions

int WinWdtIntrExample (XWdtTb *WdtTbInstancePtr, UINTPTR BaseAddress)
 This function tests the functioning of the Window Watchdog Timer in the interrupt mode. More...
 
int main (void)
 Main function to call the WdtTb interrupt example. More...
 

Macro Definition Documentation

#define WIN_WDT_BSS_COUNT   2

Byte segment selected.

Referenced by WinWdtIntrExample().

#define WIN_WDT_SBC_COUNT   16

Selected byte count.

Referenced by WinWdtIntrExample().

#define WIN_WDT_SW_COUNT   0xF00000

Number of clock cycles for second window.

Referenced by WinWdtIntrExample().

Function Documentation

int main ( void  )

Main function to call the WdtTb interrupt example.

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

References WinWdtIntrExample().

int WinWdtIntrExample ( XWdtTb WdtTbInstancePtr,
UINTPTR  BaseAddress 
)

This function tests the functioning of the Window Watchdog Timer in the interrupt mode.

This function waits for interrupt programmed point in second window. If the interrupt has occurred, interrupt handler sets a flag and restarts the timer. This function then clears the interrupt, flag and waits for second interrupt to occur and continue waiting for second interrupt as mentioned above.

This function assumes that the reset output of the Window Watchdog Timer is not connected to the reset of the processor. The function allows the Window Watchdog Timer to timeout such that a reset will occur if it is connected.

Parameters
WdtTbInstancePtris a pointer to the instance of WdtTb driver.
BaseAddresscontains the base address of the device
Returns
  • XST_SUCCESS if interrupt example run successfully.
  • XST_FAILURE, if reset has occurred.
Note
In XSCT/classic flow, WdtTbDeviceId and WdtTbIntrId are used to look up the device configuration and set up interrupt handling.

References XWdtTb_Config::BaseAddr, XWdtTb::Config, XWdtTb_Config::IntrId, XWdtTb_Config::IntrParent, XWdtTb_Config::Name, WIN_WDT_BSS_COUNT, WIN_WDT_SBC_COUNT, WIN_WDT_SW_COUNT, XWdtTb_CfgInitialize(), XWdtTb_DisableFailCounter(), XWdtTb_DisablePsm(), XWdtTb_DisableSst(), XWdtTb_IntrClear(), XWdtTb_LookupConfig(), XWDTTB_NO_BAD_EVENT, XWdtTb_RestartWdt(), XWdtTb_SelfTest(), XWdtTb_SetByteCount(), XWdtTb_SetByteSegment(), XWdtTb_SetWindowCount(), XWdtTb_Start(), XWdtTb_Stop(), and XWT_WWDT.

Referenced by main().