![]() |
tmrctr
Vitis Drivers API Documentation
|
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. 4.5 mus 07/05/18 Updated example to call TmrCtrDisableIntr function with correct arguments. Presently device id is being passed instead of interrupt id. It fixes CR#1006251. 4.5 mus 07/05/18 Fixed checkpatch errors and warnings. 4.12 ml 12/07/23 Make TimerExpired as a static variable. 4.12 mus 03/25/24 Update RESET_VALUE to reduce extecution time to 1 seconds.
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... | |
static 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.
CallBackRef | is a pointer to the callback function |
TmrCtrNumber | is the number of the timer to which this handler is associated with. |
It is called from an interrupt context.
CallBackRef | is a pointer to the callback function |
TmrCtrNumber | is the number of the timer to which this handler is associated with. |
References XTmrCtr_IsExpired(), and XTmrCtr_SetOptions().
Referenced by TmrCtrCascadeIntrExample(), TmrCtrFastIntrExample(), TmrCtrIntrExample(), and TmrCtrPwmExample().
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.
IntcInstancePtr | is a pointer to the Interrupt Controller driver Instance |
TmrCtrInstancePtr | is a pointer to the XTmrCtr driver Instance |
DeviceId | is the XPAR_<TmrCtr_instance>_DEVICE_ID value from xparameters.h |
IntrId | is XPAR_<INTC_instance>_<TmrCtr_instance>_VEC_ID value from xparameters.h |
TmrCtrNumber | is the number of the timer to which this handler is associated with. |
References XTmrCtr::Config, TimerCounterHandler(), XTmrCtr_Initialize(), XTmrCtr_SelfTest(), XTmrCtr_SetHandler(), XTmrCtr_SetOptions(), XTmrCtr_SetResetValue(), XTmrCtr_Start(), and XTmrCtr_Stop().