diff --git a/arch/arm/src/nrf53/nrf53_gpio.c b/arch/arm/src/nrf53/nrf53_gpio.c index bf7d4943d7..f5ad52ddb9 100644 --- a/arch/arm/src/nrf53/nrf53_gpio.c +++ b/arch/arm/src/nrf53/nrf53_gpio.c @@ -493,3 +493,55 @@ void nrf53_gpio_detectmode(int port, enum nrf53_gpio_detectmode_e mode) GPIO_DETECTMODE_DEFAULT : GPIO_DETECTMODE_LDETECT, offset); } + +#ifdef CONFIG_NRF53_APPCORE +/**************************************************************************** + * Name: nrf53_gpio_cpunet_allow + * + * Description: + * Allow GPIO to be used by the net core. + * Can be used only with te app core. + * + ****************************************************************************/ + +void nrf53_gpio_cpunet_allow(uint32_t gpio) +{ + unsigned int port; + unsigned int pin; + + /* Get port and pin number */ + + pin = GPIO_PIN_DECODE(gpio); + port = GPIO_PORT_DECODE(gpio); + + nrf53_gpio_mcusel(GPIO_MCUSEL_NET, port, pin); +} + +/**************************************************************************** + * Name: nrf53_gpio_cpunet_allow_all + * + * Description: + * Allow all GPIO to be used by the net core. + * This can be overwritten by the app core. + * + ****************************************************************************/ + +void nrf53_gpio_cpunet_allow_all(void) +{ + int i = 0; + + /* Port 0 */ + + for (i = 0; i < NRF53_GPIO_NPINS; i += 1) + { + nrf53_gpio_mcusel(GPIO_MCUSEL_NET, 0, i); + } + + /* Port 1 */ + + for (i = 0; i < NRF53_GPIO_NPINS; i += 1) + { + nrf53_gpio_mcusel(GPIO_MCUSEL_NET, 1, i); + } +} +#endif diff --git a/arch/arm/src/nrf53/nrf53_gpio.h b/arch/arm/src/nrf53/nrf53_gpio.h index 3d2fb85856..276d376668 100644 --- a/arch/arm/src/nrf53/nrf53_gpio.h +++ b/arch/arm/src/nrf53/nrf53_gpio.h @@ -269,6 +269,30 @@ int nrf53_gpio_dump(nrf53_pinset_t pinset, const char *msg); # define nrf53_gpio_dump(p,m) #endif +#ifdef CONFIG_NRF53_APPCORE +/**************************************************************************** + * Name: nrf53_gpio_cpunet_allow + * + * Description: + * Allow GPIO to be used by the net core. + * Can be used only with te app core. + * + ****************************************************************************/ + +void nrf53_gpio_cpunet_allow(uint32_t gpio); + +/**************************************************************************** + * Name: nrf53_gpio_cpunet_allow_all + * + * Description: + * Allow all GPIO to be used by the net core. + * This can be overwritten by the app core. + * + ****************************************************************************/ + +void nrf53_gpio_cpunet_allow_all(void); +#endif + #ifdef __cplusplus } #endif