lib/sw_services/xilplmi/src/xplmi_generic.c
static int XPlmi_MaskPoll(XPlmi_Cmd *Cmd)
{
	int Status = XST_FAILURE;
	u32 Addr = Cmd->Payload[0U];
	u32 Mask = Cmd->Payload[1U];
	u32 ExpectedValue = Cmd->Payload[2U];
	u32 TimeOutInUs = Cmd->Payload[3U];
	u32 Flags = 0U;
#ifdef PLM_PRINT_PERF_POLL
	u64 PollTime = XPlmi_GetTimerValue();
	XPlmi_PerfTime PerfTime = {0U};
#endif

	if (TimeOutInUs < XPLMI_MASK_POLL_MIN_TIMEOUT) {
		TimeOutInUs = XPLMI_MASK_POLL_MIN_TIMEOUT;
	}

	Status = XPlmi_UtilPoll(Addr, Mask, ExpectedValue, TimeOutInUs);
	if (Status != XST_SUCCESS) {
		XPlmi_Printf(DEBUG_GENERAL,
			"%s: Addr: 0x%0x,  Mask: 0x%0x, ExpVal: 0x%0x, "
			"Timeout: %u ...ERROR\r\n",  __func__,
			Addr, Mask, ExpectedValue, TimeOutInUs);
	} else {
		XPlmi_Printf(DEBUG_INFO,
			"%s: Addr: 0x%0x,  Mask: 0x%0x, ExpVal: 0x%0x, "
			"Timeout: %u ...Done\r\n",  __func__,
			Addr, Mask, ExpectedValue, TimeOutInUs);
	}
#ifdef PLM_PRINT_PERF_POLL
	XPlmi_MeasurePerfTime(PollTime, &PerfTime);
	XPlmi_Printf(DEBUG_PRINT_PERF,
		" %u.%03u ms Poll Time: Addr: 0x%0x,  Mask: 0x%0x,"
		" ExpVal: 0x%0x, Timeout: %u \r\n",
		(u32)PerfTime.TPerfMs, (u32)PerfTime.TPerfMsFrac,
		Addr, Mask, ExpectedValue, TimeOutInUs);
#endif

	/* If command length is 5, flags are included */
	if ((Cmd->Len == XPLMI_MASKPOLL_LEN_EXT) && (Status != XST_SUCCESS)) {
		Flags = Cmd->Payload[4U] & XPLMI_MASKPOLL_FLAGS_MASK;
		if (Flags == XPLMI_MASKPOLL_FLAGS_SUCCESS) {
			/* Ignore the error */
			Status = XST_SUCCESS;
		} else if (Flags == XPLMI_MASKPOLL_FLAGS_DEFERRED_ERR) {
			/* Defer the error till the end of CDO processing */
			Status = XST_SUCCESS;
			Cmd->DeferredError = (u8)TRUE;
		} else {
			/* Return mask_poll status */
		}
	}

	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function provides 32 bit mask poll command execution.
 *  		Command payload parameters are
 *		- Address
 *		- Mask
 *		- Expected Value
 *		- Timeout in us
 *		- Deferred Error flag - Optional
 *		-	0 - Return error in case of failure,
 *		-	1 - Ignore error, return success always
 *		-	2 - Defer error till the end of partition load
 *
 * @param	Cmd is pointer to the command structure
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function provides 32 bit mask poll command execution.

@param       Cmd is pointer to the command structure

@return      XST_SUCCESS on success and error code on failure
@brief This function provides 32 bit mask poll command execution . @param Cmd is pointer to the command structure @return XST_SUCCESS on success and error code on failure
static int XPlmi_MaskPoll(XPlmi_Cmd *Cmd)
{
	int Status = XST_FAILURE;
	u32 Addr = Cmd->Payload[0U];
	u32 Mask = Cmd->Payload[1U];
	u32 ExpectedValue = Cmd->Payload[2U];
	u32 TimeOutInUs = Cmd->Payload[3U];
	u32 Flags = 0U;
#ifdef PLM_PRINT_PERF_POLL
	u64 PollTime = XPlmi_GetTimerValue();
	XPlmi_PerfTime PerfTime = {0U};
#endif
	if (TimeOutInUs < XPLMI_MASK_POLL_MIN_TIMEOUT) {
		TimeOutInUs = XPLMI_MASK_POLL_MIN_TIMEOUT;
	}
	Status = XPlmi_UtilPoll(Addr, Mask, ExpectedValue, TimeOutInUs);
	if (Status != XST_SUCCESS) {
		XPlmi_Printf(DEBUG_GENERAL,
			"%s: Addr: 0x%0x,  Mask: 0x%0x, ExpVal: 0x%0x, "
			"Timeout: %u ...ERROR\r\n",  __func__,
			Addr, Mask, ExpectedValue, TimeOutInUs);
	} else {
		XPlmi_Printf(DEBUG_INFO,
			"%s: Addr: 0x%0x,  Mask: 0x%0x, ExpVal: 0x%0x, "
			"Timeout: %u ...Done\r\n",  __func__,
			Addr, Mask, ExpectedValue, TimeOutInUs);
	}
#ifdef PLM_PRINT_PERF_POLL
	XPlmi_MeasurePerfTime(PollTime, &PerfTime);
	XPlmi_Printf(DEBUG_PRINT_PERF,
		" %u.%03u ms Poll Time: Addr: 0x%0x,  Mask: 0x%0x,"
		" ExpVal: 0x%0x, Timeout: %u \r\n",
		(u32)PerfTime.TPerfMs, (u32)PerfTime.TPerfMsFrac,
		Addr, Mask, ExpectedValue, TimeOutInUs);
#endif
	if ((Cmd->Len == XPLMI_MASKPOLL_LEN_EXT) && (Status != XST_SUCCESS)) {
		Flags = Cmd->Payload[4U] & XPLMI_MASKPOLL_FLAGS_MASK;
		if (Flags == XPLMI_MASKPOLL_FLAGS_SUCCESS) {
			Status = XST_SUCCESS;
		} else if (Flags == XPLMI_MASKPOLL_FLAGS_DEFERRED_ERR) {
			Status = XST_SUCCESS;
			Cmd->DeferredError = (u8)TRUE;
		} else {
		}
	}
	return Status;
}
static int XPlmi_MaskPoll ( XPlmi_Cmd * Cmd ) { int Status = XST_FAILURE ; u32 Addr = Cmd -> Payload [ 0U ] ; u32 Mask = Cmd -> Payload [ 1U ] ; u32 ExpectedValue = Cmd -> Payload [ 2U ] ; u32 TimeOutInUs = Cmd -> Payload [ 3U ] ; u32 Flags = 0U ; #ifdef PLM_PRINT_PERF_POLL u64 PollTime = XPlmi_GetTimerValue ( ) ; XPlmi_PerfTime PerfTime = { 0U } ; #endif if ( TimeOutInUs < XPLMI_MASK_POLL_MIN_TIMEOUT ) { TimeOutInUs = XPLMI_MASK_POLL_MIN_TIMEOUT ; } Status = XPlmi_UtilPoll ( Addr , Mask , ExpectedValue , TimeOutInUs ) ; if ( Status != XST_SUCCESS ) { XPlmi_Printf ( DEBUG_GENERAL , " " " \r \n " , __func__ , Addr , Mask , ExpectedValue , TimeOutInUs ) ; } else { XPlmi_Printf ( DEBUG_INFO , " " " \r \n " , __func__ , Addr , Mask , ExpectedValue , TimeOutInUs ) ; } #ifdef PLM_PRINT_PERF_POLL XPlmi_MeasurePerfTime ( PollTime , & PerfTime ) ; XPlmi_Printf ( DEBUG_PRINT_PERF , " " " \r \n " , ( u32 ) PerfTime . TPerfMs , ( u32 ) PerfTime . TPerfMsFrac , Addr , Mask , ExpectedValue , TimeOutInUs ) ; #endif if ( ( Cmd -> Len == XPLMI_MASKPOLL_LEN_EXT ) && ( Status != XST_SUCCESS ) ) { Flags = Cmd -> Payload [ 4U ] & XPLMI_MASKPOLL_FLAGS_MASK ; if ( Flags == XPLMI_MASKPOLL_FLAGS_SUCCESS ) { Status = XST_SUCCESS ; } else if ( Flags == XPLMI_MASKPOLL_FLAGS_DEFERRED_ERR ) { Status = XST_SUCCESS ; Cmd -> DeferredError = ( u8 ) TRUE ; } else { } } return Status ; }
@brief       This function provides 32 bit mask poll command execution.
@brief This function provides 32 bit mask poll command execution .
/* If command length is 5, flags are included */ /* Ignore the error */ /* Defer the error till the end of CDO processing */ /* Return mask_poll status */