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. 37 * 38 */ 39 40 #ifndef NRF_802154_PERIPHERALS_H__ 41 #define NRF_802154_PERIPHERALS_H__ 42 43 #include <nrfx.h> 44 #include "nrf_802154_config.h" 45 #include "nrf_802154_debug.h" 46 #include "nrf_802154_debug_core.h" 47 48 #if defined(NRF52_SERIES) 49 #include "nrf_802154_peripherals_nrf52.h" 50 #elif defined(NRF5340_XXAA) 51 #include "nrf_802154_peripherals_nrf53.h" 52 #elif defined(NRF54L_SERIES) 53 #include "nrf_802154_peripherals_nrf54l.h" 54 #elif defined(NRF54H_SERIES) 55 #include "nrf_802154_peripherals_nrf54h.h" 56 #endif 57 58 #ifdef NRF_802154_USE_INTERNAL_INCLUDES 59 #include "nrf_802154_peripherals_internal.h" 60 #endif 61 62 #ifdef __cplusplus 63 extern "C" { 64 #endif 65 66 /** 67 * @def NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO 68 * 69 * Number of the timer instance used for precise frame timestamps and synchronous radio operations. 70 * 71 */ 72 #ifndef NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO 73 #define NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO 1 74 #endif 75 76 /** 77 * @def NRF_802154_HIGH_PRECISION_TIMER_INSTANCE 78 * 79 * The timer instance used for precise frame timestamps and synchronous radio operations. 80 * 81 */ 82 #define NRF_802154_HIGH_PRECISION_TIMER_INSTANCE \ 83 NRFX_CONCAT_2(NRF_TIMER, NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO) 84 85 /** 86 * @def NRF_802154_TIMER_INSTANCE_NO 87 * 88 * Number of the timer instance used both by the driver for ACK IFS and by the FEM module. 89 * 90 */ 91 #ifndef NRF_802154_TIMER_INSTANCE_NO 92 #define NRF_802154_TIMER_INSTANCE_NO 0 93 #endif 94 95 /** 96 * @def NRF_802154_TIMER_INSTANCE 97 * 98 * The timer instance used both by the driver for ACK IFS and by the FEM module. 99 * 100 */ 101 #define NRF_802154_TIMER_INSTANCE \ 102 NRFX_CONCAT_2(NRF_TIMER, NRF_802154_TIMER_INSTANCE_NO) 103 104 /** 105 * @def NRF_802154_RTC_INSTANCE 106 * 107 * The RTC instance used in the standalone timer driver implementation. 108 * 109 * @note This configuration is only applicable for the Low Power Timer Abstraction Layer 110 * implementation in nrf_802154_lp_timer_nodrv.c. 111 * 112 */ 113 #define NRF_802154_RTC_INSTANCE NRFX_CONCAT_2(NRF_RTC, NRF_802154_RTC_INSTANCE_NO) 114 115 /** 116 * @def NRF_802154_RTC_IRQ_HANDLER 117 * 118 * The RTC interrupt handler name used in the standalone timer driver implementation. 119 * 120 * @note This configuration is only applicable for Low Power Timer Abstraction Layer implementation 121 * in nrf_802154_lp_timer_nodrv.c. 122 * 123 */ 124 #define NRF_802154_RTC_IRQ_HANDLER NRFX_CONCAT_3(RTC, NRF_802154_RTC_INSTANCE_NO, _IRQHandler) 125 126 /** 127 * @def NRF_802154_RTC_IRQN 128 * 129 * The RTC Interrupt number used in the standalone timer driver implementation. 130 * 131 * @note This configuration is only applicable for the Low Power Timer Abstraction Layer implementation 132 * in nrf_802154_lp_timer_nodrv.c. 133 * 134 */ 135 #define NRF_802154_RTC_IRQN NRFX_CONCAT_3(RTC, NRF_802154_RTC_INSTANCE_NO, _IRQn) 136 137 /** 138 * @def NRF_802154_TIMERS_USED_MASK 139 * 140 * Bit mask of instances of timer peripherals used by the 802.15.4 driver. 141 */ 142 #ifndef NRF_802154_TIMERS_USED_MASK 143 #define NRF_802154_TIMERS_USED_MASK ((1 << NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO) | \ 144 (1 << NRF_802154_TIMER_INSTANCE_NO)) 145 #endif // NRF_802154_TIMERS_USED_MASK 146 147 /** 148 * @def NRF_802154_RTC_USED_MASK 149 * 150 * Bit mask of instances of RTC peripherals used by the 802.15.4 driver. 151 */ 152 #ifndef NRF_802154_RTC_USED_MASK 153 #define NRF_802154_RTC_USED_MASK (1 << NRF_802154_RTC_INSTANCE_NO) 154 #endif 155 156 /** 157 * @def NRF_802154_GPIO_PINS_USED_MASK 158 * 159 * Bit mask of GPIO pins used by the 802.15.4 driver. 160 */ 161 #ifndef NRF_802154_GPIO_PINS_USED_MASK 162 #define NRF_802154_GPIO_PINS_USED_MASK NRF_802154_DEBUG_PINS_USED_MASK 163 #endif // NRF_802154_GPIO_PINS_USED_MASK 164 165 /** 166 * @def NRF_802154_GPIOTE_CHANNELS_USED_MASK 167 * 168 * Bit mask of GPIOTE peripherals used by the 802.15.4 driver. 169 */ 170 #ifndef NRF_802154_GPIOTE_CHANNELS_USED_MASK 171 #define NRF_802154_GPIOTE_CHANNELS_USED_MASK NRF_802154_DEBUG_GPIOTE_CHANNELS_USED_MASK 172 #endif // NRF_802154_GPIOTE_CHANNELS_USED_MASK 173 174 /** 175 * @def NRF_802154_EGU_NOTIFICATION_USED_CHANNELS_MASK 176 * 177 * Mask of EGU channels used by the "notification" module. 178 * See @ref NRF_802154_EGU_USED_CHANNELS_MASK. 179 */ 180 181 #if NRF_802154_NOTIFICATION_IMPL == NRF_802154_NOTIFICATION_IMPL_SWI 182 /** 183 * @def NRF_802154_EGU_NOTIFICATION_CHANNEL_NO 184 * 185 * The channel number of the @ref NRF_802154_EGU_INSTANCE used by the 186 * "swi" implementation of the "notification" module. 187 */ 188 #ifndef NRF_802154_EGU_NOTIFICATION_CHANNEL_NO 189 #define NRF_802154_EGU_NOTIFICATION_CHANNEL_NO 0 190 #endif // NRF_802154_EGU_NOTIFICATION_SWI_CHANNEL_NO 191 192 #define NRF_802154_EGU_NOTIFICATION_USED_CHANNELS_MASK \ 193 (1U << NRF_802154_EGU_NOTIFICATION_CHANNEL_NO) 194 #else 195 #define NRF_802154_EGU_NOTIFICATION_USED_CHANNELS_MASK 0U 196 #endif 197 198 /** 199 * @def NRF_802154_EGU_REQUEST_USED_CHANNELS_MASK 200 * 201 * Mask of EGU channels used by the "request" module. 202 * See @ref NRF_802154_EGU_USED_CHANNELS_MASK. 203 */ 204 205 #if NRF_802154_REQUEST_IMPL == NRF_802154_REQUEST_IMPL_SWI 206 /** 207 * @def NRF_802154_EGU_REQUEST_CHANNEL_NO 208 * 209 * The channel number of the @ref NRF_802154_EGU_INSTANCE used by the 210 * "swi" implementation of the "request" module. 211 */ 212 #ifndef NRF_802154_EGU_REQUEST_CHANNEL_NO 213 #define NRF_802154_EGU_REQUEST_CHANNEL_NO 2 214 #endif // NRF_802154_EGU_REQUEST_CHANNEL_NO 215 #define NRF_802154_EGU_REQUEST_USED_CHANNELS_MASK (1U << NRF_802154_EGU_REQUEST_CHANNEL_NO) 216 #else 217 #define NRF_802154_EGU_REQUEST_USED_CHANNELS_MASK 0U 218 #endif 219 220 /** 221 * @def NRF_802154_EGU_SYNC_CHANNEL_NO 222 * 223 * The channel number of the @ref NRF_802154_EGU_INSTANCE used for generation 224 * of an interrupt by the RADIO.EVENTS_SYNC event. 225 * 226 */ 227 #define NRF_802154_EGU_SYNC_CHANNEL_NO 3 228 229 /** 230 * @def NRF_802154_EGU_SYNC_USED_CHANNELS_MASK 231 * 232 * Mask of EGU channels used by the interrupt generation from the RADIO.EVENTS_SYNC event. 233 * See @ref NRF_802154_EGU_USED_CHANNELS_MASK. 234 */ 235 #define NRF_802154_EGU_SYNC_USED_CHANNELS_MASK (1U << NRF_802154_EGU_SYNC_CHANNEL_NO) 236 237 /** 238 * @def NRF_802154_EGU_RAMP_UP_CHANNEL_NO 239 * 240 * The channel number of the @ref NRF_802154_EGU_INSTANCE used for triggering the ramp-up of the RADIO. 241 */ 242 #define NRF_802154_EGU_RAMP_UP_CHANNEL_NO 15 243 244 /** 245 * @def NRF_802154_EGU_RAMP_UP_USED_CHANNELS_MASK 246 * 247 * Mask of EGU channels used for triggering the ramp-up of the RADIO. 248 * See @ref NRF_802154_EGU_USED_CHANNELS_MASK. 249 */ 250 #define NRF_802154_EGU_RAMP_UP_USED_CHANNELS_MASK (1U << NRF_802154_EGU_RAMP_UP_CHANNEL_NO) 251 252 /** 253 * @def NRF_802154_EGU_RAMP_UP_EVENT 254 * 255 * The EGU event used by the driver to trigger radio ramp-up. 256 */ 257 #define NRF_802154_EGU_RAMP_UP_EVENT NRFX_CONCAT_2(NRF_EGU_EVENT_TRIGGERED, \ 258 NRF_802154_EGU_RAMP_UP_CHANNEL_NO) 259 260 /** 261 * @def NRF_802154_EGU_RAMP_UP_TASK 262 * 263 * The EGU task used by the driver to trigger radio ramp-up. 264 */ 265 #define NRF_802154_EGU_RAMP_UP_TASK NRFX_CONCAT_2(NRF_EGU_TASK_TRIGGER, \ 266 NRF_802154_EGU_RAMP_UP_CHANNEL_NO) 267 268 /** 269 * @def NRF_802154_EGU_USED_CHANNELS_MASK 270 * 271 * The mask of fixed channels of the @ref NRF_802154_EGU_INSTANCE used by the 272 * nRF 802.15.4 Radio Driver. 273 */ 274 #define NRF_802154_EGU_USED_CHANNELS_MASK \ 275 (NRF_802154_EGU_NOTIFICATION_USED_CHANNELS_MASK | \ 276 NRF_802154_EGU_REQUEST_USED_CHANNELS_MASK | \ 277 NRF_802154_EGU_SYNC_USED_CHANNELS_MASK | \ 278 NRF_802154_EGU_RAMP_UP_USED_CHANNELS_MASK | \ 279 NRF_802154_SL_EGU_USED_CHANNELS_MASK) 280 281 #ifdef __cplusplus 282 } 283 #endif 284 285 #endif // NRF_802154_PERIPHERALS_H__ 286