Files | |
file | ipc.h |
IPC Low Level Driver API/interface data types file. | |
Data Structures | |
struct | Ipc_InitPrms |
IPC initialization parameters. More... | |
struct | RPMessage_Params |
Parameter structure for creating RPMessage endpoints. More... | |
Typedefs | |
typedef struct RPMessage_Object_s * | RPMessage_Handle |
RPMessage_Handle type. More... | |
typedef void(* | RPMessage_Callback) (RPMessage_Handle handle, void *arg, void *data, uint16_t len, uint32_t src) |
RPMessage_Callback. More... | |
Functions | |
void | IpcInitPrms_init (uint32_t instId, Ipc_InitPrms *initPrms) |
Initialize IPC init params. More... | |
int32_t | Ipc_init (const Ipc_InitPrms *cfg) |
Initialize IPC module. More... | |
int32_t | Ipc_deinit (void) |
De Initialize IPC module. More... | |
uint32_t | RPMessage_getMessageBufferSize (void) |
Returns Message Buffer Size. More... | |
uint32_t | RPMessage_getObjMemRequired (void) |
Returns local memory for RPMessage Object. More... | |
int32_t | RPMessage_init (RPMessage_Params *params) |
Initialize RPMessage Module. More... | |
void | RPMessage_deInit (void) |
Tear down the RPMessage Module. The module API should not be used after this is called. More... | |
int32_t | RPMessageParams_init (RPMessage_Params *params) |
Initialize an RPMessage_Params structure to default values. More... | |
RPMessage_Handle | RPMessage_create (RPMessage_Params *params, uint32_t *endPt) |
Create a endpoint instance for receiving. More... | |
int32_t | RPMessage_setCallback (RPMessage_Handle handle, RPMessage_Callback cb, void *arg) |
Sets callback. More... | |
int32_t | RPMessage_recv (RPMessage_Handle handle, void *data, uint16_t *len, uint32_t *rplyEndPt, uint32_t *fromProcId, uint32_t timeout) |
Receives a message from an endpoint instance. More... | |
int32_t | RPMessage_recvNb (RPMessage_Handle handle, void *data, uint16_t *len, uint32_t *rplyEndPt, uint32_t *fromProcId) |
A non blocking API to receive message. More... | |
int32_t | RPMessage_send (RPMessage_Handle handle, uint32_t dstProc, uint32_t dstEndPt, uint32_t srcEndPt, void *data, uint16_t len) |
Sends data to a remote processor. More... | |
int32_t | RPMessage_delete (RPMessage_Handle *handlePtr) |
Delete an endpoint instance. More... | |
void | RPMessage_unblock (RPMessage_Handle handle) |
Unblocks an RPMessage_recv() More... | |
int32_t | RPMessage_getRemoteEndPt (uint32_t currProcId, const char *name, uint32_t *remoteProcId, uint32_t *remoteEndPt, uint32_t timeout) |
Wait for an endpoint to become available on another processor. More... | |
int32_t | RPMessage_getRemoteEndPtToken (uint32_t currProcId, const char *name, uint32_t *remoteProcId, uint32_t *remoteEndPt, uint32_t timeout, uint32_t token) |
void | RPMessage_unblockGetRemoteEndPt (uint32_t token) |
Unblocks an RPMessage_getRemoteEndPtToken() call. More... | |
int32_t | RPMessage_announce (uint32_t remoteProcId, uint32_t endPt, const char *name) |
Annouce the name of an endpoint and that it is ready to to receive messages. More... | |
void | Ipc_mailboxEnableNewMsgInt (uint16_t selfId, uint16_t remoteProcId) |
API Mailbox Enable new MSG interrupt for a given remote processor. More... | |
void | Ipc_mailboxDisableNewMsgInt (uint16_t selfId, uint16_t remoteProcId) |
API Mailbox Disable new MSG interrupt for a given remote processor. More... | |
Variables | |
uint32_t | Ipc_InitPrms::instId |
Ipc_PhyToVirtFxn | Ipc_InitPrms::phyToVirtFxn |
Ipc_VirtToPhyFxn | Ipc_InitPrms::virtToPhyFxn |
Ipc_OsalPrms | Ipc_InitPrms::osalPrms |
Ipc_NewMsgReceivedFxn | Ipc_InitPrms::newMsgFxn |
Ipc_PrintFxn | Ipc_InitPrms::printFxn |
uint32_t | RPMessage_Params::requestedEndpt |
uint32_t | RPMessage_Params::numBufs |
void * | RPMessage_Params::buf |
uint32_t | RPMessage_Params::bufSize |
void * | RPMessage_Params::stackBuffer |
uint32_t | RPMessage_Params::stackSize |
This is IPC's top level include for applications
typedef struct RPMessage_Object_s* RPMessage_Handle |
RPMessage_Handle type.
typedef void(* RPMessage_Callback) (RPMessage_Handle handle, void *arg, void *data, uint16_t len, uint32_t src) |
RPMessage_Callback.
RPMessage_Handle | [IN] |
arg | [IN] void* arguments to function |
data | [IN] data pointer |
len | [IN] length of data |
src | [IN] source |
void IpcInitPrms_init | ( | uint32_t | instId, |
Ipc_InitPrms * | initPrms | ||
) |
Initialize IPC init params.
Can be called to initialize the #Ipc_InitPrms to the default values.
instId | [IN] Ipc_InstanceId. Only 1 instance is supported in this implementation. The value shall be 0 |
initPrms | [IN] Pointer to param structure to be initialized. When building for tirtos environment, it will be filled with tirtos-compatible definitions. When using the ipc_baremetal implementation, it will be filled with baremetal definitions. |
int32_t Ipc_init | ( | const Ipc_InitPrms * | cfg | ) |
Initialize IPC module.
Very first API to be invoked to initialize internal data structure and utilities required.
cfg | [IN] Initialization parameters. May be NULL in order to use the module default implementation. May be non-NULL in order to use user-specified implementation. |
int32_t Ipc_deinit | ( | void | ) |
De Initialize IPC module.
Very last API to be invoked to de initialize.
uint32_t RPMessage_getMessageBufferSize | ( | void | ) |
Returns Message Buffer Size.
uint32_t RPMessage_getObjMemRequired | ( | void | ) |
Returns local memory for RPMessage Object.
int32_t RPMessage_init | ( | RPMessage_Params * | params | ) |
Initialize RPMessage Module.
Can be called from Main or Task context. Must be called before calling any other RPMessage function;
params | [IN] Address of the RPMessage_Params structure used to create the RPMessage |
void RPMessage_deInit | ( | void | ) |
Tear down the RPMessage Module. The module API should not be used after this is called.
int32_t RPMessageParams_init | ( | RPMessage_Params * | params | ) |
Initialize an RPMessage_Params structure to default values.
This function must be called before on a RPMessage_Params before passing it to RPMessage_create().
params | [IN] Address of the RPMessage_Params structure to be initialized. |
RPMessage_Handle RPMessage_create | ( | RPMessage_Params * | params, |
uint32_t * | endPt | ||
) |
Create a endpoint instance for receiving.
The returned handle is to an object containing a queue for receiving messages from the transport, and a 32 bit endpoint ID unique to this local processor.
params | [IN] RPMessage_Params Address of an initialized RPMessage_Params structure or NULL will use defaults. |
endPt | [OUT] Endpoint ID for this side of the connection. |
int32_t RPMessage_setCallback | ( | RPMessage_Handle | handle, |
RPMessage_Callback | cb, | ||
void * | arg | ||
) |
Sets callback.
Sets the callback function and function arguments, so that it does not need to wai for semaphore.
handle | [IN] An RPMessage_handle |
cb | [IN] RPMessage_Callback Callback function. |
arg | [IN] Arguments of the callback function |
int32_t RPMessage_recv | ( | RPMessage_Handle | handle, |
void * | data, | ||
uint16_t * | len, | ||
uint32_t * | rplyEndPt, | ||
uint32_t * | fromProcId, | ||
uint32_t | timeout | ||
) |
Receives a message from an endpoint instance.
This function returns a status. It also copies data to the client. If no message is available, it blocks on the semaphore object until the semaphore is signaled or a timeout occurs. The semaphore is signaled, when Message_send is called to deliver a message to this endpoint. If a timeout occurs, len is set to zero and the status is RPMessage_E_TIMEOUT. If a timeout of zero is specified, the function returns immediately and if no message is available, the len is set to zero and the status is RPMessage_E_TIMEOUT. RPMessage_E_UNBLOCKED status is returned, if RPMessage_unblock() is called on the RPMessage handle. When a message is retrieved, the message data is copied into the memory location of the data pointer, and RPMessage_S_SUCCESS status is returned.
handle | [IN] An RPMessage_handle |
data | [OUT] Pointer to the client's data buffer. |
len | [OUT] Amount of data received. |
rplyEndPt | [OUT] Endpoint of source (for replies). |
fromProcId | [OUT] ProcId of source (for replies). |
timeout | [IN] Maximum duration to wait for a message in microseconds. |
RPMessage_send RPMessage_unblock
int32_t RPMessage_recvNb | ( | RPMessage_Handle | handle, |
void * | data, | ||
uint16_t * | len, | ||
uint32_t * | rplyEndPt, | ||
uint32_t * | fromProcId | ||
) |
A non blocking API to receive message.
This function check if there any received messages, if found the received message is copied into buffer provided by the caller. The caller will have to allocate sufficient buffer to account for the reception of the largest message. Configured while creating the driver.
handle | [IN] An RPMessage_handle |
data | [OUT] Pointer to the buffer, allocted by the caller |
len | [OUT] Size of the received buffer, in bytes |
rplyEndPt | [OUT] Endpoint of source (for replies) |
fromProcId | [OUT] ProcId of source (for replies) |
int32_t RPMessage_send | ( | RPMessage_Handle | handle, |
uint32_t | dstProc, | ||
uint32_t | dstEndPt, | ||
uint32_t | srcEndPt, | ||
void * | data, | ||
uint16_t | len | ||
) |
Sends data to a remote processor.
handle | [IN] Handle of RPMessage Object |
dstProc | [IN] Destination ProcId. |
dstEndPt | [IN] Destination Endpoint. |
srcEndPt | [IN] Source Endpoint. |
data | [IN] Data payload to be copied and sent. |
len | [IN] Amount of data to be copied. |
int32_t RPMessage_delete | ( | RPMessage_Handle * | handlePtr | ) |
Delete an endpoint instance.
This function deletes a created endpoint instance. If the message queue is non-empty, any messages remaining in the queue will be lost.
handlePtr | [IN,OUT] Pointer to handle to delete. Set to NULL. |
void RPMessage_unblock | ( | RPMessage_Handle | handle | ) |
Unblocks an RPMessage_recv()
Unblocks a reader thread that is blocked on a RPMessage_recv. The RPMessage_recv call will return with status #IPC_E_UNBLOCKED indicating that it returned due to a RPMessage_unblock rather than by a timeout or receiving a message.
Restrictions:
[in] | handle | RPMessage handle |
int32_t RPMessage_getRemoteEndPt | ( | uint32_t | currProcId, |
const char * | name, | ||
uint32_t * | remoteProcId, | ||
uint32_t * | remoteEndPt, | ||
uint32_t | timeout | ||
) |
Wait for an endpoint to become available on another processor.
Block the current task until the specified processor announces the named endpoint. The name is a string that identifies the service that is offered on the endpoint. This allows an application to both wait for the remote processor to signal that it is ready to communicate and to lookup services by name. The procId can be that of a specific processor or PRMessage_ANY to wait for any processor to announce the named endpoint. Suitable values for timeout are the same as for the ti.sysbios.knl.Semaphore module.
currProcId | [IN] Remote processor ID |
name | [IN] Name of the endpoint |
remoteProcId | [OUT] Remote processor ID |
remoteEndPt | [OUT] Remote endpoint ID |
timeout | [IN] Timeout value (in system ticks) |
int32_t RPMessage_getRemoteEndPtToken | ( | uint32_t | currProcId, |
const char * | name, | ||
uint32_t * | remoteProcId, | ||
uint32_t * | remoteEndPt, | ||
uint32_t | timeout, | ||
uint32_t | token | ||
) |
void RPMessage_unblockGetRemoteEndPt | ( | uint32_t | token | ) |
Unblocks an RPMessage_getRemoteEndPtToken() call.
Unblocks a thread that is blocked on a RPMessage_getRemoteEndPtToken. The RPMessage_getRemoteEndPtToken call will return with status an invalid remoteProcId and remoteEndPt (RPMESSAGE_ANY) indicating that it returned due to a RPMessage_unblockGetRemoteEndPt rather than by a timeout or receiving the requested remote endpoint.
[in] | token | Token passed when calling RPMessage_getRemoteEndPtToken |
int32_t RPMessage_announce | ( | uint32_t | remoteProcId, |
uint32_t | endPt, | ||
const char * | name | ||
) |
Annouce the name of an endpoint and that it is ready to to receive messages.
Announcing an endpoint to other processesors acheives two goals. First it signals that the endpoint is ready to recieve, and second, the endpoint is offering the named service. Announcements can be sent to all remote processors by using RPMessage_ALL for remoteProcId, otherwise only the specified processor recieves the announcement. The name may not be an empty string or NULL. The value of endPt should have been returned by a prior call to RPMessage_create().
remoteProcId | [IN] RPMessage_Params The remote processor to receive the announcement |
endPt | [IN] Endpoint ID to announce |
name | [IN] Name of the service on the endpoint |
void Ipc_mailboxEnableNewMsgInt | ( | uint16_t | selfId, |
uint16_t | remoteProcId | ||
) |
API Mailbox Enable new MSG interrupt for a given remote processor.
selfId | Self Processor Identifier |
remoteProcId | Remote Processor ID |
void Ipc_mailboxDisableNewMsgInt | ( | uint16_t | selfId, |
uint16_t | remoteProcId | ||
) |
API Mailbox Disable new MSG interrupt for a given remote processor.
selfId | Self Processor Identifier |
remoteProcId | Remote Processor ID |
uint32_t Ipc_InitPrms::instId |
[IN] Ipc_InstanceId. Only 1 instance is supported in this implementation. The value shall be 0
Ipc_PhyToVirtFxn Ipc_InitPrms::phyToVirtFxn |
If not NULL, this function will be called to convert physical address to virtual address to access the pointer returned by the IPC. If NULL, the driver will assume a one-one mapping.
Note: The init fxn will initialize this to the default one-one map function Ipc_defaultPhyToVirtFxn
Ipc_VirtToPhyFxn Ipc_InitPrms::virtToPhyFxn |
If not NULL, this function will be called to convert virtual address to physical address to be provided to IPC. If NULL, the driver will assume a one-one mapping.
Note: The init fxn will initialize this to the default one-one map function Ipc_defaultVirtToPhyFxn
Ipc_OsalPrms Ipc_InitPrms::osalPrms |
OSAL callback parameters
Ipc_NewMsgReceivedFxn Ipc_InitPrms::newMsgFxn |
Optional callback function, that would be invoked when a new message is received
Ipc_PrintFxn Ipc_InitPrms::printFxn |
If not NULL, this function will be called to print debug/info message with appropriate string.
uint32_t RPMessage_Params::requestedEndpt |
Requested Endpoint - Any or next available
uint32_t RPMessage_Params::numBufs |
Maximum number of buffers to allocate for queuing received messages.
void* RPMessage_Params::buf |
Buffer pointer to store RPMessage Object
uint32_t RPMessage_Params::bufSize |
Buffer Size. Recommended Size is (512*256 + 256).
void* RPMessage_Params::stackBuffer |
Buffer used for stack for control task
uint32_t RPMessage_Params::stackSize |
StackSize used for the task