lib/sw_services/xilplmi/src/xplmi_generic.c
int XPlmi_ExecuteProc(u32 ProcId)
{
	int Status = XST_FAILURE;
	XPlmiCdo ProcCdo;
	XPlmi_ProcList *ProcList = NULL;
	u8 ProcIndex = 0U;
	XPlmi_Printf(DEBUG_GENERAL, "Proc ID received: 0x%x\r\n", ProcId);

	/* If LPD is not initialized, do not execute the proc */
	if ((LpdInitialized & LPD_INITIALIZED) != LPD_INITIALIZED) {
		XPlmi_Printf(DEBUG_GENERAL, "LPD is not initialized, "
				"Proc commands cannot be executed\r\n");
		Status = (int)XPLMI_ERR_PROC_LPD_NOT_INITIALIZED;
		goto END;
	}
	ProcList = XPlmi_GetProcList();
	ProcList->ProcData[ProcList->ProcCount].Id = ProcId;
	while (ProcList->ProcData[ProcIndex].Id != ProcId) {
		ProcIndex++;
	}
	/* Execute proc if the received ProcId is valid */
	if (ProcIndex < ProcList->ProcCount) {
		/* Pass the Proc CDO to CDO parser */
		Status = XPlmi_MemSetBytes((const void *)&ProcCdo,
			sizeof(ProcCdo), 0U, sizeof(ProcCdo));
		if (Status != XST_SUCCESS) {
			goto END;
		}
		/* Fill ProcCdo structure with Proc related parameters */
		ProcCdo.BufPtr = (u32 *)(UINTPTR)ProcList->ProcData[ProcIndex].Addr;
		ProcCdo.BufLen = (ProcList->ProcData[ProcIndex + 1U].Addr -
			ProcList->ProcData[ProcIndex].Addr) / XPLMI_WORD_LEN;
		ProcCdo.CdoLen = ProcCdo.BufLen;
		/* Execute Proc */
		Status = XPlmi_ProcessCdo(&ProcCdo);
	} else {
		/* Return an error if the received ProcId is not valid */
		Status = (int)XPLMI_PROCID_NOT_VALID;
		XPlmi_Printf(DEBUG_GENERAL, "Invalid proc ID received\r\n");
	}

END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function provides functionality to execute given ProcId when
 *          request to execute a particular ProcId.
 *
 * @param	ProcId is ProcId to be executed
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function provides functionality to execute given ProcId when
request to execute a particular ProcId.

@param       ProcId is ProcId to be executed

@return      XST_SUCCESS on success and error code on failure
@brief This function provides functionality to execute given ProcId when request to execute a particular ProcId . @param ProcId is ProcId to be executed @return XST_SUCCESS on success and error code on failure
int XPlmi_ExecuteProc(u32 ProcId)
{
	int Status = XST_FAILURE;
	XPlmiCdo ProcCdo;
	XPlmi_ProcList *ProcList = NULL;
	u8 ProcIndex = 0U;
	XPlmi_Printf(DEBUG_GENERAL, "Proc ID received: 0x%x\r\n", ProcId);
	if ((LpdInitialized & LPD_INITIALIZED) != LPD_INITIALIZED) {
		XPlmi_Printf(DEBUG_GENERAL, "LPD is not initialized, "
				"Proc commands cannot be executed\r\n");
		Status = (int)XPLMI_ERR_PROC_LPD_NOT_INITIALIZED;
		goto END;
	}
	ProcList = XPlmi_GetProcList();
	ProcList->ProcData[ProcList->ProcCount].Id = ProcId;
	while (ProcList->ProcData[ProcIndex].Id != ProcId) {
		ProcIndex++;
	}
	if (ProcIndex < ProcList->ProcCount) {
		Status = XPlmi_MemSetBytes((const void *)&ProcCdo,
			sizeof(ProcCdo), 0U, sizeof(ProcCdo));
		if (Status != XST_SUCCESS) {
			goto END;
		}
		ProcCdo.BufPtr = (u32 *)(UINTPTR)ProcList->ProcData[ProcIndex].Addr;
		ProcCdo.BufLen = (ProcList->ProcData[ProcIndex + 1U].Addr -
			ProcList->ProcData[ProcIndex].Addr) / XPLMI_WORD_LEN;
		ProcCdo.CdoLen = ProcCdo.BufLen;
		Status = XPlmi_ProcessCdo(&ProcCdo);
	} else {
		Status = (int)XPLMI_PROCID_NOT_VALID;
		XPlmi_Printf(DEBUG_GENERAL, "Invalid proc ID received\r\n");
	}
END:
	return Status;
}
int XPlmi_ExecuteProc ( u32 ProcId ) { int Status = XST_FAILURE ; XPlmiCdo ProcCdo ; XPlmi_ProcList * ProcList = NULL ; u8 ProcIndex = 0U ; XPlmi_Printf ( DEBUG_GENERAL , " \r \n " , ProcId ) ; if ( ( LpdInitialized & LPD_INITIALIZED ) != LPD_INITIALIZED ) { XPlmi_Printf ( DEBUG_GENERAL , " " " \r \n " ) ; Status = ( int ) XPLMI_ERR_PROC_LPD_NOT_INITIALIZED ; goto END ; } ProcList = XPlmi_GetProcList ( ) ; ProcList -> ProcData [ ProcList -> ProcCount ] . Id = ProcId ; while ( ProcList -> ProcData [ ProcIndex ] . Id != ProcId ) { ProcIndex ++ ; } if ( ProcIndex < ProcList -> ProcCount ) { Status = XPlmi_MemSetBytes ( ( const void * ) & ProcCdo , sizeof ( ProcCdo ) , 0U , sizeof ( ProcCdo ) ) ; if ( Status != XST_SUCCESS ) { goto END ; } ProcCdo . BufPtr = ( u32 * ) ( UINTPTR ) ProcList -> ProcData [ ProcIndex ] . Addr ; ProcCdo . BufLen = ( ProcList -> ProcData [ ProcIndex + 1U ] . Addr - ProcList -> ProcData [ ProcIndex ] . Addr ) / XPLMI_WORD_LEN ; ProcCdo . CdoLen = ProcCdo . BufLen ; Status = XPlmi_ProcessCdo ( & ProcCdo ) ; } else { Status = ( int ) XPLMI_PROCID_NOT_VALID ; XPlmi_Printf ( DEBUG_GENERAL , " \r \n " ) ; } END : return Status ; }
@brief       This function provides functionality to execute given ProcId when
          request to execute a particular ProcId.
@brief This function provides functionality to execute given ProcId when request to execute a particular ProcId .
/* If LPD is not initialized, do not execute the proc */ /* Execute proc if the received ProcId is valid */ /* Pass the Proc CDO to CDO parser */ /* Fill ProcCdo structure with Proc related parameters */ /* Execute Proc */ /* Return an error if the received ProcId is not valid */