mbox
Vitis Drivers API Documentation
|
This file contains a design example for using the Mailbox hardware and driver XMbox.
This example attempts to send a known message through the mailbox from the processor identified as 0 (XPAR_CPU_ID=0) to the other processor. The message is received by the receiver and the test passes. Since the application is running on two seperate processors, the initiator declares success when the message is sent and the receiver declares success when the message is received. There is no feedback to the initiator so a terminal is required for each processor to verify that the test passed for both sides.
The example assumes there are two processors availabile in the system that are expected to inter-communicate.
This example has been tested on ML505 Hardware Evaluation board.
These code fragments will illustrate how the XMbox component can be used to:
MODIFICATION HISTORY:
Ver Who Date Changes
2.00a hm Example that sends and receives and uses interrupts 3.01a sdm 05/06/10 Cleanup for coding guidelines, removed printfs from all the functions except the main function 4.1 ms 01/23/17 Modified xil_printf statement in main function to ensure that "Successfully ran" and "Failed" strings are available in all examples. This is a fix for CR-965028. ms 04/05/17 Added tabspace for return statements in functions for proper documentation while generating doxygen and modified filename tag to include the file in doxygen examples. 4.6 ht 07/07/23 Added support for system device-tree flow. *
Functions | |
int | MailboxExample (XIntc *IntcInstancePtr, u16 MboxDeviceId, u16 MboxIntrId) |
This function sends a message to and receives a message from the other processor. More... | |
int | MailboxExample_Send (XMbox *MboxInstancePtr, int CPU_Id, int Blocking) |
This function sends the hello message to the other processor. More... | |
int | MailboxExample_Receive (XMbox *MboxInstancePtr, int CPU_Id, int Blocking) |
This function receives a message from the other processor verifies it's the expected message. More... | |
int | MailboxExample_Wait (volatile int *Count, char *Name, int Threshold) |
This function waits for a particular variable to exceed the threshold value. More... | |
int | main (void) |
This function is the main function for the mailbox interrupt example. More... | |
int MailboxExample | ( | XIntc * | IntcInstancePtr, |
u16 | MboxDeviceId, | ||
u16 | MboxIntrId | ||
) |
This function sends a message to and receives a message from the other processor.
It also uses the interrupt to check whether the other processor has started to send or receive.
IntcInstancePtr | is the device instance of the interrupt controller that is being worked on. |
MboxDeviceId | is the Mailbox device ID. |
MboxIntrId | is the Mailbox interrupt ID. |
References XMbox_Config::BaseAddress, XMbox::Config, MailboxExample_Receive(), MailboxExample_Send(), MailboxExample_Wait(), XMbox_Config::UseFSL, and XMbox_CfgInitialize().
Referenced by main().
int MailboxExample_Receive | ( | XMbox * | MboxInstancePtr, |
int | CPU_Id, | ||
int | Blocking | ||
) |
This function receives a message from the other processor verifies it's the expected message.
MboxInstancePtr | is the instance pointer for the XMbox. |
CPU_Id | is the CPU ID for the program that is running on. |
References XMbox_Read(), and XMbox_ReadBlocking().
Referenced by MailboxExample().
int MailboxExample_Send | ( | XMbox * | MboxInstancePtr, |
int | CPU_Id, | ||
int | Blocking | ||
) |
This function sends the hello message to the other processor.
MboxInstancePtr | is the instance pointer for the XMbox. |
CPU_Id | is the CPU ID for the program that is running on. |
Blocking | is set to 1 for the send to block till the data is sent. |
References XMbox_Write(), and XMbox_WriteBlocking().
Referenced by MailboxExample().
int MailboxExample_Wait | ( | volatile int * | Count, |
char * | Name, | ||
int | Threshold | ||
) |
This function waits for a particular variable to exceed the threshold value.
If it waits too long, it will time out and returns XST_FAILURE.
Count | is the pointer to the variable to be examined. |
Name | is the name of the variable. |
Threshold | is the threshold value to be exceeded. |
Referenced by MailboxExample().
int main | ( | void | ) |
This function is the main function for the mailbox interrupt example.
None |
References MailboxExample().