TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_multi_core_api.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include "os_wrapper/semaphore.h"
9 
10 #include "tfm_api.h"
11 #include "tfm_mailbox.h"
12 #include "tfm_multi_core_api.h"
13 
14 #define MAX_SEMAPHORE_COUNT NUM_MAILBOX_QUEUE_SLOT
15 
16 static void *ns_lock_handle = NULL;
17 
18 __attribute__((weak))
20 {
23  NULL);
24  if (!ns_lock_handle) {
25  return TFM_ERROR_GENERIC;
26  }
27 
28  return TFM_SUCCESS;
29 }
30 
32 {
34 }
35 
37 {
38  return os_wrapper_semaphore_acquire(ns_lock_handle,
40 }
41 
43 {
44  return os_wrapper_semaphore_release(ns_lock_handle);
45 }
enum tfm_status_e tfm_ns_interface_init(void)
NS interface, Initialise the NS interface.
tfm_status_e
Definition: tfm_api.h:45
uint32_t tfm_ns_multi_core_lock_release(void)
Release the multi-core lock for synchronizing PSA client call(s) The actual implementation depends on...
int32_t tfm_platform_ns_wait_for_s_cpu_ready(void)
Synchronisation with secure CPU, platform-specific implementation. Flags that the non-secure side has...
void * os_wrapper_semaphore_create(uint32_t max_count, uint32_t initial_count, const char *name)
Creates a new semaphore.
#define MAX_SEMAPHORE_COUNT
#define OS_WRAPPER_WAIT_FOREVER
Definition: common.h:19
uint32_t tfm_ns_multi_core_lock_acquire(void)
Acquire the multi-core lock for synchronizing PSA client call(s) The actual implementation depends on...
uint32_t os_wrapper_semaphore_release(void *handle)
Releases the semaphore.
int32_t tfm_ns_wait_for_s_cpu_ready(void)
Called on the non-secure CPU. Flags that the non-secure side has completed its initialization. Waits, if necessary, for the secure CPU to flag that it has completed its initialization.
uint32_t os_wrapper_semaphore_acquire(void *handle, uint32_t timeout)
Acquires the semaphore.