tmrctr: xtmrctr_low_level_example.c File Reference

| tmrctr Xilinx SDK Drivers API Documentation

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

Functions
xtmrctr_low_level_example.c File Reference

## Overview

This file contains a design example using the Timer Counter (XTmrCtr) low level driver 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  10/30/09 Updated the example as the macros in the driver are
                         renamed by removing _m in the definition.
                         Minor changes as per coding guidelines are done.
     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 | TmrCtrLowLevelExample (u32 TmrCtrBaseAddress, u8 TmrCtrNumber)
| This function does a minimal test on the timer counter device and the low level driver as a design example. More...
int | main (void)
| This function is the main function of the Tmrctr low level example. More...

## Function Documentation

int main | ( | void |  | ) |

This function is the main function of the Tmrctr low level example.

Parameters

  None. |

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

Note
  None.

References TmrCtrLowLevelExample().

int TmrCtrLowLevelExample | ( | u32 | TmrCtrBaseAddress,
|  | u8 | TmrCtrNumber
| ) |  |

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

The purpose of this function is to illustrate how to use the XTmrCtr low level driver.

Parameters

  TmrCtrBaseAddress | is the base address of the device.
  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 XTC_CSR_LOAD_MASK, XTmrCtr_Disable, XTmrCtr_Enable, XTmrCtr_GetControlStatusReg, XTmrCtr_GetTimerCounterReg, XTmrCtr_LoadTimerCounterReg, XTmrCtr_SetControlStatusReg, and XTmrCtr_SetLoadReg.

Referenced by main().