lib/sw_services/xilplmi/src/xplmi_dma.c
static int XPlmi_SsitWaitForDmaDone(XPmcDma *DmaPtr, XPmcDma_Channel Channel)
{
	int Status = XST_FAILURE;
	u32 SsitErrStatus;
	u32 RegOffset = ((u32)(XCSUDMA_I_STS_OFFSET) +
			((u32)(Channel) * (u32)(XCSUDMA_OFFSET_DIFF)));

	/* Wait for DMA done */
	while ((XCsuDma_ReadReg((DmaPtr->Config.BaseAddress), RegOffset) &
		(u32)(XCSUDMA_IXR_DONE_MASK)) != (XCSUDMA_IXR_DONE_MASK)) {
		/* Check if there is an error from SSIT slaves */
		SsitErrStatus = XPlmi_In32(PMC_GLOBAL_PMC_ERR1_STATUS);
		if ((SsitErrStatus & PMC_GLOBAL_SSIT_ERR_MASK) != 0x0U) {
			XPlmi_Printf(DEBUG_GENERAL, "PDI load failed due to error from "
					"Slave SLR. Error1 Status = 0x%x\r\n", SsitErrStatus);
			/* Trigger SSIT error to all Slave SLRs */
			XPlmi_UtilRMW(PMC_GLOBAL_SSIT_ERR,
					PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK,
					PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK);
			Status = (int)XPLMI_ERR_FROM_SSIT_SLAVE;
			break;
		}
	}

	if (Status != (int)XPLMI_ERR_FROM_SSIT_SLAVE) {
		Status = XST_SUCCESS;
	}

	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function is used to check and wait for DMA done when sending
 *          data to SSIT Slave SLRs.
 *
 * @param	DmaPtr is pointer to DMA structure
 * @param	Channel is DMA source or destination channel
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function is used to check and wait for DMA done when sending
data to SSIT Slave SLRs.

@param       DmaPtr is pointer to DMA structure
@param       Channel is DMA source or destination channel

@return      XST_SUCCESS on success and error code on failure
@brief This function is used to check and wait for DMA done when sending data to SSIT Slave SLRs . @param DmaPtr is pointer to DMA structure @param Channel is DMA source or destination channel @return XST_SUCCESS on success and error code on failure
static int XPlmi_SsitWaitForDmaDone(XPmcDma *DmaPtr, XPmcDma_Channel Channel)
{
	int Status = XST_FAILURE;
	u32 SsitErrStatus;
	u32 RegOffset = ((u32)(XCSUDMA_I_STS_OFFSET) +
			((u32)(Channel) * (u32)(XCSUDMA_OFFSET_DIFF)));
	while ((XCsuDma_ReadReg((DmaPtr->Config.BaseAddress), RegOffset) &
		(u32)(XCSUDMA_IXR_DONE_MASK)) != (XCSUDMA_IXR_DONE_MASK)) {
		SsitErrStatus = XPlmi_In32(PMC_GLOBAL_PMC_ERR1_STATUS);
		if ((SsitErrStatus & PMC_GLOBAL_SSIT_ERR_MASK) != 0x0U) {
			XPlmi_Printf(DEBUG_GENERAL, "PDI load failed due to error from "
					"Slave SLR. Error1 Status = 0x%x\r\n", SsitErrStatus);
			XPlmi_UtilRMW(PMC_GLOBAL_SSIT_ERR,
					PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK,
					PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK);
			Status = (int)XPLMI_ERR_FROM_SSIT_SLAVE;
			break;
		}
	}
	if (Status != (int)XPLMI_ERR_FROM_SSIT_SLAVE) {
		Status = XST_SUCCESS;
	}
	return Status;
}
static int XPlmi_SsitWaitForDmaDone ( XPmcDma * DmaPtr , XPmcDma_Channel Channel ) { int Status = XST_FAILURE ; u32 SsitErrStatus ; u32 RegOffset = ( ( u32 ) ( XCSUDMA_I_STS_OFFSET ) + ( ( u32 ) ( Channel ) * ( u32 ) ( XCSUDMA_OFFSET_DIFF ) ) ) ; while ( ( XCsuDma_ReadReg ( ( DmaPtr -> Config . BaseAddress ) , RegOffset ) & ( u32 ) ( XCSUDMA_IXR_DONE_MASK ) ) != ( XCSUDMA_IXR_DONE_MASK ) ) { SsitErrStatus = XPlmi_In32 ( PMC_GLOBAL_PMC_ERR1_STATUS ) ; if ( ( SsitErrStatus & PMC_GLOBAL_SSIT_ERR_MASK ) != 0x0U ) { XPlmi_Printf ( DEBUG_GENERAL , " " " \r \n " , SsitErrStatus ) ; XPlmi_UtilRMW ( PMC_GLOBAL_SSIT_ERR , PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK , PMC_GLOBAL_SSIT_ERR_IRQ_OUT_2_MASK ) ; Status = ( int ) XPLMI_ERR_FROM_SSIT_SLAVE ; break ; } } if ( Status != ( int ) XPLMI_ERR_FROM_SSIT_SLAVE ) { Status = XST_SUCCESS ; } return Status ; }
@brief       This function is used to check and wait for DMA done when sending
          data to SSIT Slave SLRs.
@brief This function is used to check and wait for DMA done when sending data to SSIT Slave SLRs .
/* Wait for DMA done */ /* Check if there is an error from SSIT slaves */ /* Trigger SSIT error to all Slave SLRs */