1 /*
2  *  SPDX-License-Identifier: BSD-3-Clause
3  *  SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
4  *
5  */
6 
7 #ifndef __PLATFORM_MULTICORE_H__
8 #define __PLATFORM_MULTICORE_H__
9 
10 #include <stdint.h>
11 
12 #include "hardware/structs/sio.h"
13 
14 #define CORE1_S_READY           0x10
15 #define CORE1_NS_READY          0x20
16 #define CORE0_NS_READY          0x30
17 
18 #define NS_MAILBOX_INIT         0x100
19 #define S_MAILBOX_READY         0x110
20 
21 #define NOTIFY_FROM_CORE0       0x200
22 #define NOTIFY_FROM_CORE1       0x300
23 
24 #define HALT_DOORBELL_MASK      (0x1UL << 0)
25 #define FLASH_DOORBELL_MASK     (0x1UL << 1)
26 
27 #define UART_SPINLOCK_NUM       0
28 #define FLASH_SPINLOCK_NUM      1
29 #define MAILBOX_SPINLOCK_NUM    2
30 
31 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
32 #define UART_SPINLOCK           (&sio_ns_hw->spinlock[UART_SPINLOCK_NUM])
33 #define FLASH_SPINLOCK          (&sio_hw->spinlock[FLASH_SPINLOCK_NUM])
34 #define MAILBOX_SPINLOCK        (&sio_ns_hw->spinlock[MAILBOX_SPINLOCK_NUM])
35 #else
36 #define UART_SPINLOCK           (&sio_hw->spinlock[UART_SPINLOCK_NUM])
37 #define MAILBOX_SPINLOCK        (&sio_hw->spinlock[MAILBOX_SPINLOCK_NUM])
38 #endif
39 
40 
41 bool multicore_ns_fifo_rvalid(void);
42 bool multicore_ns_fifo_wready(void);
43 void multicore_ns_fifo_push_blocking_inline(uint32_t data);
44 uint32_t multicore_ns_fifo_pop_blocking_inline(void);
45 extern volatile uint32_t CORE1_RUNNING;
46 
47 
48 #endif  /* __PLATFORM_MULTICORE_H__ */
49