XilinxProcessorIPLib/drivers/mbox/examples/xmbox_tapp_example.c
static int MailboxExample_Receive(XMbox *MboxInstancePtr, int CPU_Id)
{
	int Status;
	u32 Nbytes;
	u32 BytesRcvd;
	int Timeout;

	Nbytes = 0;
	Timeout = 0;

	while (Nbytes < HELLO_SIZE) {
		/* Read a message from the mbox */
		Status = XMbox_Read(MboxInstancePtr,
					(u32 *)(RecvMsg + Nbytes),
					HELLO_SIZE - Nbytes, &BytesRcvd);

		if (Status == XST_SUCCESS)
			Nbytes += BytesRcvd;

		if (Timeout++ > TIMEOUT_MAX_COUNT)
			return XST_FAILURE;
	}

	/* Compare the recieved the message is the same as we expect */
	if (memcmp(RecvMsg, ProducerHello, HELLO_SIZE)) {
		return XST_FAILURE;
	} else {
		return XST_SUCCESS;
	}
}
/*****************************************************************************/
/**
*
* This function receives a message from the other processor and verifies that
* it's the expected message.
*
* @param	MboxInstancePtr is the instance pointer for the XMbox.
* @param	CPU_Id is the CPU ID for the program that is running on.
*
* @return	- XST_SUCCESS if the receive succeeds.
*		- XST_FAILURE if the receive fails.
*
* @note		None.
*
******************************************************************************/
This function receives a message from the other processor and verifies that
it's the expected message.
This function receives a message from the other processor and verifies that it ' s the expected message .
static int MailboxExample_Receive(XMbox *MboxInstancePtr, int CPU_Id)
{
	int Status;
	u32 Nbytes;
	u32 BytesRcvd;
	int Timeout;
	Nbytes = 0;
	Timeout = 0;
	while (Nbytes < HELLO_SIZE) {
		Status = XMbox_Read(MboxInstancePtr,
					(u32 *)(RecvMsg + Nbytes),
					HELLO_SIZE - Nbytes, &BytesRcvd);
		if (Status == XST_SUCCESS)
			Nbytes += BytesRcvd;
		if (Timeout++ > TIMEOUT_MAX_COUNT)
			return XST_FAILURE;
	}
	if (memcmp(RecvMsg, ProducerHello, HELLO_SIZE)) {
		return XST_FAILURE;
	} else {
		return XST_SUCCESS;
	}
}
static int MailboxExample_Receive ( XMbox * MboxInstancePtr , int CPU_Id ) { int Status ; u32 Nbytes ; u32 BytesRcvd ; int Timeout ; Nbytes = 0 ; Timeout = 0 ; while ( Nbytes < HELLO_SIZE ) { Status = XMbox_Read ( MboxInstancePtr , ( u32 * ) ( RecvMsg + Nbytes ) , HELLO_SIZE - Nbytes , & BytesRcvd ) ; if ( Status == XST_SUCCESS ) Nbytes += BytesRcvd ; if ( Timeout ++ > TIMEOUT_MAX_COUNT ) return XST_FAILURE ; } if ( memcmp ( RecvMsg , ProducerHello , HELLO_SIZE ) ) { return XST_FAILURE ; } else { return XST_SUCCESS ; } }
This function receives a message from the other processor and verifies that
it's the expected message.
This function receives a message from the other processor and verifies that it ' s the expected message .
/* Read a message from the mbox */ /* Compare the recieved the message is the same as we expect */