tmrctr: xtmrctr_intr_64bit_example.c File Reference

| tmrctr Xilinx SDK Drivers API Documentation

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

Functions
xtmrctr_intr_64bit_example.c File Reference

## Overview

This file contains a design example using the timer counter driver (XTmCtr) and hardware device using interrupt mode with the counters configured in cascasde mode for a 64 bit operation.

Both the timers should enabled in HW configuration for the cascade mode of operation.

The cascade mode of operation is present in the new versions of the axi_timer IP. Please check the HW Datasheet to see whether this feature is present in the version of the IP that you are using.

This example assumes that the interrupt controller is also present as a part of the system.

     MODIFICATION HISTORY:

     Ver   Who  Date         Changes

     2.04a sdm  07/15/11 Created based on the xtmrctr_intr_example
     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.

## Functions
int | TmrCtrCascadeIntrExample (XIntc *IntcInstancePtr, XTmrCtr *TmrCtrInstancePtr, u16 DeviceId, u16 IntrId)
| This function does a minimal test on the timer counter device and driver as a design example. More...
int | main (void)
| This function is the main function of the Tmrctr 64 bit example using Interrupts. More...

## Function Documentation

int main | ( | void |  | ) |

This function is the main function of the Tmrctr 64 bit example using Interrupts.

Parameters

  None. |

Returns

          - XST_SUCCESS to indicate success
          - XST_FAILURE to indicate a failure.

Note
  None.

References TmrCtrCascadeIntrExample().

int TmrCtrCascadeIntrExample | ( | XIntc * | IntcInstancePtr,
|  | XTmrCtr * | TmrCtrInstancePtr,
|  | u16 | DeviceId,
|  | u16 | IntrId
| ) |  |

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 driver in cascade mode of operation. 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

  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

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 XTC_CASCADE_MODE_OPTION, XTmrCtr_Initialize(), XTmrCtr_Reset(), XTmrCtr_SelfTest(), XTmrCtr_SetHandler(), XTmrCtr_SetOptions(), XTmrCtr_SetResetValue(), XTmrCtr_Start(), and XTmrCtr_Stop().

Referenced by main().