PDK API Guide for J721E
ipc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2018
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the
15  * distribution.
16  *
17  * Neither the name of Texas Instruments Incorporated nor the names of
18  * its contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
43 /* @} */
44 
59 #ifndef IPC_H_
60 #define IPC_H_
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 /* ========================================================================== */
67 /* Include Files */
68 /* ========================================================================== */
69 #include <ti/csl/soc.h>
70 #include <ti/csl/csl_types.h>
71 
77 #include <ti/drv/ipc/soc/ipc_soc.h>
78 
79 /* ========================================================================== */
80 /* Macros & Typedefs */
81 /* ========================================================================== */
85 typedef struct RPMessage_Object_s* RPMessage_Handle;
86 
97 typedef void (*RPMessage_Callback)(RPMessage_Handle handle, void* arg, void* data,
98  uint16_t len, uint32_t src);
99 
100 
101 /* ========================================================================== */
102 /* Structure Declarations */
103 /* ========================================================================== */
104 
109 typedef struct Ipc_InitPrms_s
110 {
111  uint32_t instId;
140 } Ipc_InitPrms;
141 
145 typedef struct RPMessage_Params_s
146 {
147  uint32_t requestedEndpt;
150  uint32_t numBufs;
153  void* buf;
156  uint32_t bufSize;
161  void* stackBuffer;
164  uint32_t stackSize;
167 
168 /* ========================================================================== */
169 /* Function Declarations */
170 /* ========================================================================== */
188 void IpcInitPrms_init(uint32_t instId, Ipc_InitPrms *initPrms);
189 
202 int32_t Ipc_init(Ipc_InitPrms *cfg);
203 
211 int32_t Ipc_deinit(void);
212 
216 uint32_t RPMessage_getMessageBufferSize(void);
217 
218 
222 uint32_t RPMessage_getObjMemRequired(void);
223 
235 int32_t RPMessage_init(RPMessage_Params *params);
236 
248 int32_t RPMessage_lateInit(uint32_t proc);
249 
250 
255 void RPMessage_deInit(void);
256 
257 
269 int32_t RPMessageParams_init(RPMessage_Params *params);
270 
290 RPMessage_Handle RPMessage_create(RPMessage_Params *params, uint32_t *endPt);
291 
309 int32_t RPMessage_setCallback(RPMessage_Handle handle, RPMessage_Callback cb, void* arg);
310 
342 int32_t RPMessage_recv(RPMessage_Handle handle, void* data, uint16_t *len,
343  uint32_t *rplyEndPt, uint32_t *fromProcId, uint32_t timeout);
344 
366 int32_t RPMessage_recvNb(RPMessage_Handle handle, void* data, uint16_t *len,
367  uint32_t *rplyEndPt, uint32_t *fromProcId);
368 
382 int32_t RPMessage_send(RPMessage_Handle handle,
383  uint32_t dstProc,
384  uint32_t dstEndPt,
385  uint32_t srcEndPt,
386  void* data,
387  uint16_t len);
388 
402 int32_t RPMessage_delete(RPMessage_Handle *handlePtr);
403 
421 
422 
446 int32_t RPMessage_getRemoteEndPt(uint32_t selfProcId, const char* name, uint32_t *remoteProcId,
447  uint32_t *remoteEndPt, uint32_t timeout);
448 
449 /*
450  * \brief Wait for an endpoint to become available on another
451  * processor with token.
452  *
453  * Block the current task until the specified processor announces the
454  * named endpoint. The name is a string that identifies the service
455  * that is offered on the endpoint. This allows an application to both
456  * wait for the remote processor to signal that it is ready to
457  * communicate and to lookup services by name. The procId can be that
458  * of a specific processor or PRMessage_ANY to wait for any processor
459  * to announce the named endpoint. Suitable values for timeout are the
460  * same as for the ti.sysbios.knl.Semaphore module.
461  * This is the same as RPMessage_getRemoteEndPt, except that a token
462  * can be taken with the request, which can be used by the application
463  * to unblock the request in order to unblock it's waiting task.
464  *
465  * \param selfProcId [IN] Remote processor ID
466  * \param name [IN] Name of the endpoint
467  * \param remoteProcId [OUT] Remote processor ID
468  * \param remoteEndPt [OUT] Remote endpoint ID
469  * \param timeout [IN] Timeout value (in system ticks)
470  * \param token [IN] User-provided token that can be used to unblock the function
471  *
472  * Restrictions:
473  * - The token passed must be unique for each call.
474  *
475  * \return - #IPC_SOK: Endpoint successfully returned
476  * - #IPC_ETIMEOUT: Time out occured
477  * - #IPC_EFAIL: Invalid input
478  */
479 int32_t RPMessage_getRemoteEndPtToken(uint32_t selfProcId, const char* name, uint32_t *remoteProcId,
480  uint32_t *remoteEndPt, uint32_t timeout, uint32_t token);
481 
495 void RPMessage_unblockGetRemoteEndPt(uint32_t token);
496 
521 int32_t RPMessage_announce(uint32_t remoteProcId, uint32_t endPt,
522  const char* name);
523 
539 void Ipc_newMessageIsr(uint32_t srcProcId);
540 
550 void Ipc_mailboxEnableNewMsgInt(uint16_t selfId, uint16_t remoteProcId);
551 
561 void Ipc_mailboxDisableNewMsgInt(uint16_t selfId, uint16_t remoteProcId);
562 
563 /* ========================================================================== */
564 /* Static Function Definitions */
565 /* ========================================================================== */
566 
567 /* None */
568 
569 #ifdef __cplusplus
570 }
571 #endif
572 
573 #endif /* #ifndef IPC_H_ */
574 
575 /* @} */
Ipc_OsalPrms osalPrms
Definition: ipc.h:130
configurations for ipc module.
int32_t RPMessage_delete(RPMessage_Handle *handlePtr)
Delete an endpoint instance.
Ipc_NewMsgReceivedFxn newMsgFxn
Definition: ipc.h:133
uint32_t instId
Definition: ipc.h:111
int32_t RPMessage_setCallback(RPMessage_Handle handle, RPMessage_Callback cb, void *arg)
Sets callback.
void IpcInitPrms_init(uint32_t instId, Ipc_InitPrms *initPrms)
Initialize IPC init params.
void RPMessage_unblock(RPMessage_Handle handle)
Unblocks an RPMessage_recv()
uint32_t(* Ipc_VirtToPhyFxn)(const void *virtAddr)
IPC Virtual to Physical address translation callback function.
Definition: ipc_types.h:161
VirtIO Interface for application.
IPC initialization parameters.
Definition: ipc.h:109
int32_t RPMessage_init(RPMessage_Params *params)
Initialize RPMessage Module.
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.
void *(* Ipc_PhyToVirtFxn)(uint32_t phyAddr)
IPC Physical to Virtual address translation callback function.
Definition: ipc_types.h:173
int32_t RPMessage_getRemoteEndPtToken(uint32_t selfProcId, const char *name, uint32_t *remoteProcId, uint32_t *remoteEndPt, uint32_t timeout, uint32_t token)
int32_t RPMessage_getRemoteEndPt(uint32_t selfProcId, const char *name, uint32_t *remoteProcId, uint32_t *remoteEndPt, uint32_t timeout)
Wait for an endpoint to become available on another processor.
void RPMessage_deInit(void)
Tear down the RPMessage Module. The module API should not be used after this is called.
int32_t Ipc_deinit(void)
De Initialize IPC module.
uint32_t numBufs
Definition: ipc.h:150
uint32_t RPMessage_getObjMemRequired(void)
Returns local memory for RPMessage Object.
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.
Parameter structure for creating RPMessage endpoints.
Definition: ipc.h:145
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.
void(* Ipc_NewMsgReceivedFxn)(uint32_t srcEndPt, uint32_t procId)
IPC New message notification.
Definition: ipc_types.h:325
void(* RPMessage_Callback)(RPMessage_Handle handle, void *arg, void *data, uint16_t len, uint32_t src)
RPMessage_Callback.
Definition: ipc.h:97
uint32_t data[13]
Definition: csl_udmap_tr.h:628
Ipc_PrintFxn printFxn
Definition: ipc.h:137
data types definitions for ipc module.
int32_t RPMessage_lateInit(uint32_t proc)
Add a proc to RPMessage Module.
Ipc_PhyToVirtFxn phyToVirtFxn
Definition: ipc.h:114
void Ipc_newMessageIsr(uint32_t srcProcId)
New Message Interrupt Handler.
void Ipc_mailboxEnableNewMsgInt(uint16_t selfId, uint16_t remoteProcId)
API Mailbox Enable new MSG interrupt for a given remote processor.
uint32_t requestedEndpt
Definition: ipc.h:147
RPMessage_Handle RPMessage_create(RPMessage_Params *params, uint32_t *endPt)
Create a endpoint instance for receiving.
int32_t Ipc_init(Ipc_InitPrms *cfg)
Initialize IPC module.
This file contains the Register Desciptions for CSL types.
int32_t RPMessageParams_init(RPMessage_Params *params)
Initialize an RPMessage_Params structure to default values.
IPC - Multiproc interface.
Ipc_VirtToPhyFxn virtToPhyFxn
Definition: ipc.h:122
void RPMessage_unblockGetRemoteEndPt(uint32_t token)
Unblocks an RPMessage_getRemoteEndPtToken() call.
uint32_t stackSize
Definition: ipc.h:164
struct RPMessage_Object_s * RPMessage_Handle
RPMessage_Handle type.
Definition: ipc.h:85
void Ipc_mailboxDisableNewMsgInt(uint16_t selfId, uint16_t remoteProcId)
API Mailbox Disable new MSG interrupt for a given remote processor.
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.
uint32_t RPMessage_getMessageBufferSize(void)
Returns Message Buffer Size.
void(* Ipc_PrintFxn)(const char *str)
IPC info/debug print function prototype.
Definition: ipc_types.h:182
IPC driver OSAL function pointers.
Definition: ipc_types.h:330
uint32_t bufSize
Definition: ipc.h:156
void * buf
Definition: ipc.h:153
void * stackBuffer
Definition: ipc.h:161