scuwdt
Vitis Drivers API Documentation
scuwdt Documentation

The Xilinx SCU watchdog timer driver (XScuWdt) supports the Xilinx SCU private watchdog timer hardware.The XScuWdt driver supports the following features:

  • Watchdog mode
  • Timer mode
  • Auto reload (timer mode only)

The watchdog counter register is a down counter and starts decrementing when the watchdog is started. In watchdog mode, when the counter reaches 0, the Reset flag is set in the Reset status register and the WDRESETREQ pin is asserted, causing a system reset. The Reset flag is not reset by normal processor reset and is cleared when written with a value of 1. This enables the user to differentiate a normal reset and a reset caused by watchdog time-out. The user needs to call XScuWdt_RestartWdt() periodically, to avoid the watchdog from being timed-out.

The IsWdtExpired function can be used to check if the watchdog was the cause of the last reset. In this situation, call Initialize then call IsWdtExpired. If the result is true, watchdog timeout caused the last system reset. The application then needs to clear the Reset flag.

In timer mode, when the counter reaches 0, the Event flag is set in the Interrupt status register and if interrupts are enabled, interrupt ID 30 is set as pending in the interrupt distributor. The IsTimerExpired function is used to check if the watchdog counter has decremented to 0 in timer mode. If auto-reload mode is enabled, the Counter register is automatically reloaded from the Load register.

Initialization and Configuration

The device driver enables higher layer software (e.g., an application) to communicate with the Watchdog Timer.

XScuWdt_CfgInitialize() API is used to initialize the Watchdog Timer. The user needs to first call the XScuWdt_LookupConfig() API which returns the Configuration structure pointer which is passed as a parameter to the XScuWdt_CfgInitialize() API.

Interrupts

The SCU Watchdog Timer supports interrupts in Timer mode.

This driver does not provide a Interrupt Service Routine (ISR) for the device. It is the responsibility of the application to provide one if needed. Refer to the interrupt example provided with this driver for details on using the Timer in interrupt mode.

Virtual Memory

This driver supports Virtual Memory. The RTOS is responsible for calculating the correct device base address in Virtual Memory space.

Threads

This driver is not thread safe. Any needs for threads or thread mutual exclusion must be satisfied by the layer above this driver.

Asserts

Asserts are used within all Xilinx drivers to enforce constraints on argument values. Asserts can be turned off on a system-wide basis by defining, at compile time, the NDEBUG identifier. By default, asserts are turned on and it is recommended that users leave asserts on during development.

Building the driver

The XScuWdt driver is composed of several source files. This allows the user to build and link only those parts of the driver that are necessary.



NOTE: The watchdog timer is not a part of the snoop control unit as indicated by the prefix "scu" in the name of the driver. It is an independent module in APU.

MODIFICATION HISTORY:
Ver   Who Date     Changes


1.00a sdm 01/15/10 First release 1.02a sg 07/17/12 Included xil_assert.h for CR 667947. This is an issue when the xstatus.h in the common driver overwrites the xstatus.h of the standalone BSP during the libgen. 2.1 sk 02/26/15 Modified the code for MISRA-C:2012 compliance. ms 03/17/17 Added readme.txt file in examples folder for doxygen generation. 2.3 mus 08/31/20 Updated makefile to support parallel make and incremental builds. It would help to reduce compilaton time. 2.3 sne 09/16/20 Fixed MISRA-C violations. 2.4 sne 02/04/21 Fixed Doxygen warnings. 2.5 asa 07/18/23 Added support for system device tree based workflow decoupling flow.