tmrctr
Xilinx SDK Drivers API Documentation
xtmrctr_fast_intr_example.c File Reference

Overview

This file contains a design example using the timer counter driver (XTmCtr) and hardware device using fast interrupt mode.This example assumes that the interrupt controller is also present as a part of the system.

  MODIFICATION HISTORY:
  Ver   Who  Date        Changes

1.00a bss 07/31/12 First release 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 TmrCtrFastIntrExample (XIntc *IntcInstancePtr, XTmrCtr *TmrCtrInstancePtr, u16 DeviceId, u16 IntrId, u8 TmrCtrNumber)
 This function does a minimal test on the timer counter device and driver as a design example. More...
 
void TimerCounterHandler (void *CallBackRef, u8 TmrCtrNumber)
 This function is the handler which performs processing for the timer counter. More...
 
void TmrCtrDisableIntr (XIntc *IntcInstancePtr, u16 IntrId)
 This function disables the interrupts for the Timer. More...
 
void TmrCtr_FastHandler (void)
 This is the main function of the Tmrctr example using Fast Interrupt feature in MicroBlaze and Intc controller. More...
 

Function Documentation

◆ TimerCounterHandler()

void TimerCounterHandler ( void *  CallBackRef,
u8  TmrCtrNumber 
)

This function is the handler which performs processing for the timer counter.

It is called from an interrupt context such that the amount of processing performed should be minimized. It is called when the timer counter expires if interrupts are enabled.

This handler provides an example of how to handle timer counter interrupts but is application specific.

Parameters
CallBackRefis a pointer to the callback function
TmrCtrNumberis the number of the timer to which this handler is associated with.
Returns
None.
Note
None.

References XTmrCtr_IsExpired(), and XTmrCtr_SetOptions().

◆ TmrCtr_FastHandler()

void TmrCtr_FastHandler ( void  )

This is the main function of the Tmrctr example using Fast Interrupt feature in MicroBlaze and Intc controller.

This is the Fast Interrupt Handler for the Timer.

Parameters
None.
Returns
- XST_SUCCESS to indicate success.
  • XST_FAILURE to indicate a failure.
Note
None.
Returns
None.
Note
None.

Referenced by TmrCtrDisableIntr().

◆ TmrCtrDisableIntr()

void TmrCtrDisableIntr ( XIntc *  IntcInstancePtr,
u16  IntrId 
)

This function disables the interrupts for the Timer.

Parameters
IntcInstancePtris a reference to the Interrupt Controller driver Instance.
IntrIdis XPAR_<INTC_instance>_<Timer_instance>_VEC_ID value from xparameters.h.
Returns
None.
Note
None.

References TmrCtr_FastHandler(), and XTmrCtr_InterruptHandler().

◆ TmrCtrFastIntrExample()

int TmrCtrFastIntrExample ( XIntc *  IntcInstancePtr,
XTmrCtr TmrCtrInstancePtr,
u16  DeviceId,
u16  IntrId,
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. It initializes a timer counter and then sets it up in compare mode with auto reload such that a periodic interrupt is generated.

This function uses interrupt driven mode of the timer counter.

Parameters
IntcInstancePtris a pointer to the Interrupt Controller driver Instance
TmrCtrInstancePtris a pointer to the XTmrCtr driver Instance
DeviceIdis the XPAR_<TmrCtr_instance>_DEVICE_ID value from xparameters.h
IntrIdis XPAR_<INTC_instance>_<TmrCtr_instance>_VEC_ID value from xparameters.h
TmrCtrNumberis the number of the timer to which this handler is associated with.
Returns
  • XST_SUCCESS if the Test is successful
  • XST_FAILURE if the Test is not successful
Note
This function contains an infinite loop such that if interrupts are not working it may never return.

References XTmrCtr_Initialize(), and XTmrCtr_SelfTest().