lib/sw_services/xilplmi/src/xplmi_ssit.c
int XPlmi_SsitSyncMaster(XPlmi_Cmd *Cmd)
{
	int Status = XST_FAILURE;
	u32 ErrStatus = (u32)XST_FAILURE;

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

	/* Initiate synchronization to master */
	XPlmi_UtilRMW(PMC_GLOBAL_SSIT_ERR, PMC_GLOBAL_SSIT_ERR_IRQ_OUT_0_MASK,
		PMC_GLOBAL_SSIT_ERR_IRQ_OUT_0_MASK);

	/* Wait for Master SLR to reach synchronization point */
	ErrStatus = Xil_In32((UINTPTR)PMC_GLOBAL_PMC_ERR2_STATUS);
	while ((ErrStatus & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK) !=
			PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK) {
		/* Check if there is an error from Master SLR */
		if ((ErrStatus & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR2_MASK) ==
				PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR2_MASK) {
			XPlmi_Printf(DEBUG_GENERAL, "Received error from Master SLR\n\r");
			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_MASTER_SYNC, (int)ErrStatus);
			goto END;
		}
		ErrStatus = XPlmi_In32((UINTPTR)PMC_GLOBAL_PMC_ERR2_STATUS);
	}

	/* Complete synchronization from slave */
	XPlmi_UtilRMW(PMC_GLOBAL_SSIT_ERR, PMC_GLOBAL_SSIT_ERR_IRQ_OUT_0_MASK, 0U);

	ErrStatus = XPlmi_In32((UINTPTR)PMC_GLOBAL_PMC_ERR2_STATUS);
	while ((ErrStatus & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK) ==
			PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK) {
		ErrStatus = XPlmi_In32((UINTPTR)PMC_GLOBAL_PMC_ERR2_STATUS);

		/* Clear existing status to know the actual status from Master SLR */
		XPlmi_Out32(PMC_GLOBAL_PMC_ERR2_STATUS,
			PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK);
	}

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

@return      Returns the Status of SSIT Sync Master command
@brief This function provides SSIT Sync Master command execution . @param Cmd is pointer to the command structure @return Returns the Status of SSIT Sync Master command
int XPlmi_SsitSyncMaster(XPlmi_Cmd *Cmd)
{
	int Status = XST_FAILURE;
	u32 ErrStatus = (u32)XST_FAILURE;
	XPlmi_Printf(DEBUG_INFO, "%s %p\n\r", __func__, Cmd);
	XPlmi_UtilRMW(PMC_GLOBAL_SSIT_ERR, PMC_GLOBAL_SSIT_ERR_IRQ_OUT_0_MASK,
		PMC_GLOBAL_SSIT_ERR_IRQ_OUT_0_MASK);
	ErrStatus = Xil_In32((UINTPTR)PMC_GLOBAL_PMC_ERR2_STATUS);
	while ((ErrStatus & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK) !=
			PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK) {
		if ((ErrStatus & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR2_MASK) ==
				PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR2_MASK) {
			XPlmi_Printf(DEBUG_GENERAL, "Received error from Master SLR\n\r");
			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_MASTER_SYNC, (int)ErrStatus);
			goto END;
		}
		ErrStatus = XPlmi_In32((UINTPTR)PMC_GLOBAL_PMC_ERR2_STATUS);
	}
	XPlmi_UtilRMW(PMC_GLOBAL_SSIT_ERR, PMC_GLOBAL_SSIT_ERR_IRQ_OUT_0_MASK, 0U);
	ErrStatus = XPlmi_In32((UINTPTR)PMC_GLOBAL_PMC_ERR2_STATUS);
	while ((ErrStatus & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK) ==
			PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK) {
		ErrStatus = XPlmi_In32((UINTPTR)PMC_GLOBAL_PMC_ERR2_STATUS);
		XPlmi_Out32(PMC_GLOBAL_PMC_ERR2_STATUS,
			PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK);
	}
	XPlmi_Printf(DEBUG_INFO, "SSIT Sync Master successful\n\r");
	Status = XST_SUCCESS;
END:
	return Status;
}
int XPlmi_SsitSyncMaster ( XPlmi_Cmd * Cmd ) { int Status = XST_FAILURE ; u32 ErrStatus = ( u32 ) XST_FAILURE ; XPlmi_Printf ( DEBUG_INFO , " \n \r " , __func__ , Cmd ) ; XPlmi_UtilRMW ( PMC_GLOBAL_SSIT_ERR , PMC_GLOBAL_SSIT_ERR_IRQ_OUT_0_MASK , PMC_GLOBAL_SSIT_ERR_IRQ_OUT_0_MASK ) ; ErrStatus = Xil_In32 ( ( UINTPTR ) PMC_GLOBAL_PMC_ERR2_STATUS ) ; while ( ( ErrStatus & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK ) != PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK ) { if ( ( ErrStatus & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR2_MASK ) == PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR2_MASK ) { XPlmi_Printf ( DEBUG_GENERAL , " \n \r " ) ; 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_MASTER_SYNC , ( int ) ErrStatus ) ; goto END ; } ErrStatus = XPlmi_In32 ( ( UINTPTR ) PMC_GLOBAL_PMC_ERR2_STATUS ) ; } XPlmi_UtilRMW ( PMC_GLOBAL_SSIT_ERR , PMC_GLOBAL_SSIT_ERR_IRQ_OUT_0_MASK , 0U ) ; ErrStatus = XPlmi_In32 ( ( UINTPTR ) PMC_GLOBAL_PMC_ERR2_STATUS ) ; while ( ( ErrStatus & PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK ) == PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK ) { ErrStatus = XPlmi_In32 ( ( UINTPTR ) PMC_GLOBAL_PMC_ERR2_STATUS ) ; XPlmi_Out32 ( PMC_GLOBAL_PMC_ERR2_STATUS , PMC_GLOBAL_PMC_ERR2_STATUS_SSIT_ERR0_MASK ) ; } XPlmi_Printf ( DEBUG_INFO , " \n \r " ) ; Status = XST_SUCCESS ; END : return Status ; }
@brief       This function provides SSIT Sync Master command execution.
@brief This function provides SSIT Sync Master command execution .
/* Initiate synchronization to master */ /* Wait for Master SLR to reach synchronization point */ /* Check if there is an error from Master SLR */ /* Complete synchronization from slave */ /* Clear existing status to know the actual status from Master SLR */