mirror of https://github.com/ARMmbed/mbed-os.git
psoc64: Update TF-M for MBedOS
Signed-off-by: Charley Chu <haoc@cypress.com>pull/13358/head
parent
f7e60be5cf
commit
a1bc65a152
|
@ -54,6 +54,7 @@ int32_t tfm_ns_mailbox_hal_notify_peer(void)
|
||||||
|
|
||||||
static int32_t mailbox_sema_init(void)
|
static int32_t mailbox_sema_init(void)
|
||||||
{
|
{
|
||||||
|
#if defined(CY_IPC_DEFAULT_CFG_DISABLE)
|
||||||
/* semaphore data */
|
/* semaphore data */
|
||||||
static uint32_t tfm_sema __attribute__((section("TFM_SHARED_DATA")));
|
static uint32_t tfm_sema __attribute__((section("TFM_SHARED_DATA")));
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ static int32_t mailbox_sema_init(void)
|
||||||
&tfm_sema) != CY_IPC_SEMA_SUCCESS) {
|
&tfm_sema) != CY_IPC_SEMA_SUCCESS) {
|
||||||
return PLATFORM_MAILBOX_INIT_ERROR;
|
return PLATFORM_MAILBOX_INIT_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return PLATFORM_MAILBOX_SUCCESS;
|
return PLATFORM_MAILBOX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,11 +120,7 @@ int32_t tfm_ns_mailbox_hal_init(struct ns_mailbox_queue_t *queue)
|
||||||
|
|
||||||
const void *tfm_ns_mailbox_get_task_handle(void)
|
const void *tfm_ns_mailbox_get_task_handle(void)
|
||||||
{
|
{
|
||||||
#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
|
return osThreadGetId();;
|
||||||
return osThreadGetId();
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tfm_ns_mailbox_hal_wait_reply(mailbox_msg_handle_t handle)
|
void tfm_ns_mailbox_hal_wait_reply(mailbox_msg_handle_t handle)
|
||||||
|
@ -279,7 +277,7 @@ static bool mailbox_clear_intr(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpuss_interrupts_ipc_5_IRQHandler(void)
|
void cpuss_interrupts_ipc_8_IRQHandler(void)
|
||||||
{
|
{
|
||||||
uint32_t magic;
|
uint32_t magic;
|
||||||
mailbox_msg_handle_t handle;
|
mailbox_msg_handle_t handle;
|
||||||
|
@ -299,9 +297,6 @@ void cpuss_interrupts_ipc_5_IRQHandler(void)
|
||||||
|
|
||||||
task_handle = (osThreadId_t)tfm_ns_mailbox_get_msg_owner(handle);
|
task_handle = (osThreadId_t)tfm_ns_mailbox_get_msg_owner(handle);
|
||||||
if (task_handle) {
|
if (task_handle) {
|
||||||
/* According to the description of CMSIS-RTOS v2 Thread Flags,
|
|
||||||
* osThreadFlagsSet() can be called inside Interrupt Service
|
|
||||||
* Routine. */
|
|
||||||
osThreadFlagsSet(task_handle, handle);
|
osThreadFlagsSet(task_handle, handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,22 @@
|
||||||
#include "tfm_mailbox.h"
|
#include "tfm_mailbox.h"
|
||||||
#include "tfm_multi_core_api.h"
|
#include "tfm_multi_core_api.h"
|
||||||
#include "cmsis_os2.h"
|
#include "cmsis_os2.h"
|
||||||
|
#include "mbed_rtos_storage.h"
|
||||||
|
|
||||||
#define MAX_SEMAPHORE_COUNT NUM_MAILBOX_QUEUE_SLOT
|
#define MAX_SEMAPHORE_COUNT NUM_MAILBOX_QUEUE_SLOT
|
||||||
|
|
||||||
static osSemaphoreId_t ns_lock_handle = NULL;
|
static void *ns_lock_handle = NULL;
|
||||||
|
static mbed_rtos_storage_semaphore_t tfm_ns_sema_obj;
|
||||||
|
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
enum tfm_status_e tfm_ns_interface_init(void)
|
enum tfm_status_e tfm_ns_interface_init(void)
|
||||||
{
|
{
|
||||||
osSemaphoreAttr_t sema_attrib = {0};
|
osSemaphoreAttr_t sema_attrib = {
|
||||||
|
.name = "tfm_ns_lock",
|
||||||
|
.attr_bits = 0,
|
||||||
|
.cb_size = sizeof(tfm_ns_sema_obj),
|
||||||
|
.cb_mem = &tfm_ns_sema_obj
|
||||||
|
};
|
||||||
|
|
||||||
ns_lock_handle = osSemaphoreNew(MAX_SEMAPHORE_COUNT,
|
ns_lock_handle = osSemaphoreNew(MAX_SEMAPHORE_COUNT,
|
||||||
MAX_SEMAPHORE_COUNT,
|
MAX_SEMAPHORE_COUNT,
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
#define IPC_PSA_CLIENT_CALL_IPC_INTR cpuss_interrupts_ipc_6_IRQn
|
#define IPC_PSA_CLIENT_CALL_IPC_INTR cpuss_interrupts_ipc_6_IRQn
|
||||||
|
|
||||||
#define IPC_PSA_CLIENT_REPLY_CHAN (9)
|
#define IPC_PSA_CLIENT_REPLY_CHAN (9)
|
||||||
#define IPC_PSA_CLIENT_REPLY_INTR_STRUCT (5)
|
#define IPC_PSA_CLIENT_REPLY_INTR_STRUCT (8)
|
||||||
#define IPC_PSA_CLIENT_REPLY_INTR_MASK (1 << IPC_PSA_CLIENT_REPLY_CHAN)
|
#define IPC_PSA_CLIENT_REPLY_INTR_MASK (1 << IPC_PSA_CLIENT_REPLY_CHAN)
|
||||||
#define IPC_PSA_CLIENT_REPLY_NOTIFY_MASK (1 << IPC_PSA_CLIENT_REPLY_INTR_STRUCT)
|
#define IPC_PSA_CLIENT_REPLY_NOTIFY_MASK (1 << IPC_PSA_CLIENT_REPLY_INTR_STRUCT)
|
||||||
#define IPC_PSA_CLIENT_REPLY_IPC_INTR cpuss_interrupts_ipc_5_IRQn
|
#define IPC_PSA_CLIENT_REPLY_IPC_INTR cpuss_interrupts_ipc_8_IRQn
|
||||||
|
|
||||||
#define IPC_RX_RELEASE_MASK (0)
|
#define IPC_RX_RELEASE_MASK (0)
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ bool tfm_ns_mailbox_is_msg_replied(mailbox_msg_handle_t handle);
|
||||||
*/
|
*/
|
||||||
int32_t tfm_ns_mailbox_init(struct ns_mailbox_queue_t *queue);
|
int32_t tfm_ns_mailbox_init(struct ns_mailbox_queue_t *queue);
|
||||||
|
|
||||||
|
#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
|
||||||
/**
|
/**
|
||||||
* \brief Get the handle of the current non-secure task executing mailbox
|
* \brief Get the handle of the current non-secure task executing mailbox
|
||||||
* functionalities
|
* functionalities
|
||||||
|
@ -96,6 +97,12 @@ int32_t tfm_ns_mailbox_init(struct ns_mailbox_queue_t *queue);
|
||||||
* \return Return the handle of task.
|
* \return Return the handle of task.
|
||||||
*/
|
*/
|
||||||
const void *tfm_ns_mailbox_get_task_handle(void);
|
const void *tfm_ns_mailbox_get_task_handle(void);
|
||||||
|
#else
|
||||||
|
static inline const void *tfm_ns_mailbox_get_task_handle(void)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Fetch the handle to the first replied mailbox message in the NSPE
|
* \brief Fetch the handle to the first replied mailbox message in the NSPE
|
||||||
|
|
Loading…
Reference in New Issue