AM62Ax MCU+ SDK  09.01.00
ipc_notify.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2021 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef IPC_NOTIFY_H_
34 #define IPC_NOTIFY_H_
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #include <stdint.h>
41 #include <kernel/dpl/SystemP.h>
42 #include <drivers/hw_include/cslr_soc.h>
43 
56 #define IPC_NOTIFY_CLIENT_ID_MAX (16U)
57 
61 #define IPC_NOTIFY_CLIENT_ID_RPMSG (0U)
62 
66 #define IPC_NOTIFY_CLIENT_ID_SYNC (1U)
67 
71 #define IPC_NOTIFY_CLIENT_ID_RP_MBOX (0xFU)
72 
76 #define IPC_NOTIFY_MSG_VALUE_MAX (0x10000000U)
77 
93 typedef void (*IpcNotify_FxnCallback)(uint16_t remoteCoreId, uint16_t localClientId, uint32_t msgValue, void *args);
94 
95 
103 typedef void (*IpcNotify_NonNotifyCallback)(uint32_t remoteCoreId);
104 
112 typedef struct IpcNotify_Params_ {
113 
114  uint32_t numCores;
117  uint32_t coreIdList[CSL_CORE_ID_MAX];
122  uint16_t selfCoreId;
127  uint32_t linuxCoreId;
129 
137 typedef enum IpcNotify_RP_Mbox_Message_ {
152 
159 
168 int32_t IpcNotify_init(const IpcNotify_Params *params);
169 
176 void IpcNotify_deInit(void);
177 
200 int32_t IpcNotify_sendMsg(uint32_t remoteCoreId, uint16_t remoteClientId, uint32_t msgValue, uint32_t waitForFifoNotFull);
201 
212 int32_t IpcNotify_registerClient(uint16_t localClientId, IpcNotify_FxnCallback msgCallback, void *args);
213 
214 
223 int32_t IpcNotify_unregisterClient(uint16_t localClientId);
224 
230 uint16_t IpcNotify_getSelfCoreId(void);
231 
239 uint32_t IpcNotify_isCoreEnabled(uint32_t coreId);
240 
251 int32_t IpcNotify_sendSync(uint32_t remoteCoreId);
252 
266 int32_t IpcNotify_waitSync(uint32_t remoteCoreId, uint32_t timeout);
267 
283 int32_t IpcNotify_syncAll(uint32_t timeout);
284 
285 
295 
298 #ifdef __cplusplus
299 }
300 #endif
301 
302 #endif /* IPC_NOTIFY_H_ */
303 
IPC_NOTIFY_RP_MBOX_SHUTDOWN
@ IPC_NOTIFY_RP_MBOX_SHUTDOWN
Definition: ipc_notify.h:148
CSL_CORE_ID_MAX
#define CSL_CORE_ID_MAX
Definition: cslr_soc_defines.h:79
IpcNotify_Params::selfCoreId
uint16_t selfCoreId
Definition: ipc_notify.h:122
IPC_NOTIFY_RP_MBOX_READY
@ IPC_NOTIFY_RP_MBOX_READY
Definition: ipc_notify.h:138
SystemP.h
IpcNotify_deInit
void IpcNotify_deInit(void)
De-initialize IPC Notify module.
IpcNotify_registerClient
int32_t IpcNotify_registerClient(uint16_t localClientId, IpcNotify_FxnCallback msgCallback, void *args)
Register a callback to handle messages received from a specific remote core and for a specific local ...
IpcNotify_sendSync
int32_t IpcNotify_sendSync(uint32_t remoteCoreId)
Send a sync message to specific core.
IpcNotify_registerNonNotifyCallback
void IpcNotify_registerNonNotifyCallback(IpcNotify_NonNotifyCallback callback)
This is a driver library internal API and is used in certain SOCs by the separate mailbox driver.
IpcNotify_sendMsg
int32_t IpcNotify_sendMsg(uint32_t remoteCoreId, uint16_t remoteClientId, uint32_t msgValue, uint32_t waitForFifoNotFull)
Send message to a specific remote core and specific client ID on that remote core.
IpcNotify_Params::linuxCoreId
uint32_t linuxCoreId
Definition: ipc_notify.h:127
IpcNotify_isCoreEnabled
uint32_t IpcNotify_isCoreEnabled(uint32_t coreId)
Check if a core is enabled for IPC.
IpcNotify_RP_Mbox_Message
IpcNotify_RP_Mbox_Message
Enum to list the various messages sent by remote proc kernal driver.
Definition: ipc_notify.h:137
IPC_NOTIFY_RP_MBOX_ECHO_REQUEST
@ IPC_NOTIFY_RP_MBOX_ECHO_REQUEST
Definition: ipc_notify.h:141
IpcNotify_Params
Parameters used by IpcNotify_init.
Definition: ipc_notify.h:112
IpcNotify_NonNotifyCallback
void(* IpcNotify_NonNotifyCallback)(uint32_t remoteCoreId)
This is a driver library internal API and is used in certain SOCs by the separate mailbox driver.
Definition: ipc_notify.h:103
IpcNotify_syncAll
int32_t IpcNotify_syncAll(uint32_t timeout)
Send a message to all enabled cores and wait for sync message from all enabled cores.
IPC_NOTIFY_RP_MBOX_PENDING_MSG
@ IPC_NOTIFY_RP_MBOX_PENDING_MSG
Definition: ipc_notify.h:139
IpcNotify_Params_init
void IpcNotify_Params_init(IpcNotify_Params *params)
Set default value to IpcNotify_Params.
IPC_NOTIFY_RP_MBOX_SHUTDOWN_ACK
@ IPC_NOTIFY_RP_MBOX_SHUTDOWN_ACK
Definition: ipc_notify.h:149
IPC_NOTIFY_RP_MBOX_ECHO_REPLY
@ IPC_NOTIFY_RP_MBOX_ECHO_REPLY
Definition: ipc_notify.h:142
IpcNotify_waitSync
int32_t IpcNotify_waitSync(uint32_t remoteCoreId, uint32_t timeout)
Wait for a sync message to be received from the specified core.
IPC_NOTIFY_RP_MBOX_SUSPEND_CANCEL
@ IPC_NOTIFY_RP_MBOX_SUSPEND_CANCEL
Definition: ipc_notify.h:147
IpcNotify_unregisterClient
int32_t IpcNotify_unregisterClient(uint16_t localClientId)
Un-register a previously registered callback.
IpcNotify_Params::numCores
uint32_t numCores
Definition: ipc_notify.h:114
IPC_NOTIFY_RP_MBOX_CRASH
@ IPC_NOTIFY_RP_MBOX_CRASH
Definition: ipc_notify.h:140
IPC_NOTIFY_RP_MBOX_ABORT_REQUEST
@ IPC_NOTIFY_RP_MBOX_ABORT_REQUEST
Definition: ipc_notify.h:143
IPC_NOTIFY_RP_MBOX_SUSPEND_SYSTEM
@ IPC_NOTIFY_RP_MBOX_SUSPEND_SYSTEM
Definition: ipc_notify.h:145
IpcNotify_FxnCallback
void(* IpcNotify_FxnCallback)(uint16_t remoteCoreId, uint16_t localClientId, uint32_t msgValue, void *args)
User callback that is invoked when a message is received from a reote core for a given client ID.
Definition: ipc_notify.h:93
IPC_NOTIFY_RP_MBOX_SUSPEND_AUTO
@ IPC_NOTIFY_RP_MBOX_SUSPEND_AUTO
Definition: ipc_notify.h:144
IpcNotify_init
int32_t IpcNotify_init(const IpcNotify_Params *params)
Initialize IPC Notify module.
IPC_NOTIFY_RP_MBOX_SUSPEND_ACK
@ IPC_NOTIFY_RP_MBOX_SUSPEND_ACK
Definition: ipc_notify.h:146
IpcNotify_getSelfCoreId
uint16_t IpcNotify_getSelfCoreId(void)
Return current core ID.
IPC_NOTIFY_RP_MBOX_END_MSG
@ IPC_NOTIFY_RP_MBOX_END_MSG
Definition: ipc_notify.h:150