1 /*
2  * Copyright (c) 2019, 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 nRF53 family.
37  *
38  */
39 
40 #ifndef NRF_802154_PERIPHERALS_NRF53_H__
41 #define NRF_802154_PERIPHERALS_NRF53_H__
42 
43 #include <nrfx.h>
44 #include "nrf_802154_config.h"
45 #include "nrf_802154_debug.h"
46 #include "nrf_802154_sl_periphs.h"
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 /**
53  * @def NRF_802154_EGU_INSTANCE_NO
54  *
55  * Id of the EGU instance used by the driver to synchronize DPPIs and for requests and
56  * notifications if SWI is in use.
57  *
58  */
59 #ifndef NRF_802154_EGU_INSTANCE_NO
60 #define NRF_802154_EGU_INSTANCE_NO 0
61 #endif
62 
63 /**
64  * @def NRF_802154_EGU_INSTANCE
65  *
66  * The EGU instance used by the driver to synchronize PPIs and for requests and notifications if
67  * SWI is in use.
68  *
69  * @note This option is used by the core module regardless of the driver configuration.
70  *
71  */
72 #define NRF_802154_EGU_INSTANCE NRFX_CONCAT_2(NRF_EGU, NRF_802154_EGU_INSTANCE_NO)
73 
74 /**
75  * @def NRF_802154_EGU_IRQ_HANDLER
76  *
77  * The EGU IRQ handler used by the driver for requests and notifications if SWI is in use.
78  *
79  * @note This option is used when the driver uses SWI to process requests and notifications.
80  *
81  */
82 #define NRF_802154_EGU_IRQ_HANDLER \
83     NRFX_CONCAT_3(EGU, NRF_802154_EGU_INSTANCE_NO, _IRQHandler)
84 
85 /**
86  * @def NRF_802154_EGU_USED_MASK
87  *
88  * Bit mask of instances of SWI/EGU peripherals used by the 802.15.4 driver.
89  */
90 #ifndef NRF_802154_EGU_USED_MASK
91 #define NRF_802154_EGU_USED_MASK (1 << NRF_802154_EGU_INSTANCE_NO)
92 #endif
93 
94 /**
95  * @def NRF_802154_RTC_INSTANCE_NO
96  *
97  * Number of the RTC instance used in the standalone timer driver implementation.
98  *
99  */
100 #ifndef NRF_802154_RTC_INSTANCE_NO
101 #define NRF_802154_RTC_INSTANCE_NO 2
102 #endif
103 
104 /**
105  * @def NRF_802154_DPPIC_INSTANCE
106  *
107  * The DPPIC instance used by the driver to connect peripherals to radio.
108  *
109  */
110 #define NRF_802154_DPPIC_INSTANCE NRF_DPPIC
111 
112 /**
113  * @def NRF_802154_DPPI_RADIO_DISABLED
114  *
115  * The DPPI channel that publishes RADIO_DISABLED event.
116  *
117  * @note This option is used by the core module regardless of the driver configuration.
118  *
119  */
120 #ifndef NRF_802154_DPPI_RADIO_DISABLED
121 #define NRF_802154_DPPI_RADIO_DISABLED 7U
122 #endif
123 
124 /**
125  * @def NRF_802154_DPPI_RADIO_READY
126  *
127  * The DPPI channel that publishes RADIO_READY event.
128  *
129  * @note This option is used by the core module regardless of the driver configuration.
130  *
131  */
132 #ifndef NRF_802154_DPPI_RADIO_READY
133 #define NRF_802154_DPPI_RADIO_READY 4U
134 #endif
135 
136 /**
137  * @def NRF_802154_DPPI_RADIO_ADDRESS
138  *
139  * The DPPI channel that publishes RADIO_ADDRESS event.
140  *
141  * @note This option is used by the core module regardless of the driver configuration.
142  *
143  */
144 #ifndef NRF_802154_DPPI_RADIO_ADDRESS
145 #define NRF_802154_DPPI_RADIO_ADDRESS 5U
146 #endif
147 
148 /**
149  * @def NRF_802154_DPPI_RADIO_END
150  *
151  * The DPPI channel that publishes RADIO_END event.
152  *
153  * @note This option is used by the core module regardless of the driver configuration.
154  *
155  */
156 #ifndef NRF_802154_DPPI_RADIO_END
157 #define NRF_802154_DPPI_RADIO_END 6U
158 #endif
159 
160 /**
161  * @def NRF_802154_DPPI_RADIO_PHYEND
162  *
163  * The DPPI channel that publishes RADIO_PHYEND event.
164  *
165  * @note This option is used by the core module regardless of the driver configuration.
166  *
167  */
168 #ifndef NRF_802154_DPPI_RADIO_PHYEND
169 #define NRF_802154_DPPI_RADIO_PHYEND 8U
170 #endif
171 
172 /**
173  * @def NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP
174  *
175  * The DPPI channel that connects EGU event to RADIO_TXEN or RADIO_RXEN task.
176  *
177  * @note This option is used by the core module regardless of the driver configuration.
178  *       The peripheral is shared with @ref NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP.
179  *
180  */
181 #ifndef NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP
182 #define NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP 10U
183 #endif
184 
185 /**
186  * @def NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN
187  *
188  * The DPPI channel that connects TIMER_COMPARE event to RADIO_TXEN task.
189  *
190  * @note This option is used by the core module regardless of the driver configuration.
191  *       The peripheral is shared with @ref NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP.
192  *
193  */
194 #ifndef NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN
195 #define NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN 10U
196 #endif
197 
198 /**
199  * @def NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC
200  *
201  * The DPPI channel that connects RADIO_SYNC event to EGU_SYNC task.
202  * EGU_SYNC task belongs to one of EGU channels
203  *
204  */
205 #ifndef NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC
206 #define NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC 12U
207 #endif
208 
209 /**
210  * @def NRF_802154_DPPI_RADIO_CCAIDLE
211  *
212  * The DPPI channel that RADIO.CCAIDLE event publishes to
213  */
214 #ifndef NRF_802154_DPPI_RADIO_CCAIDLE
215 #define NRF_802154_DPPI_RADIO_CCAIDLE 14U
216 #endif
217 
218 /**
219  * @def NRF_802154_DPPI_RADIO_CCABUSY
220  *
221  * The DPPI channel that RADIO.CCABUSY event publishes to
222  */
223 #ifndef NRF_802154_DPPI_RADIO_CCABUSY
224 #define NRF_802154_DPPI_RADIO_CCABUSY 3U
225 #endif
226 
227 /**
228  * @def NRF_802154_DPPI_RADIO_TEST_MODE_USED_MASK
229  *
230  * Helper bit mask of DPPI channels used by the 802.15.4 driver's test mode.
231  */
232 #define NRF_802154_DPPI_RADIO_TEST_MODE_USED_MASK 0U
233 
234 /**
235  * @def NRF_802154_DPPI_RADIO_HW_TRIGGER
236  *
237  * The DPPI channel that triggers radio
238  */
239 #ifndef NRF_802154_DPPI_RADIO_HW_TRIGGER
240 #define NRF_802154_DPPI_RADIO_HW_TRIGGER 15U
241 #endif
242 
243 /**
244  * @def NRF_802154_DPPI_CHANNELS_USED_MASK
245  *
246  * Bit mask of DPPI channels used by the 802.15.4 driver.
247  */
248 #ifndef NRF_802154_DPPI_CHANNELS_USED_MASK
249 #define NRF_802154_DPPI_CHANNELS_USED_MASK (                   \
250         (1UL << NRF_802154_DPPI_RADIO_DISABLED) |              \
251         (1UL << NRF_802154_DPPI_RADIO_READY) |                 \
252         (1UL << NRF_802154_DPPI_RADIO_ADDRESS) |               \
253         (1UL << NRF_802154_DPPI_RADIO_END) |                   \
254         (1UL << NRF_802154_DPPI_RADIO_PHYEND) |                \
255         (1UL << NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP) |        \
256         (1UL << NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN) | \
257         (1UL << NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC) |      \
258         (1UL << NRF_802154_DPPI_RADIO_CCAIDLE) |               \
259         (1UL << NRF_802154_DPPI_RADIO_CCABUSY) |               \
260         (1UL << NRF_802154_DPPI_RADIO_HW_TRIGGER) |            \
261         NRF_802154_DPPI_RADIO_TEST_MODE_USED_MASK |            \
262         NRF_802154_SL_PPI_CHANNELS_USED_MASK)
263 #endif // NRF_802154_DPPI_CHANNELS_USED_MASK
264 
265 /**
266  * @def NRF_802154_DPPI_GROUPS_USED_MASK
267  *
268  * Bit mask of DPPI groups identifiers used by the 802.15.4 driver.
269  */
270 #ifndef NRF_802154_DPPI_GROUPS_USED_MASK
271 #define NRF_802154_DPPI_GROUPS_USED_MASK 0UL
272 #endif // NRF_802154_DPPI_GROUPS_USED_MASK
273 
274 #ifdef __cplusplus
275 }
276 #endif
277 
278 #endif // NRF_802154_PERIPHERALS_NRF53_H__
279