wdttb: xwdttb_intr_example.c File Reference

| wdttb Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
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.

## 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.

Parameters

  None. |

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

  IntcInstancePtr | is a pointer to the instance of the INTC driver.
  WdtTbInstancePtr | is a pointer to the instance of WdtTb driver.
  WdtTbDeviceId | is the Device ID of the WdtTb Device and is typically XPAR_<WDTTB_instance>_DEVICE_ID value from xparameters.h.
  WdtTbIntrId | is 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().