mbox
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Macros Groups Pages
xmbox_example.c File Reference

Overview

This file contains a design example for using the Mailbox hardware and driver XMbox.

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.

Note

These code fragments will illustrate how the XMbox component can be used to:

  • Initialize the Mailbox core
  • Pass data between two processes
  MODIFICATION HISTORY:
  Ver   Who  Date     Changes


1.00a va First release 1.00a ecm 06/09/07 Cleanup, new coding standard, check into XCS 3.01a sdm 05/06/10 Cleanup for coding guidelines 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/10/17 Modified filename tag to include the file in doxygen examples. 4.6 ht 07/07/23 Added support for system device-tree flow. 4.9 ht 04/17/25 Update Canonical definition to be inline with xsct flow. 4.10 ht 02/17/26 Fix GCC warnings for unused parameter. *

#include "xmbox.h"
#include "xstatus.h"
#include "xparameters.h"

Macros

#define MSGSIZ   1024
 Size of the actual Message. More...
 
#define HELLO_SIZE   40
 Size of the Hello Message. More...
 
#define MY_CPU_ID   XPAR_CPU_ID
 CPU ID definition for multi-processor systems. More...
 
#define printf   xil_printf
 A smaller footprint printf. More...
 

Functions

int ProdCon ()
 This function performs the producer and consumer console functionality. More...
 
int main (void)
 This function is the main function for the mailbox example. More...
 

Macro Definition Documentation

#define HELLO_SIZE   40

Size of the Hello Message.

Referenced by ProdCon().

#define MSGSIZ   1024

Size of the actual Message.

Referenced by ProdCon().

#define MY_CPU_ID   XPAR_CPU_ID

CPU ID definition for multi-processor systems.

Referenced by MailboxExample(), main(), and ProdCon().

#define printf   xil_printf

A smaller footprint printf.

Referenced by main(), and ProdCon().

Function Documentation

int main ( void  )

This function is the main function for the mailbox example.

Returns
XST_SUCCESS if successful, XST_FAILURE if unsuccessful.
Note
None.

References printf, and ProdCon().

int ProdCon ( )

This function performs the producer and consumer console functionality.

At compile time the role, producer or consumer, is determined.

Returns
XST_SUCCESS.
Note
None.

References XMbox_Config::BaseAddress, HELLO_SIZE, MSGSIZ, MY_CPU_ID, printf, XMbox_CfgInitialize(), XMbox_LookupConfig(), XMbox_ReadBlocking(), and XMbox_WriteBlocking().

Referenced by main().