XilinxProcessorIPLib/drivers/resetps/src/xresetps.c
XStatus XResetPs_ResetStatus(XResetPs *InstancePtr,
		       const XResetPs_RstId ResetID, XResetPs_RstStatus *Status)
{
	/* Arguments validation */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(Status != NULL);
	if (!((ResetID <= XRESETPS_RSTID_END) &&
		((ResetID > XRESETPS_RSTID_START)||
		 (ResetID == XRESETPS_RSTID_START)))) {
		return XST_INVALID_PARAM;
	}

#if EL1_NONSECURE
	/* Get reset status via PMUFW */
	XSmc_OutVar out;

	out = Xil_Smc(PM_GETSTATUS_SMC_FID,
		      ((u64)(ResetID + XRESETPS_RSTID_BASE)), 0, 0, 0, 0, 0, 0);
	*Status = ((u32)(out.Arg0 >> 32));

	return ((u32)out.Arg0);
#else
	u32 RegAddr;
	u32 RegBitmask;
	u32 RegValue;

	/* Ignoring Nodes that donot support reset status */
	if (!XRESETPS_CHK_STATUS_SUPPORT(ResetMap[ResetID].SupportedActions)) {
			return XST_NO_FEATURE;
	}

	/*
	 * @NOTE:
	 * This will always move to else part as GPO3 are ignored because
	 * XRESETPS_PMU_LCL_READ_CTRL is not accessible.
	 */
	/* GPO3PL have status address different from control address */
	if ((ResetID >= XRESETPS_RSTID_GPO3PL0) &&
			(ResetID <= XRESETPS_RSTID_GPO3PL31)) {
		RegAddr = XRESETPS_PMU_LCL_READ_CTRL;
	} else {
		RegAddr = ResetMap[ResetID].SlcrregAddr;
	}

	RegBitmask = ResetMap[ResetID].SlcrregBitmask;

	RegValue = XResetPs_ReadReg(RegAddr);
	if ((RegValue & RegBitmask) == RegBitmask) {
		*Status = XRESETPS_RESETASSERTED;
	} else {
		*Status = XRESETPS_RESETRELEASED;
	}

	return XST_SUCCESS;
#endif
}
/****************************************************************************/
/**
*
* Get reset status for specific peripheral based on reset ID.
*
* @param	InstancePtr is a pointer to the XResetPs instance.
* @param	ResetID is the ID of the peripheral.
* @param	Status is the status of reset for ResetID.
*		1 if asserted and 0 if released
*
* @return
*		- XST_SUCCESS if status fetched successful.
*		- Error Code otherwise.
*
* @note		None.
*
******************************************************************************/
Get reset status for specific peripheral based on reset ID.
Get reset status for specific peripheral based on reset ID .
XStatus XResetPs_ResetStatus(XResetPs *InstancePtr,
		       const XResetPs_RstId ResetID, XResetPs_RstStatus *Status)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(Status != NULL);
	if (!((ResetID <= XRESETPS_RSTID_END) &&
		((ResetID > XRESETPS_RSTID_START)||
		 (ResetID == XRESETPS_RSTID_START)))) {
		return XST_INVALID_PARAM;
	}
#if EL1_NONSECURE
	XSmc_OutVar out;
	out = Xil_Smc(PM_GETSTATUS_SMC_FID,
		      ((u64)(ResetID + XRESETPS_RSTID_BASE)), 0, 0, 0, 0, 0, 0);
	*Status = ((u32)(out.Arg0 >> 32));
	return ((u32)out.Arg0);
#else
	u32 RegAddr;
	u32 RegBitmask;
	u32 RegValue;
	if (!XRESETPS_CHK_STATUS_SUPPORT(ResetMap[ResetID].SupportedActions)) {
			return XST_NO_FEATURE;
	}
	if ((ResetID >= XRESETPS_RSTID_GPO3PL0) &&
			(ResetID <= XRESETPS_RSTID_GPO3PL31)) {
		RegAddr = XRESETPS_PMU_LCL_READ_CTRL;
	} else {
		RegAddr = ResetMap[ResetID].SlcrregAddr;
	}
	RegBitmask = ResetMap[ResetID].SlcrregBitmask;
	RegValue = XResetPs_ReadReg(RegAddr);
	if ((RegValue & RegBitmask) == RegBitmask) {
		*Status = XRESETPS_RESETASSERTED;
	} else {
		*Status = XRESETPS_RESETRELEASED;
	}
	return XST_SUCCESS;
#endif
}
XStatus XResetPs_ResetStatus ( XResetPs * InstancePtr , const XResetPs_RstId ResetID , XResetPs_RstStatus * Status ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( Status != NULL ) ; if ( ! ( ( ResetID <= XRESETPS_RSTID_END ) && ( ( ResetID > XRESETPS_RSTID_START ) || ( ResetID == XRESETPS_RSTID_START ) ) ) ) { return XST_INVALID_PARAM ; } #if EL1_NONSECURE XSmc_OutVar out ; out = Xil_Smc ( PM_GETSTATUS_SMC_FID , ( ( u64 ) ( ResetID + XRESETPS_RSTID_BASE ) ) , 0 , 0 , 0 , 0 , 0 , 0 ) ; * Status = ( ( u32 ) ( out . Arg0 >> 32 ) ) ; return ( ( u32 ) out . Arg0 ) ; #else u32 RegAddr ; u32 RegBitmask ; u32 RegValue ; if ( ! XRESETPS_CHK_STATUS_SUPPORT ( ResetMap [ ResetID ] . SupportedActions ) ) { return XST_NO_FEATURE ; } if ( ( ResetID >= XRESETPS_RSTID_GPO3PL0 ) && ( ResetID <= XRESETPS_RSTID_GPO3PL31 ) ) { RegAddr = XRESETPS_PMU_LCL_READ_CTRL ; } else { RegAddr = ResetMap [ ResetID ] . SlcrregAddr ; } RegBitmask = ResetMap [ ResetID ] . SlcrregBitmask ; RegValue = XResetPs_ReadReg ( RegAddr ) ; if ( ( RegValue & RegBitmask ) == RegBitmask ) { * Status = XRESETPS_RESETASSERTED ; } else { * Status = XRESETPS_RESETRELEASED ; } return XST_SUCCESS ; #endif }
Get reset status for specific peripheral based on reset ID.
Get reset status for specific peripheral based on reset ID .
/* Arguments validation */ /* Get reset status via PMUFW */ /* Ignoring Nodes that donot support reset status */ /*
	 * @NOTE:
	 * This will always move to else part as GPO3 are ignored because
	 * XRESETPS_PMU_LCL_READ_CTRL is not accessible.
	 */ /* GPO3PL have status address different from control address */