wdttb: xwdttb_example.c File Reference

| wdttb Xilinx SDK Drivers API Documentation

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

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

## Functions
int | WdtTbExample (u16 DeviceId)
| 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.

Parameters

  None. |

Returns
  - XST_SUCCESS if example ran successfully.
  - XST_FAILURE if unsuccessful.

Note
  None.

References WdtTbExample().

int WdtTbExample | ( | u16 | DeviceId | ) |

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

  DeviceId | is the XPAR_<WDTB_instance>_DEVICE_ID value from xparameters.h.

Returns
  - XST_SUCCESS if WRS bit is not set in next two subsequent timer expiry state.
  - XST_FAILURE otherwise.

Note
  None.

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().