1 /* 2 * Copyright (c) 2019, Arm Limited. All rights reserved. 3 * Copyright (c) 2019, 2021, Cypress Semiconductor Corporation. All rights reserved 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 */ 8 9 #ifndef _TFM_PLATFORM_MULTICORE_ 10 #define _TFM_PLATFORM_MULTICORE_ 11 12 #include <stdint.h> 13 #include "cy_device_headers.h" 14 15 #define IPC_PSA_CLIENT_CALL_CHAN (8) 16 #define IPC_PSA_CLIENT_CALL_INTR_STRUCT (6) 17 #define IPC_PSA_CLIENT_CALL_INTR_MASK (1 << IPC_PSA_CLIENT_CALL_CHAN) 18 #define IPC_PSA_CLIENT_CALL_NOTIFY_MASK (1 << IPC_PSA_CLIENT_CALL_INTR_STRUCT) 19 #define IPC_PSA_CLIENT_CALL_IPC_INTR cpuss_interrupts_ipc_6_IRQn 20 21 #define IPC_PSA_CLIENT_REPLY_CHAN (9) 22 #define IPC_PSA_CLIENT_REPLY_INTR_STRUCT (8) 23 #define IPC_PSA_CLIENT_REPLY_INTR_MASK (1 << IPC_PSA_CLIENT_REPLY_CHAN) 24 #define IPC_PSA_CLIENT_REPLY_NOTIFY_MASK (1 << IPC_PSA_CLIENT_REPLY_INTR_STRUCT) 25 #define IPC_PSA_CLIENT_REPLY_IPC_INTR cpuss_interrupts_ipc_8_IRQn 26 27 #define IPC_PSA_MAILBOX_LOCK_CHAN (10) 28 29 #define IPC_RX_RELEASE_MASK (0) 30 31 #define CY_IPC_NOTIFY_SHIFT (16) 32 33 #define PSA_CLIENT_CALL_REQ_MAGIC (0xA5CF50C6) 34 #define PSA_CLIENT_CALL_REPLY_MAGIC (0xC605FC5A) 35 36 #define NS_MAILBOX_INIT_ENABLE (0xAE) 37 #define S_MAILBOX_READY (0xC3) 38 39 #define PLATFORM_MAILBOX_SUCCESS (0x0) 40 #define PLATFORM_MAILBOX_INVAL_PARAMS (INT32_MIN + 1) 41 #define PLATFORM_MAILBOX_TX_ERROR (INT32_MIN + 2) 42 #define PLATFORM_MAILBOX_RX_ERROR (INT32_MIN + 3) 43 #define PLATFORM_MAILBOX_INIT_ERROR (INT32_MIN + 4) 44 45 /* Inter-Processor Communication (IPC) data channel for the Semaphores */ 46 #define PLATFORM_MAILBOX_IPC_CHAN_SEMA CY_IPC_CHAN_SEMA 47 #define MAILBOX_SEMAPHORE_NUM (16) 48 49 #define IPC_SYNC_MAGIC 0x7DADE011 50 51 /** 52 * \brief Fetch a pointer from mailbox message 53 * 54 * \param[out] msg_ptr The address to write the pointer value to. 55 * 56 * \retval 0 The operation succeeds. 57 * \retval else The operation fails. 58 */ 59 int platform_mailbox_fetch_msg_ptr(void **msg_ptr); 60 61 /** 62 * \brief Fetch a data value from mailbox message 63 * 64 * \param[out] data_ptr The address to write the pointer value to. 65 * 66 * \retval 0 The operation succeeds. 67 * \retval else The operation fails. 68 */ 69 int platform_mailbox_fetch_msg_data(uint32_t *data_ptr); 70 71 /** 72 * \brief Send a pointer via mailbox message 73 * 74 * \param[in] msg_ptr The pointer value to be sent. 75 * 76 * \retval 0 The operation succeeds. 77 * \retval else The operation fails. 78 */ 79 int platform_mailbox_send_msg_ptr(const void *msg_ptr); 80 81 /** 82 * \brief Send a data value via mailbox message 83 * 84 * \param[in] data The data value to be sent 85 * 86 * \retval 0 The operation succeeds. 87 * \retval else The operation fails. 88 */ 89 int platform_mailbox_send_msg_data(uint32_t data); 90 91 /** 92 * \brief Wait for a mailbox notify event. 93 */ 94 void platform_mailbox_wait_for_notify(void); 95 96 #endif 97