From 222d42c22ac562aa8d63df556df64161cef03ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 24 Feb 2022 09:47:23 +0100 Subject: [PATCH] modules: hal_nordic: Improve reservation of resources for BT_CTLR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of including from nrfx_glue.h a specific Zephyr Bluetooth controller header file that defines PPI and GPIOTE resources to be reserved for exclusive use by the controller, include a file with only a fixed name and expect the chosen Bluetooth controller to provide the location of this file in include paths. This way, when a different Bluetooth controller implementation is used downstream, a different file can be easily pointed to. Signed-off-by: Andrzej Głąbek --- modules/hal_nordic/nrfx/nrfx_glue.h | 10 ++++++++-- .../bt_ctlr_used_resources.h} | 6 +++--- subsys/bluetooth/controller/ll_sw/nrf.cmake | 6 ++++++ 3 files changed, 17 insertions(+), 5 deletions(-) rename subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/{radio/radio_nrf5_resources.h => nrfx_glue/bt_ctlr_used_resources.h} (96%) diff --git a/modules/hal_nordic/nrfx/nrfx_glue.h b/modules/hal_nordic/nrfx/nrfx_glue.h index 6fef79ab101..eeb1ef89c1f 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.h +++ b/modules/hal_nordic/nrfx/nrfx_glue.h @@ -275,8 +275,14 @@ void nrfx_busy_wait(uint32_t usec_to_wait); #define NRFX_GPIOTE_CHANNELS_USED NRFX_GPIOTE_CHANNELS_USED_BY_BT_CTLR #if defined(CONFIG_BT_CTLR) -#include <../subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h> - +/* + * The enabled Bluetooth controller subsystem is responsible for providing + * definitions of the BT_CTLR_USED_* symbols used below in a file named + * bt_ctlr_used_resources.h and for adding its location to global include + * paths so that the file can be included here for all Zephyr libraries that + * are to be built. + */ +#include #define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS #define NRFX_PPI_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS #define NRFX_GPIOTE_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_GPIOTE_CHANNELS diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/nrfx_glue/bt_ctlr_used_resources.h similarity index 96% rename from subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h rename to subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/nrfx_glue/bt_ctlr_used_resources.h index cc67a11ee6f..a9c5fb216a7 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/nrfx_glue/bt_ctlr_used_resources.h @@ -3,12 +3,12 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#include "radio_nrf5_fem.h" +#include "../radio/radio_nrf5_fem.h" #ifdef DPPI_PRESENT -#include "radio_nrf5_dppi_resources.h" +#include "../radio/radio_nrf5_dppi_resources.h" #else -#include "radio_nrf5_ppi_resources.h" +#include "../radio/radio_nrf5_ppi_resources.h" #endif #if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || \ diff --git a/subsys/bluetooth/controller/ll_sw/nrf.cmake b/subsys/bluetooth/controller/ll_sw/nrf.cmake index 249c3e5c589..546e2e7531a 100644 --- a/subsys/bluetooth/controller/ll_sw/nrf.cmake +++ b/subsys/bluetooth/controller/ll_sw/nrf.cmake @@ -100,3 +100,9 @@ zephyr_library_include_directories( ll_sw/nordic hci/nordic ) + +# This path needs to be added globally as it is supposed to be used +# in nrfx_glue.h when other libraries are built. +zephyr_include_directories( + ll_sw/nordic/hal/nrf5/nrfx_glue +)