1 /*
2  * Copyright (c) 2018-2021, 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  * Copyright (c) 2021, Laird Connectivity. All rights reserved.
6  *
7  * SPDX-License-Identifier: BSD-3-Clause
8  *
9  */
10 
11 #ifndef __TFM_PERIPHERALS_DEF_H__
12 #define __TFM_PERIPHERALS_DEF_H__
13 
14 #include <nrf.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #define TFM_FPU_IRQ            (FPU_IRQn)
21 #define TFM_CACHE_IRQ          (CACHE_IRQn)
22 #define TFM_POWER_IRQ          (CLOCK_POWER_IRQn)
23 #define TFM_CLOCK_IRQ          (CLOCK_POWER_IRQn)
24 #define TFM_CLOCK_POWER_IRQ    (CLOCK_POWER_IRQn)
25 #define TFM_SPIM0_IRQ          (SERIAL0_IRQn)
26 #define TFM_SPIS0_IRQ          (SERIAL0_IRQn)
27 #define TFM_TWIM0_IRQ          (SERIAL0_IRQn)
28 #define TFM_TWIS0_IRQ          (SERIAL0_IRQn)
29 #define TFM_UARTE0_IRQ         (SERIAL0_IRQn)
30 #define TFM_SERIAL0_IRQ        (SERIAL0_IRQn)
31 #define TFM_SPIM1_IRQ          (SERIAL1_IRQn)
32 #define TFM_SPIS1_IRQ          (SERIAL1_IRQn)
33 #define TFM_TWIM1_IRQ          (SERIAL1_IRQn)
34 #define TFM_TWIS1_IRQ          (SERIAL1_IRQn)
35 #define TFM_UARTE1_IRQ         (SERIAL1_IRQn)
36 #define TFM_SERIAL1_IRQ        (SERIAL1_IRQn)
37 #define TFM_SPIM4_IRQ          (SPIM4_IRQn)
38 #define TFM_SPIM2_IRQ          (SERIAL2_IRQn)
39 #define TFM_SPIS2_IRQ          (SERIAL2_IRQn)
40 #define TFM_TWIM2_IRQ          (SERIAL2_IRQn)
41 #define TFM_TWIS2_IRQ          (SERIAL2_IRQn)
42 #define TFM_UARTE2_IRQ         (SERIAL2_IRQn)
43 #define TFM_SERIAL2_IRQ        (SERIAL2_IRQn)
44 #define TFM_SPIM3_IRQ          (SERIAL3_IRQn)
45 #define TFM_SPIS3_IRQ          (SERIAL3_IRQn)
46 #define TFM_TWIM3_IRQ          (SERIAL3_IRQn)
47 #define TFM_TWIS3_IRQ          (SERIAL3_IRQn)
48 #define TFM_UARTE3_IRQ         (SERIAL3_IRQn)
49 #define TFM_SERIAL3_IRQ        (SERIAL3_IRQn)
50 #define TFM_SAADC_IRQ          (SAADC_IRQn)
51 #define TFM_TIMER0_IRQ         (TIMER0_IRQn)
52 #define TFM_TIMER1_IRQ         (TIMER1_IRQn)
53 #define TFM_TIMER2_IRQ         (TIMER2_IRQn)
54 #define TFM_RTC0_IRQ           (RTC0_IRQn)
55 #define TFM_RTC1_IRQ           (RTC1_IRQn)
56 #define TFM_WDT0_IRQ           (WDT0_IRQn)
57 #define TFM_WDT1_IRQ           (WDT1_IRQn)
58 #define TFM_COMP_IRQ           (COMP_LPCOMP_IRQn)
59 #define TFM_LPCOMP_IRQ         (COMP_LPCOMP_IRQn)
60 #define TFM_COMP_LPCOMP_IRQ    (COMP_LPCOMP_IRQn)
61 #define TFM_EGU0_IRQ           (EGU0_IRQn)
62 #define TFM_EGU1_IRQ           (EGU1_IRQn)
63 #define TFM_EGU2_IRQ           (EGU2_IRQn)
64 #define TFM_EGU3_IRQ           (EGU3_IRQn)
65 #define TFM_EGU4_IRQ           (EGU4_IRQn)
66 #define TFM_EGU5_IRQ           (EGU5_IRQn)
67 #define TFM_PWM0_IRQ           (PWM0_IRQn)
68 #define TFM_PWM1_IRQ           (PWM1_IRQn)
69 #define TFM_PWM2_IRQ           (PWM2_IRQn)
70 #define TFM_PWM3_IRQ           (PWM3_IRQn)
71 #define TFM_PDM0_IRQ           (PDM0_IRQn)
72 #define TFM_I2S0_IRQ           (I2S0_IRQn)
73 #define TFM_IPC_IRQ            (IPC_IRQn)
74 #define TFM_QSPI_IRQ           (QSPI_IRQn)
75 #define TFM_NFCT_IRQ           (NFCT_IRQn)
76 #define TFM_GPIOTE0_IRQ        (GPIOTE0_IRQn)
77 #define TFM_QDEC0_IRQ          (QDEC0_IRQn)
78 #define TFM_QDEC1_IRQ          (QDEC1_IRQn)
79 #define TFM_USBD_IRQ           (USBD_IRQn)
80 #define TFM_USBREG_IRQ         (USBREGULATOR_IRQn)
81 
82 struct platform_data_t;
83 
84 extern struct platform_data_t tfm_peripheral_dcnf;
85 extern struct platform_data_t tfm_peripheral_fpu;
86 extern struct platform_data_t tfm_peripheral_oscillators;
87 extern struct platform_data_t tfm_peripheral_regulators;
88 extern struct platform_data_t tfm_peripheral_clock;
89 extern struct platform_data_t tfm_peripheral_power;
90 extern struct platform_data_t tfm_peripheral_reset;
91 extern struct platform_data_t tfm_peripheral_spim0;
92 extern struct platform_data_t tfm_peripheral_spis0;
93 extern struct platform_data_t tfm_peripheral_twim0;
94 extern struct platform_data_t tfm_peripheral_twis0;
95 extern struct platform_data_t tfm_peripheral_uarte0;
96 extern struct platform_data_t tfm_peripheral_spim1;
97 extern struct platform_data_t tfm_peripheral_spis1;
98 extern struct platform_data_t tfm_peripheral_twim1;
99 extern struct platform_data_t tfm_peripheral_twis1;
100 extern struct platform_data_t tfm_peripheral_uarte1;
101 extern struct platform_data_t tfm_peripheral_spim4;
102 extern struct platform_data_t tfm_peripheral_spim2;
103 extern struct platform_data_t tfm_peripheral_spis2;
104 extern struct platform_data_t tfm_peripheral_twim2;
105 extern struct platform_data_t tfm_peripheral_twis2;
106 extern struct platform_data_t tfm_peripheral_uarte2;
107 extern struct platform_data_t tfm_peripheral_spim3;
108 extern struct platform_data_t tfm_peripheral_spis3;
109 extern struct platform_data_t tfm_peripheral_twim3;
110 extern struct platform_data_t tfm_peripheral_twis3;
111 extern struct platform_data_t tfm_peripheral_uarte3;
112 extern struct platform_data_t tfm_peripheral_saadc;
113 extern struct platform_data_t tfm_peripheral_timer0;
114 extern struct platform_data_t tfm_peripheral_timer1;
115 extern struct platform_data_t tfm_peripheral_timer2;
116 extern struct platform_data_t tfm_peripheral_rtc0;
117 extern struct platform_data_t tfm_peripheral_rtc1;
118 extern struct platform_data_t tfm_peripheral_dppi;
119 extern struct platform_data_t tfm_peripheral_wdt0;
120 extern struct platform_data_t tfm_peripheral_wdt1;
121 extern struct platform_data_t tfm_peripheral_comp;
122 extern struct platform_data_t tfm_peripheral_lpcomp;
123 extern struct platform_data_t tfm_peripheral_egu0;
124 extern struct platform_data_t tfm_peripheral_egu1;
125 extern struct platform_data_t tfm_peripheral_egu2;
126 extern struct platform_data_t tfm_peripheral_egu3;
127 extern struct platform_data_t tfm_peripheral_egu4;
128 extern struct platform_data_t tfm_peripheral_egu5;
129 extern struct platform_data_t tfm_peripheral_pwm0;
130 extern struct platform_data_t tfm_peripheral_pwm1;
131 extern struct platform_data_t tfm_peripheral_pwm2;
132 extern struct platform_data_t tfm_peripheral_pwm3;
133 extern struct platform_data_t tfm_peripheral_pdm0;
134 extern struct platform_data_t tfm_peripheral_i2s0;
135 extern struct platform_data_t tfm_peripheral_ipc;
136 extern struct platform_data_t tfm_peripheral_qspi;
137 extern struct platform_data_t tfm_peripheral_nfct;
138 extern struct platform_data_t tfm_peripheral_mutex;
139 extern struct platform_data_t tfm_peripheral_qdec0;
140 extern struct platform_data_t tfm_peripheral_qdec1;
141 extern struct platform_data_t tfm_peripheral_usbd;
142 extern struct platform_data_t tfm_peripheral_usbreg;
143 extern struct platform_data_t tfm_peripheral_nvmc;
144 extern struct platform_data_t tfm_peripheral_gpio0;
145 extern struct platform_data_t tfm_peripheral_gpio1;
146 extern struct platform_data_t tfm_peripheral_vmc;
147 
148 #define TFM_PERIPHERAL_DCNF         (&tfm_peripheral_dcnf)
149 #define TFM_PERIPHERAL_FPU          (&tfm_peripheral_fpu)
150 #define TFM_PERIPHERAL_OSCILLATORS  (&tfm_peripheral_oscillators)
151 #define TFM_PERIPHERAL_REGULATORS   (&tfm_peripheral_regulators)
152 #define TFM_PERIPHERAL_CLOCK        (&tfm_peripheral_clock)
153 #define TFM_PERIPHERAL_POWER        (&tfm_peripheral_power)
154 #define TFM_PERIPHERAL_RESET        (&tfm_peripheral_reset)
155 #define TFM_PERIPHERAL_SPIM0        (&tfm_peripheral_spim0)
156 #define TFM_PERIPHERAL_SPIS0        (&tfm_peripheral_spis0)
157 #define TFM_PERIPHERAL_TWIM0        (&tfm_peripheral_twim0)
158 #define TFM_PERIPHERAL_TWIS0        (&tfm_peripheral_twis0)
159 #define TFM_PERIPHERAL_UARTE0       (&tfm_peripheral_uarte0)
160 #define TFM_PERIPHERAL_SPIM1        (&tfm_peripheral_spim1)
161 #define TFM_PERIPHERAL_SPIS1        (&tfm_peripheral_spis1)
162 #define TFM_PERIPHERAL_TWIM1        (&tfm_peripheral_twim1)
163 #define TFM_PERIPHERAL_TWIS1        (&tfm_peripheral_twis1)
164 #define TFM_PERIPHERAL_UARTE1       (&tfm_peripheral_uarte1)
165 #define TFM_PERIPHERAL_SPIM4        (&tfm_peripheral_spim4)
166 #define TFM_PERIPHERAL_SPIM2        (&tfm_peripheral_spim2)
167 #define TFM_PERIPHERAL_SPIS2        (&tfm_peripheral_spis2)
168 #define TFM_PERIPHERAL_TWIM2        (&tfm_peripheral_twim2)
169 #define TFM_PERIPHERAL_TWIS2        (&tfm_peripheral_twis2)
170 #define TFM_PERIPHERAL_UARTE2       (&tfm_peripheral_uarte2)
171 #define TFM_PERIPHERAL_SPIM3        (&tfm_peripheral_spim3)
172 #define TFM_PERIPHERAL_SPIS3        (&tfm_peripheral_spis3)
173 #define TFM_PERIPHERAL_TWIM3        (&tfm_peripheral_twim3)
174 #define TFM_PERIPHERAL_TWIS3        (&tfm_peripheral_twis3)
175 #define TFM_PERIPHERAL_UARTE3       (&tfm_peripheral_uarte3)
176 #define TFM_PERIPHERAL_SAADC        (&tfm_peripheral_saadc)
177 #define TFM_PERIPHERAL_TIMER0       (&tfm_peripheral_timer0)
178 #define TFM_PERIPHERAL_TIMER1       (&tfm_peripheral_timer1)
179 #define TFM_PERIPHERAL_TIMER2       (&tfm_peripheral_timer2)
180 #define TFM_PERIPHERAL_RTC0         (&tfm_peripheral_rtc0)
181 #define TFM_PERIPHERAL_RTC1         (&tfm_peripheral_rtc1)
182 #define TFM_PERIPHERAL_DPPI         (&tfm_peripheral_dppi)
183 #define TFM_PERIPHERAL_WDT0         (&tfm_peripheral_wdt0)
184 #define TFM_PERIPHERAL_WDT1         (&tfm_peripheral_wdt1)
185 #define TFM_PERIPHERAL_COMP         (&tfm_peripheral_comp)
186 #define TFM_PERIPHERAL_LPCOMP       (&tfm_peripheral_lpcomp)
187 #define TFM_PERIPHERAL_EGU0         (&tfm_peripheral_egu0)
188 #define TFM_PERIPHERAL_EGU1         (&tfm_peripheral_egu1)
189 #define TFM_PERIPHERAL_EGU2         (&tfm_peripheral_egu2)
190 #define TFM_PERIPHERAL_EGU3         (&tfm_peripheral_egu3)
191 #define TFM_PERIPHERAL_EGU4         (&tfm_peripheral_egu4)
192 #define TFM_PERIPHERAL_EGU5         (&tfm_peripheral_egu5)
193 #define TFM_PERIPHERAL_PWM0         (&tfm_peripheral_pwm0)
194 #define TFM_PERIPHERAL_PWM1         (&tfm_peripheral_pwm1)
195 #define TFM_PERIPHERAL_PWM2         (&tfm_peripheral_pwm2)
196 #define TFM_PERIPHERAL_PWM3         (&tfm_peripheral_pwm3)
197 #define TFM_PERIPHERAL_PDM0         (&tfm_peripheral_pdm0)
198 #define TFM_PERIPHERAL_I2S0         (&tfm_peripheral_i2s0)
199 #define TFM_PERIPHERAL_IPC          (&tfm_peripheral_ipc)
200 #define TFM_PERIPHERAL_QSPI         (&tfm_peripheral_qspi)
201 #define TFM_PERIPHERAL_NFCT         (&tfm_peripheral_nfct)
202 #define TFM_PERIPHERAL_MUTEX        (&tfm_peripheral_mutex)
203 #define TFM_PERIPHERAL_QDEC0        (&tfm_peripheral_qdec0)
204 #define TFM_PERIPHERAL_QDEC1        (&tfm_peripheral_qdec1)
205 #define TFM_PERIPHERAL_USBD         (&tfm_peripheral_usbd)
206 #define TFM_PERIPHERAL_USBREG       (&tfm_peripheral_usbreg)
207 #define TFM_PERIPHERAL_NVMC         (&tfm_peripheral_nvmc)
208 #define TFM_PERIPHERAL_GPIO0        (&tfm_peripheral_gpio0)
209 #define TFM_PERIPHERAL_GPIO1        (&tfm_peripheral_gpio1)
210 #define TFM_PERIPHERAL_VMC          (&tfm_peripheral_vmc)
211 
212 #define TFM_PERIPHERAL_STD_UART     TFM_PERIPHERAL_UARTE1
213 
214 #ifdef PSA_API_TEST_IPC
215 #define FF_TEST_UART_IRQ         (EGU5_IRQn)
216 #define FF_TEST_UART_IRQ_Handler (pal_interrupt_handler)
217 
218 extern struct platform_data_t tfm_peripheral_FF_TEST_NVMEM_REGION;
219 extern struct platform_data_t tfm_peripheral_FF_TEST_SERVER_PARTITION_MMIO;
220 extern struct platform_data_t tfm_peripheral_FF_TEST_DRIVER_PARTITION_MMIO;
221 
222 #define FF_TEST_UART_REGION           (&tfm_peripheral_std_uart)
223 #define FF_TEST_WATCHDOG_REGION       (&tfm_peripheral_timer0)
224 #define FF_TEST_NVMEM_REGION          (&tfm_peripheral_FF_TEST_NVMEM_REGION)
225 #define FF_TEST_SERVER_PARTITION_MMIO (&tfm_peripheral_FF_TEST_SERVER_PARTITION_MMIO)
226 #define FF_TEST_DRIVER_PARTITION_MMIO (&tfm_peripheral_FF_TEST_DRIVER_PARTITION_MMIO)
227 #endif /* PSA_API_TEST_IPC */
228 
229 #ifdef __cplusplus
230 }
231 #endif
232 
233 #endif /* __TFM_PERIPHERALS_DEF_H__ */
234