This is an automated email from the ASF dual-hosted git repository. kasjer pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit dd12210fb5ecf0cb6a1a72644a873a6ede6c0109 Author: Jerzy Kasenberg <[email protected]> AuthorDate: Wed Sep 30 11:35:41 2026 +0200 hw/mcu/nordic: Initialize GPPI helper nrfx 4.x GPPI helper requires nrfx_gppi_init() to be called with resources available for allocation before any GPPI API is used. nRF52 (PPI), nRF5340 app, nRF5340 net and nRF91 (DPPI) have single PPI/DPPI instance, so GPPI is initialized in hal_system_init() with all channels and groups except those reserved with NRFX_(D)PPI_CHANNELS_USED/NRFX_(D)PPI_GROUPS_USED. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Jerzy Kasenberg <[email protected]> --- hw/mcu/nordic/nrf52xxx/src/hal_system.c | 14 ++++++++++++++ hw/mcu/nordic/nrf5340/src/hal_system.c | 14 ++++++++++++++ hw/mcu/nordic/nrf5340_net/src/hal_system.c | 14 ++++++++++++++ hw/mcu/nordic/nrf91xx/src/hal_system.c | 14 ++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_system.c b/hw/mcu/nordic/nrf52xxx/src/hal_system.c index cd8e63d39..4839b3541 100644 --- a/hw/mcu/nordic/nrf52xxx/src/hal_system.c +++ b/hw/mcu/nordic/nrf52xxx/src/hal_system.c @@ -25,6 +25,16 @@ #include "nrf.h" #include "mcu/nrf52_clock.h" +#if MYNEWT_VAL(NRFX_PPI_ENABLED) +#include <helpers/nrfx_gppi.h> + +/* Resources available to GPPI helper (single PPI instance) */ +static nrfx_gppi_t nrf52_gppi = { + .ch_mask = NRFX_BIT_MASK(PPI_CH_NUM) & ~NRFX_PPI_CHANNELS_USED, + .group_mask = NRFX_BIT_MASK(PPI_GROUP_NUM) & ~NRFX_PPI_GROUPS_USED, +}; +#endif + /** * Function called at startup. Called after BSS and .data initialized but * prior to the _start function. @@ -40,6 +50,10 @@ hal_system_init(void) { NVIC_Relocate(); +#if MYNEWT_VAL(NRFX_PPI_ENABLED) + nrfx_gppi_init(&nrf52_gppi); +#endif + #if MYNEWT_VAL(MCU_ICACHE_ENABLED) NRF_NVMC->ICACHECNF = 1; #endif diff --git a/hw/mcu/nordic/nrf5340/src/hal_system.c b/hw/mcu/nordic/nrf5340/src/hal_system.c index ff9305d07..879afce7d 100644 --- a/hw/mcu/nordic/nrf5340/src/hal_system.c +++ b/hw/mcu/nordic/nrf5340/src/hal_system.c @@ -28,6 +28,16 @@ #include <hal/nrf_oscillators.h> #include <tfm/tfm.h> +#if MYNEWT_VAL(NRFX_DPPI_ENABLED) +#include <helpers/nrfx_gppi.h> + +/* Resources available to GPPI helper (single DPPIC instance) */ +static nrfx_gppi_t nrf5340_gppi = { + .ch_mask = NRFX_BIT_MASK(DPPIC_CH_NUM) & ~NRFX_DPPI_CHANNELS_USED, + .group_mask = NRFX_BIT_MASK(DPPIC_GROUP_NUM) & ~NRFX_DPPI_GROUPS_USED, +}; +#endif + /** * Function called at startup. Called after BSS and .data initialized but * prior to the _start function. @@ -43,6 +53,10 @@ hal_system_init(void) { NVIC_Relocate(); +#if MYNEWT_VAL(NRFX_DPPI_ENABLED) + nrfx_gppi_init(&nrf5340_gppi); +#endif + #if MYNEWT_VAL(MCU_CACHE_ENABLED) #if MYNEWT_VAL(MCU_APP_SECURE) || MYNEWT_VAL(BOOT_LOADER) NRF_CACHE_S->ENABLE = 1; diff --git a/hw/mcu/nordic/nrf5340_net/src/hal_system.c b/hw/mcu/nordic/nrf5340_net/src/hal_system.c index 71322cf56..26bbc150a 100644 --- a/hw/mcu/nordic/nrf5340_net/src/hal_system.c +++ b/hw/mcu/nordic/nrf5340_net/src/hal_system.c @@ -25,6 +25,16 @@ #include <mynewt_cm.h> #include <nrf.h> +#if MYNEWT_VAL(NRFX_DPPI_ENABLED) +#include <helpers/nrfx_gppi.h> + +/* Resources available to GPPI helper (single DPPIC instance) */ +static nrfx_gppi_t nrf5340_net_gppi = { + .ch_mask = NRFX_BIT_MASK(DPPIC_CH_NUM) & ~NRFX_DPPI_CHANNELS_USED, + .group_mask = NRFX_BIT_MASK(DPPIC_GROUP_NUM) & ~NRFX_DPPI_GROUPS_USED, +}; +#endif + /** * Function called at startup. Called after BSS and .data initialized but * prior to the _start function. @@ -40,6 +50,10 @@ hal_system_init(void) { NVIC_Relocate(); +#if MYNEWT_VAL(NRFX_DPPI_ENABLED) + nrfx_gppi_init(&nrf5340_net_gppi); +#endif + #if MYNEWT_VAL(MCU_ICACHE_ENABLED) NRF_NVMC_NS->ICACHECNF = 1; #endif diff --git a/hw/mcu/nordic/nrf91xx/src/hal_system.c b/hw/mcu/nordic/nrf91xx/src/hal_system.c index f370ffb04..aa8246b02 100644 --- a/hw/mcu/nordic/nrf91xx/src/hal_system.c +++ b/hw/mcu/nordic/nrf91xx/src/hal_system.c @@ -25,6 +25,16 @@ #include "nrf.h" #include "nrfx_config.h" +#if MYNEWT_VAL(NRFX_DPPI_ENABLED) +#include <helpers/nrfx_gppi.h> + +/* Resources available to GPPI helper (single DPPIC instance) */ +static nrfx_gppi_t nrf91_gppi = { + .ch_mask = NRFX_BIT_MASK(DPPIC_CH_NUM) & ~NRFX_DPPI_CHANNELS_USED, + .group_mask = NRFX_BIT_MASK(DPPIC_GROUP_NUM) & ~NRFX_DPPI_GROUPS_USED, +}; +#endif + /** * Function called at startup. Called after BSS and .data initialized but * prior to the _start function. @@ -40,6 +50,10 @@ hal_system_init(void) { NVIC_Relocate(); +#if MYNEWT_VAL(NRFX_DPPI_ENABLED) + nrfx_gppi_init(&nrf91_gppi); +#endif + #if MYNEWT_VAL(MCU_DCDC_ENABLED) NRF_REGULATORS->DCDCEN = 1; #endif
