Skip to content

Commit

Permalink
[nrf noup] modules: hal_nordic: use Kconfig symbols in NCS reservation
Browse files Browse the repository at this point in the history
As nrfx_config is included before MDK, MDK-specific device symbols
cannot be used. Use Kconfig symbols instead.

Signed-off-by: Nikodem Kastelik <[email protected]>
  • Loading branch information
nika-nordic committed Feb 21, 2025
1 parent a1a9b9a commit 5527f26
Showing 1 changed file with 40 additions and 19 deletions.
59 changes: 40 additions & 19 deletions modules/hal_nordic/nrfx/nrfx_config_reserved_resources_ncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@
*/
#define NRFX_TIMERS_USED 0

/* If the GRTC system timer driver is to be used, prepare definitions required
* by the nrfx_grtc driver (NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK and
* NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS) based on information from devicetree.
*/
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc)
#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \
(NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), owned_channels) & \
~NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), child_owned_channels))
#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \
(DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \
DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0))
#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */

/*
* The enabled Bluetooth controller subsystem is responsible for providing
* definitions of the BT_CTLR_USED_* symbols used below in a file named
Expand All @@ -40,32 +53,40 @@
*/
#if defined(CONFIG_BT_LL_SW_SPLIT)
#include <bt_ctlr_used_resources.h>
#if defined(DPPI_PRESENT)
#if defined(NRF53_SERIES)
#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_COMPATIBLE_NRF52X)
#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
#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X)
#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS
#define NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS
#elif defined(NRF54L_SERIES)
#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX)
#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS
#define NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS
#endif
#else /* defined(DPPI_PRESENT) */
#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
#endif /* defined(DPPI_PRESENT) */
#endif /* defined(CONFIG_BT_LL_SW_SPLIT) */

#if defined(CONFIG_BT_LL_SOFTDEVICE)
/* Define auxiliary symbols needed for SDC device dispatch. */
#if defined(CONFIG_SOC_COMPATIBLE_NRF52X)
#define NRF52_SERIES
#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X)
#define NRF53_SERIES
#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX)
#define NRF54L_SERIES
#elif defined(CONFIG_SOC_SERIES_NRF54HX)
#define NRF54H_SERIES
#endif
#include <sdc_soc.h>
#if defined(NRF52_SERIES)
#if defined(CONFIG_SOC_COMPATIBLE_NRF52X)
#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR SDC_PPI_CHANNELS_USED_MASK
#elif defined(NRF53_SERIES)
#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X)
#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR SDC_DPPI_CHANNELS_USED_MASK
#elif defined(NRF54L_SERIES)
#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX)
#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC10_CHANNELS_USED_MASK
#define NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC00_CHANNELS_USED_MASK
#define NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR \
(SDC_PPIB00_CHANNELS_USED_MASK | SDC_PPIB10_CHANNELS_USED_MASK)
#elif defined(NRF54H_SERIES)
#elif defined(CONFIG_SOC_SERIES_NRF54HX)
#define NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC020_CHANNELS_USED_MASK
#define NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR SDC_DPPIC030_CHANNELS_USED_MASK
#define NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR \
Expand All @@ -76,19 +97,19 @@
#endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */

#if defined(CONFIG_NRF_802154_RADIO_DRIVER)
#if defined(NRF52_SERIES)
#if defined(CONFIG_SOC_COMPATIBLE_NRF52X)
#include <../src/nrf_802154_peripherals_nrf52.h>
#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV NRF_802154_PPI_CHANNELS_USED_MASK
#define NRFX_PPI_GROUPS_USED_BY_802154_DRV NRF_802154_PPI_GROUPS_USED_MASK
#elif defined(NRF53_SERIES)
#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X)
#include <../src/nrf_802154_peripherals_nrf53.h>
#define NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK
#define NRFX_DPPI0_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK
#elif defined(NRF54L_SERIES)
#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX)
#include <../src/nrf_802154_peripherals_nrf54l.h>
#define NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK
#define NRFX_DPPI10_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK
#elif defined(NRF54H_SERIES)
#elif defined(CONFIG_SOC_SERIES_NRF54HX)
#include <../src/nrf_802154_peripherals_nrf54h.h>
#define NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK
#define NRFX_DPPI020_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK
Expand All @@ -99,16 +120,16 @@

#if defined(CONFIG_MPSL)
#include <mpsl.h>
#if defined(NRF52_SERIES)
#if defined(CONFIG_SOC_COMPATIBLE_NRF52X)
#define NRFX_PPI_CHANNELS_USED_BY_MPSL MPSL_PPI_CHANNELS_USED_MASK
#elif defined(NRF53_SERIES)
#elif defined(CONFIG_SOC_COMPATIBLE_NRF53X)
#define NRFX_DPPI0_CHANNELS_USED_BY_MPSL MPSL_DPPIC_CHANNELS_USED_MASK
#elif defined(NRF54L_SERIES)
#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX)
#define NRFX_DPPI10_CHANNELS_USED_BY_MPSL MPSL_DPPIC10_CHANNELS_USED_MASK
#define NRFX_DPPI20_CHANNELS_USED_BY_MPSL MPSL_DPPIC20_CHANNELS_USED_MASK
#define NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL \
(MPSL_PPIB11_CHANNELS_USED_MASK | MPSL_PPIB21_CHANNELS_USED_MASK)
#elif defined(NRF54H_SERIES)
#elif defined(CONFIG_SOC_SERIES_NRF54HX)
#define NRFX_DPPI020_CHANNELS_USED_BY_MPSL MPSL_DPPIC020_CHANNELS_USED_MASK
#else
#error Unsupported chip family
Expand Down

0 comments on commit 5527f26

Please sign in to comment.