aboutsummaryrefslogtreecommitdiff
path: root/interface/include/tfm_multi_core_api.h
blob: 908b1376cf5b3490c158c36ee1963cb3dfe70420 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */

#ifndef __TFM_MULTI_CORE_API__
#define __TFM_MULTI_CORE_API__

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

#include "os_wrapper/common.h"

/**
 * \brief 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.
 *
 * \return Return 0 if succeeds.
 * \return Otherwise, return specific error code.
 */
int32_t tfm_ns_wait_for_s_cpu_ready(void);

/**
 * \brief Synchronisation with secure CPU, platform-specific implementation.
 *        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.
 *
 * \retval Return 0 if succeeds.
 * \retval Otherwise, return specific error code.
 */
int32_t tfm_platform_ns_wait_for_s_cpu_ready(void);

#ifdef FORWARD_PROT_MSG
static inline uint32_t tfm_ns_multi_core_lock_acquire(void)
{
    return OS_WRAPPER_SUCCESS;
}

static inline uint32_t tfm_ns_multi_core_lock_release(void)
{
    return OS_WRAPPER_SUCCESS;
}
#else /* FORWARD_PROT_MSG */
/**
 * \brief Acquire the multi-core lock for synchronizing PSA client call(s)
 *        The actual implementation depends on the use scenario.
 *
 * \return \ref OS_WRAPPER_SUCCESS on success
 * \return \ref OS_WRAPPER_ERROR on error
 */
uint32_t tfm_ns_multi_core_lock_acquire(void);

/**
 * \brief Release the multi-core lock for synchronizing PSA client call(s)
 *        The actual implementation depends on the use scenario.
 *
 * \return \ref OS_WRAPPER_SUCCESS on success
 * \return \ref OS_WRAPPER_ERROR on error
 */
uint32_t tfm_ns_multi_core_lock_release(void);
#endif /* FORWARD_PROT_MSG */

#ifdef __cplusplus
}
#endif

#endif /* __TFM_MULTI_CORE_API__ */