| tmrctr Vitis Drivers API Documentation

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

Functions
xtmrctr_polled_example.c File Reference

## Overview

This file contains a design example using the Timer Counter driver (XTmrCtr) and hardware device in a polled mode.

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  11/26/09 Minor changes as per coding guidelines.
     4.2   ms   01/23/17 Added xil_printf statement in main function to
                         ensure that "Successfully ran" and "Failed" strings
                         are available in all examples. This is a fix for
                         CR-965028.

## Functions
int | TmrCtrPolledExample (u16 DeviceId, u8 TmrCtrNumber)
| This function does a minimal test on the timer counter device and driver as a design example. More...
int | main (void)
| Main function to call the polled example. More...

## Function Documentation

int main | ( | void |  | ) |

Main function to call the polled example.

Parameters

  None. |

Returns
  XST_SUCCESS to indicate success, else XST_FAILURE to indicate a Failure.

Note
  None.

References TmrCtrPolledExample().

int TmrCtrPolledExample | ( | u16 | DeviceId,
|  | u8 | TmrCtrNumber
| ) |  |

This function does a minimal test on the timer counter device and driver as a design example.

The purpose of this function is to illustrate how to use the XTmrCtr component in a polled mode.

Parameters

  DeviceId | is the XPAR_<TMRCTR_instance>_DEVICE_ID value from xparameters.h
  TmrCtrNumber | is the timer counter of the device to operate on. Each device may contain multiple timer counters. The timer number is a zero based number with a range of 0 - (XTC_DEVICE_TIMER_COUNT - 1).

Returns
  XST_SUCCESS to indicate success, else XST_FAILURE to indicate a Failure.

Note

This function contains a loop which waits for the value of a timer counter to change. If the hardware is not working correctly, this function may not return.

References XTmrCtr_GetValue(), XTmrCtr_Initialize(), XTmrCtr_SelfTest(), XTmrCtr_SetOptions(), and XTmrCtr_Start().

Referenced by main().