1 /* 2 * Copyright (c) 2019 - 2023, 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_IRQN 87 * 88 * The SWI EGU IRQ number used by the driver for requests and notifications if SWI is in use. 89 * 90 * @note This option is used when the driver uses SWI to process requests and notifications. 91 * 92 */ 93 #define NRF_802154_EGU_IRQN \ 94 NRFX_CONCAT_3(EGU, NRF_802154_EGU_INSTANCE_NO, _IRQn) 95 96 /** 97 * @def NRF_802154_EGU_RAMP_UP_EVENT 98 * 99 * The EGU event used by the driver to trigger radio ramp-up. 100 */ 101 #define NRF_802154_EGU_RAMP_UP_EVENT NRF_EGU_EVENT_TRIGGERED15 102 103 /** 104 * @def NRF_802154_EGU_RAMP_UP_TASK 105 * 106 * The EGU task used by the driver to trigger radio ramp-up. 107 */ 108 #define NRF_802154_EGU_RAMP_UP_TASK NRF_EGU_TASK_TRIGGER15 109 110 /** 111 * @def NRF_802154_EGU_USED_MASK 112 * 113 * Bit mask of instances of SWI/EGU peripherals used by the 802.15.4 driver. 114 */ 115 #ifndef NRF_802154_EGU_USED_MASK 116 #define NRF_802154_EGU_USED_MASK (1 << NRF_802154_EGU_INSTANCE_NO) 117 #endif 118 119 /** 120 * @def NRF_802154_RTC_INSTANCE_NO 121 * 122 * Number of the RTC instance used in the standalone timer driver implementation. 123 * 124 */ 125 #ifndef NRF_802154_RTC_INSTANCE_NO 126 #define NRF_802154_RTC_INSTANCE_NO 2 127 #endif 128 129 /** 130 * @def NRF_802154_DPPIC_INSTANCE 131 * 132 * The DPPIC instance used by the driver to connect peripherals to radio. 133 * 134 */ 135 #define NRF_802154_DPPIC_INSTANCE NRF_DPPIC 136 137 /** 138 * @def NRF_802154_DPPI_RADIO_DISABLED 139 * 140 * The DPPI channel that publishes RADIO_DISABLED event. 141 * 142 * @note This option is used by the core module regardless of the driver configuration. 143 * 144 */ 145 #ifndef NRF_802154_DPPI_RADIO_DISABLED 146 #define NRF_802154_DPPI_RADIO_DISABLED 7U 147 #endif 148 149 /** 150 * @def NRF_802154_DPPI_RADIO_READY 151 * 152 * The DPPI channel that publishes RADIO_READY event. 153 * 154 * @note This option is used by the core module regardless of the driver configuration. 155 * 156 */ 157 #ifndef NRF_802154_DPPI_RADIO_READY 158 #define NRF_802154_DPPI_RADIO_READY 4U 159 #endif 160 161 /** 162 * @def NRF_802154_DPPI_RADIO_ADDRESS 163 * 164 * The DPPI channel that publishes RADIO_ADDRESS event. 165 * 166 * @note This option is used by the core module regardless of the driver configuration. 167 * 168 */ 169 #ifndef NRF_802154_DPPI_RADIO_ADDRESS 170 #define NRF_802154_DPPI_RADIO_ADDRESS 5U 171 #endif 172 173 /** 174 * @def NRF_802154_DPPI_RADIO_END 175 * 176 * The DPPI channel that publishes RADIO_END event. 177 * 178 * @note This option is used by the core module regardless of the driver configuration. 179 * 180 */ 181 #ifndef NRF_802154_DPPI_RADIO_END 182 #define NRF_802154_DPPI_RADIO_END 6U 183 #endif 184 185 /** 186 * @def NRF_802154_DPPI_RADIO_PHYEND 187 * 188 * The DPPI channel that publishes RADIO_PHYEND event. 189 * 190 * @note This option is used by the core module regardless of the driver configuration. 191 * 192 */ 193 #ifndef NRF_802154_DPPI_RADIO_PHYEND 194 #define NRF_802154_DPPI_RADIO_PHYEND 12U 195 #endif 196 197 /** 198 * @def NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP 199 * 200 * The DPPI channel that connects EGU event to RADIO_TXEN or RADIO_RXEN task. 201 * 202 * @note This option is used by the core module regardless of the driver configuration. 203 * The peripheral is shared with @ref NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP. 204 * 205 */ 206 #ifndef NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP 207 #define NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP 10U 208 #endif 209 210 /** 211 * @def NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN 212 * 213 * The DPPI channel that connects TIMER_COMPARE event to RADIO_TXEN task. 214 * 215 * @note This option is used by the core module regardless of the driver configuration. 216 * The peripheral is shared with @ref NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP. 217 * 218 */ 219 #ifndef NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN 220 #define NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN 10U 221 #endif 222 223 /** 224 * @def NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC 225 * 226 * The DPPI channel that connects RADIO_SYNC event to EGU_SYNC task. 227 * EGU_SYNC task belongs to one of EGU channels 228 * 229 */ 230 #ifndef NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC 231 #define NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC 8U 232 #endif 233 234 /** 235 * @def NRF_802154_DPPI_RADIO_CCAIDLE 236 * 237 * The DPPI channel that RADIO.CCAIDLE event publishes to 238 */ 239 #ifndef NRF_802154_DPPI_RADIO_CCAIDLE 240 #define NRF_802154_DPPI_RADIO_CCAIDLE 9U 241 #endif 242 243 #if NRF_802154_TEST_MODES_ENABLED 244 /** 245 * @def NRF_802154_DPPI_RADIO_CCABUSY 246 * 247 * The DPPI channel that RADIO.CCABUSY event publishes to 248 */ 249 #ifndef NRF_802154_DPPI_RADIO_CCABUSY 250 #define NRF_802154_DPPI_RADIO_CCABUSY 14U 251 #endif 252 253 /** 254 * @def NRF_802154_DPPI_RADIO_TEST_MODE_USED_MASK 255 * 256 * Helper bit mask of DPPI channels used by the 802.15.4 driver's test mode. 257 */ 258 #define NRF_802154_DPPI_RADIO_TEST_MODE_USED_MASK \ 259 (1UL << NRF_802154_DPPI_RADIO_CCABUSY) 260 #else // NRF_802154_TEST_MODES_ENABLED 261 #define NRF_802154_DPPI_RADIO_TEST_MODE_USED_MASK 0U 262 #endif // NRF_802154_TEST_MODES_ENABLED 263 264 /** 265 * @def NRF_802154_DPPI_RADIO_CCABUSY 266 * 267 * The DPPI channel that triggers radio 268 */ 269 #ifndef NRF_802154_DPPI_RADIO_HW_TRIGGER 270 #define NRF_802154_DPPI_RADIO_HW_TRIGGER 15U 271 #endif 272 273 /** 274 * @def NRF_802154_DPPI_TIMESTAMPS_USED_MASK 275 * 276 * Helper bit mask of DPPI channels used by the 802.15.4 driver for timestamping. 277 */ 278 #ifdef NRF_802154_FRAME_TIMESTAMP_ENABLED 279 #define NRF_802154_DPPI_TIMESTAMPS_USED_MASK \ 280 ((1UL << NRF_802154_PPI_RTC_COMPARE_TO_TIMER_CAPTURE) | \ 281 (1UL << NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE)) 282 #else // NRF_802154_FRAME_TIMESTAMP_ENABLED 283 #define NRF_802154_DPPI_TIMESTAMPS_USED_MASK 0U 284 #endif // NRF_802154_FRAME_TIMESTAMP_ENABLED 285 286 /** 287 * @def NRF_802154_DPPI_CHANNELS_USED_MASK 288 * 289 * Bit mask of DPPI channels used by the 802.15.4 driver. 290 */ 291 #ifndef NRF_802154_DPPI_CHANNELS_USED_MASK 292 #define NRF_802154_DPPI_CHANNELS_USED_MASK ( \ 293 (1UL << NRF_802154_DPPI_RADIO_DISABLED) | \ 294 (1UL << NRF_802154_DPPI_RADIO_READY) | \ 295 (1UL << NRF_802154_DPPI_RADIO_ADDRESS) | \ 296 (1UL << NRF_802154_DPPI_RADIO_END) | \ 297 (1UL << NRF_802154_DPPI_RADIO_PHYEND) | \ 298 (1UL << NRF_802154_DPPI_EGU_TO_RADIO_RAMP_UP) | \ 299 (1UL << NRF_802154_DPPI_TIMER_COMPARE_TO_RADIO_TXEN) | \ 300 (1UL << NRF_802154_DPPI_RADIO_SYNC_TO_EGU_SYNC) | \ 301 (1UL << NRF_802154_DPPI_RADIO_CCAIDLE) | \ 302 (1UL << NRF_802154_DPPI_RADIO_HW_TRIGGER) | \ 303 NRF_802154_DPPI_RADIO_TEST_MODE_USED_MASK | \ 304 NRF_802154_DPPI_TIMESTAMPS_USED_MASK) 305 #endif // NRF_802154_DPPI_CHANNELS_USED_MASK 306 307 /** 308 * @def NRF_802154_DPPI_GROUPS_USED_MASK 309 * 310 * Bit mask of DPPI groups identifiers used by the 802.15.4 driver. 311 */ 312 #ifndef NRF_802154_DPPI_GROUPS_USED_MASK 313 #define NRF_802154_DPPI_GROUPS_USED_MASK 0UL 314 #endif // NRF_802154_DPPI_GROUPS_USED_MASK 315 316 #ifdef __cplusplus 317 } 318 #endif 319 320 #endif // NRF_802154_PERIPHERALS_NRF53_H__ 321