AM263x MCU+ SDK  10.00.00
sipc_notify.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022-23 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 SIPC_NOTIFY_H_
34 #define SIPC_NOTIFY_H_
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #include <stdint.h>
41 #include <kernel/dpl/SystemP.h>
42 #include <security_common/drivers/secure_ipc_notify/soc/sipc_notify_soc.h>
43 
74 typedef void (*SIPC_FxnCallback)(uint8_t remoteSecCoreId, uint8_t localClientId, uint8_t remoteClientId ,uint8_t *msgValue, void *args);
75 
76 
84 typedef struct SIPC_Params_ {
85 
86  uint32_t numCores;
89  uint32_t coreIdList[MAX_SEC_CORES_WITH_HSM];
94  uint16_t ipcQueue_length ;
98  uintptr_t tx_SipcQueues[MAX_SEC_CORES_WITH_HSM];
100  uintptr_t rx_SipcQueues[MAX_SEC_CORES_WITH_HSM];
102  /* The size of SecureMaster_CoreId array is 2 so the coreId value written on INDEX = 0 will represent the
103  * Secure Master 1's CORE ID and so on */
104  uint32_t secHostCoreId[MAX_SEC_CORES_WITH_HSM - 1];
105  /* This field is for soc extension if user wants to configure different interrupt for SIPC communication*/
106  /* for am263x it is fixed to zero */
107  uint8_t intrPriority;
109 
110 } SIPC_Params;
111 
115 typedef enum SIPC_fifoFlags_
116 {
119 
121 
128 
137 int32_t SIPC_init(SIPC_Params *params);
138 
145 void SIPC_deInit(void);
146 
170 int32_t SIPC_sendMsg(uint8_t remoteSecCoreId, uint8_t remoteClientId, uint8_t localClientId ,uint8_t* msgValue, SIPC_fifoFlags waitForFifoNotFull);
171 
182 int32_t SIPC_registerClient(uint8_t localClientId, SIPC_FxnCallback msgCallback, void *args);
183 
184 
193 int32_t SIPC_unregisterClient(uint16_t localClientId);
194 
200 uint32_t SIPC_getSelfCoreId(void);
201 
207 uint32_t SIPC_getSelfSecMasterId(void);
208 
216 uint32_t SIPC_isCoreEnabled(uint32_t coreId);
217 
218 
221 #ifdef __cplusplus
222 }
223 #endif
224 
225 #endif /* SIPC_NOTIFY_H_ */
226 
SIPC_unregisterClient
int32_t SIPC_unregisterClient(uint16_t localClientId)
Un-register a previously registered callback.
SIPC_Params
Parameters used by SIPC_init.
Definition: sipc_notify.h:84
args
void * args
Definition: hsmclient_msg.h:4
SystemP.h
SIPC_Params::numCores
uint32_t numCores
Definition: sipc_notify.h:86
SIPC_Params::interruptConfig_Num
uint8_t interruptConfig_Num
Definition: sipc_notify.h:108
SIPC_Params_init
void SIPC_Params_init(SIPC_Params *params)
Set default value to SIPC_Params.
SIPC_Params::ipcQueue_eleSize_inBytes
uint16_t ipcQueue_eleSize_inBytes
Definition: sipc_notify.h:95
WAIT_IF_FIFO_FULL
@ WAIT_IF_FIFO_FULL
Definition: sipc_notify.h:118
ABORT_ON_FIFO_FULL
@ ABORT_ON_FIFO_FULL
Definition: sipc_notify.h:117
SIPC_Params::intrPriority
uint8_t intrPriority
Definition: sipc_notify.h:107
SIPC_init
int32_t SIPC_init(SIPC_Params *params)
Initialize Secure IPC notify module.
SIPC_registerClient
int32_t SIPC_registerClient(uint8_t localClientId, SIPC_FxnCallback msgCallback, void *args)
Register a callback to handle messages received from a specific remote core and for a specific local ...
SIPC_FxnCallback
void(* SIPC_FxnCallback)(uint8_t remoteSecCoreId, uint8_t localClientId, uint8_t remoteClientId, uint8_t *msgValue, void *args)
User callback that is invoked when a message is received from a reote core for a given client ID.
Definition: sipc_notify.h:74
MAX_SEC_CORES_WITH_HSM
@ MAX_SEC_CORES_WITH_HSM
Definition: sipc_notify_cfg.h:129
SIPC_sendMsg
int32_t SIPC_sendMsg(uint8_t remoteSecCoreId, uint8_t remoteClientId, uint8_t localClientId, uint8_t *msgValue, SIPC_fifoFlags waitForFifoNotFull)
Send message to a specific remote core and specific client ID on that remote core.
SIPC_getSelfSecMasterId
uint32_t SIPC_getSelfSecMasterId(void)
Return current core sec master ID.
SIPC_Params::ipcQueue_totalSize_inBytes
uint32_t ipcQueue_totalSize_inBytes
Definition: sipc_notify.h:96
SIPC_isCoreEnabled
uint32_t SIPC_isCoreEnabled(uint32_t coreId)
Check if a core is enabled for SIPC.
SIPC_deInit
void SIPC_deInit(void)
De-initialize secure IPC Notify module.
SIPC_getSelfCoreId
uint32_t SIPC_getSelfCoreId(void)
Return current core ID.
SIPC_Params::ipcQueue_length
uint16_t ipcQueue_length
Definition: sipc_notify.h:94
SIPC_fifoFlags
SIPC_fifoFlags
flags to pass with the SIPC_sendMsg Api which indicates the flow of execution when the write FIFO is ...
Definition: sipc_notify.h:116