1 /*
2  * Copyright (c) 2024, Nordic Semiconductor ASA
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice, this
11  *    list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18  *    contributors may be used to endorse or promote products derived from this
19  *    software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  */
34 
35 /**
36  * @brief Module that defines the 802.15.4 driver peripheral usage for nRF54H family.
37  *
38  */
39 
40 #ifndef NRF_802154_PERIPHERALS_NRF54H_H__
41 #define NRF_802154_PERIPHERALS_NRF54H_H__
42 
43 #include <nrfx.h>
44 #include "nrf_802154_config.h"
45 #include "nrf_802154_sl_periphs.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 /**
52  * @def NRF_802154_EGU_INSTANCE_NO
53  *
54  * Id of the EGU instance used by the driver to synchronize DPPIs and for requests and
55  * notifications if SWI is in use.
56  *
57  */
58 #ifndef NRF_802154_EGU_INSTANCE_NO
59 #define NRF_802154_EGU_INSTANCE_NO 020
60 #endif
61 
62 /**
63  * @def NRF_802154_EGU_INSTANCE
64  *
65  * The EGU instance used by the driver to synchronize PPIs and for requests and notifications if
66  * SWI is in use.
67  *
68  * @note This option is used by the core module regardless of the driver configuration.
69  *
70  */
71 #define NRF_802154_EGU_INSTANCE NRFX_CONCAT_2(NRF_EGU, NRF_802154_EGU_INSTANCE_NO)
72 
73 /**
74  * @def NRF_802154_EGU_IRQ_HANDLER
75  *
76  * The EGU IRQ handler used by the driver for requests and notifications if SWI is in use.
77  *
78  * @note This option is used when the driver uses SWI to process requests and notifications.
79  *
80  */
81 #define NRF_802154_EGU_IRQ_HANDLER \
82     NRFX_CONCAT_3(EGU, NRF_802154_EGU_INSTANCE_NO, _IRQHandler)
83 
84 /**
85  * @def NRF_802154_EGU_USED_MASK
86  *
87  * Bit mask of instances of SWI/EGU peripherals used by the 802.15.4 driver.
88  */
89 #ifndef NRF_802154_EGU_USED_MASK
90 #define NRF_802154_EGU_USED_MASK (1 << NRF_802154_EGU_INSTANCE_NO)
91 #endif
92 
93 /**
94  * @def NRF_802154_CCM_INSTANCE_NO
95  *
96  * Id of the CCM instance used by the driver to encrypt outgoing frames.
97  *
98  * @note This option is used when @ref NRF_802154_ENCRYPTION_ENABLED is set.
99  *
100  */
101 #define NRF_802154_CCM_INSTANCE_NO 030
102 
103 /**
104  * @def NRF_802154_CCM_INSTANCE
105  *
106  * The CCM instance used by the driver to encrypt outgoing frames.
107  *
108  * @note This option is used when @ref NRF_802154_ENCRYPTION_ENABLED is set.
109  *
110  */
111 #define NRF_802154_CCM_INSTANCE    NRFX_CONCAT_2(NRF_CCM, NRF_802154_CCM_INSTANCE_NO)
112 
113 /**
114  * @def NRF_802154_RTC_INSTANCE_NO
115  *
116  * Number of the RTC instance used in the standalone timer driver implementation.
117  *
118  */
119 #ifndef NRF_802154_RTC_INSTANCE_NO
120 #define NRF_802154_RTC_INSTANCE_NO 2
121 #endif
122 
123 /**
124  * @def NRF_802154_DPPIC_INSTANCE_NO
125  *
126  * Id of the DPPIC instance used by the driver to connect peripherals to radio.
127  *
128  */
129 #define NRF_802154_DPPIC_INSTANCE_NO 020
130 
131 /**
132  * @def NRF_802154_DPPIC_INSTANCE
133  *
134  * The DPPIC instance used by the driver to connect peripherals to radio.
135  *
136  */
137 #define NRF_802154_DPPIC_INSTANCE    NRFX_CONCAT_2(NRF_DPPIC, NRF_802154_DPPIC_INSTANCE_NO)
138 
139 /**
140  * @def NRF_802154_DPPI_RADIO_DISABLED
141  *
142  * The DPPI channel that publishes RADIO_DISABLED event.
143  *
144  * @note This option is used by the core module regardless of the driver configuration.
145  *
146  */
147 #ifndef NRF_802154_DPPI_RADIO_DISABLED
148 #define NRF_802154_DPPI_RADIO_DISABLED 7U
149 #endif
150 
151 /**
152  * @def NRF_802154_DPPI_RADIO_READY
153  *
154  * The DPPI channel that publishes RADIO_READY event.
155  *
156  * @note This option is used by the core module regardless of the driver configuration.
157  *
158  */
159 #ifndef NRF_802154_DPPI_RADIO_READY
160 #define NRF_802154_DPPI_RADIO_READY 4U
161 #endif
162 
163 /**
164  * @def NRF_802154_DPPI_RADIO_ADDRESS
165  *
166  * The DPPI channel that publishes RADIO_ADDRESS event.
167  *
168  * @note This option is used by the core module regardless of the driver configuration.
169  *
170  */
171 #ifndef NRF_802154_DPPI_RADIO_ADDRESS
172 #define NRF_802154_DPPI_RADIO_ADDRESS 5U
173 #endif
174 
175 /**
176  * @def NRF_802154_DPPI_RADIO_END
177  *
178  * The DPPI channel that publishes RADIO_END event.
179  *
180  * @note This option is used by the core module regardless of the driver configuration.
181  *
182  */
183 #ifndef NRF_802154_DPPI_RADIO_END
184 #define NRF_802154_DPPI_RADIO_END 6U
185 #endif
186 
187 /**
188  * @def NRF_802154_DPPI_RADIO_PHYEND
189  *
190  * The DPPI channel that publishes RADIO_PHYEND event.
191  *
192  * @note This option is used by the core module regardless of the driver configuration.
193  *
194  */
195 #ifndef NRF_802154_DPPI_RADIO_PHYEND
196 #define NRF_802154_DPPI_RADIO_PHYEND 12U
197 #endif
198 
199 /**
200  * @def NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP
201  *
202  * The DPPI channel that connects EGU event to RADIO_TXEN or RADIO_RXEN task.
203  *
204  * @note This option is used by the core module regardless of the driver configuration.
205  *       The peripheral is shared with @ref NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP.
206  *
207  */
208 #ifndef NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP
209 #define NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP 10U
210 #endif
211 
212 /**
213  * @def NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN
214  *
215  * The DPPI channel that connects TIMER_COMPARE event to RADIO_TXEN task.
216  *
217  * @note This option is used by the core module regardless of the driver configuration.
218  *       The peripheral is shared with @ref NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP.
219  *
220  */
221 #ifndef NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN
222 #define NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN 10U
223 #endif
224 
225 /**
226  * @def NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC
227  *
228  * The DPPI channel that connects RADIO_SYNC event to EGU_SYNC task.
229  * EGU_SYNC task belongs to one of EGU channels
230  *
231  */
232 #ifndef NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC
233 #define NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC 8U
234 #endif
235 
236 /**
237  * @def NRF_802154_DPPI_RADIO_CCAIDLE
238  *
239  * The DPPI channel that RADIO.CCAIDLE event publishes to
240  */
241 #ifndef NRF_802154_DPPI_RADIO_CCAIDLE
242 #define NRF_802154_DPPI_RADIO_CCAIDLE 14U
243 #endif
244 
245 /**
246  * @def NRF_802154_DPPI_RADIO_CCABUSY
247  *
248  * The DPPI channel that RADIO.CCABUSY event publishes to
249  */
250 #ifndef NRF_802154_DPPI_RADIO_CCABUSY
251 #define NRF_802154_DPPI_RADIO_CCABUSY 3U
252 #endif
253 
254 /**
255  * @def NRF_802154_DPPI_RADIO_HW_TRIGGER
256  *
257  * The DPPI channel that triggers radio.
258  */
259 #ifndef NRF_802154_DPPI_RADIO_HW_TRIGGER
260 #define NRF_802154_DPPI_RADIO_HW_TRIGGER 15U
261 #endif
262 
263 /**
264  * @def NRF_802154_DPPI_CHANNELS_USED_MASK
265  *
266  * Bit mask of DPPI channels used by the 802.15.4 driver.
267  */
268 #ifndef NRF_802154_DPPI_CHANNELS_USED_MASK
269 #define NRF_802154_DPPI_CHANNELS_USED_MASK (                   \
270         (1UL << NRF_802154_DPPI_RADIO_DISABLED) |              \
271         (1UL << NRF_802154_DPPI_RADIO_READY) |                 \
272         (1UL << NRF_802154_DPPI_RADIO_ADDRESS) |               \
273         (1UL << NRF_802154_DPPI_RADIO_END) |                   \
274         (1UL << NRF_802154_DPPI_RADIO_PHYEND) |                \
275         (1UL << NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP) |        \
276         (1UL << NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN) | \
277         (1UL << NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC) |      \
278         (1UL << NRF_802154_DPPI_RADIO_CCAIDLE) |               \
279         (1UL << NRF_802154_DPPI_RADIO_CCABUSY) |               \
280         (1UL << NRF_802154_DPPI_RADIO_HW_TRIGGER) |            \
281         NRF_802154_SL_PPI_CHANNELS_USED_MASK)
282 #endif // NRF_802154_DPPI_CHANNELS_USED_MASK
283 
284 /**
285  * @def NRF_802154_DPPI_GROUPS_USED_MASK
286  *
287  * Bit mask of DPPI groups identifiers used by the 802.15.4 driver.
288  */
289 #ifndef NRF_802154_DPPI_GROUPS_USED_MASK
290 #define NRF_802154_DPPI_GROUPS_USED_MASK 0UL
291 #endif // NRF_802154_DPPI_GROUPS_USED_MASK
292 
293 /**
294  * @def NRF_802154_TIMER_INSTANCE_NO
295  *
296  * Number of the timer instance used both by the driver for ACK IFS and by the FEM module.
297  *
298  */
299 #define NRF_802154_TIMER_INSTANCE_NO 022
300 
301 #ifdef __cplusplus
302 }
303 #endif
304 
305 #endif // NRF_802154_PERIPHERALS_NRF54H_H__
306