Skip to content

Commit cc808d6

Browse files
nika-nordicjaz1-nordic
authored andcommitted
[nrf fromlist] subsys: bluetooth: nordic: align to nrfx_gpiote with extracted cb
GPIOTE driver instances are no longer defined within nrfx. Upstream PR #: 98527 Signed-off-by: Nikodem Kastelik <[email protected]>
1 parent a31a798 commit cc808d6

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <nrf_sys_event.h>
1414
#include <nrfx_gpiote.h>
15+
#include <gpiote_nrfx.h>
1516

1617
#include "util/mem.h"
1718

@@ -67,8 +68,8 @@ BUILD_ASSERT(!HAL_RADIO_GPIO_LNA_OFFSET_MISSING,
6768
#endif /* FEM_NODE */
6869

6970
#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || defined(HAL_RADIO_GPIO_HAVE_LNA_PIN)
70-
static const nrfx_gpiote_t gpiote_palna = NRFX_GPIOTE_INSTANCE(
71-
NRF_DT_GPIOTE_INST(FEM_NODE, HAL_RADIO_GPIO_PA_PROP));
71+
static nrfx_gpiote_t * const gpiote_palna =
72+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(FEM_NODE, HAL_RADIO_GPIO_PA_PROP));
7273
static uint8_t gpiote_ch_palna;
7374

7475
BUILD_ASSERT(NRF_DT_GPIOTE_INST(FEM_NODE, HAL_RADIO_GPIO_PA_PROP) ==
@@ -78,8 +79,8 @@ BUILD_ASSERT(NRF_DT_GPIOTE_INST(FEM_NODE, HAL_RADIO_GPIO_PA_PROP) ==
7879
#endif
7980

8081
#if defined(HAL_RADIO_FEM_IS_NRF21540)
81-
static const nrfx_gpiote_t gpiote_pdn = NRFX_GPIOTE_INSTANCE(
82-
NRF_DT_GPIOTE_INST(FEM_NODE, pdn_gpios));
82+
static nrfx_gpiote_t * const gpiote_pdn =
83+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(FEM_NODE, pdn_gpios));
8384
static uint8_t gpiote_ch_pdn;
8485
#endif
8586

@@ -1940,13 +1941,13 @@ uint32_t radio_tmr_sample_get(void)
19401941
int radio_gpio_pa_lna_init(void)
19411942
{
19421943
#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || defined(HAL_RADIO_GPIO_HAVE_LNA_PIN)
1943-
if (nrfx_gpiote_channel_alloc(&gpiote_palna, &gpiote_ch_palna) != NRFX_SUCCESS) {
1944+
if (nrfx_gpiote_channel_alloc(gpiote_palna, &gpiote_ch_palna) != NRFX_SUCCESS) {
19441945
return -ENOMEM;
19451946
}
19461947
#endif
19471948

19481949
#if defined(NRF_GPIO_PDN_PIN)
1949-
if (nrfx_gpiote_channel_alloc(&gpiote_pdn, &gpiote_ch_pdn) != NRFX_SUCCESS) {
1950+
if (nrfx_gpiote_channel_alloc(gpiote_pdn, &gpiote_ch_pdn) != NRFX_SUCCESS) {
19501951
return -ENOMEM;
19511952
}
19521953
#endif
@@ -1957,18 +1958,18 @@ int radio_gpio_pa_lna_init(void)
19571958
void radio_gpio_pa_lna_deinit(void)
19581959
{
19591960
#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || defined(HAL_RADIO_GPIO_HAVE_LNA_PIN)
1960-
(void)nrfx_gpiote_channel_free(&gpiote_palna, gpiote_ch_palna);
1961+
(void)nrfx_gpiote_channel_free(gpiote_palna, gpiote_ch_palna);
19611962
#endif
19621963

19631964
#if defined(NRF_GPIO_PDN_PIN)
1964-
(void)nrfx_gpiote_channel_free(&gpiote_pdn, gpiote_ch_pdn);
1965+
(void)nrfx_gpiote_channel_free(gpiote_pdn, gpiote_ch_pdn);
19651966
#endif
19661967
}
19671968

19681969
#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN)
19691970
void radio_gpio_pa_setup(void)
19701971
{
1971-
gpiote_palna.p_reg->CONFIG[gpiote_ch_palna] =
1972+
gpiote_palna->p_reg->CONFIG[gpiote_ch_palna] =
19721973
(GPIOTE_CONFIG_MODE_Task <<
19731974
GPIOTE_CONFIG_MODE_Pos) |
19741975
(NRF_GPIO_PA_PSEL <<
@@ -1988,7 +1989,7 @@ void radio_gpio_pa_setup(void)
19881989
#if defined(HAL_RADIO_GPIO_HAVE_LNA_PIN)
19891990
void radio_gpio_lna_setup(void)
19901991
{
1991-
gpiote_palna.p_reg->CONFIG[gpiote_ch_palna] =
1992+
gpiote_palna->p_reg->CONFIG[gpiote_ch_palna] =
19921993
(GPIOTE_CONFIG_MODE_Task <<
19931994
GPIOTE_CONFIG_MODE_Pos) |
19941995
(NRF_GPIO_LNA_PSEL <<
@@ -2008,7 +2009,7 @@ void radio_gpio_pdn_setup(void)
20082009
{
20092010
/* Note: the pdn-gpios property is optional. */
20102011
#if defined(NRF_GPIO_PDN)
2011-
gpiote_pdn.p_reg->CONFIG[gpiote_ch_pdn] =
2012+
gpiote_pdn->p_reg->CONFIG[gpiote_ch_pdn] =
20122013
(GPIOTE_CONFIG_MODE_Task <<
20132014
GPIOTE_CONFIG_MODE_Pos) |
20142015
(NRF_GPIO_PDN_PSEL <<
@@ -2062,12 +2063,12 @@ void radio_gpio_pa_lna_disable(void)
20622063
BIT(HAL_DISABLE_PALNA_PPI) |
20632064
BIT(HAL_ENABLE_FEM_PPI) |
20642065
BIT(HAL_DISABLE_FEM_PPI));
2065-
gpiote_palna.p_reg->CONFIG[gpiote_ch_palna] = 0;
2066-
gpiote_pdn.p_reg->CONFIG[gpiote_ch_pdn] = 0;
2066+
gpiote_palna->p_reg->CONFIG[gpiote_ch_palna] = 0;
2067+
gpiote_pdn->p_reg->CONFIG[gpiote_ch_pdn] = 0;
20672068
#else
20682069
hal_radio_nrf_ppi_channels_disable(BIT(HAL_ENABLE_PALNA_PPI) |
20692070
BIT(HAL_DISABLE_PALNA_PPI));
2070-
gpiote_palna.p_reg->CONFIG[gpiote_ch_palna] = 0;
2071+
gpiote_palna->p_reg->CONFIG[gpiote_ch_palna] = 0;
20712072
#endif
20722073
}
20732074
#endif /* HAL_RADIO_GPIO_HAVE_PA_PIN || HAL_RADIO_GPIO_HAVE_LNA_PIN */

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_gpiote.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static inline void hal_palna_ppi_setup(void)
1818
nrf_gpiote_task_t task;
1919

2020
task = nrf_gpiote_out_task_get(gpiote_ch_palna);
21-
nrf_gpiote_subscribe_set(gpiote_palna.p_reg, task, HAL_DISABLE_PALNA_PPI);
21+
nrf_gpiote_subscribe_set(gpiote_palna->p_reg, task, HAL_DISABLE_PALNA_PPI);
2222
#endif
2323
}
2424
#endif /* defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || defined(HAL_RADIO_GPIO_HAVE_LNA_PIN) */
@@ -44,14 +44,14 @@ static inline void hal_gpiote_tasks_setup(NRF_GPIOTE_Type *gpiote,
4444

4545
static inline void hal_pa_ppi_setup(void)
4646
{
47-
hal_gpiote_tasks_setup(gpiote_palna.p_reg, gpiote_ch_palna,
47+
hal_gpiote_tasks_setup(gpiote_palna->p_reg, gpiote_ch_palna,
4848
IS_ENABLED(HAL_RADIO_GPIO_PA_POL_INV),
4949
HAL_ENABLE_PALNA_PPI, HAL_DISABLE_PALNA_PPI);
5050
}
5151

5252
static inline void hal_lna_ppi_setup(void)
5353
{
54-
hal_gpiote_tasks_setup(gpiote_palna.p_reg, gpiote_ch_palna,
54+
hal_gpiote_tasks_setup(gpiote_palna->p_reg, gpiote_ch_palna,
5555
IS_ENABLED(HAL_RADIO_GPIO_LNA_POL_INV),
5656
HAL_ENABLE_PALNA_PPI, HAL_DISABLE_PALNA_PPI);
5757
}
@@ -63,7 +63,7 @@ static inline void hal_fem_ppi_setup(void)
6363
nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_DISABLED,
6464
HAL_DISABLE_FEM_PPI);
6565

66-
hal_gpiote_tasks_setup(gpiote_pdn.p_reg, gpiote_ch_pdn,
66+
hal_gpiote_tasks_setup(gpiote_pdn->p_reg, gpiote_ch_pdn,
6767
IS_ENABLED(HAL_RADIO_GPIO_NRF21540_PDN_POL_INV),
6868
HAL_ENABLE_FEM_PPI, HAL_DISABLE_FEM_PPI);
6969
}

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi_gpiote.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ static inline void hal_palna_ppi_setup(void)
1313
NRF_PPI,
1414
HAL_ENABLE_PALNA_PPI,
1515
(uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[2]),
16-
(uint32_t)&(gpiote_palna.p_reg->TASKS_OUT[gpiote_ch_palna]));
16+
(uint32_t)&(gpiote_palna->p_reg->TASKS_OUT[gpiote_ch_palna]));
1717
nrf_ppi_channel_endpoint_setup(
1818
NRF_PPI,
1919
HAL_DISABLE_PALNA_PPI,
2020
(uint32_t)&(NRF_RADIO->EVENTS_DISABLED),
21-
(uint32_t)&(gpiote_palna.p_reg->TASKS_OUT[gpiote_ch_palna]));
21+
(uint32_t)&(gpiote_palna->p_reg->TASKS_OUT[gpiote_ch_palna]));
2222
}
2323
#endif /* defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || defined(HAL_RADIO_GPIO_HAVE_LNA_PIN) */
2424

@@ -40,12 +40,12 @@ static inline void hal_fem_ppi_setup(void)
4040
NRF_PPI,
4141
HAL_ENABLE_FEM_PPI,
4242
(uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[3]),
43-
(uint32_t)&(gpiote_pdn.p_reg->TASKS_OUT[gpiote_ch_pdn]));
43+
(uint32_t)&(gpiote_pdn->p_reg->TASKS_OUT[gpiote_ch_pdn]));
4444
nrf_ppi_channel_endpoint_setup(
4545
NRF_PPI,
4646
HAL_DISABLE_FEM_PPI,
4747
(uint32_t)&(NRF_RADIO->EVENTS_DISABLED),
48-
(uint32_t)&(gpiote_pdn.p_reg->TASKS_OUT[gpiote_ch_pdn]));
48+
(uint32_t)&(gpiote_pdn->p_reg->TASKS_OUT[gpiote_ch_pdn]));
4949
}
5050

5151
#endif /* HAL_RADIO_FEM_IS_NRF21540 */

0 commit comments

Comments
 (0)