tmrctr
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Groups Pages
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. 4.15 bdk 12/08/25 Updated comments to support SDT flow for Doxygen documentation.

#include "xparameters.h"
#include "xtmrctr.h"
#include "xil_printf.h"

Functions

int TmrCtrPolledExample (UINTPTR BaseAddr, 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 ( UINTPTR  BaseAddr,
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
BaseAddris the base address of the device
TmrCtrNumberis 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
In XSCT/classic flow, DeviceId is used to look up the device configuration. 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().