axipmon
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Groups Pages
xaxipmon_intr_example.c File Reference

Overview

This file contains a design example showing how to use the driver APIs of the AXI Performance Monitor driver in interrupt mode.

Note

Metric Counters are enabled. The Application/design for which Metrics need to be computed should be run and then the Metrics collected. Sampled Metric Counter is read after Sample Metric Counter Interrupt occurs.

MODIFICATION HISTORY:
Ver   Who    Date     Changes


1.00a bss 02/29/12 First release 2.00a bss 06/23/12 Updated to support v2_00a version of IP. 3.00a bss 09/03/12 Deleted XAxiPmon_SetAgent API to support v2_01a version of IP. 3.01a bss 10/25/12 Deleted XAxiPmon_EnableCountersData API to support new version of IP. 5.00a bss 10/25/12 Modified call to XAxiPmon_SetSampleInterval as per new driver API. 6.4 mus 01/07/16 Added support for ZynqMP interrupt controller 6.5 ms 01/23/17 Modified 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. 6.10 ht 06/23/23 Added support for system device-tree flow. 6.13 sd 07/10/25 Fix a gcc warning. 6.14 vlt 12/17/25 Update Doxygen comments to include SDT flow details.

#include "xaxipmon.h"
#include "xparameters.h"
#include "xstatus.h"
#include "xil_exception.h"
#include "stdio.h"
#include "xinterrupt_wrap.h"

Functions

int AxiPmonInterruptExample (UINTPTR BaseAddress, u32 *Metrics)
 This function runs a test on the AXI Performance Monitor device using the driver APIs. More...
 
int main (void)
 Main function that invokes the example in this file. More...
 

Function Documentation

int AxiPmonInterruptExample ( UINTPTR  BaseAddress,
u32 *  Metrics 
)

This function runs a test on the AXI Performance Monitor device using the driver APIs.

This function does the following tasks:

  • Initiate the AXI Performance Monitor device driver instance
  • Run self-test on the device
  • Setup Interrupt System
  • Sets Agent Number
  • Sets Metric Set 0 as Metrics for Metric Counter 0
  • Sets Upper and Lower Ranges for Incrementer 0
  • Sets and loads Sample Interval
  • Enables Metric Counters
  • Calls Application for which Metrics need to be computed
  • Enables Sample Interval Counter Interrupt
  • Wait for interrupt and disables Interrupts after Interrupt occurs
  • Reads Sampled Metric Counter 0
  • Disables Metric Counters
Parameters
BaseAddresscontains the base address of the device
Metricsis an user reference variable in which computed metrics will be filled
Returns
  • XST_SUCCESS if the example has completed successfully.
  • XST_FAILURE if the example has failed.
Note
In XSCT/classic flow, DeviceId is used to look up the device configuration.

Wait until Sample Interval Overflow occurs

Disable Sample Interval Counter

Disable Sample Interval Counter Overflow Interrupt

Disable Global Interrupt

References XAxiPmon_Config::BaseAddress, XAxiPmon::Config, XAxiPmon_Config::IntId, XAxiPmon_Config::IntrParent, XAPM_INCREMENTER_0, XAPM_IXR_SIC_OVERFLOW_MASK, XAPM_METRIC_COUNTER_0, XAPM_METRIC_SET_0, XAxiPmon_CfgInitialize(), XAxiPmon_DisableMetricsCounter(), XAxiPmon_DisableSampleIntervalCounter, XAxiPmon_EnableMetricsCounter(), XAxiPmon_EnableSampleIntervalCounter, XAxiPmon_GetSampledMetricCounter(), XAxiPmon_IntrDisable, XAxiPmon_IntrEnable, XAxiPmon_IntrGlobalDisable, XAxiPmon_IntrGlobalEnable, XAxiPmon_LoadSampleIntervalCounter, XAxiPmon_LookupConfig(), XAxiPmon_SelfTest(), XAxiPmon_SetIncrementerRange(), XAxiPmon_SetMetrics(), and XAxiPmon_SetSampleInterval().

Referenced by main().

int main ( void  )

Main function that invokes the example in this file.

Parameters
None.
Returns
  • XST_SUCCESS if the example has completed successfully.
  • XST_FAILURE if the example has failed.
Note
None.

References AxiPmonInterruptExample().