PDK API Guide for AM64x
mailbox.h File Reference

Introduction

Mailbox driver interface.

Go to the source code of this file.

Data Structures

struct  Mailbox_Config
 Mailbox Configuration Parameters. More...
 
struct  Mailbox_Stats
 Mailbox Statistics. More...
 
struct  Mailbox_initParams
 Mailbox initialization parameters. More...
 
struct  Mailbox_openParams
 Mailbox Open parameters. More...
 

Macros

#define MAILBOX_ERRNO_BASE   (-2100)
 Mailbox driver error base. More...
 
#define MAILBOX_SOK   (0)
 Error Code: Invalid argument. More...
 
#define MAILBOX_EINVAL   (MAILBOX_ERRNO_BASE-1)
 Error Code: Invalid argument. More...
 
#define MAILBOX_EINUSE   (MAILBOX_ERRNO_BASE-2)
 Error Code: Operation cannot be implemented because a previous operation is still not complete. More...
 
#define MAILBOX_ENOMEM   (MAILBOX_ERRNO_BASE-3)
 Error Code: Out of memory. More...
 
#define MAILBOX_EINVALCFG   (MAILBOX_ERRNO_BASE-4)
 Error Code: Invalid configuration. More...
 
#define MAILBOX_ETXFULL   (MAILBOX_ERRNO_BASE-5)
 Error Code: TX mailbox full. Application tried to send a message before ACK of the previously TX message was received. More...
 
#define MAILBOX_ETXACKTIMEDOUT   (MAILBOX_ERRNO_BASE-6)
 Error Code: Write Acknowledge timed out. Driver was pending on semaphore waiting for an acknowledge and the semaphore timed out. More...
 
#define MAILBOX_EREADTIMEDOUT   (MAILBOX_ERRNO_BASE-7)
 Error Code: Blocking read timed out. More...
 
#define MAILBOX_EINITIALIZED   (MAILBOX_ERRNO_BASE-8)
 Error Code: Mailbox driver already initialized. More...
 
#define MAILBOX_EOSAL   (MAILBOX_ERRNO_BASE-9)
 Error Code: Osal call failed. More...
 
#define MAILBOX_EBADCHTYPE   (MAILBOX_ERRNO_BASE-10)
 Error Code: Invalid channel type. Indicates that the channel type is invalid, OR Indicates that a mailbox instance is tried to be opened with a channel type different than other instances (for the same endpoint). More...
 
#define MAILBOX_EBADCHID   (MAILBOX_ERRNO_BASE-11)
 Error Code: Invalid channel type. Indicates that the channel ID is invalid, OR Indicates that a channel ID is already in use. More...
 
#define MAILBOX_ECHINUSE   (MAILBOX_ERRNO_BASE-12)
 Error Code: Mailbox channel in use by another instance. More...
 
#define MAILBOX_ETIMEOUT   (MAILBOX_ERRNO_BASE-13)
 Error Code: Generic timeout from Driver pending on a semaphore. More...
 
#define MAILBOX_NUM_ENDPOINT_TYPES   ((uint8_t)3)
 Number of possible endpoint types. More...
 
#define MAILBOX_DATA_BUFFER_SIZE   ((uint32_t)2044U)
 Mailbox buffer size (in bytes) for data transfer (per direction). More...
 
#define MAILBOX_WAIT_FOREVER   (~((uint32_t) 0U))
 Wait forever define. More...
 
#define MAILBOX_OSAL_DEFAULT_PRIORITY   (~((uint32_t) 0U))
 Macro used to request default priority for osal interrupt registration. More...
 

Typedefs

typedef void * Mbox_Handle
 A handle that is returned from a Mailbox_open() call. More...
 
typedef void(* Mailbox_Callback) (Mbox_Handle handle, Mailbox_Instance remoteEndpoint)
 The definition of a callback function used by the MAILBOX driver when used in MAILBOX_MODE_CALLBACK. The callback can occur in task or HWI context. More...
 
typedef uint64_t(* Mailbox_VirtToPhyFxn) (const void *virtAddr)
 
typedef void *(* Mailbox_PhyToVirtFxn) (uint64_t phyAddr)
 MAILBOX Physical to Virtual address translation callback function. More...
 

Enumerations

enum  Mailbox_Mode { MAILBOX_MODE_BLOCKING, MAILBOX_MODE_POLLING, MAILBOX_MODE_CALLBACK, MAILBOX_MODE_FAST }
 Mailbox mode settings. More...
 
enum  Mailbox_OpMode { MAILBOX_OPERATION_MODE_PARTIAL_READ_ALLOWED }
 Mailbox operation mode settings. More...
 
enum  Mailbox_DataTransferMode { MAILBOX_DATA_TRANSFER_MEMCPY, MAILBOX_DATA_TRANSFER_DMA }
 Mailbox data transfer mode. More...
 
enum  Mailbox_ChType { MAILBOX_CHTYPE_SINGLE = 0, MAILBOX_CHTYPE_MULTI = 1, MAILBOX_CHTYPE_MAX = MAILBOX_CHTYPE_MULTI }
 Mailbox channel type. More...
 
enum  Mailbox_ChID {
  MAILBOX_CH_ID_0 = 0, MAILBOX_CH_ID_1 = 1, MAILBOX_CH_ID_2 = 2, MAILBOX_CH_ID_3 = 3,
  MAILBOX_CH_ID_4 = 4, MAILBOX_CH_ID_5 = 5, MAILBOX_CH_ID_6 = 6, MAILBOX_CH_ID_7 = 7,
  MAILBOX_CH_ID_MAX = MAILBOX_CH_ID_7
}
 Mailbox channel ID. More...
 

Functions

static int32_t Mailbox_initParams_init (Mailbox_initParams *initParam)
 init structure initialization function. More...
 
static int32_t Mailbox_openParams_init (Mailbox_openParams *openParam)
 open structure initialization function. More...
 
int32_t Mailbox_init (Mailbox_initParams *initParam)
 Function to initialize the Mailbox module.
It must be called only once per local endpoint. More...
 
int32_t Mailbox_deinit (void)
 Function to deinitialize the Mailbox module.
. More...
 
Mbox_Handle Mailbox_open (Mailbox_openParams *openParam, int32_t *errCode)
 Function to initialize an instance of the mailbox driver. More...
 
int32_t Mailbox_enableInterrupts (Mbox_Handle handle)
 Function to enable the mailbox interrupts for a mailbox instance if enableInterrupts was set to false in the Mailbox_open params. This is useful for the situation where the application wishes to delay enabling of interrupts until it has been able to do further setup. This functionality is not supported on TPR12. More...
 
int32_t Mailbox_disableInterrupts (Mbox_Handle handle)
 Function to disable the mailbox interrupts for a mailbox instance. This functionality is not supported on TPR12. More...
 
int32_t Mailbox_write (Mbox_Handle handle, const uint8_t *buffer, uint32_t size)
 Function that writes data to a Mailbox. More...
 
int32_t Mailbox_read (Mbox_Handle handle, uint8_t *buffer, uint32_t size)
 Function that reads data from a Mailbox. More...
 
int32_t Mailbox_readFlush (Mbox_Handle handle)
 Function that should be called after application is done reading the message. More...
 
uint32_t Mailbox_GetMessageCount (Mbox_Handle handle)
 Function that retrieves the number of messages available to be read. More...
 
int32_t Mailbox_getStats (Mbox_Handle handle, Mailbox_Stats *stats)
 Function that collects mailbox driver statistics. More...
 
int32_t Mailbox_close (Mbox_Handle handle)
 Function to close a Mailbox peripheral specified by the Mailbox handle. More...
 
uint64_t Mailbox_defaultVirtToPhyFxn (const void *virtAddr)
 Default virtual to physical translation function. More...
 
void * Mailbox_defaultPhyToVirtFxn (uint64_t phyAddr)
 Default physical to virtual translation function. More...
 

Macro Definition Documentation

◆ MAILBOX_NUM_ENDPOINT_TYPES

#define MAILBOX_NUM_ENDPOINT_TYPES   ((uint8_t)3)

Number of possible endpoint types.

◆ MAILBOX_DATA_BUFFER_SIZE

#define MAILBOX_DATA_BUFFER_SIZE   ((uint32_t)2044U)

Mailbox buffer size (in bytes) for data transfer (per direction).

◆ MAILBOX_WAIT_FOREVER

#define MAILBOX_WAIT_FOREVER   (~((uint32_t) 0U))

Wait forever define.

◆ MAILBOX_OSAL_DEFAULT_PRIORITY

#define MAILBOX_OSAL_DEFAULT_PRIORITY   (~((uint32_t) 0U))

Macro used to request default priority for osal interrupt registration.

Function Documentation

◆ Mailbox_defaultVirtToPhyFxn()

uint64_t Mailbox_defaultVirtToPhyFxn ( const void *  virtAddr)

Default virtual to physical translation function.

Parameters
virtAddr[IN] Virtual address
Returns
Corresponding physical address

◆ Mailbox_defaultPhyToVirtFxn()

void* Mailbox_defaultPhyToVirtFxn ( uint64_t  phyAddr)

Default physical to virtual translation function.

Parameters
phyAddr[IN] Physical address
Returns
Corresponding virtual address