### Xilinx Processor IP Library

Software Drivers

Main Page | Data Structures | File List | Data Fields | Globals

# xtmrctr.c File Reference

## Detailed Description

Contains required functions for the XTmrCtr driver.

     MODIFICATION HISTORY:

     Ver   Who  Date     Changes
     ----- ---- -------- -----------------------------------------------
     1.00a ecm  08/16/01 First release
     1.00b jhl  02/21/02 Repartitioned the driver for smaller files
     1.10b mta  03/21/07 Updated to new coding style

## Functions
int | XTmrCtr_Initialize (XTmrCtr *InstancePtr, u16 DeviceId)
void | XTmrCtr_Start (XTmrCtr *InstancePtr, u8 TmrCtrNumber)
void | XTmrCtr_Stop (XTmrCtr *InstancePtr, u8 TmrCtrNumber)
u32 | XTmrCtr_GetValue (XTmrCtr *InstancePtr, u8 TmrCtrNumber)
void | XTmrCtr_SetResetValue (XTmrCtr *InstancePtr, u8 TmrCtrNumber, u32 ResetValue)
u32 | XTmrCtr_GetCaptureValue (XTmrCtr *InstancePtr, u8 TmrCtrNumber)
void | XTmrCtr_Reset (XTmrCtr *InstancePtr, u8 TmrCtrNumber)
int | XTmrCtr_IsExpired (XTmrCtr *InstancePtr, u8 TmrCtrNumber)

## Function Documentation

u32 XTmrCtr_GetCaptureValue | ( | XTmrCtr * | InstancePtr,
|  | u8 | TmrCtrNumber
| ) |

  | Returns the timer counter value that was captured the last time the external capture input was asserted. Parameters:
  | InstancePtr | is a pointer to the XTmrCtr instance.
  | 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: The current capture value for the indicated timer counter. Note: None.

u32 XTmrCtr_GetValue | ( | XTmrCtr * | InstancePtr,
|  | u8 | TmrCtrNumber
| ) |

  | Get the current value of the specified timer counter. The timer counter may be either incrementing or decrementing based upon the current mode of operation. Parameters:
  | InstancePtr | is a pointer to the XTmrCtr instance.
  | 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: The current value for the timer counter. Note: None.

int XTmrCtr_Initialize | ( | XTmrCtr * | InstancePtr,
|  | u16 | DeviceId
| ) |

  | Initializes a specific timer/counter instance/driver. Initialize fields of the XTmrCtr structure, then reset the timer/counter Parameters:
  | InstancePtr | is a pointer to the XTmrCtr instance.
  | DeviceId | is the unique id of the device controlled by this XTmrCtr component. Passing in a device id associates the generic XTmrCtr component to a specific device, as chosen by the caller or application developer.
Returns: XST_SUCCESS if initialization was successful XST_DEVICE_IS_STARTED if the device has already been started XST_DEVICE_NOT_FOUND if the device doesn't exist Note: None.

int XTmrCtr_IsExpired | ( | XTmrCtr * | InstancePtr,
|  | u8 | TmrCtrNumber
| ) |

  | Checks if the specified timer counter of the device has expired. In capture mode, expired is defined as a capture occurred. In compare mode, expired is defined as the timer counter rolled over/under for up/down counting. When interrupts are enabled, the expiration causes an interrupt. This function is typically used to poll a timer counter to determine when it has expired. Parameters:
  | InstancePtr | is a pointer to the XTmrCtr instance.
  | 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: TRUE if the timer has expired, and FALSE otherwise. Note: None.

void XTmrCtr_Reset | ( | XTmrCtr * | InstancePtr,
|  | u8 | TmrCtrNumber
| ) |

  | Resets the specified timer counter of the device. A reset causes the timer counter to set it's value to the reset value. Parameters:
  | InstancePtr | is a pointer to the XTmrCtr instance.
  | 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: None. Note: None.

void XTmrCtr_SetResetValue | ( | XTmrCtr * | InstancePtr,
|  | u8 | TmrCtrNumber,
|  | u32 | ResetValue
| ) |

  | Set the reset value for the specified timer counter. This is the value that is loaded into the timer counter when it is reset. This value is also loaded when the timer counter is started. Parameters:
  | InstancePtr | is a pointer to the XTmrCtr instance.
  | 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).
  | ResetValue | contains the value to be used to reset the timer counter.
Returns: None. Note: None.

void XTmrCtr_Start | ( | XTmrCtr * | InstancePtr,
|  | u8 | TmrCtrNumber
| ) |

  | Starts the specified timer counter of the device such that it starts running. The timer counter is reset before it is started and the reset value is loaded into the timer counter. If interrupt mode is specified in the options, it is necessary for the caller to connect the interrupt handler of the timer/counter to the interrupt source, typically an interrupt controller, and enable the interrupt within the interrupt controller. Parameters:
  | InstancePtr | is a pointer to the XTmrCtr instance.
  | 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: None. Note: None.

void XTmrCtr_Stop | ( | XTmrCtr * | InstancePtr,
|  | u8 | TmrCtrNumber
| ) |

  | Stops the timer counter by disabling it. It is the callers' responsibility to disconnect the interrupt handler of the timer_counter from the interrupt source, typically an interrupt controller, and disable the interrupt within the interrupt controller. Parameters:
  | InstancePtr | is a pointer to the XTmrCtr instance.
  | 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: None. Note: None.

Copyright © 1995-2009 Xilinx, Inc. All rights reserved.