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. 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 #endif 53 54 #ifdef NRF_802154_USE_INTERNAL_INCLUDES 55 #include "nrf_802154_peripherals_internal.h" 56 #endif 57 58 #ifdef __cplusplus 59 extern "C" { 60 #endif 61 62 /** 63 * @def NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO 64 * 65 * Number of the timer instance used for precise frame timestamps and synchronous radio operations. 66 * 67 */ 68 #ifndef NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO 69 #define NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO 1 70 #endif 71 72 /** 73 * @def NRF_802154_HIGH_PRECISION_TIMER_INSTANCE 74 * 75 * The timer instance used for precise frame timestamps and synchronous radio operations. 76 * 77 */ 78 #define NRF_802154_HIGH_PRECISION_TIMER_INSTANCE \ 79 NRFX_CONCAT_2(NRF_TIMER, NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO) 80 81 /** 82 * @def NRF_802154_TIMER_INSTANCE_NO 83 * 84 * Number of the timer instance used both by the driver for ACK IFS and by the FEM module. 85 * 86 */ 87 #ifndef NRF_802154_TIMER_INSTANCE_NO 88 #define NRF_802154_TIMER_INSTANCE_NO 0 89 #endif 90 91 /** 92 * @def NRF_802154_TIMER_INSTANCE 93 * 94 * The timer instance used both by the driver for ACK IFS and by the FEM module. 95 * 96 */ 97 #define NRF_802154_TIMER_INSTANCE \ 98 NRFX_CONCAT_2(NRF_TIMER, NRF_802154_TIMER_INSTANCE_NO) 99 100 /** 101 * @def NRF_802154_RTC_INSTANCE 102 * 103 * The RTC instance used in the standalone timer driver implementation. 104 * 105 * @note This configuration is only applicable for the Low Power Timer Abstraction Layer 106 * implementation in nrf_802154_lp_timer_nodrv.c. 107 * 108 */ 109 #define NRF_802154_RTC_INSTANCE NRFX_CONCAT_2(NRF_RTC, NRF_802154_RTC_INSTANCE_NO) 110 111 /** 112 * @def NRF_802154_RTC_IRQ_HANDLER 113 * 114 * The RTC interrupt handler name used in the standalone timer driver implementation. 115 * 116 * @note This configuration is only applicable for Low Power Timer Abstraction Layer implementation 117 * in nrf_802154_lp_timer_nodrv.c. 118 * 119 */ 120 #define NRF_802154_RTC_IRQ_HANDLER NRFX_CONCAT_3(RTC, NRF_802154_RTC_INSTANCE_NO, _IRQHandler) 121 122 /** 123 * @def NRF_802154_RTC_IRQN 124 * 125 * The RTC Interrupt number used in the standalone timer driver implementation. 126 * 127 * @note This configuration is only applicable for the Low Power Timer Abstraction Layer implementation 128 * in nrf_802154_lp_timer_nodrv.c. 129 * 130 */ 131 #define NRF_802154_RTC_IRQN NRFX_CONCAT_3(RTC, NRF_802154_RTC_INSTANCE_NO, _IRQn) 132 133 /** 134 * @def NRF_802154_TIMERS_USED_MASK 135 * 136 * Bit mask of instances of timer peripherals used by the 802.15.4 driver. 137 */ 138 #ifndef NRF_802154_TIMERS_USED_MASK 139 #define NRF_802154_TIMERS_USED_MASK ((1 << NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO) | \ 140 (1 << NRF_802154_TIMER_INSTANCE_NO)) 141 #endif // NRF_802154_TIMERS_USED_MASK 142 143 /** 144 * @def NRF_802154_RTC_USED_MASK 145 * 146 * Bit mask of instances of RTC peripherals used by the 802.15.4 driver. 147 */ 148 #ifndef NRF_802154_RTC_USED_MASK 149 #define NRF_802154_RTC_USED_MASK (1 << NRF_802154_RTC_INSTANCE_NO) 150 #endif 151 152 /** 153 * @def NRF_802154_GPIO_PINS_USED_MASK 154 * 155 * Bit mask of GPIO pins used by the 802.15.4 driver. 156 */ 157 #ifndef NRF_802154_GPIO_PINS_USED_MASK 158 #define NRF_802154_GPIO_PINS_USED_MASK NRF_802154_DEBUG_PINS_USED_MASK 159 #endif // NRF_802154_GPIO_PINS_USED_MASK 160 161 /** 162 * @def NRF_802154_GPIOTE_CHANNELS_USED_MASK 163 * 164 * Bit mask of GPIOTE peripherals used by the 802.15.4 driver. 165 */ 166 #ifndef NRF_802154_GPIOTE_CHANNELS_USED_MASK 167 #define NRF_802154_GPIOTE_CHANNELS_USED_MASK NRF_802154_DEBUG_GPIOTE_CHANNELS_USED_MASK 168 #endif // NRF_802154_GPIOTE_CHANNELS_USED_MASK 169 170 #ifdef __cplusplus 171 } 172 #endif 173 174 #endif // NRF_802154_PERIPHERALS_H__ 175