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

Overview

This file contains a design example using the Watchdog Timer Timebase driver (XWdtTb) and hardware device.

Note

None.

MODIFICATION HISTORY:

 Ver   Who  Date     Changes


1.00b jhl 02/13/02 First release 1.00b sv 04/26/05 Minor changes to comply to Doxygen and coding guidelines 2.00a ktn 12/02/09 Updated the example to use the HAL APIs/macros. Updated this example to check for Watchdog timer reset condition instead of timer expiry state to avoid a race condition 4.0 sha 02/04/16 Added debug messages. Updated WatchdogTimebase.RegBaseAddress -> WatchdogTimebase.Config.BaseAddr. Calling XWdtTb_LookupConfig and XWdtTb_CfgInitialize functions instead of XWdtTb_Initialize for initialization. 4.5 nsk 08/07/19 Add macro to support testapp generation for polled mode 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.10 ht 10/28/24 Fix compilation warnings in SDT flow peripheral tests. 5.11 bkv 08/29/25 Fixed GCC Warning. 5.12 vlt 12/18/25 Update Doxygen comments to include SDT flow details.

#include "xparameters.h"
#include "xwdttb.h"

Functions

int WdtTbExample (XWdtTb *WdtTbInstancePtr, UINTPTR BaseAddress)
 This function tests the functioning of the TimeBase WatchDog Timer module in the polled mode. More...
 
int main (void)
 Main function to call the Wdttb driver example. More...
 

Function Documentation

int main ( void  )

Main function to call the Wdttb driver example.

Returns
  • XST_SUCCESS if example ran successfully.
  • XST_FAILURE if unsuccessful.
Note
None.

References WdtTbExample().

int WdtTbExample ( XWdtTb WdtTbInstancePtr,
UINTPTR  BaseAddress 
)

This function tests the functioning of the TimeBase WatchDog Timer module in the polled mode.

After one expiration of the WDT timeout interval, 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.

This function checks for Watchdog timer reset condition in two timer expiry state.

This function may require some time (seconds or even minutes) to execute because it waits for the watchdog timer to expire.

Parameters
WdtTbInstancePtris a pointer to the instance of XWdtTb driver.
BaseAddresscontains the base address of the device
Returns
  • XST_SUCCESS if WRS bit is not set in next two subsequent timer expiry state.
  • XST_FAILURE otherwise.
Note
In XSCT/classic flow, DeviceId is used to look up the device configuration.

References XWdtTb_Config::BaseAddr, XWdtTb::Config, XWdtTb_CfgInitialize(), XWdtTb_IsWdtExpired(), XWdtTb_LookupConfig(), XWdtTb_ReadReg, XWdtTb_RestartWdt(), XWdtTb_SelfTest(), XWdtTb_Start(), XWdtTb_Stop(), XWT_CSR0_WRS_MASK, and XWT_TWCSR0_OFFSET.

Referenced by main().