📄 xmpmc.c
字号:
*/ RegData = XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_PMCTRL_OFFSET); XMpmc_mWriteReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_PMCTRL_OFFSET, RegData | Mask);}/****************************************************************************//**** Disable the Performance Monitoring for the specified ports.** @param InstancePtr is a pointer to an XMpmc instance to be worked on.* @param Mask is the bit-mask of the ports for which the PM is to be* disabled.* Bit positions of 1 are disabled. The mask is formed by OR'ing* bits from XMPMC_PMREG_*_MASK.** @return None.** @note None.******************************************************************************/void XMpmc_DisablePm(XMpmc *InstancePtr, u32 Mask){ u32 RegData; /* * Assert arguments. */ XASSERT_VOID(InstancePtr != NULL); XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); XASSERT_VOID(InstancePtr->ConfigPtr.PerfMonitorEnable == TRUE); /* * Disable the Performance Monitoring for the specified ports. */ RegData = XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_PMCTRL_OFFSET) & XMPMC_PMREG_PM_ALL_MASK; XMpmc_mWriteReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_PMCTRL_OFFSET, RegData & (~ Mask));}/****************************************************************************//**** Clear the Performance Monitoring Data Bins for the specified ports.** @param InstancePtr is a pointer to an XMpmc instance to be worked on.* @param Mask is the bit-mask of the ports for which the PM Data bins* are to be cleared.* Bit positions of 1 are cleared. The mask is formed by OR'ing* bits from XMPMC_PMREG_*_MASK.** @return None.** @note None.******************************************************************************/void XMpmc_ClearDataBinPm(XMpmc * InstancePtr, u32 Mask){ u32 RegData; /* * Assert arguments. */ XASSERT_VOID(InstancePtr != NULL); XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); XASSERT_VOID(InstancePtr->ConfigPtr.PerfMonitorEnable == TRUE); /* * Clear the Performance Monitoring Data Bins for the specified ports. */ RegData = XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_PMSTATUS_OFFSET); XMpmc_mWriteReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_PMCLR_OFFSET, RegData | Mask );}/****************************************************************************//**** Get the Performance Monitoring Data Bin Clear Status.** @param InstancePtr is a pointer to an XMpmc instance to be worked on.** @return The Status of the Clear Operation on the Data Bins.** @note None.******************************************************************************/u32 XMpmc_GetStatusPm(XMpmc * InstancePtr){ u32 RegData; /* * Assert arguments. */ XASSERT_NONVOID(InstancePtr != NULL); XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); XASSERT_NONVOID(InstancePtr->ConfigPtr.PerfMonitorEnable == TRUE); /* * Get the Performance Monitoring Data Bin Clear Status. */ RegData = XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_PMSTATUS_OFFSET); return RegData;}/****************************************************************************//**** Clears the Performance Monitoring Data Bin Clear Status for the specified* bins.** @param InstancePtr is a pointer to an XMpmc instance to be worked on.* @param Mask is the of the ports for which the PM Data bin clear status* bits are to be cleared. Bit positions of 1 are cleared.* The mask is formed by OR'ing bits from XMPMC_PMREG_*_MASK.** @return None.** @note None.******************************************************************************/void XMpmc_ClearStatusPm(XMpmc * InstancePtr, u32 Mask){ /* * Assert arguments. */ XASSERT_VOID(InstancePtr != NULL); XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); XASSERT_VOID(InstancePtr->ConfigPtr.PerfMonitorEnable == TRUE); /* * Clear the Performance Monitoring Status for the specified ports. */ XMpmc_mWriteReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_PMSTATUS_OFFSET, Mask);}/****************************************************************************//**** Get the Performance Monitoring Global Cycle Count.** @param InstancePtr is a pointer to an XMpmc instance to be worked on.** @return The Global Cycle Count.** @note None.******************************************************************************/Xuint64 XMpmc_GetGlobalCycleCountPm(XMpmc * InstancePtr){ Xuint64 RegData; /* * Get the Performance Monitoring Global Cycle Count. */ RegData.Upper = XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_PMGCC_OFFSET); RegData.Lower = XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_PMGCC_OFFSET + 4); return RegData;}/****************************************************************************//**** Get the Performance Monitoring Dead Cycle Count for the specified port.** @param InstancePtr is a pointer to an XMpmc instance to be worked on.* @param PortNum is the Port Number. The valid port numbers are 0 to 7.* Use the definitions XMPMC_PM_PORT* for specifying the port* number.** @return The Dead Cycle Count for the specified port.** @note The user is responsible for giving valid inputs to this* function. The input arguments are not checked for correctness* in this function.******************************************************************************/Xuint64 XMpmc_GetDeadCycleCountPm(XMpmc * InstancePtr, u8 PortNum){ u32 RegAddress; Xuint64 RegData; /* * Get the Performance Monitoring Dead Cycle Count. */ RegAddress = XMPMC_PMDCC_OFFSET + (PortNum << 3); RegData.Upper = XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, RegAddress); RegData.Lower = XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, RegAddress + 4); return RegData;}/****************************************************************************//**** Get the Performance Monitoring Data for the specified bin.** @param InstancePtr is a pointer to an XMpmc instance to be worked on.* @param PortNum is the Port Number. The valid port numbers are 0 to 7.* Use the definitions XMPMC_PM_PORT* for specifying the port* number.* @param Qualifier is the qualifier type. The valid qualifier type* is 0 to 5 . Use the definitions XMPMC_PM_DATABIN_QUAL* for* specifying the Qualifier type.* @param AccessType specifies whether the Data bin is for Read or Write* access. Valid values are 0 to 1. Use the following definitions* - Read access (XMPMC_PM_DATABIN_ACCESS_READ)* - Write access (XMPMC_PM_DATABIN_ACCESS_WRITE)* @param BinNumber is the Bin Number. The valid values are 0 to 31 .*** @return The Data Bin Count for the specified Port/Qualifier/AccessType* and BinNumber.** @note The user is responsible for giving valid inputs to this* function. The input arguments are not checked for correctness* in this function.******************************************************************************/Xuint64 XMpmc_GetDataBinCountPm(XMpmc * InstancePtr, u8 PortNum , u8 Qualifier, u8 AccessType, u8 BinNumber){ u32 RegAddress; Xuint64 RegData; /* * Calculate the address of the Data bin. */ RegAddress = XMPMC_PMDATABIN_OFFSET + (XMPMC_PM_DATABIN_PORT_REG_OFFSET * PortNum) + (XMPMC_PM_DATABIN_QUAL_REG_OFFSET * Qualifier) + (XMPMC_PM_DATABIN_ACCESS_REG_OFFSET * AccessType) + (BinNumber << 3 ); /* * Get the Performance Monitoring Data bin Count. */ RegData.Upper = XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, RegAddress); RegData.Lower = XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, RegAddress + 4); return RegData;}/****************************************************************************//**** Set the Static Phy Interface Register of the MPMC device to the specified* value.** @param InstancePtr is a pointer to an XMpmc instance to be worked on.* @param Data contains the value to be written to the register. and* Use the definitions XMPMC_SPIR_* in xmpmc_hw.h for specifying* the value.** @return None.** @note None.******************************************************************************/void XMpmc_SetStaticPhyReg(XMpmc * InstancePtr, u32 Data){ /* * Assert arguments. */ XASSERT_VOID(InstancePtr != NULL); XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); XASSERT_VOID(InstancePtr->ConfigPtr.StaticPhyPresent == TRUE); /* * Set the control register without any concern for destructiveness. */ XMpmc_mWriteReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_SPIR_OFFSET, Data);}/****************************************************************************//**** Get the Static Phy Interface Register contents of the MPMC device.** @param InstancePtr is a pointer to an XMpmc instance to be worked on.** @return The value read from the register which consists of constants* Use the definitions XMPMC_SPIR_* in xmpmc_hw.h for interpreting* the value.** @note None.******************************************************************************/u32 XMpmc_GetStaticPhyReg(XMpmc * InstancePtr){ /* * Assert arguments. */ XASSERT_NONVOID(InstancePtr != NULL); XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); XASSERT_NONVOID(InstancePtr->ConfigPtr.StaticPhyPresent == TRUE); return XMpmc_mReadReg(InstancePtr->ConfigPtr.BaseAddress, XMPMC_SPIR_OFFSET);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -