1 /******************************************************************************
3 * Copyright (C) 2012 - 2015 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /****************************************************************************/
36 * @addtogroup axipmon_v6_3
39 * This file contains the driver API functions that can be used to access
40 * the AXI Performance Monitor device.
42 * Refer to the xaxipmon.h header file for more information about this driver.
48 * MODIFICATION HISTORY:
50 * Ver Who Date Changes
51 * ----- ----- -------- -----------------------------------------------------
52 * 1.00a bss 02/27/12 First release
53 * 2.00a bss 06/23/12 Updated to support v2_00a version of IP.
54 * 3.00a bss 09/03/12 Deleted XAxiPmon_SetAgent, XAxiPmon_GetAgent APIs and
55 * modified XAxiPmon_SetMetrics, XAxiPmon_GetMetrics APIs
56 * to support v2_01a version of IP.
57 * 3.01a bss 10/25/12 Added XAxiPmon_StartCounters and XAxiPmon_StopCounters
59 * Added XAxiPmon_StartEventLog and XAxiPmon_StopEventLog
61 * Added XAxiPmon_GetMetricName API (CR #683803).
62 * Modified XAxiPmon_SetMetrics and XAxiPmon_GetMetrics
64 * Added XAxiPmon_EnableEventLog,
65 * XAxiPmon_DisableMetricsCounter,
66 * XAxiPmon_EnableMetricsCounter APIs to replace macros.
67 * Added XAxiPmon_SetMetricCounterCutOff,
68 * XAxiPmon_GetMetricCounterCutOff,
69 * XAxiPmon_EnableExternalTrigger and
70 * XAxiPmon_DisableExternalTrigger APIs to support new
72 * 4.00a bss 01/17/13 To support new version of IP:
73 * Added XAxiPmon_SetLogEnableRanges,
74 * XAxiPmon_GetLogEnableRanges,
75 * XAxiPmon_EnableMetricCounterTrigger,
76 * XAxiPmon_DisableMetricCounterTrigger,
77 * XAxiPmon_EnableEventLogTrigger,
78 * XAxiPmon_DisableEventLogTrigger,
79 * XAxiPmon_SetWriteLatencyId,
80 * XAxiPmon_SetReadLatencyId,
81 * XAxiPmon_GetWriteLatencyId,
82 * XAxiPmon_GetReadLatencyId APIs and removed
83 * XAxiPmon_SetMetricCounterCutOff,
84 * XAxiPmon_GetMetricCounterCutOff,
85 * XAxiPmon_EnableExternalTrigger and
86 * XAxiPmon_DisableExternalTrigger APIs
87 * 5.00a bss 08/26/13 To support new version of IP:
88 * Modified XAxiPmon_CfgInitialize to add Mode of APM and
89 * ScaleFactor parameter.
90 * Modified Assert functions depending on Mode.
91 * Modified XAxiPmon_GetMetricCounter and
92 * XAxiPmon_GetSampledMetricCounter to include
94 * Modified XAxiPmon_SetSampleInterval and
95 * XAxiPmon_GetSampleInterval to remove higher 32 bit
96 * value of SampleInterval since Sample Interval Register
98 * Added XAxiPmon_SetWrLatencyStart,
99 * XAxiPmon_SetWrLatencyEnd, XAxiPmon_SetRdLatencyStart
100 * XAxiPmon_SetRdLatencyEnd, XAxiPmon_GetWrLatencyStart,
101 * XAxiPmon_GetWrLatencyEnd, XAxiPmon_GetRdLatencyStart,
102 * XAxiPmon_GetRdLatencyEnd, XAxiPmon_SetWriteIdMask,
103 * XAxiPmon_SetReadIdMask,
104 * XAxiPmon_GetWriteIdMask and
105 * XAxiPmon_GetReadIdMask APIs.
107 * XAxiPmon_SetWriteLatencyId to XAxiPmon_SetWriteId
108 * XAxiPmon_SetReadLatencyId to XAxiPmon_SetReadId
109 * XAxiPmon_GetWriteLatencyId to XAxiPmon_GetWriteId
110 * XAxiPmon_SetReadLatencyId to XAxiPmon_GetReadId.
111 * 6.2 bss 04/21/14 Updated XAxiPmon_CfgInitialize to Reset counters
112 * and FIFOs based on Modes(CR#782671). And if both
113 * profile and trace modes are present set mode as
115 * 6.2 bss 03/02/15 Updated XAxiPmon_SetWriteId, XAxiPmon_SetReadId,
116 * XAxiPmon_GetWriteId, XAxiPmon_GetReadId
117 * XAxiPmon_SetWriteIdMask, XAxiPmon_SetReadIdMask,
118 * XAxiPmon_GetWriteIdMask, XAxiPmon_GetReadIdMask
119 * functions to support Zynq MP APM.
120 * 6.3 kvn 07/02/15 Modified code according to MISRA-C:2012 guidelines.
121 * 6.4 sk 11/10/15 Used UINTPTR instead of u32 for Baseaddress CR# 867425.
122 * Changed the prototype of XAxiPmon_CfgInitialize API.
125 *****************************************************************************/
127 /***************************** Include Files ********************************/
129 #include "xaxipmon.h"
131 /************************** Constant Definitions *****************************/
133 /**************************** Type Definitions *******************************/
135 /***************** Macros (Inline Functions) Definitions *********************/
137 /************************** Function Prototypes ******************************/
139 /************************** Variable Definitions *****************************/
141 /*****************************************************************************/
144 * This function initializes a specific XAxiPmon device/instance. This function
145 * must be called prior to using the AXI Performance Monitor device.
147 * @param InstancePtr is a pointer to the XAxiPmon instance.
148 * @param ConfigPtr points to the XAxiPmon device configuration structure.
149 * @param EffectiveAddr is the device base address in the virtual memory
150 * address space. If the address translation is not used then the
151 * physical address is passed.
152 * Unexpected errors may occur if the address mapping is changed
153 * after this function is invoked.
156 * - XST_SUCCESS if successful.
158 * @note The user needs to first call the XAxiPmon_LookupConfig() API
159 * which returns the Configuration structure pointer which is
160 * passed as a parameter to the XAxiPmon_CfgInitialize() API.
162 ******************************************************************************/
163 s32 XAxiPmon_CfgInitialize(XAxiPmon *InstancePtr, XAxiPmon_Config *ConfigPtr,
164 UINTPTR EffectiveAddr)
167 * Assert the input arguments.
169 Xil_AssertNonvoid(InstancePtr != NULL);
170 Xil_AssertNonvoid(ConfigPtr != NULL);
173 * Set the values read from the device config and the base address.
175 InstancePtr->Config.DeviceId = ConfigPtr->DeviceId;
176 InstancePtr->Config.BaseAddress = EffectiveAddr;
177 InstancePtr->Config.GlobalClkCounterWidth =
178 ConfigPtr->GlobalClkCounterWidth;
179 InstancePtr->Config.MetricSampleCounterWidth =
180 ConfigPtr->MetricSampleCounterWidth;
181 InstancePtr->Config.IsEventCount =
182 ConfigPtr->IsEventCount;
183 InstancePtr->Config.NumberofSlots =
184 ConfigPtr->NumberofSlots;
185 InstancePtr->Config.NumberofCounters =
186 ConfigPtr->NumberofCounters;
187 InstancePtr->Config.HaveSampledCounters =
188 ConfigPtr->HaveSampledCounters;
189 InstancePtr->Config.IsEventLog =
190 ConfigPtr->IsEventLog;
191 InstancePtr->Config.FifoDepth =
192 ConfigPtr->FifoDepth;
193 InstancePtr->Config.FifoWidth =
194 ConfigPtr->FifoWidth;
195 InstancePtr->Config.TidWidth =
197 InstancePtr->Config.Is32BitFiltering = ConfigPtr->Is32BitFiltering;
199 InstancePtr->Config.ScaleFactor = ConfigPtr->ScaleFactor;
201 if ((ConfigPtr->ModeProfile == ConfigPtr->ModeTrace)
202 || (ConfigPtr->ModeAdvanced == 1U))
204 InstancePtr->Mode = XAPM_MODE_ADVANCED;
205 } else if (ConfigPtr->ModeTrace == 1U) {
206 InstancePtr->Mode = XAPM_MODE_TRACE;
208 InstancePtr->Mode = XAPM_MODE_PROFILE;
212 * Indicate the instance is now ready to use, initialized without error.
214 InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
217 * Reset the Counters and FIFO based on Modes.
220 /* Advanced and Profile */
221 if((InstancePtr->Mode == XAPM_MODE_ADVANCED) ||
222 (InstancePtr->Mode == XAPM_MODE_PROFILE))
224 (void)XAxiPmon_ResetMetricCounter(InstancePtr);
227 if(InstancePtr->Mode == XAPM_MODE_ADVANCED)
229 XAxiPmon_ResetGlobalClkCounter(InstancePtr);
231 /* Advanced and Trace */
232 if((InstancePtr->Mode == XAPM_MODE_ADVANCED) ||
233 (InstancePtr->Mode == XAPM_MODE_TRACE))
235 (void)XAxiPmon_ResetFifo(InstancePtr);
240 /*****************************************************************************/
243 * This function resets all Metric Counters and Sampled Metric Counters of
244 * AXI Performance Monitor.
246 * @param InstancePtr is a pointer to the XAxiPmon instance.
248 * @return XST_SUCCESS
253 ******************************************************************************/
254 s32 XAxiPmon_ResetMetricCounter(XAxiPmon *InstancePtr)
260 * Assert the arguments.
262 Xil_AssertNonvoid(InstancePtr != NULL);
263 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
264 Xil_AssertNonvoid(InstancePtr->Mode != XAPM_MODE_TRACE);
267 * Write the reset value to the Control register to reset
270 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
272 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
273 (RegValue | XAPM_CR_MCNTR_RESET_MASK));
277 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
278 (RegValue & ~(XAPM_CR_MCNTR_RESET_MASK)));
283 /*****************************************************************************/
286 * This function resets Global Clock Counter of AXI Performance Monitor
288 * @param InstancePtr is a pointer to the XAxiPmon instance.
294 ******************************************************************************/
295 void XAxiPmon_ResetGlobalClkCounter(XAxiPmon *InstancePtr)
301 * Assert the arguments.
303 Xil_AssertVoid(InstancePtr != NULL);
304 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
305 Xil_AssertVoid(InstancePtr->Mode == XAPM_MODE_ADVANCED);
308 * Write the reset value to the Control register to reset
309 * Global Clock Counter
311 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
313 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
314 (RegValue | XAPM_CR_GCC_RESET_MASK));
319 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
320 (RegValue & ~(XAPM_CR_GCC_RESET_MASK)));
324 /*****************************************************************************/
327 * This function resets Streaming FIFO of AXI Performance Monitor
329 * @param InstancePtr is a pointer to the XAxiPmon instance.
331 * @return XST_SUCCESS
335 ******************************************************************************/
336 s32 XAxiPmon_ResetFifo(XAxiPmon *InstancePtr)
342 * Assert the arguments.
344 Xil_AssertNonvoid(InstancePtr != NULL);
345 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
346 Xil_AssertNonvoid(InstancePtr->Mode != XAPM_MODE_PROFILE);
348 /* Check Event Logging is enabled in Hardware */
349 if((InstancePtr->Config.IsEventLog == 0U) &&
350 (InstancePtr->Mode == XAPM_MODE_ADVANCED))
352 /*Event logging not enabled in Hardware*/
356 * Write the reset value to the Control register to reset
359 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
361 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
362 (RegValue | XAPM_CR_FIFO_RESET_MASK));
366 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
367 (RegValue & ~(XAPM_CR_FIFO_RESET_MASK)));
373 /****************************************************************************/
376 * This function sets Ranges for Incrementers depending on parameters passed.
378 * @param InstancePtr is a pointer to the XAxiPmon instance.
379 * @param IncrementerNum specifies the Incrementer for which Ranges
381 * @param RangeUpper specifies the Upper limit in 32 bit Register
382 * @param RangeLower specifies the Lower limit in 32 bit Register
388 *****************************************************************************/
389 void XAxiPmon_SetIncrementerRange(XAxiPmon *InstancePtr, u8 IncrementerNum,
390 u16 RangeUpper, u16 RangeLower)
396 * Assert the arguments.
398 Xil_AssertVoid(InstancePtr != NULL);
399 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
400 Xil_AssertVoid(InstancePtr->Mode == XAPM_MODE_ADVANCED);
401 Xil_AssertVoid(IncrementerNum < XAPM_MAX_COUNTERS);
404 * Write to the specified Range register
406 RegValue = (u32)RangeUpper << 16;
407 RegValue |= RangeLower;
408 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
409 ((u32)XAPM_RANGE0_OFFSET + ((u32)IncrementerNum * (u32)16)),
413 /****************************************************************************/
416 * This function returns the Ranges of Incrementers Registers.
418 * @param InstancePtr is a pointer to the XAxiPmon instance.
419 * @param IncrementerNum specifies the Incrementer for which Ranges
420 * need to be returned.
421 * @param RangeUpper specifies the user reference variable which returns
422 * the Upper Range Value of the specified Incrementer.
423 * @param RangeLower specifies the user reference variable which returns
424 * the Lower Range Value of the specified Incrementer.
430 *****************************************************************************/
431 void XAxiPmon_GetIncrementerRange(XAxiPmon *InstancePtr, u8 IncrementerNum,
432 u16 *RangeUpper, u16 *RangeLower)
437 * Assert the arguments.
439 Xil_AssertVoid(InstancePtr != NULL);
440 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
441 Xil_AssertVoid(InstancePtr->Mode == XAPM_MODE_ADVANCED);
442 Xil_AssertVoid(IncrementerNum < XAPM_MAX_COUNTERS);
444 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
445 ((u32)XAPM_RANGE0_OFFSET + ((u32)IncrementerNum * (u32)16)));
447 *RangeLower = (u16)(RegValue & 0x0000FFFFU);
448 *RangeUpper = (u16)((RegValue >> 16) & 0x0000FFFFU);
451 /****************************************************************************/
454 * This function sets the Sample Interval Register
456 * @param InstancePtr is a pointer to the XAxiPmon instance.
457 * @param SampleInterval is the Sample Interval value to be set
463 *****************************************************************************/
464 void XAxiPmon_SetSampleInterval(XAxiPmon *InstancePtr, u32 SampleInterval)
468 * Assert the arguments.
470 Xil_AssertVoid(InstancePtr != NULL);
471 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
472 Xil_AssertVoid(InstancePtr->Mode != XAPM_MODE_TRACE);
475 * Set Sample Interval Lower
477 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
478 XAPM_SI_LOW_OFFSET, SampleInterval);
482 /****************************************************************************/
485 * This function returns the contents of Sample Interval Register
487 * @param InstancePtr is a pointer to the XAxiPmon instance.
488 * @param SampleInterval is a pointer where the Sample Interval
489 * Counter value is returned.
495 ******************************************************************************/
496 void XAxiPmon_GetSampleInterval(XAxiPmon *InstancePtr, u32 *SampleInterval)
499 * Assert the arguments.
501 Xil_AssertVoid(InstancePtr != NULL);
502 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
503 Xil_AssertVoid(InstancePtr->Mode != XAPM_MODE_TRACE);
506 * Set Sample Interval Lower
508 *SampleInterval = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
513 /****************************************************************************/
516 * This function sets Metrics for specified Counter in the corresponding
517 * Metric Selector Register.
519 * @param InstancePtr is a pointer to the XAxiPmon instance.
520 * @param Slot is the slot ID for which specified counter has to
522 * @param Metrics is one of the Metric Sets. User has to use
523 * XAPM_METRIC_SET_* macros in xaxipmon.h for this parameter
524 * @param CounterNum is the Counter Number.
525 * The valid values are 0 to 9.
527 * @return XST_SUCCESS if Success
528 * XST_FAILURE if Failure
532 *****************************************************************************/
533 s32 XAxiPmon_SetMetrics(XAxiPmon *InstancePtr, u8 Slot, u8 Metrics,
539 * Assert the arguments.
541 Xil_AssertNonvoid(InstancePtr != NULL);
542 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
543 Xil_AssertNonvoid(InstancePtr->Mode == XAPM_MODE_ADVANCED);
544 Xil_AssertNonvoid(Slot < XAPM_MAX_AGENTS);
545 Xil_AssertNonvoid((Metrics <= XAPM_METRIC_SET_22) ||
546 (Metrics == XAPM_METRIC_SET_30));
547 Xil_AssertNonvoid(CounterNum < XAPM_MAX_COUNTERS);
549 /* Find Mask value to force zero in counternum byte range */
550 if ((CounterNum == 0U) || (CounterNum == 4U) || (CounterNum == 8U)) {
553 else if ((CounterNum == 1U) || (CounterNum == 5U) || (CounterNum == 9U)) {
556 else if ((CounterNum == 2U) || (CounterNum == 6U)) {
563 if(CounterNum <= 3U) {
564 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
567 RegValue = RegValue & Mask;
568 RegValue = RegValue | ((u32)Metrics << (CounterNum * (u8)8));
569 RegValue = RegValue | ((u32)Slot << ((CounterNum * (u8)8) + (u8)5));
570 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
571 (u32)XAPM_MSR0_OFFSET,RegValue);
573 else if((CounterNum >= 4U) && (CounterNum <= 7U)) {
574 CounterNum = CounterNum - 4U;
575 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
576 (u32)XAPM_MSR1_OFFSET);
578 RegValue = RegValue & Mask;
579 RegValue = RegValue | ((u32)Metrics << (CounterNum * (u8)8));
580 RegValue = RegValue | ((u32)Slot << ((CounterNum * (u8)8) + (u8)5));
581 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
582 XAPM_MSR1_OFFSET,RegValue);
585 CounterNum = CounterNum - 8U;
586 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
589 RegValue = RegValue & Mask;
590 RegValue = RegValue | ((u32)Metrics << (CounterNum * (u8)8));
591 RegValue = RegValue | ((u32)Slot << ((CounterNum * (u8)8) + (u8)5));
592 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
593 XAPM_MSR2_OFFSET,RegValue);
598 /*****************************************************************************/
601 * This function returns Metrics in the specified Counter from the corresponding
602 * Metric Selector Register.
604 * @param InstancePtr is a pointer to the XAxiPmon instance.
605 * @param CounterNum is the Counter Number.
606 * The valid values are 0 to 9.
607 * @param Metrics is a reference parameter from application where metrics
608 * of specified counter is filled.
609 * @praram Slot is a reference parameter in which slot Id of
610 * specified counter is filled
611 * @return XST_SUCCESS if Success
612 * XST_FAILURE if Failure
616 *****************************************************************************/
617 s32 XAxiPmon_GetMetrics(XAxiPmon *InstancePtr, u8 CounterNum, u8 *Metrics,
622 * Assert the arguments.
624 Xil_AssertNonvoid(InstancePtr != NULL);
625 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
626 Xil_AssertNonvoid(InstancePtr->Mode == XAPM_MODE_ADVANCED);
627 Xil_AssertNonvoid(CounterNum <= XAPM_MAX_COUNTERS);
629 if(CounterNum <= 3U) {
630 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
632 *Metrics = (u8)(RegValue >> (CounterNum * (u8)8)) & 0x1FU;
633 *Slot = (u8)(RegValue >> ((CounterNum * (u8)8) + (u8)5)) & 0x07U;
636 else if((CounterNum >= 4U) && (CounterNum <= 7U)) {
637 CounterNum = CounterNum - 4U;
638 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
640 *Metrics = (u8)(RegValue >> (CounterNum * (u8)8)) & 0x1FU;
641 *Slot = (u8)(RegValue >> ((CounterNum * (u8)8) + (u8)5)) & 0x07U;
644 CounterNum = CounterNum - 8U;
645 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
647 *Metrics = (u8)(RegValue >> (CounterNum * (u8)8)) & 0x1FU;
648 *Slot = (u8)(RegValue >> ((CounterNum * (u8)8) + (u8)5)) & 0x07U;
653 /****************************************************************************/
656 * This function returns the contents of the Global Clock Counter Register.
658 * @param InstancePtr is a pointer to the XAxiPmon instance.
659 * @param CntHighValue is the user space pointer with which upper 32 bits
660 * of Global Clock Counter has to be filled
661 * @param CntLowValue is the user space pointer with which lower 32 bits
662 * of Global Clock Counter has to be filled
668 *****************************************************************************/
669 void XAxiPmon_GetGlobalClkCounter(XAxiPmon *InstancePtr,u32 *CntHighValue,
673 * Assert the arguments.
675 Xil_AssertVoid(InstancePtr != NULL);
676 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
677 Xil_AssertVoid(InstancePtr->Mode == XAPM_MODE_ADVANCED);
679 *CntHighValue = 0x0U;
683 * If Counter width is 64 bit then Counter Value has to be
684 * filled at CntHighValue address also.
686 if(InstancePtr->Config.GlobalClkCounterWidth == 64) {
688 /* Bits[63:32] exists at XAPM_GCC_HIGH_OFFSET */
689 *CntHighValue = XAxiPmon_ReadReg(InstancePtr->
690 Config.BaseAddress, XAPM_GCC_HIGH_OFFSET);
692 /* Bits[31:0] exists at XAPM_GCC_LOW_OFFSET */
693 *CntLowValue = XAxiPmon_ReadReg(InstancePtr->
694 Config.BaseAddress, XAPM_GCC_LOW_OFFSET);
697 /****************************************************************************/
700 * This function returns the contents of the Metric Counter Register.
702 * @param InstancePtr is a pointer to the XAxiPmon instance.
703 * @param CounterNum is the number of the Metric Counter to be read.
704 * Use the XAPM_METRIC_COUNTER* defines for the counter number in
705 * xaxipmon.h. The valid values are 0 (XAPM_METRIC_COUNTER_0) to
706 * 47(XAPM_METRIC_COUNTER_47).
707 * @return RegValue is the content of specified Metric Counter.
711 *****************************************************************************/
712 u32 XAxiPmon_GetMetricCounter(XAxiPmon *InstancePtr, u32 CounterNum)
718 * Assert the arguments.
720 Xil_AssertNonvoid(InstancePtr != NULL);
721 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
722 Xil_AssertNonvoid(InstancePtr->Mode != XAPM_MODE_TRACE);
723 Xil_AssertNonvoid(CounterNum < XAPM_MAX_COUNTERS_PROFILE);
725 if (CounterNum < 10U ) {
726 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
727 ((u32)XAPM_MC0_OFFSET + (CounterNum * (u32)16)));
729 else if ((CounterNum >= 10U) && (CounterNum < 12U)) {
730 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
731 ((u32)XAPM_MC10_OFFSET + ((CounterNum - (u32)10) * (u32)16)));
733 else if ((CounterNum >= 12U) && (CounterNum < 24U)) {
734 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
735 ((u32)XAPM_MC12_OFFSET + ((CounterNum - (u32)12) * (u32)16)));
737 else if ((CounterNum >= 24U) && (CounterNum < 36U)) {
738 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
739 ((u32)XAPM_MC24_OFFSET + ((CounterNum - (u32)24) * (u32)16)));
742 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
743 ((u32)XAPM_MC36_OFFSET + ((CounterNum - (u32)36) * (u32)16)));
749 /****************************************************************************/
752 * This function returns the contents of the Sampled Metric Counter Register.
754 * @param InstancePtr is a pointer to the XAxiPmon instance.
755 * @param CounterNum is the number of the Sampled Metric Counter to read.
756 * Use the XAPM_METRIC_COUNTER* defines for the counter number in
757 * xaxipmon.h. The valid values are 0 (XAPM_METRIC_COUNTER_0) to
758 * 47(XAPM_METRIC_COUNTER_47).
760 * @return RegValue is the content of specified Sampled Metric Counter.
764 *****************************************************************************/
765 u32 XAxiPmon_GetSampledMetricCounter(XAxiPmon *InstancePtr, u32 CounterNum)
770 * Assert the arguments.
772 Xil_AssertNonvoid(InstancePtr != NULL);
773 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
774 Xil_AssertNonvoid(InstancePtr->Mode != XAPM_MODE_TRACE);
775 Xil_AssertNonvoid(CounterNum < XAPM_MAX_COUNTERS_PROFILE);
776 Xil_AssertNonvoid((InstancePtr->Mode == XAPM_MODE_PROFILE) ||
777 ((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
778 (InstancePtr->Config.HaveSampledCounters == 1U)));
780 if (CounterNum < 10U ) {
781 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
782 ((u32)XAPM_SMC0_OFFSET + (CounterNum * (u32)16)));
784 else if ((CounterNum >= 10U) && (CounterNum < 12U)) {
785 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
786 ((u32)XAPM_SMC10_OFFSET + ((CounterNum - (u32)10) * (u32)16)));
788 else if ((CounterNum >= 12U) && (CounterNum < 24U)) {
789 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
790 ((u32)XAPM_SMC12_OFFSET + ((CounterNum - (u32)12) * (u32)16)));
792 else if ((CounterNum >= 24U) && (CounterNum < 36U)) {
793 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
794 ((u32)XAPM_SMC24_OFFSET + ((CounterNum - (u32)24) * (u32)16)));
797 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
798 ((u32)XAPM_SMC36_OFFSET + ((CounterNum - (u32)36) * (u32)16)));
804 /****************************************************************************/
807 * This function returns the contents of the Incrementer Register.
809 * @param InstancePtr is a pointer to the XAxiPmon instance.
810 * @param IncrementerNum is the number of the Incrementer register to
811 * read.Use the XAPM_INCREMENTER_* defines for the Incrementer
812 * number.The valid values are 0 (XAPM_INCREMENTER_0) to
813 * 9 (XAPM_INCREMENTER_9).
814 * @param IncrementerNum is the number of the specified Incrementer
816 * @return RegValue is content of specified Metric Incrementer register.
820 *****************************************************************************/
821 u32 XAxiPmon_GetIncrementer(XAxiPmon *InstancePtr, u32 IncrementerNum)
826 * Assert the arguments.
828 Xil_AssertNonvoid(InstancePtr != NULL);
829 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
830 Xil_AssertNonvoid((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
831 (InstancePtr->Config.IsEventCount == 1U));
832 Xil_AssertNonvoid(IncrementerNum < XAPM_MAX_COUNTERS);
834 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
835 ((u32)XAPM_INC0_OFFSET + (IncrementerNum * (u32)16)));
840 /****************************************************************************/
843 * This function returns the contents of the Sampled Incrementer Register.
845 * @param InstancePtr is a pointer to the XAxiPmon instance.
846 * @param IncrementerNum is the number of the Sampled Incrementer
847 * register to read.Use the XAPM_INCREMENTER_* defines for the
848 * Incrementer number.The valid values are 0 (XAPM_INCREMENTER_0)
849 * to 9 (XAPM_INCREMENTER_9).
850 * @param IncrementerNum is the number of the specified Sampled
851 * Incrementer register
852 * @return RegValue is content of specified Sampled Incrementer register.
856 *****************************************************************************/
857 u32 XAxiPmon_GetSampledIncrementer(XAxiPmon *InstancePtr, u32 IncrementerNum)
862 * Assert the arguments.
864 Xil_AssertNonvoid(InstancePtr != NULL);
865 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
866 Xil_AssertNonvoid((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
867 (InstancePtr->Config.IsEventCount == 1U) &&
868 (InstancePtr->Config.HaveSampledCounters == 1U));
869 Xil_AssertNonvoid(IncrementerNum < XAPM_MAX_COUNTERS);
871 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
872 ((u32)XAPM_SINC0_OFFSET + (IncrementerNum * (u32)16)));
876 /****************************************************************************/
879 * This function sets Software-written Data Register.
881 * @param InstancePtr is a pointer to the XAxiPmon instance.
882 * @param SwData is the Software written Data.
888 *****************************************************************************/
889 void XAxiPmon_SetSwDataReg(XAxiPmon *InstancePtr, u32 SwData)
892 * Assert the arguments.
894 Xil_AssertVoid(InstancePtr != NULL);
895 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
898 * Set Software-written Data Register
900 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, (u32)XAPM_SWD_OFFSET,
904 /****************************************************************************/
907 * This function returns contents of Software-written Data Register.
909 * @param InstancePtr is a pointer to the XAxiPmon instance.
915 *****************************************************************************/
916 u32 XAxiPmon_GetSwDataReg(XAxiPmon *InstancePtr)
921 * Assert the arguments.
923 Xil_AssertNonvoid(InstancePtr != NULL);
924 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
927 * Set Metric Selector Register
929 SwData = (u32)XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
934 /*****************************************************************************/
937 * This function enables the following in the AXI Performance Monitor:
940 * @param InstancePtr is a pointer to the XAxiPmon instance.
941 * @param FlagEnables is a value to write to the flag enables
942 * register defined by XAPM_FEC_OFFSET. It is recommended
943 * to use the XAPM_FEC_*_MASK mask bits to generate.
944 * A value of 0x0 will disable all events to the event
945 * log streaming FIFO.
947 * @return XST_SUCCESS
951 ******************************************************************************/
952 s32 XAxiPmon_StartEventLog(XAxiPmon *InstancePtr, u32 FlagEnables)
957 * Assert the arguments.
959 Xil_AssertNonvoid(InstancePtr != NULL);
960 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
961 Xil_AssertNonvoid((InstancePtr->Mode == XAPM_MODE_TRACE) ||
962 ((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
963 (InstancePtr->Config.IsEventLog == 1U)));
965 /* Read current register value */
966 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
967 (u32)XAPM_CTL_OFFSET);
968 /* Flag Enable register is present only in Advanced Mode */
969 if(InstancePtr->Mode == XAPM_MODE_ADVANCED)
971 /* Now write to flag enables register */
972 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
973 (u32)XAPM_FEC_OFFSET, FlagEnables);
976 /* Write the new value to the Control register to
977 * enable event logging */
978 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, (u32)XAPM_CTL_OFFSET,
979 RegValue | XAPM_CR_EVENTLOG_ENABLE_MASK);
984 /*****************************************************************************/
987 * This function disables the following in the AXI Performance Monitor:
990 * @param InstancePtr is a pointer to the XAxiPmon instance.
992 * @return XST_SUCCESS
996 ******************************************************************************/
997 s32 XAxiPmon_StopEventLog(XAxiPmon *InstancePtr)
1002 * Assert the arguments.
1004 Xil_AssertNonvoid(InstancePtr != NULL);
1005 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1006 Xil_AssertNonvoid((InstancePtr->Mode == XAPM_MODE_TRACE) ||
1007 ((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
1008 (InstancePtr->Config.IsEventLog == 1U)));
1010 /* Read current register value */
1011 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1012 (u32)XAPM_CTL_OFFSET);
1014 /* Write the new value to the Control register to disable
1016 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, (u32)XAPM_CTL_OFFSET,
1017 RegValue & ~XAPM_CR_EVENTLOG_ENABLE_MASK);
1022 /*****************************************************************************/
1025 * This function enables the following in the AXI Performance Monitor:
1026 * - Global clock counter
1027 * - All metric counters
1028 * - All sampled metric counters
1030 * @param InstancePtr is a pointer to the XAxiPmon instance.
1031 * SampleInterval is the sample interval for the sampled metric
1034 * @return XST_SUCCESS
1037 ******************************************************************************/
1038 s32 XAxiPmon_StartCounters(XAxiPmon *InstancePtr, u32 SampleInterval)
1043 * Assert the arguments.
1045 Xil_AssertNonvoid(InstancePtr != NULL);
1046 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1047 Xil_AssertNonvoid((InstancePtr->Mode == XAPM_MODE_PROFILE) ||
1048 ((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
1049 (InstancePtr->Config.IsEventCount == 1U)));
1051 /* Read current register value */
1052 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1053 (u32)XAPM_CTL_OFFSET);
1054 /* Globlal Clock Counter is present in Advanced mode only */
1055 if(InstancePtr->Mode == XAPM_MODE_ADVANCED)
1057 RegValue = RegValue | XAPM_CR_GCC_ENABLE_MASK;
1061 * Write the new value to the Control register to enable
1062 * global clock counter and metric counters
1064 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, (u32)XAPM_CTL_OFFSET,
1065 RegValue | XAPM_CR_MCNTR_ENABLE_MASK);
1067 /* Set, enable, and load sampled counters */
1068 XAxiPmon_SetSampleInterval(InstancePtr, SampleInterval);
1069 XAxiPmon_LoadSampleIntervalCounter(InstancePtr);
1070 XAxiPmon_EnableSampleIntervalCounter(InstancePtr);
1075 /*****************************************************************************/
1078 * This function disables the following in the AXI Performance Monitor:
1079 * - Global clock counter
1080 * - All metric counters
1082 * @param InstancePtr is a pointer to the XAxiPmon instance.
1084 * @return XST_SUCCESS
1088 ******************************************************************************/
1089 s32 XAxiPmon_StopCounters(XAxiPmon *InstancePtr)
1094 * Assert the arguments.
1096 Xil_AssertNonvoid(InstancePtr != NULL);
1097 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1098 Xil_AssertNonvoid((InstancePtr->Mode == XAPM_MODE_PROFILE) ||
1099 ((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
1100 (InstancePtr->Config.IsEventCount == 1U)));
1102 /* Read current register value */
1103 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1104 (u32)XAPM_CTL_OFFSET);
1105 /* Globlal Clock Counter is present in Advanced mode only */
1106 if(InstancePtr->Mode == XAPM_MODE_ADVANCED)
1108 RegValue = RegValue & ~XAPM_CR_GCC_ENABLE_MASK;
1112 * Write the new value to the Control register to disable
1113 * global clock counter and metric counters
1115 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, (u32)XAPM_CTL_OFFSET,
1116 RegValue & ~XAPM_CR_MCNTR_ENABLE_MASK);
1121 /*****************************************************************************/
1124 * This function enables Metric Counters.
1126 * @param InstancePtr is a pointer to the XAxiPmon instance.
1132 *******************************************************************************/
1133 void XAxiPmon_EnableMetricsCounter(XAxiPmon *InstancePtr)
1138 * Assert the arguments.
1140 Xil_AssertVoid(InstancePtr != NULL);
1141 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1142 Xil_AssertVoid((InstancePtr->Mode == XAPM_MODE_PROFILE) ||
1143 ((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
1144 (InstancePtr->Config.IsEventCount == 1U)));
1146 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1148 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
1149 RegVal | XAPM_CR_MCNTR_ENABLE_MASK);
1151 /****************************************************************************/
1154 * This function disables the Metric Counters.
1156 * @param InstancePtr is a pointer to the XAxiPmon instance.
1162 *****************************************************************************/
1163 void XAxiPmon_DisableMetricsCounter(XAxiPmon *InstancePtr)
1168 * Assert the arguments.
1170 Xil_AssertVoid(InstancePtr != NULL);
1171 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1172 Xil_AssertVoid((InstancePtr->Mode == XAPM_MODE_PROFILE) ||
1173 ((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
1174 (InstancePtr->Config.IsEventCount == 1U)));
1176 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1177 (u32)XAPM_CTL_OFFSET);
1179 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, (u32)XAPM_CTL_OFFSET,
1180 RegVal & ~(XAPM_CR_MCNTR_ENABLE_MASK));
1183 /****************************************************************************/
1186 * This function sets the Upper and Lower Ranges for specified Metric Counter
1187 * Log Enable Register.Event Logging starts when corresponding Metric Counter
1188 * value falls in between these ranges
1190 * @param InstancePtr is a pointer to the XAxiPmon instance.
1191 * @param CounterNum is the Metric Counter number for which
1192 * Ranges are to be assigned.Use the XAPM_METRIC_COUNTER*
1193 * defines for the counter number in xaxipmon.h.
1194 * The valid values are 0 (XAPM_METRIC_COUNTER_0) to
1195 * 9 (XAPM_METRIC_COUNTER_9).
1196 * @param RangeUpper specifies the Upper limit in 32 bit Register
1197 * @param RangeLower specifies the Lower limit in 32 bit Register
1202 *****************************************************************************/
1203 void XAxiPmon_SetLogEnableRanges(XAxiPmon *InstancePtr, u32 CounterNum,
1204 u16 RangeUpper, u16 RangeLower)
1208 * Assert the arguments.
1210 Xil_AssertVoid(InstancePtr != NULL);
1211 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1212 Xil_AssertVoid(CounterNum < XAPM_MAX_COUNTERS);
1213 Xil_AssertVoid((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
1214 (InstancePtr->Config.IsEventCount == 1U));
1218 * Write the specified Ranges to corresponding Metric Counter Log
1221 RegValue = (u32)RangeUpper << 16;
1222 RegValue |= RangeLower;
1223 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
1224 ((u32)XAPM_MC0LOGEN_OFFSET + (CounterNum * (u32)16)), RegValue);
1228 /****************************************************************************/
1231 * This function returns the Ranges of specified Metric Counter Log
1234 * @param InstancePtr is a pointer to the XAxiPmon instance.
1235 * @param CounterNum is the Metric Counter number for which
1236 * Ranges are to be returned.Use the XAPM_METRIC_COUNTER*
1237 * defines for the counter number in xaxipmon.h.
1238 * The valid values are 0 (XAPM_METRIC_COUNTER_0) to
1239 * 9 (XAPM_METRIC_COUNTER_9).
1241 * @param RangeUpper specifies the user reference variable which returns
1242 * the Upper Range Value of the specified Metric Counter
1243 * Log Enable Register.
1244 * @param RangeLower specifies the user reference variable which returns
1245 * the Lower Range Value of the specified Metric Counter
1246 * Log Enable Register.
1250 *****************************************************************************/
1251 void XAxiPmon_GetLogEnableRanges(XAxiPmon *InstancePtr, u32 CounterNum,
1252 u16 *RangeUpper, u16 *RangeLower)
1256 * Assert the arguments.
1258 Xil_AssertVoid(InstancePtr != NULL);
1259 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1260 Xil_AssertVoid(CounterNum < XAPM_MAX_COUNTERS);
1261 Xil_AssertVoid((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
1262 (InstancePtr->Config.IsEventCount == 1U));
1265 RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1266 ((u32)XAPM_MC0LOGEN_OFFSET + (CounterNum * (u32)16)));
1268 *RangeLower = (u16)RegValue & 0xFFFFU;
1269 *RangeUpper = (u16)(RegValue >> 16) & 0xFFFFU;
1272 /*****************************************************************************/
1275 * This function enables Event Logging.
1277 * @param InstancePtr is a pointer to the XAxiPmon instance.
1283 *******************************************************************************/
1284 void XAxiPmon_EnableEventLog(XAxiPmon *InstancePtr)
1289 * Assert the arguments.
1291 Xil_AssertVoid(InstancePtr != NULL);
1292 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1293 Xil_AssertVoid((InstancePtr->Mode == XAPM_MODE_TRACE) ||
1294 ((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
1295 (InstancePtr->Config.IsEventLog == 1U)));
1297 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1299 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
1300 RegVal | XAPM_CR_EVENTLOG_ENABLE_MASK);
1303 /*****************************************************************************/
1306 * This function enables External trigger pulse so that Metric Counters can be
1307 * started on external trigger pulse for a Slot.
1309 * @param InstancePtr is a pointer to the XAxiPmon instance.
1315 *******************************************************************************/
1316 void XAxiPmon_EnableMetricCounterTrigger(XAxiPmon *InstancePtr)
1321 * Assert the arguments.
1323 Xil_AssertVoid(InstancePtr != NULL);
1324 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1325 Xil_AssertVoid(InstancePtr->Mode != XAPM_MODE_TRACE);
1327 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1329 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
1330 RegVal | XAPM_CR_MCNTR_EXTTRIGGER_MASK);
1333 /****************************************************************************/
1336 * This function disables the External trigger pulse used to start Metric
1337 * Counters on external trigger pulse for a Slot.
1339 * @param InstancePtr is a pointer to the XAxiPmon instance.
1345 *****************************************************************************/
1346 void XAxiPmon_DisableMetricCounterTrigger(XAxiPmon *InstancePtr)
1351 * Assert the arguments.
1353 Xil_AssertVoid(InstancePtr != NULL);
1354 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1355 Xil_AssertVoid(InstancePtr->Mode != XAPM_MODE_TRACE);
1357 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1360 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
1361 RegVal & ~(XAPM_CR_MCNTR_EXTTRIGGER_MASK));
1364 /*****************************************************************************/
1367 * This function enables External trigger pulse for Event Log
1368 * so that Event Logging can be started on external trigger pulse for a Slot.
1370 * @param InstancePtr is a pointer to the XAxiPmon instance.
1376 *******************************************************************************/
1377 void XAxiPmon_EnableEventLogTrigger(XAxiPmon *InstancePtr)
1382 * Assert the arguments.
1384 Xil_AssertVoid(InstancePtr != NULL);
1385 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1386 Xil_AssertVoid(InstancePtr->Mode != XAPM_MODE_PROFILE);
1388 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1390 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
1391 RegVal | XAPM_CR_EVTLOG_EXTTRIGGER_MASK);
1394 /****************************************************************************/
1397 * This function disables the External trigger pulse used to start Event
1398 * Log on external trigger pulse for a Slot.
1400 * @param InstancePtr is a pointer to the XAxiPmon instance.
1406 *****************************************************************************/
1407 void XAxiPmon_DisableEventLogTrigger(XAxiPmon *InstancePtr)
1412 * Assert the arguments.
1414 Xil_AssertVoid(InstancePtr != NULL);
1415 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1416 Xil_AssertVoid(InstancePtr->Mode != XAPM_MODE_PROFILE);
1418 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1421 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress, XAPM_CTL_OFFSET,
1422 RegVal & ~(XAPM_CR_EVTLOG_EXTTRIGGER_MASK));
1425 /****************************************************************************/
1428 * This function returns a name for a given Metric.
1430 * @param Metrics is one of the Metric Sets. User has to use
1431 * XAPM_METRIC_SET_* macros in xaxipmon.h for this parameter
1433 * @return const char *
1437 *****************************************************************************/
1438 const char * XAxiPmon_GetMetricName(u8 Metrics)
1440 if (Metrics == XAPM_METRIC_SET_0 ){
1441 return "Write Transaction Count";
1443 if (Metrics == XAPM_METRIC_SET_1 ){
1444 return "Read Transaction Count";
1446 if (Metrics == XAPM_METRIC_SET_2 ){
1447 return "Write Byte Count";
1449 if (Metrics == XAPM_METRIC_SET_3 ){
1450 return "Read Byte Count";
1452 if (Metrics == XAPM_METRIC_SET_4 ){
1453 return "Write Beat Count";
1455 if (Metrics == XAPM_METRIC_SET_5 ){
1456 return "Total Read Latency";
1458 if (Metrics == XAPM_METRIC_SET_6 ){
1459 return "Total Write Latency";
1461 if (Metrics == XAPM_METRIC_SET_7 ){
1462 return "Slv_Wr_Idle_Cnt";
1464 if (Metrics == XAPM_METRIC_SET_8 ){
1465 return "Mst_Rd_Idle_Cnt";
1467 if (Metrics == XAPM_METRIC_SET_9 ){
1468 return "Num_BValids";
1470 if (Metrics == XAPM_METRIC_SET_10){
1471 return "Num_WLasts";
1473 if (Metrics == XAPM_METRIC_SET_11){
1474 return "Num_RLasts";
1476 if (Metrics == XAPM_METRIC_SET_12){
1477 return "Minimum Write Latency";
1479 if (Metrics == XAPM_METRIC_SET_13){
1480 return "Maximum Write Latency";
1482 if (Metrics == XAPM_METRIC_SET_14){
1483 return "Minimum Read Latency";
1485 if (Metrics == XAPM_METRIC_SET_15){
1486 return "Maximum Read Latency";
1488 if (Metrics == XAPM_METRIC_SET_16){
1489 return "Transfer Cycle Count";
1491 if (Metrics == XAPM_METRIC_SET_17){
1492 return "Packet Count";
1494 if (Metrics == XAPM_METRIC_SET_18){
1495 return "Data Byte Count";
1497 if (Metrics == XAPM_METRIC_SET_19){
1498 return "Position Byte Count";
1500 if (Metrics == XAPM_METRIC_SET_20){
1501 return "Null Byte Count";
1503 if (Metrics == XAPM_METRIC_SET_21){
1504 return "Slv_Idle_Cnt";
1506 if (Metrics == XAPM_METRIC_SET_22){
1507 return "Mst_Idle_Cnt";
1509 if (Metrics == XAPM_METRIC_SET_30){
1510 return "External event count";
1512 return "Unsupported";
1515 /****************************************************************************/
1518 * This function sets Write ID in ID register.
1520 * @param InstancePtr is a pointer to the XAxiPmon instance.
1521 * @param WriteId is the Write ID to be written in ID register.
1526 * If ID filtering for write is of 32 bits(for Zynq MP APM) width then
1527 * WriteID is written to XAPM_ID_OFFSET or if it is 16 bit width
1528 * then lower 16 bits of WriteID are written to XAPM_ID_OFFSET.
1530 *****************************************************************************/
1531 void XAxiPmon_SetWriteId(XAxiPmon *InstancePtr, u32 WriteId)
1535 * Assert the arguments.
1537 Xil_AssertVoid(InstancePtr != NULL);
1538 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1540 if (InstancePtr->Config.Is32BitFiltering == 0U)
1542 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1544 RegVal = RegVal & ~(XAPM_ID_WID_MASK);
1545 RegVal = RegVal | WriteId;
1546 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
1547 XAPM_ID_OFFSET, RegVal);
1549 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
1550 XAPM_ID_OFFSET, WriteId);
1554 /****************************************************************************/
1557 * This function sets Read ID in ID register.
1559 * @param InstancePtr is a pointer to the XAxiPmon instance.
1560 * @param ReadId is the Read ID to be written in ID register.
1565 * If ID filtering for read is of 32 bits(for Zynq MP APM) width then
1566 * ReadId is written to XAPM_RID_OFFSET or if it is 16 bit width
1567 * then lower 16 bits of ReadId are written to XAPM_ID_OFFSET.
1569 *****************************************************************************/
1570 void XAxiPmon_SetReadId(XAxiPmon *InstancePtr, u32 ReadId)
1574 * Assert the arguments.
1576 Xil_AssertVoid(InstancePtr != NULL);
1577 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1579 if (InstancePtr->Config.Is32BitFiltering == 0U)
1581 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1583 RegVal = RegVal & ~(XAPM_ID_RID_MASK);
1584 RegVal = RegVal | (ReadId << 16);
1585 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
1586 XAPM_ID_OFFSET, RegVal);
1588 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
1589 XAPM_RID_OFFSET, ReadId);
1593 /****************************************************************************/
1596 * This function returns Write ID in ID register.
1598 * @param InstancePtr is a pointer to the XAxiPmon instance.
1600 * @return WriteId is the required Write ID in ID register.
1603 * If ID filtering for write is of 32 bits(for Zynq MP APM) width then
1604 * 32 bit XAPM_ID_OFFSET contents are returned or if it is 16 bit
1605 * width then lower 16 bits of XAPM_ID_OFFSET register are returned.
1607 *****************************************************************************/
1608 u32 XAxiPmon_GetWriteId(XAxiPmon *InstancePtr)
1614 * Assert the arguments.
1616 Xil_AssertNonvoid(InstancePtr != NULL);
1617 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1619 if (InstancePtr->Config.Is32BitFiltering == 0U)
1621 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1623 WriteId = RegVal & XAPM_ID_WID_MASK;
1625 WriteId = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1632 /****************************************************************************/
1635 * This function returns Read ID in ID register.
1637 * @param InstancePtr is a pointer to the XAxiPmon instance.
1639 * @return ReadId is the required Read ID in ID register.
1642 * If ID filtering for write is of 32 bits(for Zynq MP APM) width then
1643 * 32 bit XAPM_RID_OFFSET contents are returned or if it is 16 bit
1644 * width then higher 16 bits of XAPM_ID_OFFSET register are returned.
1646 *****************************************************************************/
1647 u32 XAxiPmon_GetReadId(XAxiPmon *InstancePtr)
1653 * Assert the arguments.
1655 Xil_AssertNonvoid(InstancePtr != NULL);
1656 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1658 if (InstancePtr->Config.Is32BitFiltering == 0U)
1660 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1662 RegVal = RegVal & XAPM_ID_RID_MASK;
1663 ReadId = RegVal >> 16;
1665 ReadId = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1672 /*****************************************************************************/
1675 * This function sets Latency Start point to calculate write latency.
1677 * @param InstancePtr is a pointer to the XAxiPmon instance.
1678 * @param Param is XAPM_LATENCY_ADDR_ISSUE or XAPM_LATENCY_ADDR_ACCEPT
1682 * @note Param can be 0 - XAPM_LATENCY_ADDR_ISSUE
1683 * or 1 - XAPM_LATENCY_ADDR_ACCEPT
1685 *******************************************************************************/
1686 void XAxiPmon_SetWrLatencyStart(XAxiPmon *InstancePtr, u8 Param)
1691 * Assert the arguments.
1693 Xil_AssertVoid(InstancePtr != NULL);
1694 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1696 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1698 if (Param == XAPM_LATENCY_ADDR_ACCEPT) {
1699 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
1700 XAPM_CTL_OFFSET, RegVal | XAPM_CR_WRLATENCY_START_MASK);
1703 XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress,
1705 XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress,
1706 XAPM_CTL_OFFSET) & ~(XAPM_CR_WRLATENCY_START_MASK));
1710 /*****************************************************************************/
1713 * This function sets Latency End point to calculate write latency.
1715 * @param InstancePtr is a pointer to the XAxiPmon instance.
1716 * @param Param is XAPM_LATENCY_LASTWR or XAPM_LATENCY_FIRSTWR
1721 * @note Param can be 0 - XAPM_LATENCY_LASTWR
1722 * or 1 - XAPM_LATENCY_FIRSTWR
1724 *******************************************************************************/
1725 void XAxiPmon_SetWrLatencyEnd(XAxiPmon *InstancePtr, u8 Param)
1730 * Assert the arguments.
1732 Xil_AssertVoid(InstancePtr != NULL);
1733 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1735 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1737 if (Param == XAPM_LATENCY_FIRSTWR) {
1738 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
1739 XAPM_CTL_OFFSET, RegVal | XAPM_CR_WRLATENCY_END_MASK);
1742 XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress,
1744 XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress,
1745 XAPM_CTL_OFFSET) & ~(XAPM_CR_WRLATENCY_END_MASK));
1749 /*****************************************************************************/
1752 * This function sets Latency Start point to calculate read latency.
1754 * @param InstancePtr is a pointer to the XAxiPmon instance.
1755 * @param Param is XAPM_LATENCY_ADDR_ISSUE or XAPM_LATENCY_ADDR_ACCEPT
1760 * @note Param can be 0 - XAPM_LATENCY_ADDR_ISSUE
1761 * or 1 - XAPM_LATENCY_ADDR_ACCEPT
1763 *******************************************************************************/
1764 void XAxiPmon_SetRdLatencyStart(XAxiPmon *InstancePtr, u8 Param)
1769 * Assert the arguments.
1771 Xil_AssertVoid(InstancePtr != NULL);
1772 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1774 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1776 if (Param == XAPM_LATENCY_ADDR_ACCEPT) {
1777 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
1778 XAPM_CTL_OFFSET, RegVal | XAPM_CR_RDLATENCY_START_MASK);
1781 XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress,
1783 XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress,
1784 XAPM_CTL_OFFSET) & ~(XAPM_CR_RDLATENCY_START_MASK));
1788 /*****************************************************************************/
1791 * This function sets Latency End point to calculate read latency.
1793 * @param InstancePtr is a pointer to the XAxiPmon instance.
1794 * @param Param is XAPM_LATENCY_LASTRD or XAPM_LATENCY_FIRSTRD
1799 * @note Param can be 0 - XAPM_LATENCY_LASTRD
1800 * or 1 - XAPM_LATENCY_FIRSTRD
1802 *******************************************************************************/
1803 void XAxiPmon_SetRdLatencyEnd(XAxiPmon *InstancePtr, u8 Param)
1808 * Assert the arguments.
1810 Xil_AssertVoid(InstancePtr != NULL);
1811 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1813 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1815 if (Param == XAPM_LATENCY_FIRSTRD) {
1816 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
1817 XAPM_CTL_OFFSET, RegVal | XAPM_CR_RDLATENCY_END_MASK);
1820 XAxiPmon_WriteReg((InstancePtr)->Config.BaseAddress,
1822 XAxiPmon_ReadReg((InstancePtr)->Config.BaseAddress,
1823 XAPM_CTL_OFFSET) & ~(XAPM_CR_RDLATENCY_END_MASK));
1827 /*****************************************************************************/
1830 * This function returns Write Latency Start point.
1832 * @param InstancePtr is a pointer to the XAxiPmon instance.
1834 * @return Returns 0 - XAPM_LATENCY_ADDR_ISSUE or
1835 * 1 - XAPM_LATENCY_ADDR_ACCEPT
1839 *******************************************************************************/
1840 u8 XAxiPmon_GetWrLatencyStart(XAxiPmon *InstancePtr)
1845 * Assert the arguments.
1847 Xil_AssertNonvoid(InstancePtr != NULL);
1848 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1850 RegVal = (u8)XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1851 (u32)XAPM_CTL_OFFSET);
1852 RegVal = RegVal & XAPM_CR_WRLATENCY_START_MASK;
1853 if (RegVal != XAPM_LATENCY_ADDR_ISSUE) {
1854 return (u8)XAPM_LATENCY_ADDR_ACCEPT;
1857 return (u8)XAPM_LATENCY_ADDR_ISSUE;
1861 /*****************************************************************************/
1864 * This function returns Write Latency End point.
1866 * @param InstancePtr is a pointer to the XAxiPmon instance.
1868 * @return Returns 0 - XAPM_LATENCY_LASTWR or
1869 * 1 - XAPM_LATENCY_FIRSTWR.
1873 *******************************************************************************/
1874 u8 XAxiPmon_GetWrLatencyEnd(XAxiPmon *InstancePtr)
1879 * Assert the arguments.
1881 Xil_AssertNonvoid(InstancePtr != NULL);
1882 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1884 RegVal = (u8)XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1885 (u32)XAPM_CTL_OFFSET);
1886 RegVal = RegVal & XAPM_CR_WRLATENCY_END_MASK;
1887 if (RegVal != XAPM_LATENCY_LASTWR) {
1888 return (u8)XAPM_LATENCY_FIRSTWR;
1891 return (u8)XAPM_LATENCY_LASTWR;
1895 /*****************************************************************************/
1898 * This function returns read Latency Start point.
1900 * @param InstancePtr is a pointer to the XAxiPmon instance.
1902 * @return Returns 0 - XAPM_LATENCY_ADDR_ISSUE or
1903 * 1 - XAPM_LATENCY_ADDR_ACCEPT
1907 *******************************************************************************/
1908 u8 XAxiPmon_GetRdLatencyStart(XAxiPmon *InstancePtr)
1913 * Assert the arguments.
1915 Xil_AssertNonvoid(InstancePtr != NULL);
1916 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1918 RegVal = (u8)XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1919 (u32)XAPM_CTL_OFFSET);
1920 RegVal = RegVal & XAPM_CR_RDLATENCY_START_MASK;
1922 if (RegVal != XAPM_LATENCY_ADDR_ISSUE) {
1923 return (u8)XAPM_LATENCY_ADDR_ACCEPT;
1926 return (u8)XAPM_LATENCY_ADDR_ISSUE;
1930 /*****************************************************************************/
1933 * This function returns Read Latency End point.
1935 * @param InstancePtr is a pointer to the XAxiPmon instance.
1937 * @return Returns 0 - XAPM_LATENCY_LASTRD or
1938 * 1 - XAPM_LATENCY_FIRSTRD.
1942 *******************************************************************************/
1943 u8 XAxiPmon_GetRdLatencyEnd(XAxiPmon *InstancePtr)
1948 * Assert the arguments.
1950 Xil_AssertNonvoid(InstancePtr != NULL);
1951 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1953 RegVal = (u8)XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1954 (u32)XAPM_CTL_OFFSET);
1955 RegVal = RegVal & XAPM_CR_RDLATENCY_END_MASK;
1956 if (RegVal != XAPM_LATENCY_LASTRD) {
1957 return (u8)XAPM_LATENCY_FIRSTRD;
1960 return (u8)XAPM_LATENCY_LASTRD;
1965 /****************************************************************************/
1968 * This function sets Write ID Mask in ID Mask register.
1970 * @param InstancePtr is a pointer to the XAxiPmon instance.
1971 * @param WrMask is the Write ID mask to be written in ID register.
1976 * If ID masking for write is of 32 bits(for Zynq MP APM) width then
1977 * WrMask is written to XAPM_IDMASK_OFFSET or if it is 16 bit width
1978 * then lower 16 bits of WrMask are written to XAPM_IDMASK_OFFSET.
1980 *****************************************************************************/
1981 void XAxiPmon_SetWriteIdMask(XAxiPmon *InstancePtr, u32 WrMask)
1985 * Assert the arguments.
1987 Xil_AssertVoid(InstancePtr != NULL);
1988 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
1990 if (InstancePtr->Config.Is32BitFiltering == 0U)
1992 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
1993 XAPM_IDMASK_OFFSET);
1994 RegVal = RegVal & ~(XAPM_MASKID_WID_MASK);
1995 RegVal = RegVal | WrMask;
1996 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
1997 XAPM_IDMASK_OFFSET, RegVal);
1999 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
2000 XAPM_IDMASK_OFFSET, WrMask);
2004 /****************************************************************************/
2007 * This function sets Read ID Mask in ID Mask register.
2009 * @param InstancePtr is a pointer to the XAxiPmon instance.
2010 * @param RdMask is the Read ID mask to be written in ID Mask register.
2015 * If ID masking for read is of 32 bits(for Zynq MP APM) width then
2016 * RdMask is written to XAPM_RIDMASK_OFFSET or if it is 16 bit width
2017 * then lower 16 bits of RdMask are written to XAPM_IDMASK_OFFSET.
2019 *****************************************************************************/
2020 void XAxiPmon_SetReadIdMask(XAxiPmon *InstancePtr, u32 RdMask)
2024 * Assert the arguments.
2026 Xil_AssertVoid(InstancePtr != NULL);
2027 Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
2029 if (InstancePtr->Config.Is32BitFiltering == 0U)
2031 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
2032 XAPM_IDMASK_OFFSET);
2033 RegVal = RegVal & ~(XAPM_MASKID_RID_MASK);
2034 RegVal = RegVal | (RdMask << 16);
2035 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
2036 XAPM_IDMASK_OFFSET, RegVal);
2038 XAxiPmon_WriteReg(InstancePtr->Config.BaseAddress,
2039 XAPM_RIDMASK_OFFSET, RdMask);
2043 /****************************************************************************/
2046 * This function returns Write ID Mask in ID Mask register.
2048 * @param InstancePtr is a pointer to the XAxiPmon instance.
2050 * @return WrMask is the required Write ID Mask in ID Mask register.
2053 * If ID masking for write is of 32 bits(for Zynq MP APM) width then
2054 * 32 bit XAPM_IDMASK_OFFSET contents are returned or if it is 16 bit
2055 * width then lower 16 bits of XAPM_IDMASK_OFFSET register
2058 *****************************************************************************/
2059 u32 XAxiPmon_GetWriteIdMask(XAxiPmon *InstancePtr)
2065 * Assert the arguments.
2067 Xil_AssertNonvoid(InstancePtr != NULL);
2068 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
2070 if (InstancePtr->Config.Is32BitFiltering == 0U)
2072 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
2073 XAPM_IDMASK_OFFSET);
2074 WrMask = RegVal & XAPM_MASKID_WID_MASK;
2076 WrMask = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
2077 XAPM_IDMASK_OFFSET);
2083 /****************************************************************************/
2086 * This function returns Read ID Mask in ID Mask register.
2088 * @param InstancePtr is a pointer to the XAxiPmon instance.
2090 * @return RdMask is the required Read ID Mask in ID Mask register.
2093 * If ID masking for read is of 32 bits(for Zynq MP APM) width then
2094 * 32 bit XAPM_RIDMASK_OFFSET contents are returned or if it is 16 bit
2095 * width then higher 16 bits of XAPM_IDMASK_OFFSET register
2098 *****************************************************************************/
2099 u32 XAxiPmon_GetReadIdMask(XAxiPmon *InstancePtr)
2105 * Assert the arguments.
2107 Xil_AssertNonvoid(InstancePtr != NULL);
2108 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
2110 if (InstancePtr->Config.Is32BitFiltering == 0U)
2112 RegVal = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
2113 XAPM_IDMASK_OFFSET);
2114 RegVal = RegVal & XAPM_MASKID_RID_MASK;
2115 RdMask = RegVal >> 16;
2117 RdMask = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
2118 XAPM_RIDMASK_OFFSET);