axipmon
Vitis Drivers API Documentation
xaxipmon_ocm_example.c File Reference

Overview

This file contains a design example showing how to use the driver APIs of the AXI Performance Monitor driver to measure the following metrics captured at OCM of Zynq MP:

  - Write Transcation Count
  - Write Byte Count
  - Read Transcation Count
  - Read Byte Count
MODIFICATION HISTORY:
Ver   Who    Date     Changes


1.00a bss 04/01/15 First release 6.5 sg 11/02/16 Updated device ID to OCM PSU APM ID 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.

Functions

int ApmCheck (u32 *BufferPtr, u16 Wtx, u16 Wbc, u16 Rtx, u16 Rbc)
 Checks the metrics passed to this function are same as collected by APM. More...
 
void OcmTransaction ()
 Generates write and read transcations to OCM and reads metrics captured by APM. More...
 
int ApmMetricConfig (XAxiPmon *InstancePtr, u8 slot, u8 Metric1, u8 Metric2)
 Sets Counter 0 and Counter 1 for collecting the passed metrics. More...
 
void ReadMetrics (XAxiPmon *InstancePtr, u32 *BufferPtr, u8 Counter1, u8 Counter2)
 Reads metrics from APM counters to buffer. More...
 
int main (void)
 Main function that invokes the example in this file. More...
 

Function Documentation

int ApmCheck ( u32 *  BufferPtr,
u16  Wtx,
u16  Wbc,
u16  Rtx,
u16  Rbc 
)

Checks the metrics passed to this function are same as collected by APM.

Parameters
BufferPtris pointer to buffer containing captured metrics.
Wtxis Write transaction count value to be checked.
Wbcis Write byte count value to be checked.
Rtxis Read transaction count value to be checked.
Rbcis Read byte count value to be checked.
Returns
  • XST_SUCCESS if metrics passed are equal to metrics collected by APM.
  • XST_FAILURE if any of the metrics passed is not equal to metrics collected by APM.
Note
None.

Referenced by main().

int ApmMetricConfig ( XAxiPmon InstancePtr,
u8  slot,
u8  Metric1,
u8  Metric2 
)

Sets Counter 0 and Counter 1 for collecting the passed metrics.

Parameters
InstancePtris pointer to APM instance.
Slotis APM slot.
Metric1is Metric to be captured by Counter 1
Metric2is Metric to be captured by Counter 2
Returns
  • XST_SUCCESS on success.
  • XST_FAILURE on failure.
Note
None.

References XAPM_METRIC_COUNTER_0, XAPM_METRIC_COUNTER_1, XAxiPmon_EnableMetricsCounter(), XAxiPmon_ResetGlobalClkCounter(), XAxiPmon_ResetMetricCounter(), XAxiPmon_SetMetrics(), and XAxiPmon_StartCounters().

Referenced by OcmTransaction().

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 ApmCheck(), XAxiPmon_Config::BaseAddress, OcmTransaction(), XAxiPmon_CfgInitialize(), XAxiPmon_DisableMetricsCounter(), and XAxiPmon_LookupConfig().

void OcmTransaction ( )

Generates write and read transcations to OCM and reads metrics captured by APM.

Parameters
None.
Returns
None.
Note
None.

References ApmMetricConfig(), ReadMetrics(), XAPM_METRIC_COUNTER_0, XAPM_METRIC_COUNTER_1, XAPM_METRIC_SET_0, XAPM_METRIC_SET_1, XAPM_METRIC_SET_2, and XAPM_METRIC_SET_3.

Referenced by main().

void ReadMetrics ( XAxiPmon InstancePtr,
u32 *  BufferPtr,
u8  Counter1,
u8  Counter2 
)

Reads metrics from APM counters to buffer.

Parameters
InstancePtris pointer to APM instance.
BufferPtris pointer to buffer.
Counter1is counter number.
Counter2is counter number.
Returns
None.
Note
None.

References XAxiPmon_GetMetricCounter(), and XAxiPmon_StopCounters().

Referenced by OcmTransaction().