XilinxProcessorIPLib/drivers/pciepsu/src/xpciepsu_caps.c
u8 XPciePsu_HasCapability(XPciePsu *InstancePtr, u8 Bus, u8 Device,
		u8 Function, u8 CapId)
{
	u8 CapStatus = CAP_NOT_PRESENT;
	u32 CapBase = XPciePsu_GetBaseCapability(InstancePtr, Bus, Device,
			Function);

	while (CapBase != 0U) {
		if (XPciePsu_ReadConfigSpace(InstancePtr, Bus, Device,
		       Function, XPciePsu_GetCapabilityAddr(CapBase), &CapBase) != (u8)XST_SUCCESS) {
			break;
		}
		if (CapId == (CapBase & XPCIEPSU_CFG_CAP_ID_LOC)){
			CapStatus =  CAP_PRESENT;
			break;
		}


		CapBase = (u32)((CapBase >> XPCIEPSU_CAP_SHIFT) & (u32)XPCIEPSU_CAP_PTR_LOC);
	}

	return CapStatus;

}
/******************************************************************************/
/**
* This function returns whether capability Id is available or not for the
* particular Function.
*
* @param   InstancePtr pointer to XPciePsu Instance Pointer
* @param   Bus is the number of the Bus
* @param   Device is the number of the Device
* @param   Function is number of the Function
* @param   cap id to check capability pointer availability
*
* @return  u32 0 if capability is not available
* 1 if capability is available
*
*******************************************************************************/
This function returns whether capability Id is available or not for the
particular Function.
This function returns whether capability Id is available or not for the particular Function .
u8 XPciePsu_HasCapability(XPciePsu *InstancePtr, u8 Bus, u8 Device,
		u8 Function, u8 CapId)
{
	u8 CapStatus = CAP_NOT_PRESENT;
	u32 CapBase = XPciePsu_GetBaseCapability(InstancePtr, Bus, Device,
			Function);
	while (CapBase != 0U) {
		if (XPciePsu_ReadConfigSpace(InstancePtr, Bus, Device,
		       Function, XPciePsu_GetCapabilityAddr(CapBase), &CapBase) != (u8)XST_SUCCESS) {
			break;
		}
		if (CapId == (CapBase & XPCIEPSU_CFG_CAP_ID_LOC)){
			CapStatus =  CAP_PRESENT;
			break;
		}
		CapBase = (u32)((CapBase >> XPCIEPSU_CAP_SHIFT) & (u32)XPCIEPSU_CAP_PTR_LOC);
	}
	return CapStatus;
}
u8 XPciePsu_HasCapability ( XPciePsu * InstancePtr , u8 Bus , u8 Device , u8 Function , u8 CapId ) { u8 CapStatus = CAP_NOT_PRESENT ; u32 CapBase = XPciePsu_GetBaseCapability ( InstancePtr , Bus , Device , Function ) ; while ( CapBase != 0U ) { if ( XPciePsu_ReadConfigSpace ( InstancePtr , Bus , Device , Function , XPciePsu_GetCapabilityAddr ( CapBase ) , & CapBase ) != ( u8 ) XST_SUCCESS ) { break ; } if ( CapId == ( CapBase & XPCIEPSU_CFG_CAP_ID_LOC ) ) { CapStatus = CAP_PRESENT ; break ; } CapBase = ( u32 ) ( ( CapBase >> XPCIEPSU_CAP_SHIFT ) & ( u32 ) XPCIEPSU_CAP_PTR_LOC ) ; } return CapStatus ; }
This function returns whether capability Id is available or not for the
particular Function.
This function returns whether capability Id is available or not for the particular Function .