lib/sw_services/xilplmi/src/xplmi_ssit.c
int XPlmi_SsitWaitSlaves(XPlmi_Cmd *Cmd)
{
	int Status = XST_FAILURE;
	u32 SlavesMask = Cmd->Payload[0U];
	u32 TimeOut = Cmd->Payload[1U];
	u32 SlavesReady = 0U;
	volatile u32 ErrorStatus = 0U;
	volatile u32 PmcErrStatus2;

	XPlmi_Printf(DEBUG_INFO, "%s %p\n\r", __func__, Cmd);

	/* Wait until all Slaves initiate synchronization point */
	while (((SlavesReady & SlavesMask) != SlavesMask) &&
			(TimeOut != 0x0U)) {
		if (ErrorStatus != 0x0U) {
			break;
		}
		usleep(1U);
		ErrorStatus = XPlmi_In32(PMC_GLOBAL_PMC_ERR1_STATUS) &
			PMC_GLOBAL_SSIT_ERR_MASK;
		PmcErrStatus2 = XPlmi_In32(PMC_GLOBAL_PMC_ERR2_STATUS);
		if ((PmcErrStatus2 & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK) != (u32)FALSE) {
			SlavesReady |= SSIT_SLAVE_0_MASK;
		}
		if ((PmcErrStatus2 & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR1_MASK) != (u32)FALSE) {
			SlavesReady |= SSIT_SLAVE_1_MASK;
		}
		if ((PmcErrStatus2 & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR2_MASK) != (u32)FALSE) {
			SlavesReady |= SSIT_SLAVE_2_MASK;
		}

		--TimeOut;
	}

	/* If error or timeout trigger error out to all slaves */
	if ((ErrorStatus != 0x0U) || (TimeOut == 0x0U)) {
		XPlmi_Printf(DEBUG_GENERAL,
			"Received error from Slave SLR or Timed out\r\n");
		XPlmi_UtilRMW(PMC_GLOBAL_SSIT_ERR, PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK,
			PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK);
		Status = XPlmi_UpdateStatus(XPLMI_ERR_SSIT_SLAVE_SYNC, Status);
		goto END;
	}

	XPlmi_Printf(DEBUG_INFO, "SSIT Wait Master successful\n\r");
	Status = XST_SUCCESS;
END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function provides SSIT Wait Slaves command execution.
 * 			 Command payload parameters are
 *				* Slaves Mask
 *				* Timeout
 *
 * @param	Cmd is pointer to the command structure
 *
 * @return	Returns the Status of SSIT Wait Slaves command
 *
 *****************************************************************************/
@brief       This function provides SSIT Wait Slaves command execution.
Command payload parameters are
Slaves Mask
Timeout

@param       Cmd is pointer to the command structure

@return      Returns the Status of SSIT Wait Slaves command
@brief This function provides SSIT Wait Slaves command execution . Command payload parameters are Slaves Mask Timeout @param Cmd is pointer to the command structure @return Returns the Status of SSIT Wait Slaves command
int XPlmi_SsitWaitSlaves(XPlmi_Cmd *Cmd)
{
	int Status = XST_FAILURE;
	u32 SlavesMask = Cmd->Payload[0U];
	u32 TimeOut = Cmd->Payload[1U];
	u32 SlavesReady = 0U;
	volatile u32 ErrorStatus = 0U;
	volatile u32 PmcErrStatus2;
	XPlmi_Printf(DEBUG_INFO, "%s %p\n\r", __func__, Cmd);
	while (((SlavesReady & SlavesMask) != SlavesMask) &&
			(TimeOut != 0x0U)) {
		if (ErrorStatus != 0x0U) {
			break;
		}
		usleep(1U);
		ErrorStatus = XPlmi_In32(PMC_GLOBAL_PMC_ERR1_STATUS) &
			PMC_GLOBAL_SSIT_ERR_MASK;
		PmcErrStatus2 = XPlmi_In32(PMC_GLOBAL_PMC_ERR2_STATUS);
		if ((PmcErrStatus2 & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK) != (u32)FALSE) {
			SlavesReady |= SSIT_SLAVE_0_MASK;
		}
		if ((PmcErrStatus2 & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR1_MASK) != (u32)FALSE) {
			SlavesReady |= SSIT_SLAVE_1_MASK;
		}
		if ((PmcErrStatus2 & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR2_MASK) != (u32)FALSE) {
			SlavesReady |= SSIT_SLAVE_2_MASK;
		}
		--TimeOut;
	}
	if ((ErrorStatus != 0x0U) || (TimeOut == 0x0U)) {
		XPlmi_Printf(DEBUG_GENERAL,
			"Received error from Slave SLR or Timed out\r\n");
		XPlmi_UtilRMW(PMC_GLOBAL_SSIT_ERR, PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK,
			PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK);
		Status = XPlmi_UpdateStatus(XPLMI_ERR_SSIT_SLAVE_SYNC, Status);
		goto END;
	}
	XPlmi_Printf(DEBUG_INFO, "SSIT Wait Master successful\n\r");
	Status = XST_SUCCESS;
END:
	return Status;
}
int XPlmi_SsitWaitSlaves ( XPlmi_Cmd * Cmd ) { int Status = XST_FAILURE ; u32 SlavesMask = Cmd -> Payload [ 0U ] ; u32 TimeOut = Cmd -> Payload [ 1U ] ; u32 SlavesReady = 0U ; volatile u32 ErrorStatus = 0U ; volatile u32 PmcErrStatus2 ; XPlmi_Printf ( DEBUG_INFO , " \n \r " , __func__ , Cmd ) ; while ( ( ( SlavesReady & SlavesMask ) != SlavesMask ) && ( TimeOut != 0x0U ) ) { if ( ErrorStatus != 0x0U ) { break ; } usleep ( 1U ) ; ErrorStatus = XPlmi_In32 ( PMC_GLOBAL_PMC_ERR1_STATUS ) & PMC_GLOBAL_SSIT_ERR_MASK ; PmcErrStatus2 = XPlmi_In32 ( PMC_GLOBAL_PMC_ERR2_STATUS ) ; if ( ( PmcErrStatus2 & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK ) != ( u32 ) FALSE ) { SlavesReady |= SSIT_SLAVE_0_MASK ; } if ( ( PmcErrStatus2 & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR1_MASK ) != ( u32 ) FALSE ) { SlavesReady |= SSIT_SLAVE_1_MASK ; } if ( ( PmcErrStatus2 & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR2_MASK ) != ( u32 ) FALSE ) { SlavesReady |= SSIT_SLAVE_2_MASK ; } -- TimeOut ; } if ( ( ErrorStatus != 0x0U ) || ( TimeOut == 0x0U ) ) { XPlmi_Printf ( DEBUG_GENERAL , " \r \n " ) ; XPlmi_UtilRMW ( PMC_GLOBAL_SSIT_ERR , PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK , PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK ) ; Status = XPlmi_UpdateStatus ( XPLMI_ERR_SSIT_SLAVE_SYNC , Status ) ; goto END ; } XPlmi_Printf ( DEBUG_INFO , " \n \r " ) ; Status = XST_SUCCESS ; END : return Status ; }
@brief       This function provides SSIT Wait Slaves command execution.
@brief This function provides SSIT Wait Slaves command execution .
/* Wait until all Slaves initiate synchronization point */ /* If error or timeout trigger error out to all slaves */