1 /* 2 * Copyright (c) 2020 - 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 * @file Module that defines the 802.15.4 driver peripheral usage. 37 * 38 */ 39 40 #ifndef NRF_802154_SL_PERIPHS_H__ 41 #define NRF_802154_SL_PERIPHS_H__ 42 43 #include <nrfx.h> 44 45 #if NRF_802154_USE_INTERNAL_INCLUDES 46 #include "nrf_802154_sl_periphs_internal.h" 47 #endif 48 49 /** 50 * @def NRF_802154_EGU_INSTANCE_NO 51 * 52 * Id of the EGU instance used by the driver to synchronize DPPIs and for requests and 53 * notifications if SWI is in use. 54 * 55 */ 56 #ifndef NRF_802154_EGU_INSTANCE_NO 57 #define NRF_802154_EGU_INSTANCE_NO 0 58 #endif 59 60 /** 61 * @def NRF_802154_EGU_INSTANCE 62 * 63 * The EGU instance used by the driver to synchronize PPIs and for requests and notifications if 64 * SWI is in use. 65 * 66 * @note This option is used by the core module regardless of the driver configuration. 67 * 68 */ 69 #define NRF_802154_EGU_INSTANCE NRFX_CONCAT_2(NRF_EGU, NRF_802154_EGU_INSTANCE_NO) 70 71 /** 72 * @def NRF_802154_EGU_TIMESTAMP_CHANNEL 73 */ 74 #define NRF_802154_EGU_TIMESTAMP_CHANNEL 4 75 76 /** 77 * @def NRF_802154_RTC_INSTANCE_NO 78 * 79 * Number of the RTC instance used in the standalone timer driver implementation. 80 * 81 */ 82 #ifndef NRF_802154_RTC_INSTANCE_NO 83 84 #define NRF_802154_RTC_INSTANCE_NO 2 85 86 #endif // NRF_802154_RTC_INSTANCE_NO 87 88 /** 89 * @def NRF_802154_RTC_INSTANCE 90 * 91 * The RTC instance used in the standalone timer driver implementation. 92 * 93 * @note This configuration is only applicable for the Low Power Timer Abstraction Layer 94 * implementation in nrf_802154_lp_timer_nodrv.c. 95 * 96 */ 97 #define NRF_802154_RTC_INSTANCE NRFX_CONCAT_2(NRF_RTC, NRF_802154_RTC_INSTANCE_NO) 98 99 /** 100 * @def NRF_802154_RTC_IRQ_HANDLER 101 * 102 * The RTC interrupt handler name used in the standalone timer driver implementation. 103 * 104 * @note This configuration is only applicable for Low Power Timer Abstraction Layer implementation 105 * in nrf_802154_lp_timer_nodrv.c. 106 * 107 */ 108 #define NRF_802154_RTC_IRQ_HANDLER NRFX_CONCAT_3(RTC, NRF_802154_RTC_INSTANCE_NO, _IRQHandler) 109 110 /** 111 * @def NRF_802154_RTC_IRQN 112 * 113 * The RTC Interrupt number used in the standalone timer driver implementation. 114 * 115 * @note This configuration is only applicable for the Low Power Timer Abstraction Layer implementation 116 * in nrf_802154_lp_timer_nodrv.c. 117 * 118 */ 119 #define NRF_802154_RTC_IRQN NRFX_CONCAT_3(RTC, NRF_802154_RTC_INSTANCE_NO, _IRQn) 120 121 /** 122 * @def NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO 123 * 124 * Number of the timer instance used for precise frame timestamps and synchronous radio operations. 125 * 126 */ 127 #ifndef NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO 128 #define NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO 1 129 #endif 130 131 /** 132 * @def NRF_802154_HIGH_PRECISION_TIMER_INSTANCE 133 * 134 * The timer instance used for precise frame timestamps and synchronous radio operations. 135 * 136 */ 137 #define NRF_802154_HIGH_PRECISION_TIMER_INSTANCE \ 138 NRFX_CONCAT_2(NRF_TIMER, NRF_802154_HIGH_PRECISION_TIMER_INSTANCE_NO) 139 140 /** 141 * @def NRF_802154_PPI_RTC_COMPARE_TO_TIMER_CAPTURE 142 * 143 * The PPI channel that connects LP timer's COMPARE event to HP timer's TIMER_CAPTURE task. 144 * 145 * @note This option is used only when the timestamping feature is enabled 146 * (see @ref NRF_802154_SL_TIMESTAMP_ENABLED). 147 * 148 */ 149 #ifndef NRF_802154_PPI_RTC_COMPARE_TO_TIMER_CAPTURE 150 #if defined(DPPI_PRESENT) 151 #define NRF_802154_PPI_RTC_COMPARE_TO_TIMER_CAPTURE 13U 152 #else 153 #define NRF_802154_PPI_RTC_COMPARE_TO_TIMER_CAPTURE NRF_PPI_CHANNEL13 154 #endif 155 #endif 156 157 /** 158 * @def NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE 159 * 160 * The PPI channel that connects provided event to HP timer's TIMER_CAPTURE task. 161 * 162 * @note This option is used only when the timestamping feature is enabled 163 * (see @ref NRF_802154_SL_TIMESTAMP_ENABLED). 164 * 165 */ 166 #ifndef NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE 167 #if defined(DPPI_PRESENT) 168 #define NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE 11U 169 #else 170 #define NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE NRF_PPI_CHANNEL14 171 #endif 172 #endif 173 174 /** 175 * @def NRF_802154_TIMESTAMP_PPI_CHANNELS_USED_MASK 176 * 177 * Helper bit mask of PPI channels used by the 802.15.4 driver for timestamping. 178 */ 179 #define NRF_802154_TIMESTAMP_PPI_CHANNELS_USED_MASK \ 180 ((1 << NRF_802154_PPI_RTC_COMPARE_TO_TIMER_CAPTURE) | \ 181 (1 << NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE)) 182 183 /** 184 * @def NRF_802154_PPI_TIMESTAMP_GROUP 185 * 186 * The PPI channel group used to control PPIs used for timestamping. 187 * 188 * @note This option is used only when the timestamping feature is enabled 189 * (see @ref NRF_802154_SL_TIMESTAMP_ENABLED). 190 * 191 */ 192 #ifndef NRF_802154_PPI_TIMESTAMP_GROUP 193 #if defined(DPPI_PRESENT) 194 #define NRF_802154_PPI_TIMESTAMP_GROUP NRF_DPPI_CHANNEL_GROUP1 195 #else 196 #define NRF_802154_PPI_TIMESTAMP_GROUP NRF_PPI_CHANNEL_GROUP2 197 #endif 198 #endif 199 200 #endif // NRF_802154_SL_PERIPHS_H__ 201