diff --git a/nrf_802154/common/include/nrf_802154_config.h b/nrf_802154/common/include/nrf_802154_config.h index 43e0e18bbf..bbd2d2dcd9 100644 --- a/nrf_802154/common/include/nrf_802154_config.h +++ b/nrf_802154/common/include/nrf_802154_config.h @@ -35,13 +35,14 @@ #ifndef NRF_802154_CONFIG_H__ #define NRF_802154_CONFIG_H__ +/* This file must not include nrf.h or nrfx.h directly or indirectly, + * to avoid circular dependencies. + */ + #ifdef NRF_802154_PROJECT_CONFIG #include NRF_802154_PROJECT_CONFIG #endif -#include -#include "nrf_802154_nrfx_addons.h" - #ifdef __cplusplus extern "C" { #endif @@ -499,19 +500,6 @@ extern "C" { #define NRF_802154_ENCRYPTION_ENABLED 1 #endif -/** - * @def NRF_802154_ENCRYPTION_ACCELERATOR_ECB - * - * Enables ECB peripheral to be used as hardware accelerator for on-the-fly AES-CCM* encryption. - */ -#if !defined(NRF_802154_ENCRYPTION_ACCELERATOR_ECB) || defined(__DOXYGEN__) -#if defined(NRF52_SERIES) || defined(NRF5340_XXAA) || defined(__DOXYGEN__) -#define NRF_802154_ENCRYPTION_ACCELERATOR_ECB 1 -#elif defined(NRF54H_SERIES) || defined(NRF54L_SERIES) -#define NRF_802154_ENCRYPTION_ACCELERATOR_ECB 0 -#endif -#endif - /** * @} * @defgroup nrf_802154_ie Information Elements configuration diff --git a/nrf_802154/common/include/nrf_802154_config_soc.h b/nrf_802154/common/include/nrf_802154_config_soc.h new file mode 100644 index 0000000000..4399192443 --- /dev/null +++ b/nrf_802154/common/include/nrf_802154_config_soc.h @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2025, Nordic Semiconductor ASA + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_802154_CONFIG_SOC_H_ +#define NRF_802154_CONFIG_SOC_H_ + +/* This file provides information about the SoC to the nRF 802.15.4 driver. + * It defines nrf 802.15.4 driver's internal macros to denote SoC series and + * SoC features based on macros provided by the build system. + * + * This file intentionally does not include nrf.h or nrfx.h to avoid + * circular include dependencies. + */ + +#ifdef NRF_802154_SOC_SUPPORTED + #error "Do not define NRF_802154_SOC_SUPPORTED externally" +#endif + +#ifdef NRF_802154_SOC_NRF52_SERIES + #error "Do not define NRF_802154_SOC_NRF52_SERIES externally" +#endif + +#if defined (NRF52833_XXAA) || defined (NRF52840_XXAA) + #define NRF_802154_SOC_NRF52_SERIES + #define NRF_802154_SOC_SUPPORTED +#endif + +#ifdef NRF_802154_SOC_NRF53_SERIES + #error "Do not define NRF_802154_SOC_NRF53_SERIES externally" +#endif + +#if defined (NRF5340_XXAA) || defined(NRF5340_XXAA_APPLICATION) || defined(NRF5340_XXAA_NETWORK) + #define NRF_802154_SOC_NRF53_SERIES + #define NRF_802154_SOC_SUPPORTED +#endif + +#ifdef NRF_802154_SOC_NRF54H_SERIES + #error "Do not define NRF_802154_SOC_NRF54H_SERIES externally" +#endif + +#if defined (NRF54H20_XXAA) + #define NRF_802154_SOC_NRF54H_SERIES + #define NRF_802154_SOC_SUPPORTED +#endif + +#ifdef NRF_802154_SOC_NRF54L_SERIES + #error "Do not define NRF_802154_SOC_NRF54L_SERIES externally" +#endif + +#if defined (NRF54L05_XXAA) || defined (NRF54LV10A_ENGA_XXAA) || defined (NRF54L10_XXAA) \ + || defined (NRF54L15_XXAA) || defined (NRF54LM20A_ENGA_XXAA) + #define NRF_802154_SOC_NRF54L_SERIES + #define NRF_802154_SOC_SUPPORTED +#endif + +#ifdef NRF_802154_SOC_PPI_PRESENT + #error "Do not define NRF_802154_SOC_PPI_PRESENT externally" +#endif + +#ifdef NRF_802154_SOC_DPPI_PRESENT + #error "Do not define NRF_802154_SOC_DPPI_PRESENT externally" +#endif + +#if defined(NRF_802154_SOC_NRF52_SERIES) + #define NRF_802154_SOC_PPI_PRESENT +#endif + +#if defined(NRF_802154_SOC_NRF53_SERIES) + #define NRF_802154_SOC_DPPI_PRESENT +#endif + +#if defined(NRF_802154_SOC_NRF54H_SERIES) + #define NRF_802154_SOC_DPPI_PRESENT +#endif + +#if defined(NRF_802154_SOC_NRF54L_SERIES) + #define NRF_802154_SOC_DPPI_PRESENT +#endif + +#ifdef NRF_802154_USE_INTERNAL_INCLUDES +#include "nrf_802154_soc_config_internal.h" +#endif + +#ifndef NRF_802154_SOC_SUPPORTED +#error "nRF 802.15.4 driver is not supported on the selected SoC." +#endif + +#endif /* NRF_802154_CONFIG_SOC_H_ */ diff --git a/nrf_802154/doc/CHANGELOG.rst b/nrf_802154/doc/CHANGELOG.rst index fd06420437..138e55a999 100644 --- a/nrf_802154/doc/CHANGELOG.rst +++ b/nrf_802154/doc/CHANGELOG.rst @@ -25,6 +25,12 @@ Notable changes * The experimental IFS feature has been removed. (KRKNWK-20788) * The return value of :c:func:`nrf_802154_transmit_raw`, :c:func:`nrf_802154_transmit_csma_ca_raw`, and :c:func:`nrf_802154_transmit_raw_at` was updated. These API functions now return ``nrf_802154_tx_error_t`` instead of ``bool``. (KRKNWK-18536) +* The following header files no longer include ``nrf.h`` or ``nrfx.h`` to avoid circular dependencies (KRKNWK-20956): + + * ``nrf_802154_peripherals_nrf52.h`` + * ``nrf_802154_peripherals_nrf53.h`` + * ``nrf_802154_peripherals_nrf54h.h`` + * ``nrf_802154_peripherals_nrf54l.h`` Added ===== diff --git a/nrf_802154/doc/rd_including.rst b/nrf_802154/doc/rd_including.rst index 31c79e37ff..2c3036c66d 100644 --- a/nrf_802154/doc/rd_including.rst +++ b/nrf_802154/doc/rd_including.rst @@ -16,8 +16,6 @@ Using CMake The nRF 802.15.4 Radio Driver supports the CMake build system and can be directly included in a project using the CMake build system with the ``add_subdirectory(nrfxlib/nrf_802154)`` CMake command. -To do so, you must first set the ``NRF52_SERIES`` or ``NRF53_SERIES`` CMake variable to ``1``, depending on the used SoC family. - If building on a single core SoC, you should then do the following: 1. Link the following libraries (CMake targets) to the application library: diff --git a/nrf_802154/driver/CMakeLists.txt b/nrf_802154/driver/CMakeLists.txt index d3ffc8b294..9b1ef3a555 100644 --- a/nrf_802154/driver/CMakeLists.txt +++ b/nrf_802154/driver/CMakeLists.txt @@ -52,6 +52,7 @@ target_sources(nrf-802154-driver src/nrf_802154_core_hooks.c src/nrf_802154_critical_section.c src/nrf_802154_debug.c + src/nrf_802154_debug_gpio.c src/nrf_802154_encrypt.c src/nrf_802154_notification_direct.c src/nrf_802154_notification_swi.c diff --git a/nrf_802154/driver/src/nrf_802154.c b/nrf_802154/driver/src/nrf_802154.c index d3abbef6b9..26c91a45c2 100644 --- a/nrf_802154/driver/src/nrf_802154.c +++ b/nrf_802154/driver/src/nrf_802154.c @@ -49,6 +49,7 @@ #include #include "nrf_802154_config.h" +#include "nrf_802154_facade_helpers.h" #include "nrf_802154_utils.h" #include "nrf_802154_const.h" #include "nrf_802154_core.h" @@ -92,25 +93,6 @@ static uint8_t m_tx_buffer[RAW_PAYLOAD_OFFSET + MAX_PACKET_SIZE]; #endif // NRF_802154_CARRIER_FUNCTIONS_ENABLED -static inline bool are_frame_properties_valid(const nrf_802154_transmitted_frame_props_t * p_props) -{ - return p_props->dynamic_data_is_set || !(p_props->is_secured); -} - -static inline bool are_extra_cca_attempts_valid(const nrf_802154_transmit_at_metadata_t * p_data) -{ - return !p_data->cca || (p_data->extra_cca_attempts < UINT8_MAX); -} - -static inline bool is_tx_timestamp_request_valid(const bool tx_timestamp_encode) -{ -#if NRF_802154_TX_TIMESTAMP_PROVIDER_ENABLED - return true; -#else - return !tx_timestamp_encode; -#endif -} - void nrf_802154_channel_set(uint8_t channel) { bool changed = nrf_802154_pib_channel_get() != channel; @@ -403,16 +385,7 @@ nrf_802154_tx_error_t nrf_802154_transmit_raw(uint8_t if (p_metadata == NULL) { - static const nrf_802154_transmit_metadata_t metadata_default = - { - .frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT, - .cca = true, - .tx_power = {.use_metadata_value = false}, - .tx_channel = {.use_metadata_value = false}, - .tx_timestamp_encode = false - }; - - p_metadata = &metadata_default; + p_metadata = nrf_802154_transmit_metadata_default_ptr_get(); } result = nrf_802154_frame_parser_data_init(p_data, @@ -432,8 +405,7 @@ nrf_802154_tx_error_t nrf_802154_transmit_raw(uint8_t if (result) { - result = are_frame_properties_valid(&p_metadata->frame_props) && - is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode); + result = nrf_802154_transmit_metadata_is_valid(p_metadata); } if (result) @@ -459,21 +431,14 @@ nrf_802154_tx_error_t nrf_802154_transmit_raw_at( bool result; nrf_802154_frame_t frame; nrf_802154_tx_error_t error; - nrf_802154_transmit_at_metadata_t metadata_default = - { - .frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT, - .cca = true, - .tx_power = {.use_metadata_value = false}, - .extra_cca_attempts = 0, - .tx_timestamp_encode = false, - }; + nrf_802154_transmit_at_metadata_t metadata_default; nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); if (p_metadata == NULL) { - metadata_default.channel = nrf_802154_channel_get(); - p_metadata = &metadata_default; + nrf_802154_transmit_at_metadata_default_prepare(&metadata_default); + p_metadata = &metadata_default; } result = nrf_802154_frame_parser_data_init(p_data, @@ -493,9 +458,7 @@ nrf_802154_tx_error_t nrf_802154_transmit_raw_at( if (result) { - result = are_frame_properties_valid(&p_metadata->frame_props) && - are_extra_cca_attempts_valid(p_metadata) && - is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode); + result = nrf_802154_transmit_at_metadata_is_valid(p_metadata); } if (result) @@ -766,15 +729,7 @@ nrf_802154_tx_error_t nrf_802154_transmit_csma_ca_raw( if (p_metadata == NULL) { - static const nrf_802154_transmit_csma_ca_metadata_t metadata_default = - { - .frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT, - .tx_power = {.use_metadata_value = false}, - .tx_channel = {.use_metadata_value = false}, - .tx_timestamp_encode = false - }; - - p_metadata = &metadata_default; + p_metadata = nrf_802154_transmit_csma_ca_metadata_default_ptr_get(); } result = nrf_802154_frame_parser_data_init(p_data, @@ -794,8 +749,7 @@ nrf_802154_tx_error_t nrf_802154_transmit_csma_ca_raw( if (result) { - result = are_frame_properties_valid(&p_metadata->frame_props) && - is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode); + result = nrf_802154_transmit_csma_ca_metadata_is_valid(p_metadata); } if (result) diff --git a/nrf_802154/driver/src/nrf_802154_aes_ccm_acc_ccm.c b/nrf_802154/driver/src/nrf_802154_aes_ccm_acc_ccm.c index 84a76f920d..a44087db84 100644 --- a/nrf_802154/driver/src/nrf_802154_aes_ccm_acc_ccm.c +++ b/nrf_802154/driver/src/nrf_802154_aes_ccm_acc_ccm.c @@ -33,8 +33,9 @@ */ #include "nrf_802154_config.h" +#include "nrf_802154_peripherals.h" -#if NRF_802154_ENCRYPTION_ENABLED && !NRF_802154_ENCRYPTION_ACCELERATOR_ECB +#if NRF_802154_ENCRYPTION_ENABLED && defined(NRF_802154_ENCRYPTION_ACCELERATOR_CCM) /** Configures if the CCM's OUT.PTR pointer points to the same memory location as PACKETPTR register * of the RADIO. @@ -48,6 +49,7 @@ #define CCM_ADATA_ATTR_ID 13 ///< Attribute field that identifies the adata CCM job #define CCM_MDATA_ATTR_ID 14 ///< Attribute field that identifies the mdata CCM job +#include #include "nrf_802154_aes_ccm.h" #include @@ -383,4 +385,4 @@ void nrf_802154_aes_ccm_transform_reset(void) memset(m_nonce, 0, sizeof(m_nonce)); } -#endif // NRF_802154_ENCRYPTION_ENABLED && !NRF_802154_ENCRYPTION_ACCELERATOR_ECB +#endif // NRF_802154_ENCRYPTION_ENABLED && defined(NRF_802154_ENCRYPTION_ACCELERATOR_CCM) diff --git a/nrf_802154/driver/src/nrf_802154_aes_ccm_acc_ecb.c b/nrf_802154/driver/src/nrf_802154_aes_ccm_acc_ecb.c index c79b20fc2a..87167486d9 100644 --- a/nrf_802154/driver/src/nrf_802154_aes_ccm_acc_ecb.c +++ b/nrf_802154/driver/src/nrf_802154_aes_ccm_acc_ecb.c @@ -33,16 +33,17 @@ */ #include "nrf_802154_config.h" +#include "nrf_802154_peripherals.h" -#if NRF_802154_ENCRYPTION_ACCELERATOR_ECB +#if NRF_802154_ENCRYPTION_ENABLED && defined(NRF_802154_ENCRYPTION_ACCELERATOR_ECB) +#include #include "nrf_802154_aes_ccm.h" #include "nrf_802154_assert.h" #include #include "nrf_802154_const.h" -#include "nrf_802154_config.h" #include "nrf_802154_tx_work_buffer.h" #if defined(CONFIG_MPSL) #include "mpsl_ecb.h" @@ -614,4 +615,4 @@ void nrf_802154_aes_ccm_transform_abort(uint8_t * p_frame) m_aes_ccm_data.raw_frame = NULL; } -#endif /* NRF_802154_ENCRYPTION_ACCELERATOR_ECB */ +#endif /* NRF_802154_ENCRYPTION_ENABLED && defined(NRF_802154_ENCRYPTION_ACCELERATOR_ECB) */ diff --git a/nrf_802154/driver/src/nrf_802154_debug.h b/nrf_802154/driver/src/nrf_802154_debug.h index 8d1660cdfe..52fdee1888 100644 --- a/nrf_802154/driver/src/nrf_802154_debug.h +++ b/nrf_802154/driver/src/nrf_802154_debug.h @@ -45,64 +45,12 @@ #include "nrf_802154_config.h" #include "nrf_802154_sl_log.h" #include "nrf_802154_debug_log.h" -#include "nrf_802154_debug_core.h" +#include "nrf_802154_debug_peripherals.h" #ifdef __cplusplus extern "C" { #endif -#define PIN_DBG_RADIO_EVT_END 11 -#define PIN_DBG_RADIO_EVT_DISABLED 12 -#define PIN_DBG_RADIO_EVT_READY 13 -#define PIN_DBG_RADIO_EVT_FRAMESTART 14 -#define PIN_DBG_RADIO_EVT_EDEND 25 -#define PIN_DBG_RADIO_EVT_PHYEND 24 - -#define PPI_DBG_RADIO_EVT_END 0 -#define PPI_DBG_RADIO_EVT_DISABLED 1 -#define PPI_DBG_RADIO_EVT_READY 2 -#define PPI_DBG_RADIO_EVT_FRAMESTART 3 -#define PPI_DBG_RADIO_EVT_EDEND 4 -#define PPI_DBG_RADIO_EVT_PHYEND 5 - -#define GPIOTE_DBG_RADIO_EVT_END 0 -#define GPIOTE_DBG_RADIO_EVT_DISABLED 1 -#define GPIOTE_DBG_RADIO_EVT_READY 2 -#define GPIOTE_DBG_RADIO_EVT_FRAMESTART 3 -#define GPIOTE_DBG_RADIO_EVT_EDEND 4 -#define GPIOTE_DBG_RADIO_EVT_PHYEND 5 - -#if ENABLE_DEBUG_GPIO - -#define NRF_802154_DEBUG_PINS_USED_MASK ((1 << PIN_DBG_RADIO_EVT_END) | \ - (1 << PIN_DBG_RADIO_EVT_DISABLED) | \ - (1 << PIN_DBG_RADIO_EVT_READY) | \ - (1 << PIN_DBG_RADIO_EVT_FRAMESTART) | \ - (1 << PIN_DBG_RADIO_EVT_EDEND) | \ - (1 << PIN_DBG_RADIO_EVT_PHYEND)) - -#define NRF_802154_DEBUG_PPI_CHANNELS_USED_MASK ((1 << PPI_DBG_RADIO_EVT_END) | \ - (1 << PPI_DBG_RADIO_EVT_DISABLED) | \ - (1 << PPI_DBG_RADIO_EVT_READY) | \ - (1 << PPI_DBG_RADIO_EVT_FRAMESTART) | \ - (1 << PPI_DBG_RADIO_EVT_EDEND) | \ - (1 << PPI_DBG_RADIO_EVT_PHYEND)) - -#define NRF_802154_DEBUG_GPIOTE_CHANNELS_USED_MASK ((1 << GPIOTE_DBG_RADIO_EVT_END) | \ - (1 << GPIOTE_DBG_RADIO_EVT_DISABLED) | \ - (1 << GPIOTE_DBG_RADIO_EVT_READY) | \ - (1 << GPIOTE_DBG_RADIO_EVT_FRAMESTART) | \ - (1 << GPIOTE_DBG_RADIO_EVT_EDEND) | \ - (1 << GPIOTE_DBG_RADIO_EVT_PHYEND)) - -#else // ENABLE_DEBUG_GPIO - -#define NRF_802154_DEBUG_PINS_USED_MASK 0 -#define NRF_802154_DEBUG_PPI_CHANNELS_USED_MASK 0 -#define NRF_802154_DEBUG_GPIOTE_CHANNELS_USED_MASK 0 - -#endif // ENABLE_DEBUG_GPIO - /** * @brief Initializes debug helpers for the nRF 802.15.4 driver. */ diff --git a/nrf_802154/driver/src/nrf_802154_debug_core.h b/nrf_802154/driver/src/nrf_802154_debug_core.h deleted file mode 100644 index 7ee319aed6..0000000000 --- a/nrf_802154/driver/src/nrf_802154_debug_core.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2019, Nordic Semiconductor ASA - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - * @brief Module that contains debug helpers for the 802.15.4 radio driver for the nRF SoC devices. - * - */ - -#ifndef NRF_802154_DEBUG_CORE_H_ -#define NRF_802154_DEBUG_CORE_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define PIN_DBG_TIMESLOT_ACTIVE 3 -#define PIN_DBG_TIMESLOT_EXTEND_REQ 4 -#define PIN_DBG_TIMESLOT_SESSION_IDLE 16 -#define PIN_DBG_TIMESLOT_RADIO_IRQ 28 -#define PIN_DBG_TIMESLOT_FAILED 29 -#define PIN_DBG_TIMESLOT_BLOCKED 30 -#define PIN_DBG_RAAL_CRITICAL_SECTION 15 - -#define PIN_DBG_RTC0_EVT_REM 31 - -#if ENABLE_DEBUG_GPIO - -#define NRF_802154_DEBUG_CORE_PINS_USED ((1 << PIN_DBG_TIMESLOT_ACTIVE) | \ - (1 << PIN_DBG_TIMESLOT_EXTEND_REQ) | \ - (1 << PIN_DBG_TIMESLOT_SESSION_IDLE) | \ - (1 << PIN_DBG_TIMESLOT_RADIO_IRQ) | \ - (1 << PIN_DBG_TIMESLOT_FAILED) | \ - (1 << PIN_DBG_TIMESLOT_BLOCKED) | \ - (1 << PIN_DBG_RAAL_CRITICAL_SECTION)) - -#else // ENABLE_DEBUG_GPIO - -#define NRF_802154_DEBUG_CORE_PINS_USED 0 - -#endif - -#if ENABLE_DEBUG_GPIO - -#define nrf_802154_pin_set(pin) NRF_P0->OUTSET = (1UL << (pin)) -#define nrf_802154_pin_clr(pin) NRF_P0->OUTCLR = (1UL << (pin)) -#define nrf_802154_pin_tgl(pin) \ - do \ - { \ - volatile uint32_t ps = NRF_P0->OUT; \ - \ - NRF_P0->OUTSET = (~ps & (1UL << (pin))); \ - NRF_P0->OUTCLR = (ps & (1UL << (pin))); \ - } \ - while (0); - -#else // ENABLE_DEBUG_GPIO - -#define nrf_802154_pin_set(pin) -#define nrf_802154_pin_clr(pin) -#define nrf_802154_pin_tgl(pin) - -#endif // ENABLE_DEBUG_GPIO - -#ifdef __cplusplus -} -#endif - -#endif /* NRF_802154_DEBUG_CORE_H_ */ diff --git a/nrf_802154/driver/src/nrf_802154_debug_gpio.c b/nrf_802154/driver/src/nrf_802154_debug_gpio.c index f078f51ff7..cdbc7d9c00 100644 --- a/nrf_802154/driver/src/nrf_802154_debug_gpio.c +++ b/nrf_802154/driver/src/nrf_802154_debug_gpio.c @@ -43,6 +43,13 @@ #include #include "nrfx.h" + +#ifdef ENABLE_DEBUG_GPIO + +#if !defined(NRF52_SERIES) +#error "ENABLE_DEBUG_GPIO is supported only for nRF52 series devices." +#endif + #include "hal/nrf_gpio.h" #include "hal/nrf_gpiote.h" #include "hal/nrf_ppi.h" @@ -95,19 +102,11 @@ static void radio_event_gpio_toggle_init(void) nrf_ppi_channel_enable(NRF_PPI, (nrf_ppi_channel_t)PPI_DBG_RADIO_EVT_READY); } -/** - * @brief Initialize GPIO to set it simulated arbiter events. - */ -static void raal_simulator_gpio_init(void) -{ -#if RAAL_SIMULATOR - nrf_gpio_cfg_output(PIN_DBG_TIMESLOT_ACTIVE); - nrf_gpio_cfg_output(PIN_DBG_RAAL_CRITICAL_SECTION); -#endif -} +#endif /* ENABLE_DEBUG_GPIO */ void nrf_802154_debug_gpio_init(void) { +#ifdef ENABLE_DEBUG_GPIO radio_event_gpio_toggle_init(); - raal_simulator_gpio_init(); +#endif } diff --git a/nrf_802154/driver/src/nrf_802154_debug_peripherals.h b/nrf_802154/driver/src/nrf_802154_debug_peripherals.h new file mode 100644 index 0000000000..1051d6e7be --- /dev/null +++ b/nrf_802154/driver/src/nrf_802154_debug_peripherals.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2025, Nordic Semiconductor ASA + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @brief Module that contains configuration of peripherals used by debug helpers + * for the 802.15.4 Radio Driver. + * + */ + +#ifndef NRF_802154_DEBUG_PERIPHERALS_H_ +#define NRF_802154_DEBUG_PERIPHERALS_H_ + +/* This file must not include nrf.h or nrfx.h directly or indirectly, + * to avoid circular dependencies. + */ + +#if ENABLE_DEBUG_GPIO + +#define PIN_DBG_RADIO_EVT_END 11 +#define PIN_DBG_RADIO_EVT_DISABLED 12 +#define PIN_DBG_RADIO_EVT_READY 13 +#define PIN_DBG_RADIO_EVT_FRAMESTART 14 +#define PIN_DBG_RADIO_EVT_EDEND 25 +#define PIN_DBG_RADIO_EVT_PHYEND 24 + +#define PPI_DBG_RADIO_EVT_END 0 +#define PPI_DBG_RADIO_EVT_DISABLED 1 +#define PPI_DBG_RADIO_EVT_READY 2 +#define PPI_DBG_RADIO_EVT_FRAMESTART 3 +#define PPI_DBG_RADIO_EVT_EDEND 4 +#define PPI_DBG_RADIO_EVT_PHYEND 5 + +#define GPIOTE_DBG_RADIO_EVT_END 0 +#define GPIOTE_DBG_RADIO_EVT_DISABLED 1 +#define GPIOTE_DBG_RADIO_EVT_READY 2 +#define GPIOTE_DBG_RADIO_EVT_FRAMESTART 3 +#define GPIOTE_DBG_RADIO_EVT_EDEND 4 +#define GPIOTE_DBG_RADIO_EVT_PHYEND 5 + +#define NRF_802154_DEBUG_PINS_USED_MASK ((1 << PIN_DBG_RADIO_EVT_END) | \ + (1 << PIN_DBG_RADIO_EVT_DISABLED) | \ + (1 << PIN_DBG_RADIO_EVT_READY) | \ + (1 << PIN_DBG_RADIO_EVT_FRAMESTART) | \ + (1 << PIN_DBG_RADIO_EVT_EDEND) | \ + (1 << PIN_DBG_RADIO_EVT_PHYEND)) + +#define NRF_802154_DEBUG_PPI_CHANNELS_USED_MASK ((1 << PPI_DBG_RADIO_EVT_END) | \ + (1 << PPI_DBG_RADIO_EVT_DISABLED) | \ + (1 << PPI_DBG_RADIO_EVT_READY) | \ + (1 << PPI_DBG_RADIO_EVT_FRAMESTART) | \ + (1 << PPI_DBG_RADIO_EVT_EDEND) | \ + (1 << PPI_DBG_RADIO_EVT_PHYEND)) + +#define NRF_802154_DEBUG_GPIOTE_CHANNELS_USED_MASK ((1 << GPIOTE_DBG_RADIO_EVT_END) | \ + (1 << GPIOTE_DBG_RADIO_EVT_DISABLED) | \ + (1 << GPIOTE_DBG_RADIO_EVT_READY) | \ + (1 << GPIOTE_DBG_RADIO_EVT_FRAMESTART) | \ + (1 << GPIOTE_DBG_RADIO_EVT_EDEND) | \ + (1 << GPIOTE_DBG_RADIO_EVT_PHYEND)) + +#else // ENABLE_DEBUG_GPIO + +#define NRF_802154_DEBUG_PINS_USED_MASK 0 +#define NRF_802154_DEBUG_PPI_CHANNELS_USED_MASK 0 +#define NRF_802154_DEBUG_GPIOTE_CHANNELS_USED_MASK 0 + +#endif // ENABLE_DEBUG_GPIO + +#endif /* NRF_802154_DEBUG_PERIPHERALS_H_ */ diff --git a/nrf_802154/driver/src/nrf_802154_facade_helpers.h b/nrf_802154/driver/src/nrf_802154_facade_helpers.h new file mode 100644 index 0000000000..8a2bd3d1df --- /dev/null +++ b/nrf_802154/driver/src/nrf_802154_facade_helpers.h @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2025, Nordic Semiconductor ASA + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_802154_FACADE_HELPERS_H__ +#define NRF_802154_FACADE_HELPERS_H__ + +#include "nrfx.h" +#include "nrf_802154.h" +#include "nrf_802154_config.h" +#include "nrf_802154_types.h" + +#ifdef __STATIC_INLINE__ +#undef __STATIC_INLINE__ +#endif + +#ifdef NRF_802154_FACADE_HELPERS_DECLARE_ONLY +#define __STATIC_INLINE__ +#else +#define __STATIC_INLINE__ __STATIC_INLINE +#endif + +/** @brief Gets a pointer to the default transmit metadata. + * + * @return Pointer to default transmit metadata. The pointed data can be + * used directly, no need to copy them unless modification is needed. + */ +__STATIC_INLINE__ const nrf_802154_transmit_metadata_t * +nrf_802154_transmit_metadata_default_ptr_get(void); + +/** @brief Checks if transmit metadata is valid. + * + * @param[in] p_metadata Metadata to check. + * + * @retval false Metadata is invalid. + * @retval true Metadata is valid. + */ +__STATIC_INLINE__ bool nrf_802154_transmit_metadata_is_valid( + const nrf_802154_transmit_metadata_t * p_metadata); + +/** @brief Prepares a default transmit metadata for timed transmissions. + * + * @param[out] p_metadata Default metadata returned through this pointer. + */ +__STATIC_INLINE__ void nrf_802154_transmit_at_metadata_default_prepare( + nrf_802154_transmit_at_metadata_t * p_metadata); + +/** @brief Checks if transmit metadata for timed transmissions is valid. + * + * @param[in] p_metadata Metadata to check. + * + * @retval false Metadata is invalid. + * @retval true Metadata is valid. + */ +__STATIC_INLINE__ bool nrf_802154_transmit_at_metadata_is_valid( + const nrf_802154_transmit_at_metadata_t * p_metadata); + +#if NRF_802154_CSMA_CA_ENABLED + +/** @brief Gets a pointer to the default CSMA/CA transmit metadata. + * + * @return Pointer to default CSMA/CA transmit metadata. The pointed data can be + * used directly, no need to copy them unless modification is needed. + */ +__STATIC_INLINE__ const nrf_802154_transmit_csma_ca_metadata_t * +nrf_802154_transmit_csma_ca_metadata_default_ptr_get(void); + +/** @brief Checks if CSMA/CA transmit metadata is valid. + * + * @param[in] p_metadata Metadata to check. + * + * @retval false Metadata is invalid. + * @retval true Metadata is valid. + */ +__STATIC_INLINE__ bool nrf_802154_transmit_csma_ca_metadata_is_valid( + const nrf_802154_transmit_csma_ca_metadata_t * p_metadata); + +#endif /* NRF_802154_CSMA_CA_ENABLED */ + +#ifndef NRF_802154_FACADE_HELPERS_DECLARE_ONLY + +static inline bool are_frame_properties_valid(const nrf_802154_transmitted_frame_props_t * p_props) +{ + return p_props->dynamic_data_is_set || !(p_props->is_secured); +} + +static inline bool are_extra_cca_attempts_valid( + const nrf_802154_transmit_at_metadata_t * p_metadata) +{ + return !p_metadata->cca || (p_metadata->extra_cca_attempts < UINT8_MAX); +} + +static inline bool is_tx_timestamp_request_valid(const bool tx_timestamp_encode) +{ +#if NRF_802154_TX_TIMESTAMP_PROVIDER_ENABLED + return true; +#else + return !tx_timestamp_encode; +#endif +} + +__STATIC_INLINE__ const nrf_802154_transmit_metadata_t * +nrf_802154_transmit_metadata_default_ptr_get(void) +{ + static const nrf_802154_transmit_metadata_t metadata = { + .frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT, + .cca = true, + .tx_power = {.use_metadata_value = false}, + .tx_channel = {.use_metadata_value = false}, + .tx_timestamp_encode = false, + }; + + return &metadata; +} + +__STATIC_INLINE__ bool nrf_802154_transmit_metadata_is_valid( + const nrf_802154_transmit_metadata_t * p_metadata) +{ + return are_frame_properties_valid(&p_metadata->frame_props) && + is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode); +} + +__STATIC_INLINE__ void nrf_802154_transmit_at_metadata_default_prepare( + nrf_802154_transmit_at_metadata_t * p_metadata) +{ + static const nrf_802154_transmit_at_metadata_t initial_metadata = + { + .frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT, + .cca = true, + .tx_power = {.use_metadata_value = false}, + .extra_cca_attempts = 0, + .tx_timestamp_encode = false, + }; + + *p_metadata = initial_metadata; + p_metadata->channel = nrf_802154_channel_get(); +} + +__STATIC_INLINE__ bool nrf_802154_transmit_at_metadata_is_valid( + const nrf_802154_transmit_at_metadata_t * p_metadata) +{ + return are_frame_properties_valid(&p_metadata->frame_props) && + are_extra_cca_attempts_valid(p_metadata) && + is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode); +} + +#if NRF_802154_CSMA_CA_ENABLED + +__STATIC_INLINE__ const nrf_802154_transmit_csma_ca_metadata_t * +nrf_802154_transmit_csma_ca_metadata_default_ptr_get(void) +{ + static const nrf_802154_transmit_csma_ca_metadata_t metadata = + { + .frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT, + .tx_power = {.use_metadata_value = false}, + .tx_channel = {.use_metadata_value = false}, + .tx_timestamp_encode = false, + }; + + return &metadata; +} + +__STATIC_INLINE__ bool nrf_802154_transmit_csma_ca_metadata_is_valid( + const nrf_802154_transmit_csma_ca_metadata_t * p_metadata) +{ + return are_frame_properties_valid(&p_metadata->frame_props) && + is_tx_timestamp_request_valid(p_metadata->tx_timestamp_encode); +} + +#endif /* NRF_802154_CSMA_CA_ENABLED */ + +#endif /* NRF_802154_FACADE_HELPERS_DECLARE_ONLY */ + +#endif // NRF_802154_FACADE_HELPERS_H__ diff --git a/nrf_802154/driver/src/nrf_802154_peripherals.h b/nrf_802154/driver/src/nrf_802154_peripherals.h index 892b16ca0e..70df41aac1 100644 --- a/nrf_802154/driver/src/nrf_802154_peripherals.h +++ b/nrf_802154/driver/src/nrf_802154_peripherals.h @@ -42,8 +42,6 @@ #include #include "nrf_802154_config.h" -#include "nrf_802154_debug.h" -#include "nrf_802154_debug_core.h" #if defined(NRF52_SERIES) #include "nrf_802154_peripherals_nrf52.h" @@ -153,24 +151,6 @@ extern "C" { #define NRF_802154_RTC_USED_MASK (1 << NRF_802154_RTC_INSTANCE_NO) #endif -/** - * @def NRF_802154_GPIO_PINS_USED_MASK - * - * Bit mask of GPIO pins used by the 802.15.4 driver. - */ -#ifndef NRF_802154_GPIO_PINS_USED_MASK -#define NRF_802154_GPIO_PINS_USED_MASK NRF_802154_DEBUG_PINS_USED_MASK -#endif // NRF_802154_GPIO_PINS_USED_MASK - -/** - * @def NRF_802154_GPIOTE_CHANNELS_USED_MASK - * - * Bit mask of GPIOTE peripherals used by the 802.15.4 driver. - */ -#ifndef NRF_802154_GPIOTE_CHANNELS_USED_MASK -#define NRF_802154_GPIOTE_CHANNELS_USED_MASK NRF_802154_DEBUG_GPIOTE_CHANNELS_USED_MASK -#endif // NRF_802154_GPIOTE_CHANNELS_USED_MASK - /** * @def NRF_802154_EGU_NOTIFICATION_USED_CHANNELS_MASK * diff --git a/nrf_802154/driver/src/nrf_802154_peripherals_nrf52.h b/nrf_802154/driver/src/nrf_802154_peripherals_nrf52.h index 3909d9a7ec..7a15999d45 100644 --- a/nrf_802154/driver/src/nrf_802154_peripherals_nrf52.h +++ b/nrf_802154/driver/src/nrf_802154_peripherals_nrf52.h @@ -40,9 +40,13 @@ #ifndef NRF_802154_PERIPHERALS_NRF52_H__ #define NRF_802154_PERIPHERALS_NRF52_H__ -#include +/* This file must not include nrf.h or nrfx.h directly or indirectly, + * to avoid circular dependencies. + */ + +#include "nrf_802154_config_soc.h" #include "nrf_802154_config.h" -#include "nrf_802154_debug.h" +#include "nrf_802154_debug_peripherals.h" #include "nrf_802154_sl_periphs.h" #ifdef __cplusplus @@ -264,6 +268,8 @@ extern "C" { (1 << NRF_802154_PPI_ABORT_GROUP) ) #endif // NRF_802154_PPI_GROUPS_USED_MASK +#define NRF_802154_ENCRYPTION_ACCELERATOR_ECB + #ifdef __cplusplus } #endif diff --git a/nrf_802154/driver/src/nrf_802154_peripherals_nrf53.h b/nrf_802154/driver/src/nrf_802154_peripherals_nrf53.h index e937379324..38184b03db 100644 --- a/nrf_802154/driver/src/nrf_802154_peripherals_nrf53.h +++ b/nrf_802154/driver/src/nrf_802154_peripherals_nrf53.h @@ -40,9 +40,12 @@ #ifndef NRF_802154_PERIPHERALS_NRF53_H__ #define NRF_802154_PERIPHERALS_NRF53_H__ -#include +/* This file must not include nrf.h or nrfx.h directly or indirectly, + * to avoid circular dependencies. + */ + +#include "nrf_802154_config_soc.h" #include "nrf_802154_config.h" -#include "nrf_802154_debug.h" #include "nrf_802154_sl_periphs.h" #ifdef __cplusplus @@ -333,6 +336,8 @@ extern "C" { #define NRF_802154_DPPI_GROUPS_USED_MASK 0UL #endif // NRF_802154_DPPI_GROUPS_USED_MASK +#define NRF_802154_ENCRYPTION_ACCELERATOR_ECB + #ifdef __cplusplus } #endif diff --git a/nrf_802154/driver/src/nrf_802154_peripherals_nrf54h.h b/nrf_802154/driver/src/nrf_802154_peripherals_nrf54h.h index dc41b5fab1..54d2337802 100644 --- a/nrf_802154/driver/src/nrf_802154_peripherals_nrf54h.h +++ b/nrf_802154/driver/src/nrf_802154_peripherals_nrf54h.h @@ -40,7 +40,11 @@ #ifndef NRF_802154_PERIPHERALS_NRF54H_H__ #define NRF_802154_PERIPHERALS_NRF54H_H__ -#include +/* This file must not include nrf.h or nrfx.h directly or indirectly, + * to avoid circular dependencies. + */ + +#include "nrf_802154_config_soc.h" #include "nrf_802154_config.h" #include "nrf_802154_sl_periphs.h" @@ -298,6 +302,8 @@ extern "C" { */ #define NRF_802154_TIMER_INSTANCE_NO 022 +#define NRF_802154_ENCRYPTION_ACCELERATOR_CCM + #ifdef __cplusplus } #endif diff --git a/nrf_802154/driver/src/nrf_802154_peripherals_nrf54l.h b/nrf_802154/driver/src/nrf_802154_peripherals_nrf54l.h index 79c1164cc8..79ed08200f 100644 --- a/nrf_802154/driver/src/nrf_802154_peripherals_nrf54l.h +++ b/nrf_802154/driver/src/nrf_802154_peripherals_nrf54l.h @@ -40,7 +40,11 @@ #ifndef NRF_802154_PERIPHERALS_NRF54L_H__ #define NRF_802154_PERIPHERALS_NRF54L_H__ -#include +/* This file must not include nrf.h or nrfx.h directly or indirectly, + * to avoid circular dependencies. + */ + +#include "nrf_802154_config_soc.h" #include "nrf_802154_config.h" #include "nrf_802154_sl_periphs.h" @@ -361,6 +365,8 @@ extern "C" { */ #define NRF_802154_TIMER_INSTANCE_NO 10 +#define NRF_802154_ENCRYPTION_ACCELERATOR_CCM + #ifdef __cplusplus } #endif diff --git a/nrf_802154/driver/src/nrf_802154_swi_callouts_weak.c b/nrf_802154/driver/src/nrf_802154_swi_callouts_weak.c index 47a07c4921..ac2b84ad3a 100644 --- a/nrf_802154/driver/src/nrf_802154_swi_callouts_weak.c +++ b/nrf_802154/driver/src/nrf_802154_swi_callouts_weak.c @@ -33,7 +33,7 @@ */ #include "nrf_802154_swi_callouts.h" -#include "compiler_abstraction.h" +#include __WEAK void nrf_802154_trx_swi_irq_handler(void) { diff --git a/nrf_802154/driver/src/nrf_802154_trx.c b/nrf_802154/driver/src/nrf_802154_trx.c index 118ba3798d..5e76697fea 100644 --- a/nrf_802154/driver/src/nrf_802154_trx.c +++ b/nrf_802154/driver/src/nrf_802154_trx.c @@ -42,13 +42,14 @@ #include "nrf_802154_compiler.h" #include "nrf_802154_config.h" #include "nrf_802154_const.h" +#include "nrf_802154_debug.h" #include "nrf_802154_peripherals.h" #include "nrf_802154_pib.h" #include "nrf_802154_rssi.h" #include "nrf_802154_trx_ppi_api.h" #include "nrf_802154_utils.h" -#include +#include #include "hal/nrf_egu.h" #include "hal/nrf_radio.h" #include "hal/nrf_timer.h" diff --git a/nrf_802154/sl/sl/include/nrf_802154_sl_periphs.h b/nrf_802154/sl/sl/include/nrf_802154_sl_periphs.h index fb3bdbb13b..6df2df4074 100644 --- a/nrf_802154/sl/sl/include/nrf_802154_sl_periphs.h +++ b/nrf_802154/sl/sl/include/nrf_802154_sl_periphs.h @@ -12,8 +12,11 @@ #ifndef NRF_802154_SL_PERIPHS_H__ #define NRF_802154_SL_PERIPHS_H__ -#include -#include +/* This file must not include nrf.h or nrfx.h directly or indirectly, + * to avoid circular dependencies. + */ + +#include "nrf_802154_config_soc.h" #if NRF_802154_USE_INTERNAL_INCLUDES #include "nrf_802154_sl_periphs_internal.h" @@ -27,16 +30,16 @@ * */ #ifndef NRF_802154_EGU_INSTANCE_NO -#if defined(NRF52_SERIES) || defined(NRF5340_XXAA) +#if defined(NRF_802154_SOC_NRF52_SERIES) || defined(NRF_802154_SOC_NRF53_SERIES) #define NRF_802154_EGU_INSTANCE_NO 0 -#elif defined(NRF54L_SERIES) +#elif defined(NRF_802154_SOC_NRF54L_SERIES) #define NRF_802154_EGU_INSTANCE_NO 10 -#elif defined(NRF54H_SERIES) +#elif defined(NRF_802154_SOC_NRF54H_SERIES) #define NRF_802154_EGU_INSTANCE_NO 020 #endif #endif -#if defined(NRF53_SERIES) +#if defined(NRF_802154_SOC_NRF53_SERIES) /** * @def NRF_802154_EGU_INSTANCE * @@ -138,7 +141,7 @@ * */ #ifndef NRF_802154_PPI_RTC_COMPARE_TO_TIMER_CAPTURE -#if defined(DPPI_PRESENT) +#if defined(NRF_802154_SOC_DPPI_PRESENT) #define NRF_802154_PPI_RTC_COMPARE_TO_TIMER_CAPTURE 13U #else #define NRF_802154_PPI_RTC_COMPARE_TO_TIMER_CAPTURE 13U @@ -155,7 +158,7 @@ * */ #ifndef NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE -#if defined(DPPI_PRESENT) +#if defined(NRF_802154_SOC_DPPI_PRESENT) #define NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE 11U #else #define NRF_802154_PPI_TIMESTAMP_EVENT_TO_TIMER_CAPTURE 14U @@ -181,7 +184,7 @@ * */ #ifndef NRF_802154_PPI_TIMESTAMP_GROUP -#if defined(DPPI_PRESENT) +#if defined(NRF_802154_SOC_DPPI_PRESENT) #define NRF_802154_PPI_TIMESTAMP_GROUP 1U #else #define NRF_802154_PPI_TIMESTAMP_GROUP 2U @@ -204,7 +207,7 @@ #define NRF_802154_SL_EGU_USED_CHANNELS_MASK \ NRF_802154_SL_EGU_TIMESTAMP_USED_CHANNELS_MASK -#if defined(NRF54L_SERIES) +#if defined(NRF_802154_SOC_NRF54L_SERIES) /** * @def NRF_802154_SL_DPPIC_INSTANCE_NO * @@ -223,9 +226,9 @@ */ #define NRF_802154_SL_DPPIC_INSTANCE NRFX_CONCAT_2(NRF_DPPIC, NRF_802154_SL_DPPIC_INSTANCE_NO) -#endif // defined(NRF54L_SERIES) +#endif // defined(NRF_802154_SOC_NRF54L_SERIES) -#if defined(NRF54H_SERIES) +#if defined(NRF_802154_SOC_NRF54H_SERIES) /** * @def NRF_802154_SL_DPPIC_INSTANCE_NO @@ -245,6 +248,6 @@ */ #define NRF_802154_SL_DPPIC_INSTANCE NRFX_CONCAT_2(NRF_DPPIC, NRF_802154_SL_DPPIC_INSTANCE_NO) -#endif // defined(NRF54H_SERIES) +#endif // defined(NRF_802154_SOC_NRF54H_SERIES) #endif // NRF_802154_SL_PERIPHS_H__ diff --git a/nrf_802154/sl/sl_opensource/include/nrf_802154_sl_periphs.h b/nrf_802154/sl/sl_opensource/include/nrf_802154_sl_periphs.h index e8df3be6bc..9061c6c193 100644 --- a/nrf_802154/sl/sl_opensource/include/nrf_802154_sl_periphs.h +++ b/nrf_802154/sl/sl_opensource/include/nrf_802154_sl_periphs.h @@ -12,7 +12,11 @@ #ifndef NRF_802154_SL_PERIPHS_H__ #define NRF_802154_SL_PERIPHS_H__ -#include +/* This file must not include nrf.h or nrfx.h directly or indirectly, + * to avoid circular dependencies. + */ + +#include "nrf_802154_config_soc.h" #if NRF_802154_USE_INTERNAL_INCLUDES #include "nrf_802154_sl_periphs_internal.h" diff --git a/nrf_802154/sl/sl_opensource/include/protocol/mpsl_fem_protocol_api.h b/nrf_802154/sl/sl_opensource/include/protocol/mpsl_fem_protocol_api.h index 62f196c048..ce229ddc35 100644 --- a/nrf_802154/sl/sl_opensource/include/protocol/mpsl_fem_protocol_api.h +++ b/nrf_802154/sl/sl_opensource/include/protocol/mpsl_fem_protocol_api.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nrf_errno.h" /** @brief PA and LNA functionality types. */