axipmon : Deprecate old version and create new one.
This patch deprecates v6_2 old version and creates a new v6_3 version of axipmon driver. Signed-off-by: Venkata Naga Sai Krishna Kolapalli <venkatan@xilinx.com>
This commit is contained in:
parent
c635f10c8f
commit
9873ff6b0a
13 changed files with 5229 additions and 0 deletions
42
XilinxProcessorIPLib/drivers/axipmon/data/axipmon.mdd
Executable file
42
XilinxProcessorIPLib/drivers/axipmon/data/axipmon.mdd
Executable file
|
@ -0,0 +1,42 @@
|
|||
###############################################################################
|
||||
#
|
||||
# Copyright (C) 2012 - 2015 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
###############################################################################
|
||||
OPTION psf_version = 2.1;
|
||||
|
||||
BEGIN driver axipmon
|
||||
|
||||
OPTION supported_peripherals = (axi_perf_mon_v[5-9]_[0-9] psu_apm);
|
||||
OPTION copyfiles = all;
|
||||
OPTION driver_state = ACTIVE;
|
||||
OPTION VERSION = 6.3;
|
||||
OPTION NAME = axipmon;
|
||||
|
||||
END driver
|
196
XilinxProcessorIPLib/drivers/axipmon/data/axipmon.tcl
Executable file
196
XilinxProcessorIPLib/drivers/axipmon/data/axipmon.tcl
Executable file
|
@ -0,0 +1,196 @@
|
|||
###############################################################################
|
||||
#
|
||||
# Copyright (C) 2012 - 2015 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
#
|
||||
# MODIFICATION HISTORY:
|
||||
# Ver Who Date Changes
|
||||
# -------- ------ -------- ----------------------------------------------------
|
||||
# 6.1 adk 16/04/14 Added two new parameters(C_S_AXI4_BASEADDR,
|
||||
# C_S_AXI4_HIGHADDR)
|
||||
# 6.2 bss 02/03/15 Added support to handle
|
||||
# - Zynq MP APM Baseaddress(C_S_AXI_BASEADDR)
|
||||
# - SoftIP APM Baseaddress(C_BASEADDR)
|
||||
###############################################################################
|
||||
|
||||
#uses "xillib.tcl"
|
||||
|
||||
proc generate {drv_handle} {
|
||||
|
||||
apm_define_include_file $drv_handle "xparameters.h" "XAxiPmon" "NUM_INSTANCES" "DEVICE_ID" C_BASEADDR C_HIGHADDR "C_GLOBAL_COUNT_WIDTH" "C_METRICS_SAMPLE_COUNT_WIDTH" "C_ENABLE_EVENT_COUNT" "C_NUM_MONITOR_SLOTS" "C_NUM_OF_COUNTERS" "C_HAVE_SAMPLED_METRIC_CNT" "C_ENABLE_EVENT_LOG" "C_FIFO_AXIS_DEPTH" "C_FIFO_AXIS_TDATA_WIDTH" "C_FIFO_AXIS_TID_WIDTH" "C_METRIC_COUNT_SCALE" "C_ENABLE_ADVANCED" "C_ENABLE_PROFILE" "C_ENABLE_TRACE" "C_S_AXI4_BASEADDR" "C_S_AXI4_HIGHADDR" "C_ENABLE_32BIT_FILTER_ID"
|
||||
::hsi::utils::define_config_file $drv_handle "xaxipmon_g.c" "XAxiPmon" "DEVICE_ID" C_BASEADDR "C_GLOBAL_COUNT_WIDTH" "C_METRICS_SAMPLE_COUNT_WIDTH" "C_ENABLE_EVENT_COUNT" "C_NUM_MONITOR_SLOTS" "C_NUM_OF_COUNTERS" "C_HAVE_SAMPLED_METRIC_CNT" "C_ENABLE_EVENT_LOG" "C_FIFO_AXIS_DEPTH" "C_FIFO_AXIS_TDATA_WIDTH" "C_FIFO_AXIS_TID_WIDTH" "C_METRIC_COUNT_SCALE" "C_ENABLE_ADVANCED" "C_ENABLE_PROFILE" "C_ENABLE_TRACE" "C_ENABLE_32BIT_FILTER_ID"
|
||||
apm_define_canonical_xpars $drv_handle "xparameters.h" "AxiPmon" "DEVICE_ID" C_BASEADDR C_HIGHADDR "C_GLOBAL_COUNT_WIDTH" "C_METRICS_SAMPLE_COUNT_WIDTH" "C_ENABLE_EVENT_COUNT" "C_NUM_MONITOR_SLOTS" "C_NUM_OF_COUNTERS" "C_HAVE_SAMPLED_METRIC_CNT" "C_ENABLE_EVENT_LOG" "C_FIFO_AXIS_DEPTH" "C_FIFO_AXIS_TDATA_WIDTH" "C_FIFO_AXIS_TID_WIDTH" "C_METRIC_COUNT_SCALE" "C_ENABLE_ADVANCED" "C_ENABLE_PROFILE" "C_ENABLE_TRACE" "C_S_AXI4_BASEADDR" "C_S_AXI4_HIGHADDR" "C_ENABLE_32BIT_FILTER_ID"
|
||||
}
|
||||
|
||||
proc apm_define_include_file {drv_handle file_name drv_string args} {
|
||||
set args [::hsi::utils::get_exact_arg_list $args]
|
||||
# Open include file
|
||||
set file_handle [::hsi::utils::open_include_file $file_name]
|
||||
|
||||
# Get all peripherals connected to this driver
|
||||
set periphs [::hsi::utils::get_common_driver_ips $drv_handle]
|
||||
|
||||
# Handle special cases
|
||||
set arg "NUM_INSTANCES"
|
||||
set posn [lsearch -exact $args $arg]
|
||||
if {$posn > -1} {
|
||||
puts $file_handle "/* Definitions for driver [string toupper [common::get_property name $drv_handle]] */"
|
||||
# Define NUM_INSTANCES
|
||||
puts $file_handle "#define [::hsi::utils::get_driver_param_name $drv_string $arg] [llength $periphs]"
|
||||
set args [lreplace $args $posn $posn]
|
||||
}
|
||||
|
||||
# Check if it is a driver parameter
|
||||
lappend newargs
|
||||
foreach arg $args {
|
||||
set value [common::get_property CONFIG.$arg $drv_handle]
|
||||
if {[llength $value] == 0} {
|
||||
lappend newargs $arg
|
||||
} else {
|
||||
puts $file_handle "#define [::hsi::utils::get_driver_param_name $drv_string $arg] [common::get_property $arg $drv_handle]"
|
||||
}
|
||||
}
|
||||
set args $newargs
|
||||
|
||||
# Print all parameters for all peripherals
|
||||
set device_id 0
|
||||
foreach periph $periphs {
|
||||
puts $file_handle ""
|
||||
puts $file_handle "/* Definitions for peripheral [string toupper [common::get_property NAME $periph]] */"
|
||||
foreach arg $args {
|
||||
if {[string compare -nocase "DEVICE_ID" $arg] == 0} {
|
||||
set value $device_id
|
||||
incr device_id
|
||||
} elseif {[string compare -nocase "C_BASEADDR" $arg] == 0} {
|
||||
set value [common::get_property CONFIG.$arg $periph]
|
||||
if {[llength $value] == 0} {
|
||||
set value [common::get_property CONFIG.C_S_AXI_BASEADDR $periph]
|
||||
}
|
||||
} elseif {[string compare -nocase "C_HIGHADDR" $arg] == 0} {
|
||||
set value [common::get_property CONFIG.$arg $periph]
|
||||
if {[llength $value] == 0} {
|
||||
set value [common::get_property CONFIG.C_S_AXI_HIGHADDR $periph]
|
||||
}
|
||||
} else {
|
||||
set value [common::get_property CONFIG.$arg $periph]
|
||||
}
|
||||
|
||||
if {[llength $value] == 0} {
|
||||
set value 0
|
||||
}
|
||||
set value [::hsi::utils::format_addr_string $value $arg]
|
||||
if {[string compare -nocase "HW_VER" $arg] == 0} {
|
||||
puts $file_handle "#define [::hsi::utils::get_ip_param_name $periph $arg] \"$value\""
|
||||
} else {
|
||||
puts $file_handle "#define [::hsi::utils::get_ip_param_name $periph $arg] $value"
|
||||
}
|
||||
}
|
||||
puts $file_handle ""
|
||||
}
|
||||
puts $file_handle "\n/******************************************************************/\n"
|
||||
close $file_handle
|
||||
}
|
||||
|
||||
proc apm_define_canonical_xpars {drv_handle file_name drv_string args} {
|
||||
set args [::hsi::utils::get_exact_arg_list $args]
|
||||
# Open include file
|
||||
set file_handle [::hsi::utils::open_include_file $file_name]
|
||||
|
||||
# Get all the peripherals connected to this driver
|
||||
set periphs [::hsi::utils::get_common_driver_ips $drv_handle]
|
||||
|
||||
# Get the names of all the peripherals connected to this driver
|
||||
foreach periph $periphs {
|
||||
set peripheral_name [string toupper [common::get_property NAME $periph]]
|
||||
lappend peripherals $peripheral_name
|
||||
}
|
||||
|
||||
# Get possible canonical names for all the peripherals connected to this
|
||||
# driver
|
||||
set device_id 0
|
||||
foreach periph $periphs {
|
||||
set canonical_name [string toupper [format "%s_%s" $drv_string $device_id]]
|
||||
lappend canonicals $canonical_name
|
||||
|
||||
# Create a list of IDs of the peripherals whose hardware instance name
|
||||
# doesn't match the canonical name. These IDs can be used later to
|
||||
# generate canonical definitions
|
||||
if { [lsearch $peripherals $canonical_name] < 0 } {
|
||||
lappend indices $device_id
|
||||
}
|
||||
incr device_id
|
||||
}
|
||||
|
||||
set i 0
|
||||
foreach periph $periphs {
|
||||
set periph_name [string toupper [common::get_property NAME $periph]]
|
||||
|
||||
# Generate canonical definitions only for the peripherals whose
|
||||
# canonical name is not the same as hardware instance name
|
||||
if { [lsearch $canonicals $periph_name] < 0 } {
|
||||
puts $file_handle "/* Canonical definitions for peripheral $periph_name */"
|
||||
set canonical_name [format "%s_%s" $drv_string [lindex $indices $i]]
|
||||
|
||||
foreach arg $args {
|
||||
set lvalue [::hsi::utils::get_driver_param_name $canonical_name $arg]
|
||||
|
||||
# The commented out rvalue is the name of the instance-specific constant
|
||||
# set rvalue [::hsi::utils::get_ip_param_name $periph $arg]
|
||||
# The rvalue set below is the actual value of the parameter
|
||||
|
||||
if {[string compare -nocase "C_BASEADDR" $arg] == 0} {
|
||||
set rvalue [::hsi::utils::get_param_value $periph $arg]
|
||||
if {[llength $rvalue] == 0} {
|
||||
set rvalue [common::get_property CONFIG.C_S_AXI_BASEADDR $periph]
|
||||
}
|
||||
} elseif {[string compare -nocase "C_HIGHADDR" $arg] == 0} {
|
||||
set rvalue [::hsi::utils::get_param_value $periph $arg]
|
||||
if {[llength $rvalue] == 0} {
|
||||
set rvalue [common::get_property CONFIG.C_S_AXI_HIGHADDR $periph]
|
||||
}
|
||||
} else {
|
||||
set rvalue [::hsi::utils::get_param_value $periph $arg]
|
||||
}
|
||||
|
||||
if {[llength $rvalue] == 0} {
|
||||
set rvalue 0
|
||||
}
|
||||
set rvalue [::hsi::utils::format_addr_string $rvalue $arg]
|
||||
|
||||
puts $file_handle "#define $lvalue $rvalue"
|
||||
|
||||
}
|
||||
puts $file_handle ""
|
||||
incr i
|
||||
}
|
||||
}
|
||||
|
||||
puts $file_handle "\n/******************************************************************/\n"
|
||||
close $file_handle
|
||||
}
|
18
XilinxProcessorIPLib/drivers/axipmon/examples/index.html
Executable file
18
XilinxProcessorIPLib/drivers/axipmon/examples/index.html
Executable file
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Language" content="en-us">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Driver example applications</title>
|
||||
<link rel="stylesheet" type="text/css" href="../help.css">
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF">
|
||||
<h1> Example Applications for the driver axipmon_v6_1 </h1>
|
||||
<HR>
|
||||
<ul>
|
||||
<li>xaxipmon_intr_example.c <a href="xaxipmon_intr_example.c">(source)</a> </li>
|
||||
<li>xaxipmon_polled_example.c <a href="xaxipmon_polled_example.c">(source)</a> </li>
|
||||
</ul>
|
||||
<p><font face="Times New Roman" color="#800000">Copyright <20> 1995-2014 Xilinx, Inc. All rights reserved.</font></p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,428 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xaxipmon_intr_example.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* 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.
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************** Include Files ********************************/
|
||||
|
||||
#include "xaxipmon.h"
|
||||
#include "xparameters.h"
|
||||
#include "xstatus.h"
|
||||
#include "xintc.h"
|
||||
#include "xil_exception.h"
|
||||
#include "stdio.h"
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#define AXIPMON_DEVICE_ID XPAR_AXIPMON_0_DEVICE_ID
|
||||
#define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID
|
||||
#define INTC_AXIPMON_INTERRUPT_ID XPAR_INTC_0_AXIPMON_0_VEC_ID
|
||||
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions ********************/
|
||||
|
||||
/************************** Function Prototypes *****************************/
|
||||
|
||||
int AxiPmonInterruptExample(u16 AxiPmonDeviceId, u32 *Metrics);
|
||||
|
||||
static void AxiPmonInterruptHandler(void *CallBackRef);
|
||||
|
||||
static int AxiPmonSetupIntrSystem(XIntc* IntcInstancePtr,
|
||||
XAxiPmon* InstancePtr, u16 IntrId);
|
||||
|
||||
/************************** Variable Definitions ****************************/
|
||||
|
||||
static XAxiPmon AxiPmonInst; /* AXI Performance Monitor driver instance */
|
||||
XIntc Intc; /* The Instance of the Interrupt Controller Driver */
|
||||
|
||||
/*
|
||||
* Shared variables used to test the callbacks.
|
||||
*/
|
||||
volatile static int SampleCounterIntr = FALSE; /*
|
||||
* Sample Interval Counter
|
||||
* Overflow interrupt
|
||||
*/
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Main function that invokes the example in this file.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if the example has completed successfully.
|
||||
* - XST_FAILURE if the example has failed.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
int main(void)
|
||||
{
|
||||
|
||||
int Status;
|
||||
u32 Metrics;
|
||||
|
||||
/*
|
||||
* Run the AxiPmon Interrupt example, specify the Device ID that is
|
||||
* generated in xparameters.h .
|
||||
*/
|
||||
Status = AxiPmonInterruptExample(AXIPMON_DEVICE_ID, &Metrics);
|
||||
|
||||
if (Status != XST_SUCCESS) {
|
||||
xil_printf("AXI Performance Monitor Interrupt example \
|
||||
failed\r\n");
|
||||
return XST_FAILURE;
|
||||
}
|
||||
xil_printf("AXI Performance Monitor Interrupt example passed\r\n");
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @param AxiPmonDeviceId is the XPAR_<AXIPMON_instance>_DEVICE_ID value
|
||||
* from xparameters.h.
|
||||
* @param Metrics is an user referece variable in which computed metrics
|
||||
* will be filled
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if the example has completed successfully.
|
||||
* - XST_FAILURE if the example has failed.
|
||||
*
|
||||
* @note None
|
||||
*
|
||||
******************************************************************************/
|
||||
int AxiPmonInterruptExample(u16 AxiPmonDeviceId, u32 *Metrics)
|
||||
{
|
||||
int Status;
|
||||
XAxiPmon_Config *ConfigPtr;
|
||||
u8 SlotId = 0x1;
|
||||
u16 Range2 = 0x10; /* Range 2 - 16 */
|
||||
u16 Range1 = 0x08; /* Range 1 - 8 */
|
||||
XAxiPmon *AxiPmonInstPtr = &AxiPmonInst;
|
||||
u32 SampleInterval = 0x3FFFF;
|
||||
|
||||
/*
|
||||
* Initialize the AxiPmon driver.
|
||||
*/
|
||||
ConfigPtr = XAxiPmon_LookupConfig(AxiPmonDeviceId);
|
||||
if (ConfigPtr == NULL) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
XAxiPmon_CfgInitialize(AxiPmonInstPtr, ConfigPtr,
|
||||
ConfigPtr->BaseAddress);
|
||||
|
||||
/*
|
||||
* Self Test the Axi Performance Monitor device
|
||||
*/
|
||||
Status = XAxiPmon_SelfTest(AxiPmonInstPtr);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
Status = AxiPmonSetupIntrSystem(&Intc, AxiPmonInstPtr,
|
||||
INTC_AXIPMON_INTERRUPT_ID);
|
||||
|
||||
|
||||
/*
|
||||
* Select Agent and required set of Metrics for a Counter.
|
||||
* We can select another agent,Metrics for another counter by
|
||||
* calling below function again.
|
||||
*/
|
||||
|
||||
XAxiPmon_SetMetrics(AxiPmonInstPtr, SlotId, XAPM_METRIC_SET_0,
|
||||
XAPM_METRIC_COUNTER_0);
|
||||
|
||||
/*
|
||||
* Set Incrementer Ranges
|
||||
*/
|
||||
XAxiPmon_SetIncrementerRange(AxiPmonInstPtr, XAPM_INCREMENTER_0,
|
||||
Range2, Range1);
|
||||
|
||||
|
||||
XAxiPmon_SetSampleInterval(AxiPmonInstPtr, SampleInterval);
|
||||
|
||||
XAxiPmon_LoadSampleIntervalCounter(AxiPmonInstPtr);
|
||||
|
||||
/*
|
||||
* Enable Metric Counters.
|
||||
*/
|
||||
XAxiPmon_EnableMetricsCounter(AxiPmonInstPtr);
|
||||
|
||||
|
||||
/*
|
||||
* Enable Sample Interval Counter Overflow Interrupt
|
||||
*/
|
||||
XAxiPmon_IntrEnable(AxiPmonInstPtr, XAPM_IXR_SIC_OVERFLOW_MASK);
|
||||
|
||||
/*
|
||||
* Enable Global Interrupt
|
||||
*/
|
||||
XAxiPmon_IntrGlobalEnable(AxiPmonInstPtr);
|
||||
|
||||
|
||||
/*
|
||||
* Application for which Metrics has to be computed should be
|
||||
* called here
|
||||
*/
|
||||
|
||||
/*
|
||||
* Enable Sample Interval Counter and wait for interrupt to occur
|
||||
*/
|
||||
XAxiPmon_EnableSampleIntervalCounter(AxiPmonInstPtr);
|
||||
|
||||
|
||||
/** Wait until Sample Interval Overflow occurs */
|
||||
while(!(SampleCounterIntr));
|
||||
|
||||
|
||||
/** Disable Sample Interval Counter */
|
||||
XAxiPmon_DisableSampleIntervalCounter(AxiPmonInstPtr);
|
||||
|
||||
/** Disable Sample Interval Counter Overflow Interrupt */
|
||||
XAxiPmon_IntrDisable(AxiPmonInstPtr, XAPM_IXR_SIC_OVERFLOW_MASK);
|
||||
|
||||
/** Disable Global Interrupt */
|
||||
XAxiPmon_IntrGlobalDisable(AxiPmonInstPtr);
|
||||
|
||||
/* Get Sampled Metric Counter 0 in Metrics */
|
||||
*Metrics = XAxiPmon_GetSampledMetricCounter(AxiPmonInstPtr,
|
||||
XAPM_METRIC_COUNTER_0);
|
||||
/*
|
||||
* Disable Metric Counters.
|
||||
*/
|
||||
XAxiPmon_DisableMetricsCounter(AxiPmonInstPtr);
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function is the Interrupt Service Routine for the AXI Performance
|
||||
* Monitor device. It will be called by the processor whenever an interrupt is
|
||||
* asserted by the device.
|
||||
*
|
||||
* There are 13 different interrupts supported
|
||||
* - Sample Interval Counter Overflow Interrupt
|
||||
* - Global Clock Counter Overflow Interrupt
|
||||
* - Event Log FIFO full Interrupt
|
||||
* - Metric Counter 0 overflow Interrupt
|
||||
* - Metric Counter 1 overflow Interrupt
|
||||
* - Metric Counter 2 overflow Interrupt
|
||||
* - Metric Counter 3 overflow Interrupt
|
||||
* - Metric Counter 4 overflow Interrupt
|
||||
* - Metric Counter 5 overflow Interrupt
|
||||
* - Metric Counter 6 overflow Interrupt
|
||||
* - Metric Counter 7 overflow Interrupt
|
||||
* - Metric Counter 8 overflow Interrupt
|
||||
* - Metric Counter 9 overflow Interrupt
|
||||
* This function only handles Sample Interval Counter Overflow Interrupt.
|
||||
* User of this code may need to modify the code to meet needs of the
|
||||
* application.
|
||||
*
|
||||
* @param CallBackRef is the callback reference passed from the Interrupt
|
||||
* controller driver, which in our case is a pointer to the
|
||||
* driver instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note This function is called within interrupt context.
|
||||
*
|
||||
******************************************************************************/
|
||||
static void AxiPmonInterruptHandler(void *CallBackRef)
|
||||
{
|
||||
u32 IntrStatus;
|
||||
|
||||
XAxiPmon *AxiPmonPtr = (XAxiPmon *)CallBackRef;
|
||||
|
||||
/*
|
||||
* Get the interrupt status from the device and check the value.
|
||||
*/
|
||||
IntrStatus = XAxiPmon_IntrGetStatus(AxiPmonPtr);
|
||||
|
||||
if (IntrStatus & XAPM_IXR_SIC_OVERFLOW_MASK) {
|
||||
/*
|
||||
* Set Sample Interval Counter Overflow interrupt flag so
|
||||
* the code in application context can be aware of this interrupt.
|
||||
*/
|
||||
SampleCounterIntr = TRUE;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear Interrupt Status Register.
|
||||
*/
|
||||
XAxiPmon_IntrClear(AxiPmonPtr, IntrStatus);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function performs the AXI Performance Monitor set up for Interrupts
|
||||
*
|
||||
* @param IntcInstancePtr is a reference to the Interrupt Controller
|
||||
* driver Instance
|
||||
* @param InstancePtr is a reference to the XAxiPmon driver Instance
|
||||
* @param IntrId is XPAR_<INTC_instance>_<AXIPMON_instance>_INTERRUPT_INTR
|
||||
* value from xparameters.h
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if the interrupt setup is successful.
|
||||
* - XST_FAILURE if interrupt setup is not successful.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static int AxiPmonSetupIntrSystem(XIntc* IntcInstancePtr, XAxiPmon* InstancePtr,
|
||||
u16 IntrId)
|
||||
{
|
||||
int Status;
|
||||
|
||||
/*
|
||||
* Initialize the interrupt controller driver so that it's ready to
|
||||
* use.
|
||||
*/
|
||||
Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Connect the handler that will be called when an interrupt
|
||||
* for the device occurs, the handler defined above performs the
|
||||
* specific interrupt processing for the device.
|
||||
*/
|
||||
Status = XIntc_Connect(IntcInstancePtr, IntrId,
|
||||
(XInterruptHandler) AxiPmonInterruptHandler, InstancePtr);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the interrupt controller so interrupts are enabled for all
|
||||
* devices that cause interrupts. Specify real mode so that the Axi
|
||||
* Performance Monitor device can cause interrupts through the interrupt
|
||||
* controller.
|
||||
*/
|
||||
Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable the interrupt for the AXI Performance Monitor.
|
||||
*/
|
||||
XIntc_Enable(IntcInstancePtr, IntrId);
|
||||
|
||||
/*
|
||||
* Initialize the exception table.
|
||||
*/
|
||||
Xil_ExceptionInit();
|
||||
|
||||
/*
|
||||
* Register the interrupt controller handler with the exception table.
|
||||
*/
|
||||
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
|
||||
(Xil_ExceptionHandler) XIntc_InterruptHandler,
|
||||
IntcInstancePtr);
|
||||
/*
|
||||
* Enable exceptions.
|
||||
*/
|
||||
Xil_ExceptionEnable();
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,306 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2015 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xaxipmon_ocm_example.c
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ----- -------- -----------------------------------------------------
|
||||
* 1.00a bss 04/01/15 First release
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xaxipmon.h"
|
||||
#include "xil_cache.h"
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#define AXIPMON_DEVICE_ID XPAR_AXIPMON_1_DEVICE_ID
|
||||
|
||||
/* Sampling interval */
|
||||
#define SAMPLE_INTERVAL 0x100
|
||||
|
||||
/* OCM test Address */
|
||||
#define OCM_WRITE_ADDRESS 0xFFFE0000
|
||||
#define OCM_READ_ADDRESS 0xFFFF0000
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions ********************/
|
||||
|
||||
/************************** Function Prototypes *******************************/
|
||||
|
||||
int ApmCheck(u32 *BufferPtr, u16 Wtx, u16 Wbc, u16 Rtx, u16 Rbc);
|
||||
void OcmTransaction();
|
||||
int ApmMetricConfig(XAxiPmon *ApmInst, u8 slot, u8 Metric1, u8 Metric2);
|
||||
void ReadMetrics(XAxiPmon *ApmInst, u32 *buffer, u8 Counter1, u8 Counter2);
|
||||
|
||||
/************************** Variable Definitions ****************************/
|
||||
|
||||
static XAxiPmon AxiPmonInst;
|
||||
|
||||
u32 MetricsBuffer[6];
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Main function that invokes the example in this file.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if the example has completed successfully.
|
||||
* - XST_FAILURE if the example has failed.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
int main(void)
|
||||
{
|
||||
XAxiPmon_Config *ConfigPtr = NULL;
|
||||
u32 Status;
|
||||
|
||||
ConfigPtr = XAxiPmon_LookupConfig(AXIPMON_DEVICE_ID);
|
||||
if (ConfigPtr == NULL) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
Status = XAxiPmon_CfgInitialize(&AxiPmonInst, ConfigPtr,
|
||||
ConfigPtr->BaseAddress);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
Xil_DCacheDisable();
|
||||
|
||||
OcmTransaction();
|
||||
|
||||
xil_printf("OCM APM Monitor results\n");
|
||||
|
||||
/*
|
||||
* 1 32 bit write transaction from A53 to OCM i.e, 4 bytes
|
||||
* 1 read trasaction i.e, 16 bytes at OCM (128 bit data bus)
|
||||
* A53 -> Interconnect -> APM -> OCM
|
||||
*/
|
||||
Status = ApmCheck(MetricsBuffer, 1, 4, 1, 16);
|
||||
|
||||
XAxiPmon_DisableMetricsCounter(&AxiPmonInst);
|
||||
if (Status == XST_SUCCESS) {
|
||||
xil_printf("Example passed\r\n");
|
||||
return XST_SUCCESS;
|
||||
} else {
|
||||
xil_printf("Example failed\r\n");
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Checks the metrics passed to this function are same as collected by APM.
|
||||
*
|
||||
* @param BufferPtr is pointer to buffer containing captured metrics.
|
||||
* @param Wtx is Write transaction count value to be checked.
|
||||
* @param Wbc is Write byte count value to be checked.
|
||||
* @param Rtx is Read transaction count value to be checked.
|
||||
* @param Rbc is Read byte count value to be checked.
|
||||
*
|
||||
* @return
|
||||
* - 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.
|
||||
*
|
||||
*****************************************************************************/
|
||||
int ApmCheck(u32 *BufferPtr, u16 Wtx, u16 Wbc, u16 Rtx, u16 Rbc)
|
||||
{
|
||||
int Errors = 0;
|
||||
|
||||
xil_printf("Write Transaction Count : %d\r\n", BufferPtr[0]);
|
||||
xil_printf("Write Byte Count : %d\r\n", BufferPtr[1]);
|
||||
xil_printf("Read Transaction Count : %d\r\n", BufferPtr[3]);
|
||||
xil_printf("Read Byte Count : %d\r\n", BufferPtr[4]);
|
||||
|
||||
if (Wtx != BufferPtr[0]) {
|
||||
xil_printf("write tx count fail\r\n");
|
||||
Errors = Errors + 1;
|
||||
}
|
||||
|
||||
if (Wbc != BufferPtr[1]) {
|
||||
xil_printf("write byte count fail\r\n");
|
||||
Errors = Errors + 1;
|
||||
}
|
||||
|
||||
if (Rtx != BufferPtr[3]) {
|
||||
xil_printf("read tx count fail\n");
|
||||
Errors = Errors + 1;
|
||||
}
|
||||
|
||||
if (Rbc != BufferPtr[4]) {
|
||||
xil_printf("read byte count fail\r\n");
|
||||
Errors = Errors + 1;
|
||||
}
|
||||
|
||||
if (Errors > 0) {
|
||||
return XST_FAILURE;
|
||||
} else {
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Generates write and read transcations to OCM and reads metrics captured
|
||||
* by APM.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void OcmTransaction()
|
||||
{
|
||||
|
||||
ApmMetricConfig(&AxiPmonInst, 0, XAPM_METRIC_SET_0, XAPM_METRIC_SET_2);
|
||||
|
||||
/* write to OCM */
|
||||
Xil_Out32(OCM_WRITE_ADDRESS, 0xBAADFACE);
|
||||
|
||||
ReadMetrics(&AxiPmonInst, &MetricsBuffer[0], XAPM_METRIC_COUNTER_0,
|
||||
XAPM_METRIC_COUNTER_1);
|
||||
|
||||
ApmMetricConfig(&AxiPmonInst, 0, XAPM_METRIC_SET_1, XAPM_METRIC_SET_3);
|
||||
|
||||
/* read from OCM */
|
||||
Xil_In32(OCM_READ_ADDRESS);
|
||||
|
||||
ReadMetrics(&AxiPmonInst, &MetricsBuffer[3], XAPM_METRIC_COUNTER_0,
|
||||
XAPM_METRIC_COUNTER_1);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
* Sets Counter 0 and Counter 1 for collecting the passed metrics
|
||||
*
|
||||
* @param InstancePtr is pointer to APM instance.
|
||||
* @param Slot is APM slot.
|
||||
* @param Metric1 is Metric to be captured by Counter 1
|
||||
* @param Metric2 is Metric to be captured by Counter 2
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS on success.
|
||||
* - XST_FAILURE on failure.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
int ApmMetricConfig(XAxiPmon *InstancePtr, u8 slot, u8 Metric1, u8 Metric2)
|
||||
{
|
||||
int Status;
|
||||
|
||||
/* reset Metric conter and Global counters */
|
||||
XAxiPmon_ResetMetricCounter(InstancePtr);
|
||||
XAxiPmon_ResetGlobalClkCounter(InstancePtr);
|
||||
|
||||
Status = XAxiPmon_SetMetrics(InstancePtr, slot, Metric1,
|
||||
XAPM_METRIC_COUNTER_0);
|
||||
if (Status == XST_FAILURE) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
Status = XAxiPmon_SetMetrics(InstancePtr, slot, Metric2,
|
||||
XAPM_METRIC_COUNTER_1);
|
||||
if (Status == XST_FAILURE) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/* Enable Metric counter */
|
||||
XAxiPmon_EnableMetricsCounter(InstancePtr);
|
||||
|
||||
/* Start Metric counter */
|
||||
XAxiPmon_StartCounters(InstancePtr, SAMPLE_INTERVAL);
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Reads metrics from APM counters to buffer.
|
||||
*
|
||||
* @param InstancePtr is pointer to APM instance.
|
||||
* @param BufferPtr is pointer to buffer.
|
||||
* @param Counter1 is counter number.
|
||||
* @param Counter2 is counter number.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void ReadMetrics(XAxiPmon *InstancePtr, u32 *BufferPtr, u8 Counter1,
|
||||
u8 Counter2)
|
||||
{
|
||||
/* Stop Counters */
|
||||
XAxiPmon_StopCounters(InstancePtr);
|
||||
|
||||
BufferPtr[0] = XAxiPmon_GetMetricCounter(InstancePtr, Counter1);
|
||||
BufferPtr[1] = XAxiPmon_GetMetricCounter(InstancePtr, Counter2);
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xaxipmon_polled_example.c
|
||||
*
|
||||
* This file contains a design example showing how to use the driver APIs of the
|
||||
* AXI Performance Monitor driver in poll mode.
|
||||
*
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* Global Clock Counter and Metric Counters are enabled. The Application
|
||||
* for which Metrics need to be computed should be run and then the Metrics
|
||||
* collected.
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* 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.
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************** Include Files ********************************/
|
||||
|
||||
#include "xaxipmon.h"
|
||||
#include "xparameters.h"
|
||||
#include "xstatus.h"
|
||||
#include "stdio.h"
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#define AXIPMON_DEVICE_ID XPAR_AXIPMON_0_DEVICE_ID
|
||||
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions ********************/
|
||||
|
||||
/************************** Function Prototypes *****************************/
|
||||
|
||||
int AxiPmonPolledExample(u16 AxiPmonDeviceId, u32 *Metrics, u32 *ClkCntHigh,
|
||||
u32 *ClkCntLow);
|
||||
|
||||
/************************** Variable Definitions ****************************/
|
||||
|
||||
static XAxiPmon AxiPmonInst; /* System Monitor driver instance */
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Main function that invokes the example in this file.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if the example has completed successfully.
|
||||
* - XST_FAILURE if the example has failed.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
int main(void)
|
||||
{
|
||||
|
||||
int Status;
|
||||
u32 Metrics;
|
||||
u32 ClkCntHigh = 0x0;
|
||||
u32 ClkCntLow = 0x0;
|
||||
|
||||
/*
|
||||
* Run the AxiPmonitor polled example, specify the Device ID that is
|
||||
* generated in xparameters.h .
|
||||
*/
|
||||
Status = AxiPmonPolledExample(AXIPMON_DEVICE_ID, &Metrics, &ClkCntHigh,
|
||||
&ClkCntLow);
|
||||
|
||||
if (Status != XST_SUCCESS) {
|
||||
xil_printf("AXI Performance Monitor Polled example failed\r\n");
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
xil_printf("AXI Performance Monitor Polled example passed\r\n");
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* 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
|
||||
* - Sets Metric Selector to select Slave Agent Number 1 and first set of
|
||||
* Metrics
|
||||
* - Enables Global Clock Counter and Metric Counters
|
||||
* - Calls Application for which Metrics need to be computed
|
||||
* - Disables Global Clock Counter and Metric Counters
|
||||
* - Read Global Clock Counter and Metric Counter 0
|
||||
*
|
||||
* @param AxiPmonDeviceId is the XPAR_<AXIPMON_instance>_DEVICE_ID value
|
||||
* from xparameters.h.
|
||||
* @param Metrics is an user referece variable in which computed metrics
|
||||
* will be filled
|
||||
* @param ClkCntHigh is an user referece variable in which Higher 64 bits
|
||||
* of Global Clock Counter are filled
|
||||
* @param ClkCntLow is an user referece variable in which Lower 64 bits
|
||||
* of Global Clock Counter are filled
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if the example has completed successfully.
|
||||
* - XST_FAILURE if the example has failed.
|
||||
*
|
||||
* @note None
|
||||
*
|
||||
****************************************************************************/
|
||||
int AxiPmonPolledExample(u16 AxiPmonDeviceId, u32 *Metrics, u32 *ClkCntHigh,
|
||||
u32 *ClkCntLow)
|
||||
{
|
||||
int Status;
|
||||
XAxiPmon_Config *ConfigPtr;
|
||||
u8 SlotId = 0x0;
|
||||
u16 Range2 = 0x10; /* Range 2 - 16 */
|
||||
u16 Range1 = 0x08; /* Range 1 - 8 */
|
||||
XAxiPmon *AxiPmonInstPtr = &AxiPmonInst;
|
||||
|
||||
/*
|
||||
* Initialize the AxiPmon driver.
|
||||
*/
|
||||
ConfigPtr = XAxiPmon_LookupConfig(AxiPmonDeviceId);
|
||||
if (ConfigPtr == NULL) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
XAxiPmon_CfgInitialize(AxiPmonInstPtr, ConfigPtr,
|
||||
ConfigPtr->BaseAddress);
|
||||
|
||||
/*
|
||||
* Self Test the System Monitor/ADC device
|
||||
*/
|
||||
Status = XAxiPmon_SelfTest(AxiPmonInstPtr);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Select Agent and required set of Metrics for a Counter.
|
||||
* We can select another agent,Metrics for another counter by
|
||||
* calling below function again.
|
||||
*/
|
||||
|
||||
XAxiPmon_SetMetrics(AxiPmonInstPtr, SlotId, XAPM_METRIC_SET_0,
|
||||
XAPM_METRIC_COUNTER_0);
|
||||
|
||||
/*
|
||||
* Set Incrementer Ranges
|
||||
*/
|
||||
XAxiPmon_SetIncrementerRange(AxiPmonInstPtr, XAPM_INCREMENTER_0,
|
||||
Range2, Range1);
|
||||
/*
|
||||
* Enable Metric Counters.
|
||||
*/
|
||||
XAxiPmon_EnableMetricsCounter(AxiPmonInstPtr);
|
||||
|
||||
/*
|
||||
* Enable Global Clock Counter Register.
|
||||
*/
|
||||
XAxiPmon_EnableGlobalClkCounter(AxiPmonInstPtr);
|
||||
|
||||
/*
|
||||
* Application for which Metrics has to be computed should be
|
||||
* called here
|
||||
*/
|
||||
|
||||
/*
|
||||
* Disable Global Clock Counter Register.
|
||||
*/
|
||||
|
||||
XAxiPmon_DisableGlobalClkCounter(AxiPmonInstPtr);
|
||||
|
||||
/*
|
||||
* Disable Metric Counters.
|
||||
*/
|
||||
XAxiPmon_DisableMetricsCounter(AxiPmonInstPtr);
|
||||
|
||||
/* Get Metric Counter 0 */
|
||||
*Metrics = XAxiPmon_GetMetricCounter(AxiPmonInstPtr,
|
||||
XAPM_METRIC_COUNTER_0);
|
||||
|
||||
/* Get Global Clock Cycles Count in ClkCntHigh,ClkCntLow */
|
||||
XAxiPmon_GetGlobalClkCounter(AxiPmonInstPtr, ClkCntHigh, ClkCntLow);
|
||||
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
27
XilinxProcessorIPLib/drivers/axipmon/src/Makefile
Normal file
27
XilinxProcessorIPLib/drivers/axipmon/src/Makefile
Normal file
|
@ -0,0 +1,27 @@
|
|||
COMPILER=
|
||||
ARCHIVER=
|
||||
CP=cp
|
||||
COMPILER_FLAGS=
|
||||
EXTRA_COMPILER_FLAGS=
|
||||
LIB=libxil.a
|
||||
|
||||
RELEASEDIR=../../../lib
|
||||
INCLUDEDIR=../../../include
|
||||
INCLUDES=-I./. -I${INCLUDEDIR}
|
||||
|
||||
INCLUDEFILES=*.h
|
||||
LIBSOURCES=*.c
|
||||
OUTS = *.o
|
||||
|
||||
|
||||
libs:
|
||||
echo "Compiling axipmon"
|
||||
$(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $(LIBSOURCES)
|
||||
$(ARCHIVER) -r ${RELEASEDIR}/${LIB} ${OUTS}
|
||||
make clean
|
||||
|
||||
include:
|
||||
${CP} ${INCLUDEFILES} ${INCLUDEDIR}
|
||||
|
||||
clean:
|
||||
rm -rf ${OUTS}
|
2119
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon.c
Normal file
2119
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon.c
Normal file
File diff suppressed because it is too large
Load diff
935
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon.h
Normal file
935
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon.h
Normal file
|
@ -0,0 +1,935 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2007 - 2015 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xaxipmon.h
|
||||
* @addtogroup axipmon_v6_2
|
||||
* @{
|
||||
* @details
|
||||
*
|
||||
* The XAxiPmon driver supports the Xilinx AXI Performance Monitor device.
|
||||
*
|
||||
* The AXI Performance Monitor device provides following features:
|
||||
*
|
||||
* Configurable number of Metric Counters and Incrementers
|
||||
* Computes performance metrics for Agents connected to
|
||||
* monitor slots (Up to 8 slots)
|
||||
*
|
||||
* The following Metrics can be computed:
|
||||
*
|
||||
* Metrics computed for an AXI4 MM agent:
|
||||
* Write Request Count: Total number of write requests by/to the agent.
|
||||
* Read Request Count: Total number of read requests given by/to the
|
||||
* agent.
|
||||
* Read Latency: It is defined as the time from the start of read address
|
||||
* transaction to the beginning of the read data service.
|
||||
* Write Latency: It is defined as the period needed a master completes
|
||||
* write data transaction, i.e. from write address
|
||||
* transaction to write response from slave.
|
||||
* Write Byte Count: Total number of bytes written by/to the agent.
|
||||
* This metric is helpful when calculating the
|
||||
* throughput of the system.
|
||||
* Read Byte Count: Total number of bytes read from/by the agent.
|
||||
* Average Write Latency: Average write latency seen by the agent.
|
||||
* It can be derived from total write latency
|
||||
* and the write request count.
|
||||
* Average Read Latency: Average read latency seen by the agent. It can be
|
||||
* derived from total read latency and the read
|
||||
* request count.
|
||||
* Master Write Idle Cycle Count: Number of idle cycles caused by the
|
||||
* masters during write transactions to
|
||||
* the slave.
|
||||
* Slave Write Idle Cycle Count: Number of idle cycles caused by this slave
|
||||
* during write transactions to the slave.
|
||||
* Master Read Idle Cycle Count: Number of idle cycles caused by the
|
||||
* master during read transactions to the
|
||||
* slave.
|
||||
* Slave Read Idle Cycle Count: Number of idle cycles caused by this slave
|
||||
* during read transactions to the slave.
|
||||
*
|
||||
* Metrics computed for an AXI4-Stream agent:
|
||||
*
|
||||
* Transfer Cycle Count: Total number of writes by/to the agent.
|
||||
* Data Byte Count: Total number of data bytes written by/to the agent.
|
||||
* This metric helps in calculating the throughput
|
||||
* of the system.
|
||||
* Position Byte Count: Total number of position bytes transferred.
|
||||
* Null Byte Count: Total number of null bytes transferred.
|
||||
* Packet Count: Total number of packets transferred.
|
||||
*
|
||||
* There are three modes : Advanced, Profile and Trace.
|
||||
* - Advanced mode has 10 Mertic Counters, Sampled Metric Counters, Incrementors
|
||||
* and Sampled Incrementors.
|
||||
* - Profile mode has only 47 Metric Counters and Sampled Metric Counters.
|
||||
* - Trace mode has no Counters.
|
||||
* User should refer to the hardware device specification for detailed
|
||||
* information about the device.
|
||||
*
|
||||
* This header file contains the prototypes of driver functions that can
|
||||
* be used to access the AXI Performance Monitor device.
|
||||
*
|
||||
*
|
||||
* <b> Initialization and Configuration </b>
|
||||
*
|
||||
* The device driver enables higher layer software (e.g., an application) to
|
||||
* communicate to the AXI Performance Monitor device.
|
||||
*
|
||||
* XAxiPmon_CfgInitialize() API is used to initialize the AXI Performance Monitor
|
||||
* device. The user needs to first call the XAxiPmon_LookupConfig() API which
|
||||
* returns the Configuration structure pointer which is passed as a parameter to
|
||||
* the XAxiPmon_CfgInitialize() API.
|
||||
*
|
||||
*
|
||||
* <b>Interrupts</b>
|
||||
*
|
||||
* The AXI Performance Monitor does not support Interrupts
|
||||
*
|
||||
*
|
||||
* <b> Virtual Memory </b>
|
||||
*
|
||||
* This driver supports Virtual Memory. The RTOS is responsible for calculating
|
||||
* the correct device base address in Virtual Memory space.
|
||||
*
|
||||
*
|
||||
* <b> Threads </b>
|
||||
*
|
||||
* This driver is not thread safe. Any needs for threads or thread mutual
|
||||
* exclusion must be satisfied by the layer above this driver.
|
||||
*
|
||||
* <b> Asserts </b>
|
||||
*
|
||||
* Asserts are used within all Xilinx drivers to enforce constraints on argument
|
||||
* values. Asserts can be turned off on a system-wide basis by defining, at
|
||||
* compile time, the NDEBUG identifier. By default, asserts are turned on and it
|
||||
* is recommended that users leave asserts on during development.
|
||||
*
|
||||
*
|
||||
* <b> Building the driver </b>
|
||||
*
|
||||
* The XAxiPmon driver is composed of several source files. This allows the user
|
||||
* to build and link only those parts of the driver that are necessary.
|
||||
*
|
||||
* <b> Limitations of the driver </b>
|
||||
*
|
||||
*
|
||||
* <br><br>
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ----- -------- -----------------------------------------------------
|
||||
* 1.00a bss 02/27/12 First release
|
||||
* 2.00a bss 06/23/12 Updated to support v2_00a version of IP.
|
||||
* 3.00a bss 09/03/12 To support v2_01_a version of IP:
|
||||
* Deleted XAxiPmon_SetAgent, XAxiPmon_GetAgent APIs and
|
||||
* added XAPM_FLAG_EVENT, XAPM_FLAG_EVNTSTAR,
|
||||
* XAPM_FLAG_EVNTSTOP.
|
||||
* Deleted XAxiPmon_SetAgent, XAxiPmon_GetAgent APIs and
|
||||
* modified XAxiPmon_SetMetrics, XAxiPmon_GetMetrics APIs
|
||||
* in xaxipmon.c
|
||||
* Deleted XAPM_AGENT_OFFSET Macro in xaxipmon_hw.h
|
||||
* 3.01a bss 10/25/12 To support new version of IP:
|
||||
* Added XAPM_MCXLOGEN_OFFSET macros in xaxipmon_hw.h.
|
||||
* Added XAxiPmon_SetMetricCounterCutOff,
|
||||
* XAxiPmon_GetMetricCounterCutOff,
|
||||
* XAxiPmon_EnableExternalTrigger and
|
||||
* XAxiPmon_DisableExternalTrigger APIs in xaxipmon.c
|
||||
* Modified XAxiPmon_SetMetrics and XAxiPmon_GetMetrics
|
||||
* (CR #683746) in xaxipmon.c
|
||||
* Added XAxiPmon_EnableEventLog,
|
||||
* XAxiPmon_DisableMetricsCounter,
|
||||
* XAxiPmon_EnableMetricsCounter APIs in xaxipmon.c to
|
||||
* replace macros in this file.
|
||||
* Added XAPM_FLAG_XXX macros.
|
||||
* Added XAxiPmon_StartCounters and XAxiPmon_StopCounters
|
||||
* APIs (CR #683799).
|
||||
* Added XAxiPmon_StartEventLog and XAxiPmon_StopEventLog
|
||||
* APIs (CR #683801).
|
||||
* Added XAxiPmon_GetMetricName API (CR #683803).
|
||||
* Deleted XAxiPmon_SetAgent, XAxiPmon_GetAgent
|
||||
* declarations (CR #677337)
|
||||
* 4.00a bss 01/17/13 To support new version of IP:
|
||||
* Added XAPM_METRIC_SET_12 to XAPM_METRIC_SET_15 macros.
|
||||
* Added XAxiPmon_SetLogEnableRanges,
|
||||
* XAxiPmon_GetLogEnableRanges,
|
||||
* XAxiPmon_EnableMetricCounterTrigger,
|
||||
* XAxiPmon_DisableMetricCounterTrigger,
|
||||
* XAxiPmon_EnableEventLogTrigger,
|
||||
* XAxiPmon_DisableEventLogTrigger,
|
||||
* XAxiPmon_SetWriteLatencyId,
|
||||
* XAxiPmon_SetReadLatencyId,
|
||||
* XAxiPmon_GetWriteLatencyId,
|
||||
* XAxiPmon_GetReadLatencyId APIs and removed
|
||||
* XAxiPmon_SetMetricCounterCutOff,
|
||||
* XAxiPmon_GetMetricCounterCutOff,
|
||||
* XAxiPmon_EnableExternalTrigger and
|
||||
* XAxiPmon_DisableExternalTrigger APIs in xaxipmon.c
|
||||
* Added XAPM_LATENCYID_OFFSET,
|
||||
* XAPM_CR_EVTLOG_EXTTRIGGER_MASK,
|
||||
* XAPM_LATENCYID_RID_MASK and XAPM_LATENCYID_WID_MASK in
|
||||
* xaxipmon_hw.h
|
||||
* 5.00a bss 08/26/13 To support new version of IP:
|
||||
* XAxiPmon_SampleMetrics Macro.
|
||||
* Modified XAxiPmon_CfgInitialize, Assert functions
|
||||
* Added XAxiPmon_GetMetricCounter,
|
||||
* XAxiPmon_SetSampleInterval, XAxiPmon_GetSampleInterval,
|
||||
* XAxiPmon_SetWrLatencyStart, XAxiPmon_SetWrLatencyEnd,
|
||||
* XAxiPmon_SetRdLatencyStart, XAxiPmon_SetRdLatencyEnd,
|
||||
* XAxiPmon_GetWrLatencyStart, XAxiPmon_GetWrLatencyEnd,
|
||||
* XAxiPmon_GetRdLatencyStart, XAxiPmon_GetRdLatencyEnd,
|
||||
* XAxiPmon_SetWriteIdMask, XAxiPmon_SetReadIdMask,
|
||||
* XAxiPmon_GetWriteIdMask and XAxiPmon_GetReadIdMask APIs
|
||||
* Renamed :
|
||||
* XAxiPmon_SetWriteLatencyId to
|
||||
* XAxiPmon_SetWriteId, XAxiPmon_SetReadLatencyId to
|
||||
* XAxiPmon_SetReadId, XAxiPmon_GetWriteLatencyId to
|
||||
* XAxiPmon_GetWriteId and XAxiPmon_SetReadLatencyId to
|
||||
* XAxiPmon_GetReadId. in xaxipmon.c
|
||||
* Added Macros XAPM_MC10_OFFSET to XAPM_MC47_OFFSET,
|
||||
* XAPM_SMC10_OFFSET to XAPM_SMC47_OFFSET,
|
||||
* XAPM_IDMASK_OFFSET, XAPM_CR_IDFILTER_ENABLE_MASK,
|
||||
* XAPM_CR_WRLATENCY_START_MASK,
|
||||
* XAPM_CR_WRLATENCY_END_MASK,
|
||||
* XAPM_CR_RDLATENCY_START_MASK,
|
||||
* XAPM_CR_RDLATENCY_END_MASK and
|
||||
* XAPM_MAX_COUNTERS_PROFILE.
|
||||
* Renamed:
|
||||
* XAPM_LATENCYID_OFFSET to XAPM_ID_OFFSET,
|
||||
* XAPM_LATENCYID_RID_MASK to XAPM_ID_RID_MASK,
|
||||
* XAPM_LATENCYID_WID_MASK to XAPM_ID_WID_MASK.
|
||||
* in xaxipmon_hw.h.
|
||||
* Modified driver tcl to generate new parameters
|
||||
* ScaleFactor, ModeProfile, ModeTrace and ModeAdvanced
|
||||
* in Config structure.
|
||||
* 6.0 adk 19/12/13 Updated as per the New Tcl API's
|
||||
* 6.1 adk 16/04/14 Updated the driver tcl for the newly added parameters in
|
||||
* The Axi pmon IP.
|
||||
* 6.2 bss 04/21/14 Updated XAxiPmon_CfgInitialize in xaxipmon.c to Reset
|
||||
* counters and FIFOs based on Modes(CR#782671). And if
|
||||
* both profile and trace modes are present set mode as
|
||||
* Advanced.
|
||||
* 6.2 bss 03/02/15 To support Zynq MP APM:
|
||||
* Added Is32BitFiltering in XAxiPmon_Config structure.
|
||||
* Updated XAxiPmon_SetWriteId, XAxiPmon_SetReadId,
|
||||
* XAxiPmon_GetWriteId, XAxiPmon_GetReadId
|
||||
* XAxiPmon_SetWriteIdMask, XAxiPmon_SetReadIdMask
|
||||
* XAxiPmon_GetWriteIdMask, XAxiPmon_GetReadIdMask
|
||||
* functions in xaxipmon.c.
|
||||
* Added XAPM_RID_OFFSET and XAPM_RIDMASK_OFFSET in
|
||||
* xaxipmon_hw.h
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef XAXIPMON_H /* Prevent circular inclusions */
|
||||
#define XAXIPMON_H /* by using protection macros */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/***************************** Include Files ********************************/
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
#include "xaxipmon_hw.h"
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
|
||||
/**
|
||||
* @name Macro for Maximum number of Counters
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define XAPM_MAX_COUNTERS 10 /**< Maximum number of Counters */
|
||||
#define XAPM_MAX_COUNTERS_PROFILE 48 /**< Maximum number of Counters */
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Indices for Metric Counters and Sampled Metric Coounters used with
|
||||
* XAxiPmon_GetMetricCounter and XAxiPmon_GetSampledMetricCounter APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_METRIC_COUNTER_0 0 /**< Metric Counter 0 Register Index */
|
||||
#define XAPM_METRIC_COUNTER_1 1 /**< Metric Counter 1 Register Index */
|
||||
#define XAPM_METRIC_COUNTER_2 2 /**< Metric Counter 2 Register Index */
|
||||
#define XAPM_METRIC_COUNTER_3 3 /**< Metric Counter 3 Register Index */
|
||||
#define XAPM_METRIC_COUNTER_4 4 /**< Metric Counter 4 Register Index */
|
||||
#define XAPM_METRIC_COUNTER_5 5 /**< Metric Counter 5 Register Index */
|
||||
#define XAPM_METRIC_COUNTER_6 6 /**< Metric Counter 6 Register Index */
|
||||
#define XAPM_METRIC_COUNTER_7 7 /**< Metric Counter 7 Register Index */
|
||||
#define XAPM_METRIC_COUNTER_8 8 /**< Metric Counter 8 Register Index */
|
||||
#define XAPM_METRIC_COUNTER_9 9 /**< Metric Counter 9 Register Index */
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @name Indices for Incrementers and Sampled Incrementers used with
|
||||
* XAxiPmon_GetIncrementer and XAxiPmon_GetSampledIncrementer APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_INCREMENTER_0 0 /**< Metric Counter 0 Register Index */
|
||||
#define XAPM_INCREMENTER_1 1 /**< Metric Counter 0 Register Index */
|
||||
#define XAPM_INCREMENTER_2 2 /**< Metric Counter 0 Register Index */
|
||||
#define XAPM_INCREMENTER_3 3 /**< Metric Counter 0 Register Index */
|
||||
#define XAPM_INCREMENTER_4 4 /**< Metric Counter 0 Register Index */
|
||||
#define XAPM_INCREMENTER_5 5 /**< Metric Counter 0 Register Index */
|
||||
#define XAPM_INCREMENTER_6 6 /**< Metric Counter 0 Register Index */
|
||||
#define XAPM_INCREMENTER_7 7 /**< Metric Counter 0 Register Index */
|
||||
#define XAPM_INCREMENTER_8 8 /**< Metric Counter 0 Register Index */
|
||||
#define XAPM_INCREMENTER_9 9 /**< Metric Counter 0 Register Index */
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @name Macros for Metric Selector Settings
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_METRIC_SET_0 0 /**< Write Transaction Count */
|
||||
#define XAPM_METRIC_SET_1 1 /**< Read Transaction Count */
|
||||
#define XAPM_METRIC_SET_2 2 /**< Write Byte Count */
|
||||
#define XAPM_METRIC_SET_3 3 /**< Read Byte Count */
|
||||
#define XAPM_METRIC_SET_4 4 /**< Write Beat Count */
|
||||
#define XAPM_METRIC_SET_5 5 /**< Total Read Latency */
|
||||
#define XAPM_METRIC_SET_6 6 /**< Total Write Latency */
|
||||
#define XAPM_METRIC_SET_7 7 /**< Slv_Wr_Idle_Cnt */
|
||||
#define XAPM_METRIC_SET_8 8 /**< Mst_Rd_Idle_Cnt */
|
||||
#define XAPM_METRIC_SET_9 9 /**< Num_BValids */
|
||||
#define XAPM_METRIC_SET_10 10 /**< Num_WLasts */
|
||||
#define XAPM_METRIC_SET_11 11 /**< Num_RLasts */
|
||||
#define XAPM_METRIC_SET_12 12 /**< Minimum Write Latency */
|
||||
#define XAPM_METRIC_SET_13 13 /**< Maximum Write Latency */
|
||||
#define XAPM_METRIC_SET_14 14 /**< Minimum Read Latency */
|
||||
#define XAPM_METRIC_SET_15 15 /**< Maximum Read Latency */
|
||||
#define XAPM_METRIC_SET_16 16 /**< Transfer Cycle Count */
|
||||
#define XAPM_METRIC_SET_17 17 /**< Packet Count */
|
||||
#define XAPM_METRIC_SET_18 18 /**< Data Byte Count */
|
||||
#define XAPM_METRIC_SET_19 19 /**< Position Byte Count */
|
||||
#define XAPM_METRIC_SET_20 20 /**< Null Byte Count */
|
||||
#define XAPM_METRIC_SET_21 21 /**< Slv_Idle_Cnt */
|
||||
#define XAPM_METRIC_SET_22 22 /**< Mst_Idle_Cnt */
|
||||
#define XAPM_METRIC_SET_30 30 /**< External event count */
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Macros for Maximum number of Agents
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_MAX_AGENTS 8 /**< Maximum number of Agents */
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @name Macros for Flags in Flag Enable Control Register
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_FLAG_WRADDR 0x00000001 /**< Write Address Flag */
|
||||
#define XAPM_FLAG_FIRSTWR 0x00000002 /**< First Write Flag */
|
||||
#define XAPM_FLAG_LASTWR 0x00000004 /**< Last Write Flag */
|
||||
#define XAPM_FLAG_RESPONSE 0x00000008 /**< Response Flag */
|
||||
#define XAPM_FLAG_RDADDR 0x00000010 /**< Read Address Flag */
|
||||
#define XAPM_FLAG_FIRSTRD 0x00000020 /**< First Read Flag */
|
||||
#define XAPM_FLAG_LASTRD 0x00000040 /**< Last Read Flag */
|
||||
#define XAPM_FLAG_SWDATA 0x00010000 /**< Software-written Data Flag */
|
||||
#define XAPM_FLAG_EVENT 0x00020000 /**< Last Read Flag */
|
||||
#define XAPM_FLAG_EVNTSTOP 0x00040000 /**< Last Read Flag */
|
||||
#define XAPM_FLAG_EVNTSTART 0x00080000 /**< Last Read Flag */
|
||||
#define XAPM_FLAG_GCCOVF 0x00100000 /**< Global Clock Counter Overflow
|
||||
* Flag */
|
||||
#define XAPM_FLAG_SCLAPSE 0x00200000 /**< Sample Counter Lapse Flag */
|
||||
#define XAPM_FLAG_MC0 0x00400000 /**< Metric Counter 0 Flag */
|
||||
#define XAPM_FLAG_MC1 0x00800000 /**< Metric Counter 1 Flag */
|
||||
#define XAPM_FLAG_MC2 0x01000000 /**< Metric Counter 2 Flag */
|
||||
#define XAPM_FLAG_MC3 0x02000000 /**< Metric Counter 3 Flag */
|
||||
#define XAPM_FLAG_MC4 0x04000000 /**< Metric Counter 4 Flag */
|
||||
#define XAPM_FLAG_MC5 0x08000000 /**< Metric Counter 5 Flag */
|
||||
#define XAPM_FLAG_MC6 0x10000000 /**< Metric Counter 6 Flag */
|
||||
#define XAPM_FLAG_MC7 0x20000000 /**< Metric Counter 7 Flag */
|
||||
#define XAPM_FLAG_MC8 0x40000000 /**< Metric Counter 8 Flag */
|
||||
#define XAPM_FLAG_MC9 0x80000000 /**< Metric Counter 9 Flag */
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @name Macros for Read/Write Latency Start and End points
|
||||
* @{
|
||||
*/
|
||||
#define XAPM_LATENCY_ADDR_ISSUE 0 /**< Address Issue as start
|
||||
point for Latency calculation*/
|
||||
#define XAPM_LATENCY_ADDR_ACCEPT 1 /**< Address Acceptance as start
|
||||
point for Latency calculation*/
|
||||
#define XAPM_LATENCY_LASTRD 0 /**< Last Read as end point for
|
||||
Latency calculation */
|
||||
#define XAPM_LATENCY_LASTWR 0 /**< Last Write as end point for
|
||||
Latency calculation */
|
||||
#define XAPM_LATENCY_FIRSTRD 1 /**< First Read as end point for
|
||||
Latency calculation */
|
||||
#define XAPM_LATENCY_FIRSTWR 1 /**< First Write as end point for
|
||||
Latency calculation */
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @name Macros for Modes of APM
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_MODE_TRACE 2 /**< APM in Trace mode */
|
||||
|
||||
#define XAPM_MODE_PROFILE 1 /**< APM in Profile mode */
|
||||
|
||||
#define XAPM_MODE_ADVANCED 0 /**< APM in Advanced mode */
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/**
|
||||
* This typedef contains configuration information for the AXI Performance
|
||||
* Monitor device.
|
||||
*/
|
||||
typedef struct {
|
||||
u16 DeviceId; /**< Unique ID of device */
|
||||
u32 BaseAddress; /**< Device base address */
|
||||
int GlobalClkCounterWidth; /**< Global Clock Counter Width */
|
||||
int MetricSampleCounterWidth ; /**< Metric Sample Counters Width */
|
||||
u8 IsEventCount; /**< Event Count Enabled 1 - enabled
|
||||
0 - not enabled */
|
||||
u8 NumberofSlots; /**< Number of Monitor Slots */
|
||||
u8 NumberofCounters; /**< Number of Counters */
|
||||
u8 HaveSampledCounters; /**< Have Sampled Counters 1 - present
|
||||
0 - Not present */
|
||||
u8 IsEventLog; /**< Event Logging Enabled 1 - enabled
|
||||
0 - Not enabled */
|
||||
u32 FifoDepth; /**< Event Log FIFO Depth */
|
||||
u32 FifoWidth; /**< Event Log FIFO Width */
|
||||
u32 TidWidth; /**< Streaming Interface TID Width */
|
||||
u8 ScaleFactor; /**< Event Count Scaling factor */
|
||||
u8 ModeAdvanced; /**< Advanced Mode */
|
||||
u8 ModeProfile; /**< Profile Mode */
|
||||
u8 ModeTrace; /**< Trace Mode */
|
||||
u8 Is32BitFiltering; /**< 32 bit filtering enabled */
|
||||
} XAxiPmon_Config;
|
||||
|
||||
|
||||
/**
|
||||
* The driver's instance data. The user is required to allocate a variable
|
||||
* of this type for every AXI Performance Monitor device in system. A pointer
|
||||
* to a variable of this type is then passed to the driver API functions.
|
||||
*/
|
||||
typedef struct {
|
||||
XAxiPmon_Config Config; /**< XAxiPmon_Config of current device */
|
||||
u32 IsReady; /**< Device is initialized and ready */
|
||||
u8 Mode; /**< APM Mode */
|
||||
} XAxiPmon;
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions ********************/
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This routine enables the Global Interrupt.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_IntrGlobalEnable(XAxiPmon *InstancePtr)
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_IntrGlobalEnable(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_GIE_OFFSET, 1)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This routine disables the Global Interrupt.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_IntrGlobalDisable(XAxiPmon *InstancePtr)
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_IntrGlobalDisable(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_GIE_OFFSET, 0)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This routine enables interrupt(s). Use the XAPM_IXR_* constants defined in
|
||||
* xaxipmon_hw.h to create the bit-mask to enable interrupts.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
* @param Mask is the mask to enable. Bit positions of 1 will be enabled.
|
||||
* Bit positions of 0 will keep the previous setting. This mask is
|
||||
* formed by OR'ing XAPM_IXR__* bits defined in xaxipmon_hw.h.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_IntrEnable(XAxiPmon *InstancePtr, u32 Mask)
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_IntrEnable(InstancePtr, Mask) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_IE_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_IE_OFFSET) | Mask);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This routine disable interrupt(s). Use the XAPM_IXR_* constants defined in
|
||||
* xaxipmon_hw.h to create the bit-mask to disable interrupts.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
* @param Mask is the mask to disable. Bit positions of 1 will be
|
||||
* disabled. Bit positions of 0 will keep the previous setting.
|
||||
* This mask is formed by OR'ing XAPM_IXR_* bits defined in
|
||||
* xaxipmon_hw.h.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_IntrEnable(XAxiPmon *InstancePtr, u32 Mask)
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_IntrDisable(InstancePtr, Mask) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_IE_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_IE_OFFSET) | Mask);
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This routine clears the specified interrupt(s).
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
* @param Mask is the mask to clear. Bit positions of 1 will be cleared.
|
||||
* This mask is formed by OR'ing XAPM_IXR_* bits defined in
|
||||
* xaxipmon_hw.h.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_IntrClear(XAxiPmon *InstancePtr, u32 Mask)
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_IntrClear(InstancePtr, Mask) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_IS_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_IS_OFFSET) | Mask);
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This routine returns the Interrupt Status Register.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return Interrupt Status Register contents
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_IntrClear(XAxiPmon *InstancePtr)
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_IntrGetStatus(InstancePtr) \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_IS_OFFSET);
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function enables the Global Clock Counter.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_EnableGlobalClkCounter(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_EnableGlobalClkCounter(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_CTL_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_CTL_OFFSET) | XAPM_CR_GCC_ENABLE_MASK);
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function disbles the Global Clock Counter.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_DisableGlobalClkCounter(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_DisableGlobalClkCounter(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_CTL_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_CTL_OFFSET) & ~(XAPM_CR_GCC_ENABLE_MASK));
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function enables the specified flag in Flag Control Register.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
* @param Flag is one of the XAPM_FLAG_* masks defined in xaxipmon.h
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_EnableFlag(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_EnableFlag(InstancePtr, Flag) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_FEC_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_FEC_OFFSET) | Flag);
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function disables the specified flag in Flag Control Register.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
* @param Flag is one of the XAPM_FLAG_* masks defined in xaxipmon.h*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_DisableFlag(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_DisableFlag(InstancePtr, Flag) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_FEC_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_FEC_OFFSET) & ~(Flag));
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function loads the sample interval register value into the sample
|
||||
* interval counter.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_LoadSampleIntervalCounter(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_LoadSampleIntervalCounter(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_SICR_OFFSET, \
|
||||
XAPM_SICR_LOAD_MASK);
|
||||
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This enables the down count of the sample interval counter.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_EnableSampleIntervalCounter(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_EnableSampleIntervalCounter(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_SICR_OFFSET,\
|
||||
XAPM_SICR_ENABLE_MASK);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This disables the down count of the sample interval counter.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_DisableSampleIntervalCounter(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_DisableSampleIntervalCounter(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_SICR_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_SICR_OFFSET) & ~(XAPM_SICR_ENABLE_MASK));
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This enables Reset of Metric Counters when Sample Interval Counter lapses.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_EnableMetricCounterReset(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_EnableMetricCounterReset(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_SICR_OFFSET,\
|
||||
XAPM_SICR_MCNTR_RST_MASK);
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This disables the down count of the sample interval counter.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_DisableMetricCounterReset(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_DisableMetricCounterReset(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_SICR_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_SICR_OFFSET) & ~(XAPM_SICR_MCNTR_RST_MASK));
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function enables the ID Filter Masking.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_EnableIDFilter(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_EnableIDFilter(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_CTL_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_CTL_OFFSET) | XAPM_CR_IDFILTER_ENABLE_MASK);
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function disbles the ID Filter masking.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* void XAxiPmon_DisableIDFilter(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_DisableIDFilter(InstancePtr) \
|
||||
XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress, XAPM_CTL_OFFSET, \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
XAPM_CTL_OFFSET) & ~(XAPM_CR_IDFILTER_ENABLE_MASK));
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function samples Metric Counters to Sampled Metric Counters by
|
||||
* reading Sample Register and also returns interval. i.e. the number of
|
||||
* clocks in between previous read to the current read of sample register.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return Interval. i.e. the number of clocks in between previous
|
||||
* read to the current read of sample register.
|
||||
*
|
||||
* @note C-Style signature:
|
||||
* u32 XAxiPmon_SampleMetrics(XAxiPmon *InstancePtr);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XAxiPmon_SampleMetrics(InstancePtr) \
|
||||
XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress, XAPM_SR_OFFSET);
|
||||
|
||||
|
||||
/************************** Function Prototypes *****************************/
|
||||
|
||||
/**
|
||||
* Functions in xaxipmon_sinit.c
|
||||
*/
|
||||
XAxiPmon_Config *XAxiPmon_LookupConfig(u16 DeviceId);
|
||||
|
||||
/**
|
||||
* Functions in xaxipmon.c
|
||||
*/
|
||||
int XAxiPmon_CfgInitialize(XAxiPmon *InstancePtr,
|
||||
XAxiPmon_Config *ConfigPtr, u32 EffectiveAddr);
|
||||
|
||||
int XAxiPmon_ResetMetricCounter(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_ResetGlobalClkCounter(XAxiPmon *InstancePtr);
|
||||
|
||||
int XAxiPmon_ResetFifo(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_SetIncrementerRange(XAxiPmon *InstancePtr, u8 IncrementerNum,
|
||||
u16 RangeUpper, u16 RangeLower);
|
||||
|
||||
void XAxiPmon_GetIncrementerRange(XAxiPmon *InstancePtr, u8 IncrementerNum,
|
||||
u16 *RangeUpper, u16 *RangeLower);
|
||||
|
||||
void XAxiPmon_SetSampleInterval(XAxiPmon *InstancePtr, u32 SampleInterval);
|
||||
|
||||
void XAxiPmon_GetSampleInterval(XAxiPmon *InstancePtr, u32 *SampleInterval);
|
||||
|
||||
int XAxiPmon_SetMetrics(XAxiPmon *InstancePtr, u8 Slot, u8 Metrics,
|
||||
u8 CounterNum);
|
||||
|
||||
int XAxiPmon_GetMetrics(XAxiPmon *InstancePtr, u8 CounterNum, u8 *Metrics,
|
||||
u8 *Slot);
|
||||
void XAxiPmon_GetGlobalClkCounter(XAxiPmon *InstancePtr,u32 *CntHighValue,
|
||||
u32 *CntLowValue);
|
||||
|
||||
u32 XAxiPmon_GetMetricCounter(XAxiPmon *InstancePtr, u32 CounterNum);
|
||||
|
||||
u32 XAxiPmon_GetSampledMetricCounter(XAxiPmon *InstancePtr, u32 CounterNum);
|
||||
|
||||
u32 XAxiPmon_GetIncrementer(XAxiPmon *InstancePtr, u32 IncrementerNum);
|
||||
|
||||
u32 XAxiPmon_GetSampledIncrementer(XAxiPmon *InstancePtr, u32 IncrementerNum);
|
||||
|
||||
void XAxiPmon_SetSwDataReg(XAxiPmon *InstancePtr, u32 SwData);
|
||||
|
||||
u32 XAxiPmon_GetSwDataReg(XAxiPmon *InstancePtr);
|
||||
|
||||
int XAxiPmon_StartEventLog(XAxiPmon *InstancePtr, u32 FlagEnables);
|
||||
|
||||
int XAxiPmon_StopEventLog(XAxiPmon *InstancePtr);
|
||||
|
||||
int XAxiPmon_StartCounters(XAxiPmon *InstancePtr, u32 SampleInterval);
|
||||
|
||||
int XAxiPmon_StopCounters(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_EnableMetricsCounter(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_DisableMetricsCounter(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_SetLogEnableRanges(XAxiPmon *InstancePtr, u32 CounterNum,
|
||||
u16 RangeUpper, u16 RangeLower);
|
||||
|
||||
void XAxiPmon_GetLogEnableRanges(XAxiPmon *InstancePtr, u32 CounterNum,
|
||||
u16 *RangeUpper, u16 *RangeLower);
|
||||
|
||||
void XAxiPmon_EnableEventLog(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_EnableMetricCounterTrigger(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_DisableMetricCounterTrigger(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_EnableEventLogTrigger(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_DisableEventLogTrigger(XAxiPmon *InstancePtr);
|
||||
|
||||
const char * XAxiPmon_GetMetricName(u8 Metrics);
|
||||
|
||||
void XAxiPmon_SetWriteId(XAxiPmon *InstancePtr, u32 WriteId);
|
||||
|
||||
void XAxiPmon_SetReadId(XAxiPmon *InstancePtr, u32 ReadId);
|
||||
|
||||
u32 XAxiPmon_GetWriteId(XAxiPmon *InstancePtr);
|
||||
|
||||
u32 XAxiPmon_GetReadId(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_SetWrLatencyStart(XAxiPmon *InstancePtr, u8 Param);
|
||||
|
||||
void XAxiPmon_SetWrLatencyEnd(XAxiPmon *InstancePtr, u8 Param);
|
||||
|
||||
void XAxiPmon_SetRdLatencyStart(XAxiPmon *InstancePtr, u8 Param);
|
||||
|
||||
void XAxiPmon_SetRdLatencyEnd(XAxiPmon *InstancePtr, u8 Param);
|
||||
|
||||
u8 XAxiPmon_GetWrLatencyStart(XAxiPmon *InstancePtr);
|
||||
|
||||
u8 XAxiPmon_GetWrLatencyEnd(XAxiPmon *InstancePtr);
|
||||
|
||||
u8 XAxiPmon_GetRdLatencyStart(XAxiPmon *InstancePtr);
|
||||
|
||||
u8 XAxiPmon_GetRdLatencyEnd(XAxiPmon *InstancePtr);
|
||||
|
||||
void XAxiPmon_SetWriteIdMask(XAxiPmon *InstancePtr, u32 WrMask);
|
||||
|
||||
void XAxiPmon_SetReadIdMask(XAxiPmon *InstancePtr, u32 RdMask);
|
||||
|
||||
u32 XAxiPmon_GetWriteIdMask(XAxiPmon *InstancePtr);
|
||||
|
||||
u32 XAxiPmon_GetReadIdMask(XAxiPmon *InstancePtr);
|
||||
|
||||
|
||||
/**
|
||||
* Functions in xaxipmon_selftest.c
|
||||
*/
|
||||
int XAxiPmon_SelfTest(XAxiPmon *InstancePtr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* End of protection macro. */
|
||||
/** @} */
|
87
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon_g.c
Normal file
87
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon_g.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xaxipmon_g.c
|
||||
* @addtogroup axipmon_v6_2
|
||||
* @{
|
||||
* @details
|
||||
*
|
||||
* This file contains a configuration table that specifies the configuration
|
||||
* of AxiMon devices in the system.
|
||||
*
|
||||
* See xaxipmon.h for more information about this driver.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ----- -------- -----------------------------------------------------
|
||||
* 1.00a bss 02/22/12 First release
|
||||
* 2.00a bss 06/23/12 Updated to support v2_00a version of IP.
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xaxipmon.h"
|
||||
#include "xparameters.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
/************************** Variable Prototypes ******************************/
|
||||
|
||||
/**
|
||||
* This table contains configuration information for each System Monitor/ADC
|
||||
* device in the system.
|
||||
*/
|
||||
XAxiPmon_Config XAxiPmon_ConfigTable[XPAR_XAXIPMON_NUM_INSTANCES] =
|
||||
{
|
||||
{
|
||||
XPAR_AXI_PERF_MON_0_DEVICE_ID,
|
||||
XPAR_AXI_PERF_MON_0_BASEADDR,
|
||||
XPAR_AXI_PERF_MON_0_GLOBAL_COUNT_WIDTH,
|
||||
XPAR_AXI_PERF_MON_0_METRICS_SAMPLE_COUNT_WIDTH
|
||||
}
|
||||
};
|
||||
/** @} */
|
570
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon_hw.h
Normal file
570
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon_hw.h
Normal file
|
@ -0,0 +1,570 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 - 2015 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xaxipmon_hw.h
|
||||
* @addtogroup axipmon_v6_2
|
||||
* @{
|
||||
* @details
|
||||
*
|
||||
* This header file contains identifiers and basic driver functions (or
|
||||
* macros) that can be used to access the AXI Performance Monitor.
|
||||
*
|
||||
* Refer to the device specification for more information about this driver.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ----- -------- -----------------------------------------------------
|
||||
* 1.00a bss 02/27/12 First release
|
||||
* 2.00a bss 06/23/12 Updated to support v2_00a version of IP.
|
||||
* 3.00a bss 09/03/12 Deleted XAPM_AGENT_OFFSET Macro to support
|
||||
* v2_01a version of IP.
|
||||
* 3.01a bss 10/25/12 To support new version of IP:
|
||||
* Added XAPM_MCXLOGEN_OFFSET and
|
||||
* XAPM_CR_EXTERNAL_TRIGGER_MASK macros.
|
||||
* 4.00a bss 01/17/13 To support new version of IP:
|
||||
* Added XAPM_LATENCYID_OFFSET,
|
||||
* XAPM_CR_EVTLOG_EXTTRIGGER_MASK,
|
||||
* XAPM_LATENCYID_RID_MASK and XAPM_LATENCYID_WID_MASK
|
||||
* 5.00a bss 08/26/13 To support new version of IP:
|
||||
* Added Macros XAPM_MC10_OFFSET to XAPM_MC47_OFFSET,
|
||||
* XAPM_SMC10_OFFSET to XAPM_SMC47_OFFSET.
|
||||
* Added macro XAPM_IDMASK_OFFSET, XAPM_SR_OFFSET.
|
||||
* Added XAPM_CR_IDFILTER_ENABLE_MASK,
|
||||
* XAPM_CR_WRLATENCY_START_MASK,
|
||||
* XAPM_CR_WRLATENCY_END_MASK,
|
||||
* XAPM_CR_RDLATENCY_START_MASK,
|
||||
* XAPM_CR_RDLATENCY_END_MASK, XAPM_MASKID_RID_MASK
|
||||
* and XAPM_MASKID_WID_MASK macros.
|
||||
* Renamed:
|
||||
* XAPM_LATENCYID_OFFSET to XAPM_ID_OFFSET,
|
||||
* XAPM_LATENCYID_RID_MASK to XAPM_ID_RID_MASK,
|
||||
* XAPM_LATENCYID_WID_MASK to XAPM_ID_WID_MASK.
|
||||
*
|
||||
* 6.2 bss 03/02/15 Added XAPM_RID_OFFSET and XAPM_RIDMASK_OFFSET to support
|
||||
* Zynq MP APM.
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef XAXIPMON_HW_H /* Prevent circular inclusions */
|
||||
#define XAXIPMON_HW_H /* by using protection macros */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/***************************** Include Files ********************************/
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xil_io.h"
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
|
||||
/**@name Register offsets of AXIMONITOR in the Device Config
|
||||
*
|
||||
* The following constants provide access to each of the registers of the
|
||||
* AXI PERFORMANCE MONITOR device.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_GCC_HIGH_OFFSET 0x0000 /**< Global Clock Counter
|
||||
32 to 63 bits */
|
||||
#define XAPM_GCC_LOW_OFFSET 0x0004 /**< Global Clock Counter Lower
|
||||
0-31 bits */
|
||||
#define XAPM_SI_HIGH_OFFSET 0x0020 /**< Sample Interval MSB */
|
||||
#define XAPM_SI_LOW_OFFSET 0x0024 /**< Sample Interval LSB */
|
||||
#define XAPM_SICR_OFFSET 0x0028 /**< Sample Interval Control
|
||||
Register */
|
||||
#define XAPM_SR_OFFSET 0x002C /**< Sample Register */
|
||||
#define XAPM_GIE_OFFSET 0x0030 /**< Global Interrupt Enable
|
||||
Register */
|
||||
#define XAPM_IE_OFFSET 0x0034 /**< Interrupt Enable Register */
|
||||
#define XAPM_IS_OFFSET 0x0038 /**< Interrupt Status Register */
|
||||
|
||||
#define XAPM_MSR0_OFFSET 0x0044 /**< Metric Selector 0 Register */
|
||||
#define XAPM_MSR1_OFFSET 0x0048 /**< Metric Selector 1 Register */
|
||||
#define XAPM_MSR2_OFFSET 0x004C /**< Metric Selector 2 Register */
|
||||
|
||||
#define XAPM_MC0_OFFSET 0x0100 /**< Metric Counter 0 Register */
|
||||
#define XAPM_INC0_OFFSET 0x0104 /**< Incrementer 0 Register */
|
||||
#define XAPM_RANGE0_OFFSET 0x0108 /**< Range 0 Register */
|
||||
#define XAPM_MC0LOGEN_OFFSET 0x010C /**< Metric Counter 0
|
||||
Log Enable Register */
|
||||
#define XAPM_MC1_OFFSET 0x0110 /**< Metric Counter 1 Register */
|
||||
#define XAPM_INC1_OFFSET 0x0114 /**< Incrementer 1 Register */
|
||||
#define XAPM_RANGE1_OFFSET 0x0118 /**< Range 1 Register */
|
||||
#define XAPM_MC1LOGEN_OFFSET 0x011C /**< Metric Counter 1
|
||||
Log Enable Register */
|
||||
#define XAPM_MC2_OFFSET 0x0120 /**< Metric Counter 2 Register */
|
||||
#define XAPM_INC2_OFFSET 0x0124 /**< Incrementer 2 Register */
|
||||
#define XAPM_RANGE2_OFFSET 0x0128 /**< Range 2 Register */
|
||||
#define XAPM_MC2LOGEN_OFFSET 0x012C /**< Metric Counter 2
|
||||
Log Enable Register */
|
||||
#define XAPM_MC3_OFFSET 0x0130 /**< Metric Counter 3 Register */
|
||||
#define XAPM_INC3_OFFSET 0x0134 /**< Incrementer 3 Register */
|
||||
#define XAPM_RANGE3_OFFSET 0x0138 /**< Range 3 Register */
|
||||
#define XAPM_MC3LOGEN_OFFSET 0x013C /**< Metric Counter 3
|
||||
Log Enable Register */
|
||||
#define XAPM_MC4_OFFSET 0x0140 /**< Metric Counter 4 Register */
|
||||
#define XAPM_INC4_OFFSET 0x0144 /**< Incrementer 4 Register */
|
||||
#define XAPM_RANGE4_OFFSET 0x0148 /**< Range 4 Register */
|
||||
#define XAPM_MC4LOGEN_OFFSET 0x014C /**< Metric Counter 4
|
||||
Log Enable Register */
|
||||
#define XAPM_MC5_OFFSET 0x0150 /**< Metric Counter 5
|
||||
Register */
|
||||
#define XAPM_INC5_OFFSET 0x0154 /**< Incrementer 5 Register */
|
||||
#define XAPM_RANGE5_OFFSET 0x0158 /**< Range 5 Register */
|
||||
#define XAPM_MC5LOGEN_OFFSET 0x015C /**< Metric Counter 5
|
||||
Log Enable Register */
|
||||
#define XAPM_MC6_OFFSET 0x0160 /**< Metric Counter 6
|
||||
Register */
|
||||
#define XAPM_INC6_OFFSET 0x0164 /**< Incrementer 6 Register */
|
||||
#define XAPM_RANGE6_OFFSET 0x0168 /**< Range 6 Register */
|
||||
#define XAPM_MC6LOGEN_OFFSET 0x016C /**< Metric Counter 6
|
||||
Log Enable Register */
|
||||
#define XAPM_MC7_OFFSET 0x0170 /**< Metric Counter 7
|
||||
Register */
|
||||
#define XAPM_INC7_OFFSET 0x0174 /**< Incrementer 7 Register */
|
||||
#define XAPM_RANGE7_OFFSET 0x0178 /**< Range 7 Register */
|
||||
#define XAPM_MC7LOGEN_OFFSET 0x017C /**< Metric Counter 7
|
||||
Log Enable Register */
|
||||
#define XAPM_MC8_OFFSET 0x0180 /**< Metric Counter 8
|
||||
Register */
|
||||
#define XAPM_INC8_OFFSET 0x0184 /**< Incrementer 8 Register */
|
||||
#define XAPM_RANGE8_OFFSET 0x0188 /**< Range 8 Register */
|
||||
#define XAPM_MC8LOGEN_OFFSET 0x018C /**< Metric Counter 8
|
||||
Log Enable Register */
|
||||
#define XAPM_MC9_OFFSET 0x0190 /**< Metric Counter 9
|
||||
Register */
|
||||
#define XAPM_INC9_OFFSET 0x0194 /**< Incrementer 9 Register */
|
||||
#define XAPM_RANGE9_OFFSET 0x0198 /**< Range 9 Register */
|
||||
#define XAPM_MC9LOGEN_OFFSET 0x019C /**< Metric Counter 9
|
||||
Log Enable Register */
|
||||
#define XAPM_SMC0_OFFSET 0x0200 /**< Sampled Metric Counter
|
||||
0 Register */
|
||||
#define XAPM_SINC0_OFFSET 0x0204 /**< Sampled Incrementer
|
||||
0 Register */
|
||||
#define XAPM_SMC1_OFFSET 0x0210 /**< Sampled Metric Counter
|
||||
1 Register */
|
||||
#define XAPM_SINC1_OFFSET 0x0214 /**< Sampled Incrementer
|
||||
1 Register */
|
||||
#define XAPM_SMC2_OFFSET 0x0220 /**< Sampled Metric Counter
|
||||
2 Register */
|
||||
#define XAPM_SINC2_OFFSET 0x0224 /**< Sampled Incrementer
|
||||
2 Register */
|
||||
#define XAPM_SMC3_OFFSET 0x0230 /**< Sampled Metric Counter
|
||||
3 Register */
|
||||
#define XAPM_SINC3_OFFSET 0x0234 /**< Sampled Incrementer
|
||||
3 Register */
|
||||
#define XAPM_SMC4_OFFSET 0x0240 /**< Sampled Metric Counter
|
||||
4 Register */
|
||||
#define XAPM_SINC4_OFFSET 0x0244 /**< Sampled Incrementer
|
||||
4 Register */
|
||||
#define XAPM_SMC5_OFFSET 0x0250 /**< Sampled Metric Counter
|
||||
5 Register */
|
||||
#define XAPM_SINC5_OFFSET 0x0254 /**< Sampled Incrementer
|
||||
5 Register */
|
||||
#define XAPM_SMC6_OFFSET 0x0260 /**< Sampled Metric Counter
|
||||
6 Register */
|
||||
#define XAPM_SINC6_OFFSET 0x0264 /**< Sampled Incrementer
|
||||
6 Register */
|
||||
#define XAPM_SMC7_OFFSET 0x0270 /**< Sampled Metric Counter
|
||||
7 Register */
|
||||
#define XAPM_SINC7_OFFSET 0x0274 /**< Sampled Incrementer
|
||||
7 Register */
|
||||
#define XAPM_SMC8_OFFSET 0x0280 /**< Sampled Metric Counter
|
||||
8 Register */
|
||||
#define XAPM_SINC8_OFFSET 0x0284 /**< Sampled Incrementer
|
||||
8 Register */
|
||||
#define XAPM_SMC9_OFFSET 0x0290 /**< Sampled Metric Counter
|
||||
9 Register */
|
||||
#define XAPM_SINC9_OFFSET 0x0294 /**< Sampled Incrementer
|
||||
9 Register */
|
||||
|
||||
#define XAPM_MC10_OFFSET 0x01A0 /**< Metric Counter 10
|
||||
Register */
|
||||
#define XAPM_MC11_OFFSET 0x01B0 /**< Metric Counter 11
|
||||
Register */
|
||||
#define XAPM_MC12_OFFSET 0x0500 /**< Metric Counter 12
|
||||
Register */
|
||||
#define XAPM_MC13_OFFSET 0x0510 /**< Metric Counter 13
|
||||
Register */
|
||||
#define XAPM_MC14_OFFSET 0x0520 /**< Metric Counter 14
|
||||
Register */
|
||||
#define XAPM_MC15_OFFSET 0x0530 /**< Metric Counter 15
|
||||
Register */
|
||||
#define XAPM_MC16_OFFSET 0x0540 /**< Metric Counter 16
|
||||
Register */
|
||||
#define XAPM_MC17_OFFSET 0x0550 /**< Metric Counter 17
|
||||
Register */
|
||||
#define XAPM_MC18_OFFSET 0x0560 /**< Metric Counter 18
|
||||
Register */
|
||||
#define XAPM_MC19_OFFSET 0x0570 /**< Metric Counter 19
|
||||
Register */
|
||||
#define XAPM_MC20_OFFSET 0x0580 /**< Metric Counter 20
|
||||
Register */
|
||||
#define XAPM_MC21_OFFSET 0x0590 /**< Metric Counter 21
|
||||
Register */
|
||||
#define XAPM_MC22_OFFSET 0x05A0 /**< Metric Counter 22
|
||||
Register */
|
||||
#define XAPM_MC23_OFFSET 0x05B0 /**< Metric Counter 23
|
||||
Register */
|
||||
#define XAPM_MC24_OFFSET 0x0700 /**< Metric Counter 24
|
||||
Register */
|
||||
#define XAPM_MC25_OFFSET 0x0710 /**< Metric Counter 25
|
||||
Register */
|
||||
#define XAPM_MC26_OFFSET 0x0720 /**< Metric Counter 26
|
||||
Register */
|
||||
#define XAPM_MC27_OFFSET 0x0730 /**< Metric Counter 27
|
||||
Register */
|
||||
#define XAPM_MC28_OFFSET 0x0740 /**< Metric Counter 28
|
||||
Register */
|
||||
#define XAPM_MC29_OFFSET 0x0750 /**< Metric Counter 29
|
||||
Register */
|
||||
#define XAPM_MC30_OFFSET 0x0760 /**< Metric Counter 30
|
||||
Register */
|
||||
#define XAPM_MC31_OFFSET 0x0770 /**< Metric Counter 31
|
||||
Register */
|
||||
#define XAPM_MC32_OFFSET 0x0780 /**< Metric Counter 32
|
||||
Register */
|
||||
#define XAPM_MC33_OFFSET 0x0790 /**< Metric Counter 33
|
||||
Register */
|
||||
#define XAPM_MC34_OFFSET 0x07A0 /**< Metric Counter 34
|
||||
Register */
|
||||
#define XAPM_MC35_OFFSET 0x07B0 /**< Metric Counter 35
|
||||
Register */
|
||||
#define XAPM_MC36_OFFSET 0x0900 /**< Metric Counter 36
|
||||
Register */
|
||||
#define XAPM_MC37_OFFSET 0x0910 /**< Metric Counter 37
|
||||
Register */
|
||||
#define XAPM_MC38_OFFSET 0x0920 /**< Metric Counter 38
|
||||
Register */
|
||||
#define XAPM_MC39_OFFSET 0x0930 /**< Metric Counter 39
|
||||
Register */
|
||||
#define XAPM_MC40_OFFSET 0x0940 /**< Metric Counter 40
|
||||
Register */
|
||||
#define XAPM_MC41_OFFSET 0x0950 /**< Metric Counter 41
|
||||
Register */
|
||||
#define XAPM_MC42_OFFSET 0x0960 /**< Metric Counter 42
|
||||
Register */
|
||||
#define XAPM_MC43_OFFSET 0x0970 /**< Metric Counter 43
|
||||
Register */
|
||||
#define XAPM_MC44_OFFSET 0x0980 /**< Metric Counter 44
|
||||
Register */
|
||||
#define XAPM_MC45_OFFSET 0x0990 /**< Metric Counter 45
|
||||
Register */
|
||||
#define XAPM_MC46_OFFSET 0x09A0 /**< Metric Counter 46
|
||||
Register */
|
||||
#define XAPM_MC47_OFFSET 0x09B0 /**< Metric Counter 47
|
||||
Register */
|
||||
|
||||
#define XAPM_SMC10_OFFSET 0x02A0 /**< Sampled Metric Counter
|
||||
10 Register */
|
||||
#define XAPM_SMC11_OFFSET 0x02B0 /**< Sampled Metric Counter
|
||||
11 Register */
|
||||
#define XAPM_SMC12_OFFSET 0x0600 /**< Sampled Metric Counter
|
||||
12 Register */
|
||||
#define XAPM_SMC13_OFFSET 0x0610 /**< Sampled Metric Counter
|
||||
13 Register */
|
||||
#define XAPM_SMC14_OFFSET 0x0620 /**< Sampled Metric Counter
|
||||
14 Register */
|
||||
#define XAPM_SMC15_OFFSET 0x0630 /**< Sampled Metric Counter
|
||||
15 Register */
|
||||
#define XAPM_SMC16_OFFSET 0x0640 /**< Sampled Metric Counter
|
||||
16 Register */
|
||||
#define XAPM_SMC17_OFFSET 0x0650 /**< Sampled Metric Counter
|
||||
17 Register */
|
||||
#define XAPM_SMC18_OFFSET 0x0660 /**< Sampled Metric Counter
|
||||
18 Register */
|
||||
#define XAPM_SMC19_OFFSET 0x0670 /**< Sampled Metric Counter
|
||||
19 Register */
|
||||
#define XAPM_SMC20_OFFSET 0x0680 /**< Sampled Metric Counter
|
||||
20 Register */
|
||||
#define XAPM_SMC21_OFFSET 0x0690 /**< Sampled Metric Counter
|
||||
21 Register */
|
||||
#define XAPM_SMC22_OFFSET 0x06A0 /**< Sampled Metric Counter
|
||||
22 Register */
|
||||
#define XAPM_SMC23_OFFSET 0x06B0 /**< Sampled Metric Counter
|
||||
23 Register */
|
||||
#define XAPM_SMC24_OFFSET 0x0800 /**< Sampled Metric Counter
|
||||
24 Register */
|
||||
#define XAPM_SMC25_OFFSET 0x0810 /**< Sampled Metric Counter
|
||||
25 Register */
|
||||
#define XAPM_SMC26_OFFSET 0x0820 /**< Sampled Metric Counter
|
||||
26 Register */
|
||||
#define XAPM_SMC27_OFFSET 0x0830 /**< Sampled Metric Counter
|
||||
27 Register */
|
||||
#define XAPM_SMC28_OFFSET 0x0840 /**< Sampled Metric Counter
|
||||
28 Register */
|
||||
#define XAPM_SMC29_OFFSET 0x0850 /**< Sampled Metric Counter
|
||||
29 Register */
|
||||
#define XAPM_SMC30_OFFSET 0x0860 /**< Sampled Metric Counter
|
||||
30 Register */
|
||||
#define XAPM_SMC31_OFFSET 0x0870 /**< Sampled Metric Counter
|
||||
31 Register */
|
||||
#define XAPM_SMC32_OFFSET 0x0880 /**< Sampled Metric Counter
|
||||
32 Register */
|
||||
#define XAPM_SMC33_OFFSET 0x0890 /**< Sampled Metric Counter
|
||||
33 Register */
|
||||
#define XAPM_SMC34_OFFSET 0x08A0 /**< Sampled Metric Counter
|
||||
34 Register */
|
||||
#define XAPM_SMC35_OFFSET 0x08B0 /**< Sampled Metric Counter
|
||||
35 Register */
|
||||
#define XAPM_SMC36_OFFSET 0x0A00 /**< Sampled Metric Counter
|
||||
36 Register */
|
||||
#define XAPM_SMC37_OFFSET 0x0A10 /**< Sampled Metric Counter
|
||||
37 Register */
|
||||
#define XAPM_SMC38_OFFSET 0x0A20 /**< Sampled Metric Counter
|
||||
38 Register */
|
||||
#define XAPM_SMC39_OFFSET 0x0A30 /**< Sampled Metric Counter
|
||||
39 Register */
|
||||
#define XAPM_SMC40_OFFSET 0x0A40 /**< Sampled Metric Counter
|
||||
40 Register */
|
||||
#define XAPM_SMC41_OFFSET 0x0A50 /**< Sampled Metric Counter
|
||||
41 Register */
|
||||
#define XAPM_SMC42_OFFSET 0x0A60 /**< Sampled Metric Counter
|
||||
42 Register */
|
||||
#define XAPM_SMC43_OFFSET 0x0A70 /**< Sampled Metric Counter
|
||||
43 Register */
|
||||
#define XAPM_SMC44_OFFSET 0x0A80 /**< Sampled Metric Counter
|
||||
44 Register */
|
||||
#define XAPM_SMC45_OFFSET 0x0A90 /**< Sampled Metric Counter
|
||||
45 Register */
|
||||
#define XAPM_SMC46_OFFSET 0x0AA0 /**< Sampled Metric Counter
|
||||
46 Register */
|
||||
#define XAPM_SMC47_OFFSET 0x0AB0 /**< Sampled Metric Counter
|
||||
47 Register */
|
||||
|
||||
#define XAPM_CTL_OFFSET 0x0300 /**< Control Register */
|
||||
|
||||
#define XAPM_ID_OFFSET 0x0304 /**< Latency ID Register */
|
||||
|
||||
#define XAPM_IDMASK_OFFSET 0x0308 /**< ID Mask Register */
|
||||
|
||||
#define XAPM_RID_OFFSET 0x030C /**< Latency Write ID Register */
|
||||
|
||||
#define XAPM_RIDMASK_OFFSET 0x0310 /**< Read ID Mask Register */
|
||||
|
||||
#define XAPM_FEC_OFFSET 0x0400 /**< Flag Enable
|
||||
Control Register */
|
||||
|
||||
#define XAPM_SWD_OFFSET 0x0404 /**< Software-written
|
||||
Data Register */
|
||||
|
||||
/* @} */
|
||||
|
||||
/**
|
||||
* @name AXI Monitor Sample Interval Control Register mask(s)
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_SICR_MCNTR_RST_MASK 0x00000100 /**< Enable the Metric
|
||||
Counter Reset */
|
||||
#define XAPM_SICR_LOAD_MASK 0x00000002 /**< Load the Sample Interval
|
||||
* Register Value into the
|
||||
* counter */
|
||||
#define XAPM_SICR_ENABLE_MASK 0x00000001 /**< Enable the downcounter */
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/** @name Interrupt Status/Enable Register Bit Definitions and Masks
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_IXR_MC9_OVERFLOW_MASK 0x00001000 /**< Metric Counter 9
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_MC8_OVERFLOW_MASK 0x00000800 /**< Metric Counter 8
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_MC7_OVERFLOW_MASK 0x00000400 /**< Metric Counter 7
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_MC6_OVERFLOW_MASK 0x00000200 /**< Metric Counter 6
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_MC5_OVERFLOW_MASK 0x00000100 /**< Metric Counter 5
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_MC4_OVERFLOW_MASK 0x00000080 /**< Metric Counter 4
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_MC3_OVERFLOW_MASK 0x00000040 /**< Metric Counter 3
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_MC2_OVERFLOW_MASK 0x00000020 /**< Metric Counter 2
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_MC1_OVERFLOW_MASK 0x00000010 /**< Metric Counter 1
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_MC0_OVERFLOW_MASK 0x00000008 /**< Metric Counter 0
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_FIFO_FULL_MASK 0x00000004 /**< Event Log FIFO
|
||||
* full> */
|
||||
#define XAPM_IXR_SIC_OVERFLOW_MASK 0x00000002 /**< Sample Interval
|
||||
* Counter Overflow> */
|
||||
#define XAPM_IXR_GCC_OVERFLOW_MASK 0x00000001 /**< Global Clock Counter
|
||||
* Overflow> */
|
||||
#define XAPM_IXR_ALL_MASK (XAPM_IXR_SIC_OVERFLOW_MASK | \
|
||||
XAPM_IXR_GCC_OVERFLOW_MASK | \
|
||||
XAPM_IXR_FIFO_FULL_MASK | \
|
||||
XAPM_IXR_MC0_OVERFLOW_MASK | \
|
||||
XAPM_IXR_MC1_OVERFLOW_MASK | \
|
||||
XAPM_IXR_MC2_OVERFLOW_MASK | \
|
||||
XAPM_IXR_MC3_OVERFLOW_MASK | \
|
||||
XAPM_IXR_MC4_OVERFLOW_MASK | \
|
||||
XAPM_IXR_MC5_OVERFLOW_MASK | \
|
||||
XAPM_IXR_MC6_OVERFLOW_MASK | \
|
||||
XAPM_IXR_MC7_OVERFLOW_MASK | \
|
||||
XAPM_IXR_MC8_OVERFLOW_MASK | \
|
||||
XAPM_IXR_MC9_OVERFLOW_MASK)
|
||||
/* @} */
|
||||
|
||||
/**
|
||||
* @name AXI Monitor Control Register mask(s)
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_CR_FIFO_RESET_MASK 0x02000000
|
||||
/**< FIFO Reset */
|
||||
#define XAPM_CR_GCC_RESET_MASK 0x00020000
|
||||
/**< Global Clk
|
||||
Counter Reset */
|
||||
#define XAPM_CR_GCC_ENABLE_MASK 0x00010000
|
||||
/**< Global Clk
|
||||
Counter Enable */
|
||||
#define XAPM_CR_EVTLOG_EXTTRIGGER_MASK 0x00000200
|
||||
/**< Enable External trigger
|
||||
to start event Log */
|
||||
#define XAPM_CR_EVENTLOG_ENABLE_MASK 0x00000100
|
||||
/**< Event Log Enable */
|
||||
|
||||
#define XAPM_CR_RDLATENCY_END_MASK 0x00000080
|
||||
/**< Write Latency
|
||||
End point */
|
||||
#define XAPM_CR_RDLATENCY_START_MASK 0x00000040
|
||||
/**< Read Latency
|
||||
Start point */
|
||||
#define XAPM_CR_WRLATENCY_END_MASK 0x00000020
|
||||
/**< Write Latency
|
||||
End point */
|
||||
#define XAPM_CR_WRLATENCY_START_MASK 0x00000010
|
||||
/**< Write Latency
|
||||
Start point */
|
||||
#define XAPM_CR_IDFILTER_ENABLE_MASK 0x00000008
|
||||
/**< ID Filter Enable */
|
||||
|
||||
#define XAPM_CR_MCNTR_EXTTRIGGER_MASK 0x00000004
|
||||
/**< Enable External
|
||||
trigger to start
|
||||
Metric Counters */
|
||||
#define XAPM_CR_MCNTR_RESET_MASK 0x00000002
|
||||
/**< Metrics Counter
|
||||
Reset */
|
||||
#define XAPM_CR_MCNTR_ENABLE_MASK 0x00000001
|
||||
/**< Metrics Counter
|
||||
Enable */
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @name AXI Monitor ID Register mask(s)
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_ID_RID_MASK 0xFFFF0000 /**< Read ID */
|
||||
|
||||
#define XAPM_ID_WID_MASK 0x0000FFFF /**< Write ID */
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @name AXI Monitor ID Mask Register mask(s)
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XAPM_MASKID_RID_MASK 0xFFFF0000 /**< Read ID Mask */
|
||||
|
||||
#define XAPM_MASKID_WID_MASK 0x0000FFFF /**< Write ID Mask*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Read a register of the AXI Performance Monitor device. This macro provides
|
||||
* register access to all registers using the register offsets defined above.
|
||||
*
|
||||
* @param BaseAddress contains the base address of the device.
|
||||
* @param RegOffset is the offset of the register to read.
|
||||
*
|
||||
* @return The contents of the register.
|
||||
*
|
||||
* @note C-style Signature:
|
||||
* u32 XAxiPmon_ReadReg(u32 BaseAddress, u32 RegOffset);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XAxiPmon_ReadReg(BaseAddress, RegOffset) \
|
||||
(Xil_In32((BaseAddress) + (RegOffset)))
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Write a register of the AXI Performance Monitor device. This macro provides
|
||||
* register access to all registers using the register offsets defined above.
|
||||
*
|
||||
* @param BaseAddress contains the base address of the device.
|
||||
* @param RegOffset is the offset of the register to write.
|
||||
* @param Data is the value to write to the register.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style Signature:
|
||||
* void XAxiPmon_WriteReg(u32 BaseAddress,
|
||||
* u32 RegOffset,u32 Data)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XAxiPmon_WriteReg(BaseAddress, RegOffset, Data) \
|
||||
(Xil_Out32((BaseAddress) + (RegOffset), (Data)))
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* End of protection macro. */
|
||||
/** @} */
|
152
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon_selftest.c
Normal file
152
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon_selftest.c
Normal file
|
@ -0,0 +1,152 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xaxipmon_selftest.c
|
||||
* @addtogroup axipmon_v6_2
|
||||
* @{
|
||||
* @details
|
||||
*
|
||||
* This file contains a diagnostic self test function for the XAxiPmon driver.
|
||||
* The self test function does a simple read/write test of the Alarm Threshold
|
||||
* Register.
|
||||
*
|
||||
* See XAxiPmon.h for more information.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ----- -------- -----------------------------------------------------
|
||||
* 1.00a bss 02/24/12 First release
|
||||
* 2.00a bss 06/23/12 Updated to support v2_00a version of IP.
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************** Include Files ********************************/
|
||||
|
||||
#include "xaxipmon.h"
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
/*
|
||||
* The following constant defines the test value to be written
|
||||
* to the Range Registers of Incrementers
|
||||
*/
|
||||
|
||||
#define XAPM_TEST_RANGEUPPER_VALUE 16 /**< Test Value for Upper Range */
|
||||
#define XAPM_TEST_RANGELOWER_VALUE 8 /**< Test Value for Lower Range */
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions ********************/
|
||||
|
||||
/************************** Variable Definitions ****************************/
|
||||
|
||||
/************************** Function Prototypes *****************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Run a self-test on the driver/device. The test
|
||||
* - Resets the device,
|
||||
* - Writes a value into the Range Registers of Incrementer 0 and reads
|
||||
* it back for comparison.
|
||||
* - Resets the device again.
|
||||
*
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XAxiPmon instance.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if the value read from the Range Register of
|
||||
* Incrementer 0 is the same as the value written.
|
||||
* - XST_FAILURE Otherwise
|
||||
*
|
||||
* @note This is a destructive test in that resets of the device are
|
||||
* performed. Refer to the device specification for the
|
||||
* device status after the reset operation.
|
||||
*
|
||||
******************************************************************************/
|
||||
int XAxiPmon_SelfTest(XAxiPmon *InstancePtr)
|
||||
{
|
||||
int Status;
|
||||
u16 RangeUpper;
|
||||
u16 RangeLower;
|
||||
|
||||
/*
|
||||
* Assert the argument
|
||||
*/
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
|
||||
/*
|
||||
* Reset the device to get it back to its default state
|
||||
*/
|
||||
XAxiPmon_ResetMetricCounter(InstancePtr);
|
||||
XAxiPmon_ResetGlobalClkCounter(InstancePtr);
|
||||
|
||||
/*
|
||||
* Write a value into the Incrementer register and
|
||||
* read it back, and do the comparison
|
||||
*/
|
||||
XAxiPmon_SetIncrementerRange(InstancePtr, XAPM_INCREMENTER_0,
|
||||
XAPM_TEST_RANGEUPPER_VALUE,
|
||||
XAPM_TEST_RANGELOWER_VALUE);
|
||||
|
||||
XAxiPmon_GetIncrementerRange(InstancePtr, XAPM_INCREMENTER_0,
|
||||
&RangeUpper, &RangeLower);
|
||||
|
||||
if ((RangeUpper == XAPM_TEST_RANGEUPPER_VALUE) &&
|
||||
(RangeLower == XAPM_TEST_RANGELOWER_VALUE)) {
|
||||
Status = XST_SUCCESS;
|
||||
} else {
|
||||
Status = XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the device again to its default state.
|
||||
*/
|
||||
XAxiPmon_ResetMetricCounter(InstancePtr);
|
||||
XAxiPmon_ResetGlobalClkCounter(InstancePtr);
|
||||
|
||||
/*
|
||||
* Return the test result.
|
||||
*/
|
||||
return Status;
|
||||
}
|
||||
/** @} */
|
104
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon_sinit.c
Normal file
104
XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon_sinit.c
Normal file
|
@ -0,0 +1,104 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xaxipmon_sinit.c
|
||||
* @addtogroup axipmon_v6_2
|
||||
* @{
|
||||
* @details
|
||||
*
|
||||
* This file contains the implementation of the XAxiPmon driver's static
|
||||
* initialization functionality.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ----- -------- -----------------------------------------------------
|
||||
* 1.00a bss 02/27/12 First release
|
||||
* 2.00a bss 06/23/12 Updated to support v2_00a version of IP.
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xaxipmon.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
extern XAxiPmon_Config XAxiPmon_ConfigTable[];
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function looks up the device configuration based on the unique device ID.
|
||||
* The table XAxiPmon_ConfigTable contains the configuration info for each device
|
||||
* in the system.
|
||||
*
|
||||
* @param DeviceId contains the ID of the device for which the
|
||||
* device configuration pointer is to be returned.
|
||||
*
|
||||
* @return
|
||||
* - A pointer to the configuration found.
|
||||
* - NULL if the specified device ID was not found.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
XAxiPmon_Config *XAxiPmon_LookupConfig(u16 DeviceId)
|
||||
{
|
||||
XAxiPmon_Config *CfgPtr = NULL;
|
||||
u32 Index;
|
||||
|
||||
for (Index=0; Index < XPAR_XAXIPMON_NUM_INSTANCES; Index++) {
|
||||
if (XAxiPmon_ConfigTable[Index].DeviceId == DeviceId) {
|
||||
CfgPtr = &XAxiPmon_ConfigTable[Index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CfgPtr;
|
||||
}
|
||||
/** @} */
|
Loading…
Add table
Reference in a new issue