1 /*
2  * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
3  * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
4  * Copyright (c) 2020, Nordic Semiconductor ASA. All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
8  */
9 
10 #ifndef __TFM_PERIPHERALS_DEF_H__
11 #define __TFM_PERIPHERALS_DEF_H__
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #include <nrfx.h>
18 
19 #define TFM_FPU_IRQ            (NRFX_IRQ_NUMBER_GET(NRF_FPU))
20 #define TFM_POWER_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_POWER))
21 #define TFM_CLOCK_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_CLOCK))
22 #define TFM_CLOCK_POWER_IRQ    (NRFX_IRQ_NUMBER_GET(NRF_POWER))
23 #define TFM_SPIM0_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_SPIM0))
24 #define TFM_SPIS0_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_SPIS0))
25 #define TFM_TWIM0_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_TWIM0))
26 #define TFM_TWIS0_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_TWIS0))
27 #define TFM_UARTE0_IRQ         (NRFX_IRQ_NUMBER_GET(NRF_UARTE0))
28 #define TFM_SERIAL0_IRQ        (NRFX_IRQ_NUMBER_GET(NRF_SPIM0))
29 #define TFM_SPIM1_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_SPIM1))
30 #define TFM_SPIS1_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_SPIS1))
31 #define TFM_TWIM1_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_TWIM1))
32 #define TFM_TWIS1_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_TWIS1))
33 #define TFM_UARTE1_IRQ         (NRFX_IRQ_NUMBER_GET(NRF_UARTE1))
34 #define TFM_SERIAL1_IRQ        (NRFX_IRQ_NUMBER_GET(NRF_SPIM1))
35 #define TFM_SPIM2_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_SPIM2))
36 #define TFM_SPIS2_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_SPIS2))
37 #define TFM_TWIM2_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_TWIM2))
38 #define TFM_TWIS2_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_TWIS2))
39 #define TFM_UARTE2_IRQ         (NRFX_IRQ_NUMBER_GET(NRF_UARTE2))
40 #define TFM_SERIAL2_IRQ        (NRFX_IRQ_NUMBER_GET(NRF_SPIM2))
41 #define TFM_SPIM3_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_SPIM3))
42 #define TFM_SPIS3_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_SPIS3))
43 #define TFM_TWIM3_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_TWIM3))
44 #define TFM_TWIS3_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_TWIS3))
45 #define TFM_UARTE3_IRQ         (NRFX_IRQ_NUMBER_GET(NRF_UARTE3))
46 #define TFM_SERIAL3_IRQ        (NRFX_IRQ_NUMBER_GET(NRF_SPIM3))
47 #define TFM_SAADC_IRQ          (NRFX_IRQ_NUMBER_GET(NRF_SAADC))
48 #define TFM_TIMER0_IRQ         (NRFX_IRQ_NUMBER_GET(NRF_TIMER0))
49 #define TFM_TIMER1_IRQ         (NRFX_IRQ_NUMBER_GET(NRF_TIMER1))
50 #define TFM_TIMER2_IRQ         (NRFX_IRQ_NUMBER_GET(NRF_TIMER2))
51 #define TFM_RTC0_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_RTC0))
52 #define TFM_RTC1_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_RTC1))
53 #define TFM_WDT_IRQ            (NRFX_IRQ_NUMBER_GET(NRF_WDT))
54 #define TFM_EGU0_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_EGU0))
55 #define TFM_EGU1_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_EGU1))
56 #define TFM_EGU2_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_EGU2))
57 #define TFM_EGU3_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_EGU3))
58 #define TFM_EGU4_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_EGU4))
59 #define TFM_EGU5_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_EGU5))
60 #define TFM_PWM0_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_PWM0))
61 #define TFM_PWM1_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_PWM1))
62 #define TFM_PWM2_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_PWM2))
63 #define TFM_PWM3_IRQ           (NRFX_IRQ_NUMBER_GET(NRF_PWM3))
64 #define TFM_PDM_IRQ            (NRFX_IRQ_NUMBER_GET(NRF_PDM))
65 #define TFM_I2S_IRQ            (NRFX_IRQ_NUMBER_GET(NRF_I2S))
66 #define TFM_IPC_IRQ            (NRFX_IRQ_NUMBER_GET(NRF_IPC))
67 #define TFM_GPIOTE0_IRQ        (NRFX_IRQ_NUMBER_GET(NRF_GPIOTE0))
68 
69 struct platform_data_t;
70 
71 extern struct platform_data_t tfm_peripheral_regulators;
72 extern struct platform_data_t tfm_peripheral_clock;
73 extern struct platform_data_t tfm_peripheral_power;
74 extern struct platform_data_t tfm_peripheral_spim0;
75 extern struct platform_data_t tfm_peripheral_spis0;
76 extern struct platform_data_t tfm_peripheral_twim0;
77 extern struct platform_data_t tfm_peripheral_twis0;
78 extern struct platform_data_t tfm_peripheral_uarte0;
79 extern struct platform_data_t tfm_peripheral_spim1;
80 extern struct platform_data_t tfm_peripheral_spis1;
81 extern struct platform_data_t tfm_peripheral_twim1;
82 extern struct platform_data_t tfm_peripheral_twis1;
83 extern struct platform_data_t tfm_peripheral_uarte1;
84 extern struct platform_data_t tfm_peripheral_spim2;
85 extern struct platform_data_t tfm_peripheral_spis2;
86 extern struct platform_data_t tfm_peripheral_twim2;
87 extern struct platform_data_t tfm_peripheral_twis2;
88 extern struct platform_data_t tfm_peripheral_uarte2;
89 extern struct platform_data_t tfm_peripheral_spim3;
90 extern struct platform_data_t tfm_peripheral_spis3;
91 extern struct platform_data_t tfm_peripheral_twim3;
92 extern struct platform_data_t tfm_peripheral_twis3;
93 extern struct platform_data_t tfm_peripheral_uarte3;
94 extern struct platform_data_t tfm_peripheral_saadc;
95 extern struct platform_data_t tfm_peripheral_timer0;
96 extern struct platform_data_t tfm_peripheral_timer1;
97 extern struct platform_data_t tfm_peripheral_timer2;
98 extern struct platform_data_t tfm_peripheral_rtc0;
99 extern struct platform_data_t tfm_peripheral_rtc1;
100 extern struct platform_data_t tfm_peripheral_dppi;
101 extern struct platform_data_t tfm_peripheral_wdt;
102 extern struct platform_data_t tfm_peripheral_egu0;
103 extern struct platform_data_t tfm_peripheral_egu1;
104 extern struct platform_data_t tfm_peripheral_egu2;
105 extern struct platform_data_t tfm_peripheral_egu3;
106 extern struct platform_data_t tfm_peripheral_egu4;
107 extern struct platform_data_t tfm_peripheral_egu5;
108 extern struct platform_data_t tfm_peripheral_pwm0;
109 extern struct platform_data_t tfm_peripheral_pwm1;
110 extern struct platform_data_t tfm_peripheral_pwm2;
111 extern struct platform_data_t tfm_peripheral_pwm3;
112 extern struct platform_data_t tfm_peripheral_pdm;
113 extern struct platform_data_t tfm_peripheral_i2s;
114 extern struct platform_data_t tfm_peripheral_ipc;
115 extern struct platform_data_t tfm_peripheral_fpu;
116 extern struct platform_data_t tfm_peripheral_nvmc;
117 extern struct platform_data_t tfm_peripheral_vmc;
118 extern struct platform_data_t tfm_peripheral_gpio0;
119 
120 
121 #define TFM_PERIPHERAL_REGULATORS   (&tfm_peripheral_regulators)
122 #define TFM_PERIPHERAL_CLOCK        (&tfm_peripheral_clock)
123 #define TFM_PERIPHERAL_POWER        (&tfm_peripheral_power)
124 #define TFM_PERIPHERAL_SPIM0        (&tfm_peripheral_spim0)
125 #define TFM_PERIPHERAL_SPIS0        (&tfm_peripheral_spis0)
126 #define TFM_PERIPHERAL_TWIM0        (&tfm_peripheral_twim0)
127 #define TFM_PERIPHERAL_TWIS0        (&tfm_peripheral_twis0)
128 #define TFM_PERIPHERAL_UARTE0       (&tfm_peripheral_uarte0)
129 #define TFM_PERIPHERAL_SPIM1        (&tfm_peripheral_spim1)
130 #define TFM_PERIPHERAL_SPIS1        (&tfm_peripheral_spis1)
131 #define TFM_PERIPHERAL_TWIM1        (&tfm_peripheral_twim1)
132 #define TFM_PERIPHERAL_TWIS1        (&tfm_peripheral_twis1)
133 #define TFM_PERIPHERAL_UARTE1       (&tfm_peripheral_uarte1)
134 #define TFM_PERIPHERAL_SPIM2        (&tfm_peripheral_spim2)
135 #define TFM_PERIPHERAL_SPIS2        (&tfm_peripheral_spis2)
136 #define TFM_PERIPHERAL_TWIM2        (&tfm_peripheral_twim2)
137 #define TFM_PERIPHERAL_TWIS2        (&tfm_peripheral_twis2)
138 #define TFM_PERIPHERAL_UARTE2       (&tfm_peripheral_uarte2)
139 #define TFM_PERIPHERAL_SPIM3        (&tfm_peripheral_spim3)
140 #define TFM_PERIPHERAL_SPIS3        (&tfm_peripheral_spis3)
141 #define TFM_PERIPHERAL_TWIM3        (&tfm_peripheral_twim3)
142 #define TFM_PERIPHERAL_TWIS3        (&tfm_peripheral_twis3)
143 #define TFM_PERIPHERAL_UARTE3       (&tfm_peripheral_uarte3)
144 #define TFM_PERIPHERAL_SAADC        (&tfm_peripheral_saadc)
145 #define TFM_PERIPHERAL_TIMER0       (&tfm_peripheral_timer0)
146 #define TFM_PERIPHERAL_TIMER1       (&tfm_peripheral_timer1)
147 #define TFM_PERIPHERAL_TIMER2       (&tfm_peripheral_timer2)
148 #define TFM_PERIPHERAL_RTC0         (&tfm_peripheral_rtc0)
149 #define TFM_PERIPHERAL_RTC1         (&tfm_peripheral_rtc1)
150 #define TFM_PERIPHERAL_DPPI         (&tfm_peripheral_dppi)
151 #define TFM_PERIPHERAL_WDT          (&tfm_peripheral_wdt)
152 #define TFM_PERIPHERAL_EGU0         (&tfm_peripheral_egu0)
153 #define TFM_PERIPHERAL_EGU1         (&tfm_peripheral_egu1)
154 #define TFM_PERIPHERAL_EGU2         (&tfm_peripheral_egu2)
155 #define TFM_PERIPHERAL_EGU3         (&tfm_peripheral_egu3)
156 #define TFM_PERIPHERAL_EGU4         (&tfm_peripheral_egu4)
157 #define TFM_PERIPHERAL_EGU5         (&tfm_peripheral_egu5)
158 #define TFM_PERIPHERAL_PWM0         (&tfm_peripheral_pwm0)
159 #define TFM_PERIPHERAL_PWM1         (&tfm_peripheral_pwm1)
160 #define TFM_PERIPHERAL_PWM2         (&tfm_peripheral_pwm2)
161 #define TFM_PERIPHERAL_PWM3         (&tfm_peripheral_pwm3)
162 #define TFM_PERIPHERAL_PDM          (&tfm_peripheral_pdm)
163 #define TFM_PERIPHERAL_I2S          (&tfm_peripheral_i2s)
164 #define TFM_PERIPHERAL_IPC          (&tfm_peripheral_ipc)
165 #define TFM_PERIPHERAL_FPU          (&tfm_peripheral_fpu)
166 #define TFM_PERIPHERAL_NVMC         (&tfm_peripheral_nvmc)
167 #define TFM_PERIPHERAL_VMC          (&tfm_peripheral_vmc)
168 #define TFM_PERIPHERAL_GPIO0        (&tfm_peripheral_gpio0)
169 
170 #define TFM_PERIPHERAL_STD_UART     TFM_PERIPHERAL_UARTE1
171 
172 #ifdef PSA_API_TEST_IPC
173 #define FF_TEST_UART_IRQ         (EGU5_IRQn)
174 #define FF_TEST_UART_IRQ_Handler (pal_interrupt_handler)
175 
176 extern struct platform_data_t tfm_peripheral_FF_TEST_NVMEM_REGION;
177 extern struct platform_data_t tfm_peripheral_FF_TEST_SERVER_PARTITION_MMIO;
178 extern struct platform_data_t tfm_peripheral_FF_TEST_DRIVER_PARTITION_MMIO;
179 
180 #define FF_TEST_UART_REGION           (&tfm_peripheral_std_uart)
181 #define FF_TEST_WATCHDOG_REGION       (&tfm_peripheral_timer0)
182 #define FF_TEST_NVMEM_REGION          (&tfm_peripheral_FF_TEST_NVMEM_REGION)
183 #define FF_TEST_SERVER_PARTITION_MMIO (&tfm_peripheral_FF_TEST_SERVER_PARTITION_MMIO)
184 #define FF_TEST_DRIVER_PARTITION_MMIO (&tfm_peripheral_FF_TEST_DRIVER_PARTITION_MMIO)
185 #endif /* PSA_API_TEST_IPC */
186 
187 /*
188  * Quantized default IRQ priority, the value is:
189  * (Number of configurable priority) / 4: (1UL << __NVIC_PRIO_BITS) / 4
190  */
191 #define DEFAULT_IRQ_PRIORITY    (1UL << (__NVIC_PRIO_BITS - 2))
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #endif /* __TFM_PERIPHERALS_DEF_H__ */
198