xilmailbox
Vitis Drivers API Documentation
Overview

Data Structures

struct  XMailbox_Agent
 Data structure used to refer Xilmailbox agents. More...
 
struct  XMboxTag
 Data structure used to refer XilMailbox. More...
 

Macros

#define BIT(x)   (1 << (x))
 Bit position. More...
 
#define XIPI_DONE_TIMEOUT_VAL   2000000
 Timeout for IPI. More...
 
#define XIPI_IPI_DONE_BIT_SLEEP_IN_US   (1U)
 Sleep for 1Us. More...
 
#define XMAILBOX_IPI0   BIT(0)
 IPI0 channel. More...
 
#define XMAILBOX_IPI1   BIT(8)
 IPI1 channel. More...
 
#define XMAILBOX_IPI2   BIT(9)
 IPI2 channel. More...
 
#define XMAILBOX_IPI3   BIT(16)
 IPI3 channel. More...
 
#define XMAILBOX_IPI4   BIT(17)
 IPI4 channel. More...
 
#define XMAILBOX_IPI5   BIT(18)
 IPI5 channel. More...
 
#define XMAILBOX_IPI6   BIT(19)
 IPI6 channel. More...
 
#define XMAILBOX_IPI7   BIT(24)
 IPI7 channel. More...
 
#define XMAILBOX_IPI8   BIT(25)
 IPI8 channel. More...
 
#define XMAILBOX_IPI9   BIT(26)
 IPI9 channel. More...
 
#define XMAILBOX_IPI10   BIT(27)
 IPI10 channel. More...
 
#define XMAILBOX_MAX_CHANNELS   11U
 Maximum channel. More...
 
#define XMAILBOX_INTR_ID   22U
 Interrupt id. More...
 
#define IPI_BASEADDRESS   0xFF380000U
 Base Address. More...
 
#define IPI_ADDRDECODE_ERROR   BIT(0)
 Address decode error. More...
 
#define XILMBOX_MSG_TYPE_REQ   (0x00000001U)
 Message type buffer. More...
 
#define XILMBOX_MSG_TYPE_RESP   (0x00000002U)
 Response type buffer. More...
 
#define XMAILBOX_MAX_MSG_LEN   XIPIPSU_MAX_MSG_LEN
 Maximum number of Messages (each 4-bytes long) More...
 
#define XMAILBOX_PAYLOAD_LEN_1U   (1U)
 Payload lengths. More...
 
#define XMAILBOX_PAYLOAD_LEN_2U   (2U)
 Payload length of size 2byte. More...
 
#define XMAILBOX_PAYLOAD_LEN_3U   (3U)
 Payload length of size 3byte. More...
 
#define XMAILBOX_PAYLOAD_LEN_4U   (4U)
 Payload length of size 4byte. More...
 
#define XMAILBOX_PAYLOAD_LEN_5U   (5U)
 Payload length of size 5byte. More...
 
#define XMAILBOX_PAYLOAD_LEN_6U   (6U)
 Payload length of size 6byte. More...
 
#define XMAILBOX_PAYLOAD_LEN_7U   (7U)
 Payload length of size 7byte. More...
 

Typedefs

typedef void(* XMailbox_RecvHandler )(void *CallBackRefPtr)
 Receive handler. More...
 
typedef void(* XMailbox_ErrorHandler )(void *CallBackRefPtr, u32 ErrorMask)
 Error handler. More...
 
typedef struct XMboxTag XMailbox
 Data structure used to refer XilMailbox. More...
 

Enumerations

enum  XMailbox_IpiSharedMemState { XMAILBOX_SHARED_MEM_UNINITIALIZED = 0, XMAILBOX_SHARED_MEM_INITIALIZED }
 This typedef contains XMAILBOX shared memory state. More...
 
enum  XMailbox_Handler { XMAILBOX_RECV_HANDLER, XMAILBOX_ERROR_HANDLER }
 This typedef contains XMAILBOX Handler Types. More...
 

Functions

u32 XIpiPs_Init (XMailbox *InstancePtr, u8 DeviceId)
 Initialize the ZynqMP Mailbox Instance. More...
 
u32 XIpiPs_Send (XMailbox *InstancePtr, u8 Is_Blocking)
 This function triggers an IPI to a destnation CPU. More...
 
u32 XIpiPs_SendData (XMailbox *InstancePtr, void *MsgBufferPtr, u32 MsgLen, u8 BufferType, u8 Is_Blocking)
 This function sends an IPI message to a destnation CPU. More...
 
u32 XIpiPs_RecvData (XMailbox *InstancePtr, void *MsgBufferPtr, u32 MsgLen, u8 BufferType)
 This function reads an IPI message. More...
 
void XIpiPs_IntrHandler (void *XMailboxPtr)
 This function implements the interrupt handler. More...
 
void XIpiPs_ErrorIntrHandler (void *XMailboxPtr)
 This function implements the interrupt handler for errors. More...
 
u32 XIpiPs_PollforDone (XMailbox *InstancePtr)
 Poll for an acknowledgement using Observation Register. More...
 
XStatus XIpiPs_RegisterIrq (XScuGic *IntcInstancePtr, XMailbox *InstancePtr, u32 IpiIntrId)
 This function registers an irq. More...
 

Variables

XIpiPsu XMailbox_Agent::IpiInst
 Ipi instance. More...
 
XScuGic XMailbox_Agent::GicInst
 Interrupt instance. More...
 
u32 XMailbox_Agent::SourceId
 Source id. More...
 
u32 XMailbox_Agent::RemoteId
 Remote id. More...
 
u64 XMailbox_IpiSharedMem::Address
 Address of the shared memory location. More...
 
u32 XMailbox_IpiSharedMem::Size
 Size of the shared memory location. More...
 
XMailbox_IpiSharedMemState XMailbox_IpiSharedMem::SharedMemState
 State of shared memory. More...
 
u32(* XMboxTag::XMbox_IPI_Send )(struct XMboxTag *InstancePtr, u8 Is_Blocking)
 Triggers an IPI to a destination CPU. More...
 
u32(* XMboxTag::XMbox_IPI_SendData )(struct XMboxTag *InstancePtr, void *BufferPtr, u32 MsgLen, u8 BufferType, u8 Is_Blocking)
 Sends an IPI message to a destination CPU. More...
 
u32(* XMboxTag::XMbox_IPI_Recv )(struct XMboxTag *InstancePtr, void *BufferPtr, u32 MsgLen, u8 BufferType)
 Reads an IPI message. More...
 
XMailbox_RecvHandler XMboxTag::RecvHandler
 Receive handler. More...
 
XMailbox_ErrorHandler XMboxTag::ErrorHandler
 Callback for rx IPI event. More...
 
void * XMboxTag::ErrorRefPtr
 To be passed to the error interrupt callback. More...
 
void * XMboxTag::RecvRefPtr
 To be passed to the receive interrupt callback. More...
 
XMailbox_Agent XMboxTag::Agent
 Agent to store IPI channel information. More...
 
XMailbox_IpiSharedMem XMboxTag::SharedMem
 shared memory segment More...
 
u32 XMailbox_Initialize (XMailbox *InstancePtr, u8 DeviceId)
 Initialize the XMailbox Instance. More...
 
u32 XMailbox_Send (XMailbox *InstancePtr, u32 RemoteId, u8 Is_Blocking)
 This function triggers an IPI to a destination CPU. More...
 
u32 XMailbox_SendData (XMailbox *InstancePtr, u32 RemoteId, void *BufferPtr, u32 MsgLen, u8 BufferType, u8 Is_Blocking)
 This function sends an IPI message to a destination CPU. More...
 
u32 XMailbox_Recv (XMailbox *InstancePtr, u32 SourceId, void *BufferPtr, u32 MsgLen, u8 BufferType)
 This function reads an IPI message. More...
 
s32 XMailbox_SetCallBack (XMailbox *InstancePtr, XMailbox_Handler HandlerType, void *CallBackFuncPtr, void *CallBackRefPtr)
 This routine installs an asynchronous callback function for the given HandlerType. More...
 
u32 XMailbox_SetSharedMem (XMailbox *InstancePtr, u64 Address, u32 Size)
 This function sets the shared memory location for IPI usage. More...
 
u32 XMailbox_GetSharedMem (XMailbox *InstancePtr, u64 **Address)
 This function returns the shared memory location for IPI usage. More...
 
int XMailbox_ReleaseSharedMem (XMailbox *InstancePtr)
 This function releases the shared memory. More...
 

Macro Definition Documentation

#define BIT (   x)    (1 << (x))

Bit position.

#define IPI_ADDRDECODE_ERROR   BIT(0)

Address decode error.

#define IPI_BASEADDRESS   0xFF380000U

Base Address.

Referenced by XIpiPs_ErrorIntrHandler().

#define XILMBOX_MSG_TYPE_REQ   (0x00000001U)

Message type buffer.

Referenced by XMailbox_Recv(), and XMailbox_SendData().

#define XILMBOX_MSG_TYPE_RESP   (0x00000002U)

Response type buffer.

Referenced by XMailbox_Recv(), and XMailbox_SendData().

#define XIPI_DONE_TIMEOUT_VAL   2000000

Timeout for IPI.

Referenced by XIpiPs_PollforDone().

#define XIPI_IPI_DONE_BIT_SLEEP_IN_US   (1U)

Sleep for 1Us.

Referenced by XIpiPs_PollforDone().

#define XMAILBOX_INTR_ID   22U

Interrupt id.

Referenced by XIpiPs_RegisterIrq().

#define XMAILBOX_IPI0   BIT(0)

IPI0 channel.

#define XMAILBOX_IPI1   BIT(8)

IPI1 channel.

#define XMAILBOX_IPI10   BIT(27)

IPI10 channel.

#define XMAILBOX_IPI2   BIT(9)

IPI2 channel.

#define XMAILBOX_IPI3   BIT(16)

IPI3 channel.

#define XMAILBOX_IPI4   BIT(17)

IPI4 channel.

#define XMAILBOX_IPI5   BIT(18)

IPI5 channel.

#define XMAILBOX_IPI6   BIT(19)

IPI6 channel.

#define XMAILBOX_IPI7   BIT(24)

IPI7 channel.

#define XMAILBOX_IPI8   BIT(25)

IPI8 channel.

#define XMAILBOX_IPI9   BIT(26)

IPI9 channel.

#define XMAILBOX_MAX_CHANNELS   11U

Maximum channel.

#define XMAILBOX_MAX_MSG_LEN   XIPIPSU_MAX_MSG_LEN

Maximum number of Messages (each 4-bytes long)

Referenced by XMailbox_Recv(), and XMailbox_SendData().

#define XMAILBOX_PAYLOAD_LEN_1U   (1U)

Payload lengths.

Payload length of size 1byte

#define XMAILBOX_PAYLOAD_LEN_2U   (2U)

Payload length of size 2byte.

#define XMAILBOX_PAYLOAD_LEN_3U   (3U)

Payload length of size 3byte.

#define XMAILBOX_PAYLOAD_LEN_4U   (4U)

Payload length of size 4byte.

#define XMAILBOX_PAYLOAD_LEN_5U   (5U)

Payload length of size 5byte.

#define XMAILBOX_PAYLOAD_LEN_6U   (6U)

Payload length of size 6byte.

#define XMAILBOX_PAYLOAD_LEN_7U   (7U)

Payload length of size 7byte.

Typedef Documentation

typedef struct XMboxTag XMailbox

Data structure used to refer XilMailbox.

XilMailbox structure

typedef void(* XMailbox_ErrorHandler)(void *CallBackRefPtr, u32 ErrorMask)

Error handler.

typedef void(* XMailbox_RecvHandler)(void *CallBackRefPtr)

Receive handler.

Enumeration Type Documentation

This typedef contains XMAILBOX Handler Types.

Enumerator
XMAILBOX_RECV_HANDLER 

For Recv Handler.

XMAILBOX_ERROR_HANDLER 

For Error Handler.

This typedef contains XMAILBOX shared memory state.

Enumerator
XMAILBOX_SHARED_MEM_UNINITIALIZED 

Shared memory uninitialized.

XMAILBOX_SHARED_MEM_INITIALIZED 

Shared memory initialized.

Function Documentation

void XIpiPs_ErrorIntrHandler ( void *  XMailboxPtr)

This function implements the interrupt handler for errors.

Parameters
XMailboxPtrPointer to the XMailbox instance
Returns
None

References XMboxTag::ErrorHandler, XMboxTag::ErrorRefPtr, and IPI_BASEADDRESS.

Referenced by XIpiPs_RegisterIrq().

u32 XIpiPs_Init ( XMailbox InstancePtr,
u8  DeviceId 
)

Initialize the ZynqMP Mailbox Instance.

Parameters
InstancePtris a pointer to the instance to be worked on
DeviceIdis the IPI Instance to be worked on
Returns
XST_SUCCESS if initialization was successful XST_FAILURE in case of failure

References XMboxTag::Agent, XMailbox_Agent::GicInst, XMailbox_Agent::IpiInst, and XIpiPs_RegisterIrq().

Referenced by XMailbox_Initialize().

void XIpiPs_IntrHandler ( void *  XMailboxPtr)

This function implements the interrupt handler.

Parameters
XMailboxPtrPointer to the XMailbox instance
Returns
None

References XMboxTag::Agent, XMailbox_Agent::IpiInst, XMboxTag::RecvHandler, and XMboxTag::RecvRefPtr.

Referenced by XIpiPs_RegisterIrq().

u32 XIpiPs_PollforDone ( XMailbox InstancePtr)

Poll for an acknowledgement using Observation Register.

Parameters
InstancePtrPointer to the XMailbox instance
Returns
XST_SUCCESS in case of success XST_FAILURE in case of failure

References XMboxTag::Agent, XMailbox_Agent::IpiInst, XMailbox_Agent::RemoteId, XIPI_DONE_TIMEOUT_VAL, and XIPI_IPI_DONE_BIT_SLEEP_IN_US.

Referenced by XIpiPs_Send(), and XIpiPs_SendData().

u32 XIpiPs_RecvData ( XMailbox InstancePtr,
void *  MsgBufferPtr,
u32  MsgLen,
u8  BufferType 
)

This function reads an IPI message.

Parameters
InstancePtrPointer to the XMailbox instance
MsgBufferPtris the pointer to Buffer to which the read message needs to be stored
MsgLenis the number of messages (each message is 4bytes)
BufferTypeis the type of buffer
Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if unsuccessful

References XMboxTag::Agent, XMailbox_Agent::IpiInst, and XMailbox_Agent::SourceId.

Referenced by XMailbox_Initialize().

XStatus XIpiPs_RegisterIrq ( XScuGic *  IntcInstancePtr,
XMailbox InstancePtr,
u32  IpiIntrId 
)

This function registers an irq.

Parameters
IntcInstancePtrPointer to the scugic instance
InstancePtrPointer to the XMailbox instance
IpiIntrIdis the interrupt id of the IPI
Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if unsuccessful

References XMboxTag::Agent, XMailbox_Agent::IpiInst, XIpiPs_ErrorIntrHandler(), XIpiPs_IntrHandler(), and XMAILBOX_INTR_ID.

Referenced by XIpiPs_Init().

u32 XIpiPs_Send ( XMailbox InstancePtr,
u8  Is_Blocking 
)

This function triggers an IPI to a destnation CPU.

Parameters
InstancePtrPointer to the XMailbox instance.
Is_Blockingif set trigger the notification in blocking mode
Returns
XST_SUCCESS in case of success XST_FAILURE in case of failure

References XMboxTag::Agent, XMailbox_Agent::IpiInst, XMailbox_Agent::RemoteId, and XIpiPs_PollforDone().

Referenced by XMailbox_Initialize().

u32 XIpiPs_SendData ( XMailbox InstancePtr,
void *  MsgBufferPtr,
u32  MsgLen,
u8  BufferType,
u8  Is_Blocking 
)

This function sends an IPI message to a destnation CPU.

Parameters
InstancePtrPointer to the XMailbox instance
MsgBufferPtris the pointer to Buffer which contains the message to be sent
MsgLenis the number of messages (each message is 4bytes)
BufferTypeis the type of buffer
Is_Blockingif set trigger the notification in blocking mode
Returns
XST_SUCCESS in case of success XST_FAILURE in case of failure

References XMboxTag::Agent, XMailbox_Agent::IpiInst, XMailbox_Agent::RemoteId, and XIpiPs_PollforDone().

Referenced by XMailbox_Initialize().

u32 XMailbox_GetSharedMem ( XMailbox InstancePtr,
u64 **  Address 
)

This function returns the shared memory location for IPI usage.

Parameters
InstancePtris a pointer to the XMailbox instance.
AddressPointer to the address of the variable for which memory needs to be assigned
Returns
  • Size Size of the memory allocated for IPI usage

References XMboxTag::SharedMem, and XMAILBOX_SHARED_MEM_INITIALIZED.

u32 XMailbox_Initialize ( XMailbox InstancePtr,
u8  DeviceId 
)

Initialize the XMailbox Instance.

Functions for xilmailbox.c.

Parameters
InstancePtris a pointer to the instance to be worked on
DeviceIdis the IPI Instance to be worked on
Returns
XST_SUCCESS if initialization was successful XST_FAILURE in case of failure

References XIpiPs_Init(), XIpiPs_RecvData(), XIpiPs_Send(), XIpiPs_SendData(), XMboxTag::XMbox_IPI_Recv, XMboxTag::XMbox_IPI_Send, and XMboxTag::XMbox_IPI_SendData.

u32 XMailbox_Recv ( XMailbox InstancePtr,
u32  SourceId,
void *  BufferPtr,
u32  MsgLen,
u8  BufferType 
)

This function reads an IPI message.

Parameters
InstancePtrPointer to the XMailbox instance
SourceIdis the Mask for the CPU which has sent the message
BufferPtris the pointer to Buffer to which the read message needs to be stored
MsgLenis the number of messages (each message is 4bytes)
BufferTypeis the type of buffer (XILMBOX_MSG_TYPE_REQ or XILMBOX_MSG_TYPE_RESP)
Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if unsuccessful

References XMboxTag::Agent, XMailbox_Agent::SourceId, XILMBOX_MSG_TYPE_REQ, XILMBOX_MSG_TYPE_RESP, XMAILBOX_MAX_MSG_LEN, and XMboxTag::XMbox_IPI_Recv.

int XMailbox_ReleaseSharedMem ( XMailbox InstancePtr)

This function releases the shared memory.

Returns
  • XST_SUCCESS - if memory is released
  • XST_FAILURE - if memory is not released

References XMboxTag::SharedMem, and XMAILBOX_SHARED_MEM_UNINITIALIZED.

u32 XMailbox_Send ( XMailbox InstancePtr,
u32  RemoteId,
u8  Is_Blocking 
)

This function triggers an IPI to a destination CPU.

Parameters
InstancePtrPointer to the XMailbox instance
RemoteIdis the Mask of the CPU to which IPI is to be triggered
Is_Blockingif set trigger the notification in blocking mode
Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if unsuccessful

References XMboxTag::Agent, XMailbox_Agent::RemoteId, and XMboxTag::XMbox_IPI_Send.

u32 XMailbox_SendData ( XMailbox InstancePtr,
u32  RemoteId,
void *  BufferPtr,
u32  MsgLen,
u8  BufferType,
u8  Is_Blocking 
)

This function sends an IPI message to a destination CPU.

Parameters
InstancePtrPointer to the XMailbox instance
RemoteIdis the Mask of the CPU to which IPI is to be triggered
BufferPtris the pointer to Buffer which contains the message to be sent
MsgLenis the number of messages (each message is 4bytes)
BufferTypeis the type of buffer (XILMBOX_MSG_TYPE_REQ (OR) XILMBOX_MSG_TYPE_RESP)
Is_Blockingif set trigger the notification in blocking mode
Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if unsuccessful

References XMboxTag::Agent, XMailbox_Agent::RemoteId, XILMBOX_MSG_TYPE_REQ, XILMBOX_MSG_TYPE_RESP, XMAILBOX_MAX_MSG_LEN, and XMboxTag::XMbox_IPI_SendData.

s32 XMailbox_SetCallBack ( XMailbox InstancePtr,
XMailbox_Handler  HandlerType,
void *  CallBackFuncPtr,
void *  CallBackRefPtr 
)

This routine installs an asynchronous callback function for the given HandlerType.

HandlerType              Callback Function Type
-----------------------  --------------------------------------------------
XMAILBOX_RECV_HANDLER      Recv handler
XMAILBOX_ERROR_HANDLER   Error handler
Parameters
InstancePtris a pointer to the XMailbox instance.
HandlerTypespecifies which callback is to be attached.
CallBackFuncPtris the address of the callback function.
CallBackRefPtris a user data item that will be passed to the callback function when it is invoked.
Returns
  • XST_SUCCESS when handler is installed.
  • XST_FAILURE when HandlerType is invalid.
Note
Invoking this function for a handler that already has been installed replaces it with the new handler.

References XMboxTag::ErrorHandler, XMboxTag::ErrorRefPtr, XMboxTag::RecvHandler, XMboxTag::RecvRefPtr, XMAILBOX_ERROR_HANDLER, and XMAILBOX_RECV_HANDLER.

u32 XMailbox_SetSharedMem ( XMailbox InstancePtr,
u64  Address,
u32  Size 
)

This function sets the shared memory location for IPI usage.

Parameters
InstancePtris a pointer to the XMailbox instance.
AddressAddress of shared memory location
SizeSize of the memory location
Returns
  • XST_SUCCESS - if memory is set for IPI usage
  • XST_FAILURE - On failure

References XMboxTag::SharedMem, and XMAILBOX_SHARED_MEM_INITIALIZED.

Variable Documentation

u64 XMailbox_IpiSharedMem::Address

Address of the shared memory location.

XMailbox_ErrorHandler XMboxTag::ErrorHandler

Callback for rx IPI event.

Referenced by XIpiPs_ErrorIntrHandler(), and XMailbox_SetCallBack().

void* XMboxTag::ErrorRefPtr

To be passed to the error interrupt callback.

Referenced by XIpiPs_ErrorIntrHandler(), and XMailbox_SetCallBack().

XScuGic XMailbox_Agent::GicInst

Interrupt instance.

Referenced by XIpiPs_Init().

XMailbox_RecvHandler XMboxTag::RecvHandler

Receive handler.

Referenced by XIpiPs_IntrHandler(), and XMailbox_SetCallBack().

void* XMboxTag::RecvRefPtr

To be passed to the receive interrupt callback.

Referenced by XIpiPs_IntrHandler(), and XMailbox_SetCallBack().

u32 XMailbox_Agent::RemoteId
XMailbox_IpiSharedMem XMboxTag::SharedMem
XMailbox_IpiSharedMemState XMailbox_IpiSharedMem::SharedMemState

State of shared memory.

u32 XMailbox_IpiSharedMem::Size

Size of the shared memory location.

u32 XMailbox_Agent::SourceId

Source id.

Referenced by XIpiPs_RecvData(), and XMailbox_Recv().

u32(* XMboxTag::XMbox_IPI_Recv)(struct XMboxTag *InstancePtr, void *BufferPtr, u32 MsgLen, u8 BufferType)

Reads an IPI message.

Referenced by XMailbox_Initialize(), and XMailbox_Recv().

u32(* XMboxTag::XMbox_IPI_Send)(struct XMboxTag *InstancePtr, u8 Is_Blocking)

Triggers an IPI to a destination CPU.

Referenced by XMailbox_Initialize(), and XMailbox_Send().

u32(* XMboxTag::XMbox_IPI_SendData)(struct XMboxTag *InstancePtr, void *BufferPtr, u32 MsgLen, u8 BufferType, u8 Is_Blocking)

Sends an IPI message to a destination CPU.

Referenced by XMailbox_Initialize(), and XMailbox_SendData().