wdttb
Vitis Drivers API Documentation
xwdttb_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).

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


1.00b hvm 05/10/06 First release 1.00b sv 05/30/06 Updated to support interrupt examples in Test App 1.11a hvm 03/30/09 Modified the example to avoid a race condition 2.00a ktn 10/22/09 Updated the example to use the HAL APIs/macros. Updated the example with support for MicroBlaze. 2.00a ssb 01/11/01 Updated the example to be used with the SCUGIC in Zynq. 4.0 sha 02/04/16 Added debug messages. Updated WdtTbInstancePtr->RegBaseAddress -> WdtTbInstancePtr->Config.BaseAddr. Calling XWdtTb_LookupConfig and XWdtTb_CfgInitialize functions instead of XWdtTb_Initialize for initialization. 5.0 sne 03/26/20 Updated example with interrupt id's. 5.1 sne 06/01/20 Corrected fabric watchdog interrupt id. 5.7 sb 07/12/23 Added support for system device-tree flow.

Functions

int WdtTbIntrExample (INTC *IntcInstancePtr, XWdtTb *WdtTbInstancePtr, u16 WdtTbDeviceId, u16 WdtTbIntrId)
 This function tests the functioning of the TimeBase WatchDog Timer module in the Interrupt mode (for the WDT interrupt). More...
 
int main (void)
 Main function to call the WdtTb interrupt example. More...
 

Function Documentation

int main ( void  )

Main function to call the WdtTb interrupt example.

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

References WdtTbIntrExample().

int WdtTbIntrExample ( INTC *  IntcInstancePtr,
XWdtTb WdtTbInstancePtr,
u16  WdtTbDeviceId,
u16  WdtTbIntrId 
)

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

After one expiration of the WDT timeout interval, an interrupt is generated and the WDT state bit is set to one in the status register. If the state bit is not cleared (by writing a 1 to the state bit) before the next expiration of the timeout interval, a WDT reset is generated. A WDT reset sets the WDT 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 WdtTb 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 INTC driver.
WdtTbInstancePtris a pointer to the instance of WdtTb driver.
WdtTbDeviceIdis the Device ID of the WdtTb Device and is typically XPAR_<WDTTB_instance>_DEVICE_ID value from xparameters.h.
WdtTbIntrIdis the Interrupt Id of the WatchDog and is typically XPAR_<INTC_instance>_<WDTTB_instance>_WDT_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::Config, XWdtTb_CfgInitialize(), XWdtTb_LookupConfig(), XWdtTb_ReadReg, XWdtTb_SelfTest(), XWdtTb_Start(), XWdtTb_Stop(), XWT_CSR0_WRS_MASK, and XWT_TWCSR0_OFFSET.

Referenced by main().