TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_ns_mailbox.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 /* Data types and API definitions in NSPE mailbox library */
9 
10 #ifndef __TFM_NS_MAILBOX_H__
11 #define __TFM_NS_MAILBOX_H__
12 
13 #include <stdbool.h>
14 #include <stdint.h>
15 #include "tfm_mailbox.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #ifdef TFM_MULTI_CORE_TEST
22 
25 struct ns_mailbox_stats_res_t {
26  uint8_t avg_nr_slots; /* The value before the decimal point
27  * in the average number of NSPE
28  * mailbox slots in use.
29  */
30  uint8_t avg_nr_slots_tenths; /* The first digit value after the
31  * decimal point in the average
32  * number of NSPE mailbox slots in use.
33  */
34 };
35 #endif
36 
50  const struct psa_client_params_t *params,
51  int32_t client_id);
52 
63  int32_t *reply);
64 
75 
85 int32_t tfm_ns_mailbox_init(struct ns_mailbox_queue_t *queue);
86 
87 #ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
88 
99 const void *tfm_ns_mailbox_get_task_handle(void);
100 #else
101 static inline const void *tfm_ns_mailbox_get_task_handle(void)
102 {
103  return NULL;
104 }
105 #endif
106 
122 
132 
133 #ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
134 
143 int32_t tfm_ns_mailbox_wait_reply(mailbox_msg_handle_t handle);
144 #endif
145 
156 int32_t tfm_ns_mailbox_hal_init(struct ns_mailbox_queue_t *queue);
157 
166 int32_t tfm_ns_mailbox_hal_notify_peer(void);
167 
174 
181 
188 
195 
196 #ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
197 
206 void tfm_ns_mailbox_hal_wait_reply(mailbox_msg_handle_t handle);
207 #endif
208 
209 #ifdef TFM_MULTI_CORE_TEST
210 
215 void tfm_ns_mailbox_tx_stats_init(void);
216 
229 void tfm_ns_mailbox_stats_avg_slot(struct ns_mailbox_stats_res_t *stats_res);
230 #endif
231 
232 #ifdef __cplusplus
233 }
234 #endif
235 
236 #endif /* __TFM_NS_MAILBOX_H__ */
const void * tfm_ns_mailbox_get_msg_owner(mailbox_msg_handle_t handle)
Return the handle of owner task of a mailbox message according to the mailbox_msg_handle_t.
int32_t tfm_ns_mailbox_hal_notify_peer(void)
Notify SPE to deal with the PSA client call sent via mailbox.
void tfm_ns_mailbox_hal_enter_critical(void)
Enter critical section of NSPE mailbox.
int32_t mailbox_msg_handle_t
Definition: tfm_mailbox.h:122
mailbox_msg_handle_t tfm_ns_mailbox_fetch_reply_msg_isr(void)
Fetch the handle to the first replied mailbox message in the NSPE mailbox queue. This function is int...
int32_t tfm_ns_mailbox_rx_client_reply(mailbox_msg_handle_t handle, int32_t *reply)
Fetch PSA client return result.
int32_t tfm_ns_mailbox_init(struct ns_mailbox_queue_t *queue)
NSPE mailbox initialization.
void tfm_ns_mailbox_hal_exit_critical_isr(void)
Enter critical section of NSPE mailbox in IRQ handler.
void tfm_ns_mailbox_hal_enter_critical_isr(void)
Enter critical section of NSPE mailbox in IRQ handler.
int32_t tfm_ns_mailbox_hal_init(struct ns_mailbox_queue_t *queue)
Platform specific NSPE mailbox initialization. Invoked by tfm_ns_mailbox_init().
mailbox_msg_handle_t tfm_ns_mailbox_tx_client_req(uint32_t call_type, const struct psa_client_params_t *params, int32_t client_id)
Prepare and send PSA client request to SPE via mailbox.
bool tfm_ns_mailbox_is_msg_replied(mailbox_msg_handle_t handle)
Check whether a specific mailbox message has been replied.
void tfm_ns_mailbox_hal_exit_critical(void)
Exit critical section of NSPE mailbox.