Skip to content

Commit 8130877

Browse files
nika-nordicmasz-nordic
authored andcommitted
subsys: mpsl: align to nrfx_gpiote changes
GPIOTE driver instances are no longer defined within nrfx. Signed-off-by: Nikodem Kastelik <[email protected]>
1 parent cb1e59b commit 8130877

File tree

10 files changed

+122
-99
lines changed

10 files changed

+122
-99
lines changed

subsys/mpsl/cx/1wire/mpsl_cx_1wire.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "hal/nrf_gpio.h"
2828
#include <nrfx_gpiote.h>
29+
#include <gpiote_nrfx.h>
2930

3031
#if DT_NODE_EXISTS(DT_NODELABEL(nrf_radio_coex))
3132
#define CX_NODE DT_NODELABEL(nrf_radio_coex)
@@ -50,8 +51,8 @@
5051
#define GRANT_PIN_PORT_NO DT_PROP(DT_GPIO_CTLR(CX_NODE, grant_gpios), port)
5152
#define GRANT_PIN_PIN_NO DT_GPIO_PIN(CX_NODE, grant_gpios)
5253

53-
static const nrfx_gpiote_t gpiote =
54-
NRFX_GPIOTE_INSTANCE(NRF_DT_GPIOTE_INST(CX_NODE, grant_gpios));
54+
static nrfx_gpiote_t *gpiote =
55+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(CX_NODE, grant_gpios));
5556

5657
static const struct gpio_dt_spec gra_spec = GPIO_DT_SPEC_GET(CX_NODE, grant_gpios);
5758

@@ -123,9 +124,9 @@ static int32_t register_callback(mpsl_cx_cb_t cb)
123124
callback = cb;
124125

125126
if (cb) {
126-
nrfx_gpiote_trigger_enable(&gpiote, grant_abs_pin, true);
127+
nrfx_gpiote_trigger_enable(gpiote, grant_abs_pin, true);
127128
} else {
128-
nrfx_gpiote_trigger_disable(&gpiote, grant_abs_pin);
129+
nrfx_gpiote_trigger_disable(gpiote, grant_abs_pin);
129130
}
130131

131132
return 0;
@@ -162,7 +163,7 @@ static int mpsl_cx_init(void)
162163
}
163164

164165
grant_abs_pin = NRF_GPIO_PIN_MAP(GRANT_PIN_PORT_NO, GRANT_PIN_PIN_NO);
165-
nrfx_gpiote_trigger_disable(&gpiote, grant_abs_pin);
166+
nrfx_gpiote_trigger_disable(gpiote, grant_abs_pin);
166167

167168
gpio_init_callback(&grant_cb, gpiote_irq_handler, BIT(gra_spec.pin));
168169
gpio_add_callback(gra_spec.port, &grant_cb);

subsys/mpsl/cx/3wire/mpsl_cx_3wire.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include "hal/nrf_gpio.h"
3131
#include <nrfx_gpiote.h>
32+
#include <gpiote_nrfx.h>
3233

3334
#if DT_NODE_EXISTS(DT_NODELABEL(nrf_radio_coex))
3435
#define CX_NODE DT_NODELABEL(nrf_radio_coex)
@@ -45,8 +46,8 @@
4546
#define GRANT_PIN_PORT_NO DT_PROP(DT_GPIO_CTLR(CX_NODE, grant_gpios), port)
4647
#define GRANT_PIN_PIN_NO DT_GPIO_PIN(CX_NODE, grant_gpios)
4748

48-
static const nrfx_gpiote_t gpiote =
49-
NRFX_GPIOTE_INSTANCE(NRF_DT_GPIOTE_INST(CX_NODE, grant_gpios));
49+
static nrfx_gpiote_t *gpiote =
50+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(CX_NODE, grant_gpios));
5051

5152
static const struct gpio_dt_spec req_spec = GPIO_DT_SPEC_GET(CX_NODE, req_gpios);
5253
static const struct gpio_dt_spec pri_spec = GPIO_DT_SPEC_GET(CX_NODE, pri_dir_gpios);
@@ -175,9 +176,9 @@ static int32_t register_callback(mpsl_cx_cb_t cb)
175176
callback = cb;
176177

177178
if (cb != NULL) {
178-
nrfx_gpiote_trigger_enable(&gpiote, grant_abs_pin, true);
179+
nrfx_gpiote_trigger_enable(gpiote, grant_abs_pin, true);
179180
} else {
180-
nrfx_gpiote_trigger_disable(&gpiote, grant_abs_pin);
181+
nrfx_gpiote_trigger_disable(gpiote, grant_abs_pin);
181182
}
182183

183184
return 0;
@@ -224,7 +225,7 @@ static int mpsl_cx_init(void)
224225
return ret;
225226
}
226227
grant_abs_pin = NRF_GPIO_PIN_MAP(GRANT_PIN_PORT_NO, GRANT_PIN_PIN_NO);
227-
nrfx_gpiote_trigger_disable(&gpiote, grant_abs_pin);
228+
nrfx_gpiote_trigger_disable(gpiote, grant_abs_pin);
228229

229230
gpio_init_callback(&grant_cb, gpiote_irq_handler, BIT(gra_spec.pin));
230231
gpio_add_callback(gra_spec.port, &grant_cb);

subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include "hal/nrf_gpio.h"
3030
#include <nrfx_gpiote.h>
31+
#include <gpiote_nrfx.h>
3132

3233
/*
3334
* Typical part of device tree describing coex (sample port and pin numbers).
@@ -58,8 +59,8 @@
5859
#define GRANT_PIN_PORT_NO DT_PROP(DT_GPIO_CTLR(CX_NODE, grant_gpios), port)
5960
#define GRANT_PIN_PIN_NO DT_GPIO_PIN(CX_NODE, grant_gpios)
6061

61-
static const nrfx_gpiote_t gpiote =
62-
NRFX_GPIOTE_INSTANCE(NRF_DT_GPIOTE_INST(CX_NODE, grant_gpios));
62+
static nrfx_gpiote_t *gpiote =
63+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(CX_NODE, grant_gpios));
6364

6465
static const struct gpio_dt_spec req_spec = GPIO_DT_SPEC_GET(CX_NODE, req_gpios);
6566
static const struct gpio_dt_spec status0_spec = GPIO_DT_SPEC_GET(CX_NODE, status0_gpios);
@@ -231,9 +232,9 @@ static int32_t register_callback(mpsl_cx_cb_t cb)
231232
callback = cb;
232233

233234
if (cb != NULL) {
234-
nrfx_gpiote_trigger_enable(&gpiote, grant_abs_pin, true);
235+
nrfx_gpiote_trigger_enable(gpiote, grant_abs_pin, true);
235236
} else {
236-
nrfx_gpiote_trigger_disable(&gpiote, grant_abs_pin);
237+
nrfx_gpiote_trigger_disable(gpiote, grant_abs_pin);
237238
}
238239

239240
return 0;
@@ -279,7 +280,7 @@ static int mpsl_cx_init(void)
279280
return ret;
280281
}
281282
grant_abs_pin = NRF_GPIO_PIN_MAP(GRANT_PIN_PORT_NO, GRANT_PIN_PIN_NO);
282-
nrfx_gpiote_trigger_disable(&gpiote, grant_abs_pin);
283+
nrfx_gpiote_trigger_disable(gpiote, grant_abs_pin);
283284

284285
gpio_init_callback(&grant_cb, gpiote_irq_handler, BIT(grant_spec.pin));
285286
gpio_add_callback(grant_spec.port, &grant_cb);

subsys/mpsl/fem/nrf21540_gpio/mpsl_fem_nrf21540_gpio.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "mpsl_fem_power_model_interface.h"
1717
#endif
1818
#include <nrfx_gpiote.h>
19+
#include <gpiote_nrfx.h>
1920
#include <mpsl_fem_utils.h>
2021
#else /* !defined(CONFIG_MPSL_FEM_PIN_FORWARDER) */
2122
#include <soc_secure.h>
@@ -24,37 +25,39 @@
2425
#endif
2526
#endif /* !defined(CONFIG_MPSL_FEM_PIN_FORWARDER) */
2627

28+
#define RADIO_FEM_NODE DT_NODELABEL(nrf_radio_fem)
29+
2730
#if !defined(CONFIG_MPSL_FEM_PIN_FORWARDER)
2831
static int fem_nrf21540_gpio_configure(void)
2932
{
3033
int err;
3134

3235
#if DT_NODE_HAS_PROP(DT_NODELABEL(nrf_radio_fem), tx_en_gpios)
3336
uint8_t txen_gpiote_channel;
34-
const nrfx_gpiote_t txen_gpiote = NRFX_GPIOTE_INSTANCE(
35-
NRF_DT_GPIOTE_INST(DT_NODELABEL(nrf_radio_fem), tx_en_gpios));
37+
nrfx_gpiote_t *txen_gpiote =
38+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(RADIO_FEM_NODE, tx_en_gpios));
3639

37-
if (nrfx_gpiote_channel_alloc(&txen_gpiote, &txen_gpiote_channel) != NRFX_SUCCESS) {
40+
if (nrfx_gpiote_channel_alloc(txen_gpiote, &txen_gpiote_channel) != 0) {
3841
return -ENOMEM;
3942
}
4043
#endif
4144

4245
#if DT_NODE_HAS_PROP(DT_NODELABEL(nrf_radio_fem), rx_en_gpios)
4346
uint8_t rxen_gpiote_channel;
44-
const nrfx_gpiote_t rxen_gpiote = NRFX_GPIOTE_INSTANCE(
45-
NRF_DT_GPIOTE_INST(DT_NODELABEL(nrf_radio_fem), rx_en_gpios));
47+
nrfx_gpiote_t *rxen_gpiote =
48+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(RADIO_FEM_NODE, rx_en_gpios));
4649

47-
if (nrfx_gpiote_channel_alloc(&rxen_gpiote, &rxen_gpiote_channel) != NRFX_SUCCESS) {
50+
if (nrfx_gpiote_channel_alloc(rxen_gpiote, &rxen_gpiote_channel) != 0) {
4851
return -ENOMEM;
4952
}
5053
#endif
5154

5255
#if DT_NODE_HAS_PROP(DT_NODELABEL(nrf_radio_fem), pdn_gpios)
5356
uint8_t pdn_gpiote_channel;
54-
const nrfx_gpiote_t pdn_gpiote = NRFX_GPIOTE_INSTANCE(
55-
NRF_DT_GPIOTE_INST(DT_NODELABEL(nrf_radio_fem), pdn_gpios));
57+
nrfx_gpiote_t *pdn_gpiote =
58+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(RADIO_FEM_NODE, pdn_gpios));
5659

57-
if (nrfx_gpiote_channel_alloc(&pdn_gpiote, &pdn_gpiote_channel) != NRFX_SUCCESS) {
60+
if (nrfx_gpiote_channel_alloc(pdn_gpiote, &pdn_gpiote_channel) != 0) {
5861
return -ENOMEM;
5962
}
6063
#endif
@@ -93,7 +96,7 @@ static int fem_nrf21540_gpio_configure(void)
9396
.active_high = MPSL_FEM_GPIO_POLARITY_GET(tx_en_gpios),
9497
.gpiote_ch_id = txen_gpiote_channel,
9598
#if defined(NRF54L_SERIES)
96-
.p_gpiote = txen_gpiote.p_reg,
99+
.p_gpiote = txen_gpiote->p_reg,
97100
#endif
98101
#else
99102
MPSL_FEM_DISABLED_GPIOTE_PIN_CONFIG_INIT
@@ -110,7 +113,7 @@ static int fem_nrf21540_gpio_configure(void)
110113
.active_high = MPSL_FEM_GPIO_POLARITY_GET(rx_en_gpios),
111114
.gpiote_ch_id = rxen_gpiote_channel,
112115
#if defined(NRF54L_SERIES)
113-
.p_gpiote = rxen_gpiote.p_reg,
116+
.p_gpiote = rxen_gpiote->p_reg,
114117
#endif
115118
#else
116119
MPSL_FEM_DISABLED_GPIOTE_PIN_CONFIG_INIT
@@ -127,7 +130,7 @@ static int fem_nrf21540_gpio_configure(void)
127130
.active_high = MPSL_FEM_GPIO_POLARITY_GET(pdn_gpios),
128131
.gpiote_ch_id = pdn_gpiote_channel,
129132
#if defined(NRF54L_SERIES)
130-
.p_gpiote = pdn_gpiote.p_reg,
133+
.p_gpiote = pdn_gpiote->p_reg,
131134
#endif
132135
#else
133136
MPSL_FEM_DISABLED_GPIOTE_PIN_CONFIG_INIT

subsys/mpsl/fem/nrf21540_gpio_spi/mpsl_fem_nrf21540_gpio_spi.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@
2020
#include "mpsl_fem_power_model_interface.h"
2121
#endif
2222
#include <nrfx_gpiote.h>
23+
#include <gpiote_nrfx.h>
2324

2425
#if !defined(CONFIG_PINCTRL)
2526
#error CONFIG_PINCTRL is required for nRF21540 GPIO SPI driver
2627
#endif
2728

29+
#define RADIO_FEM_NODE DT_NODELABEL(nrf_radio_fem)
30+
2831
#define MPSL_FEM_SPI_IF DT_PHANDLE(DT_NODELABEL(nrf_radio_fem), spi_if)
2932
#define MPSL_FEM_SPI_BUS DT_BUS(MPSL_FEM_SPI_IF)
3033
#define MPSL_FEM_SPI_REG ((NRF_SPIM_Type *) DT_REG_ADDR(MPSL_FEM_SPI_BUS))
@@ -44,10 +47,10 @@ static uint32_t fem_nrf21540_spi_configure(mpsl_fem_nrf21540_gpio_spi_interface_
4447
{
4548
#if DT_NODE_HAS_PROP(MPSL_FEM_SPI_BUS, cs_gpios)
4649
uint8_t cs_gpiote_channel;
47-
const nrfx_gpiote_t cs_gpiote = NRFX_GPIOTE_INSTANCE(
48-
NRF_DT_GPIOTE_INST(MPSL_FEM_SPI_BUS, cs_gpios));
50+
nrfx_gpiote_t *cs_gpiote =
51+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(MPSL_FEM_SPI_BUS, cs_gpios));
4952

50-
if (nrfx_gpiote_channel_alloc(&cs_gpiote, &cs_gpiote_channel) != NRFX_SUCCESS) {
53+
if (nrfx_gpiote_channel_alloc(cs_gpiote, &cs_gpiote_channel) != 0) {
5154
return -ENOMEM;
5255
}
5356
#endif
@@ -65,7 +68,7 @@ static uint32_t fem_nrf21540_spi_configure(mpsl_fem_nrf21540_gpio_spi_interface_
6568
.active_high = true,
6669
.gpiote_ch_id = cs_gpiote_channel,
6770
#if defined(NRF54L_SERIES)
68-
.p_gpiote = cs_gpiote.p_reg,
71+
.p_gpiote = cs_gpiote->p_reg,
6972
#endif
7073
#else
7174
MPSL_FEM_DISABLED_GPIOTE_PIN_CONFIG_INIT
@@ -115,30 +118,30 @@ static int fem_nrf21540_gpio_spi_configure(void)
115118

116119
#if DT_NODE_HAS_PROP(DT_NODELABEL(nrf_radio_fem), tx_en_gpios)
117120
uint8_t txen_gpiote_channel;
118-
const nrfx_gpiote_t txen_gpiote = NRFX_GPIOTE_INSTANCE(
119-
NRF_DT_GPIOTE_INST(DT_NODELABEL(nrf_radio_fem), tx_en_gpios));
121+
nrfx_gpiote_t *txen_gpiote =
122+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(RADIO_FEM_NODE, tx_en_gpios));
120123

121-
if (nrfx_gpiote_channel_alloc(&txen_gpiote, &txen_gpiote_channel) != NRFX_SUCCESS) {
124+
if (nrfx_gpiote_channel_alloc(txen_gpiote, &txen_gpiote_channel) != 0) {
122125
return -ENOMEM;
123126
}
124127
#endif
125128

126129
#if DT_NODE_HAS_PROP(DT_NODELABEL(nrf_radio_fem), rx_en_gpios)
127130
uint8_t rxen_gpiote_channel;
128-
const nrfx_gpiote_t rxen_gpiote = NRFX_GPIOTE_INSTANCE(
129-
NRF_DT_GPIOTE_INST(DT_NODELABEL(nrf_radio_fem), rx_en_gpios));
131+
nrfx_gpiote_t *rxen_gpiote =
132+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(RADIO_FEM_NODE, rx_en_gpios));
130133

131-
if (nrfx_gpiote_channel_alloc(&rxen_gpiote, &rxen_gpiote_channel) != NRFX_SUCCESS) {
134+
if (nrfx_gpiote_channel_alloc(rxen_gpiote, &rxen_gpiote_channel) != 0) {
132135
return -ENOMEM;
133136
}
134137
#endif
135138

136139
#if DT_NODE_HAS_PROP(DT_NODELABEL(nrf_radio_fem), pdn_gpios)
137140
uint8_t pdn_gpiote_channel;
138-
const nrfx_gpiote_t pdn_gpiote = NRFX_GPIOTE_INSTANCE(
139-
NRF_DT_GPIOTE_INST(DT_NODELABEL(nrf_radio_fem), pdn_gpios));
141+
nrfx_gpiote_t *pdn_gpiote =
142+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(RADIO_FEM_NODE, pdn_gpios));
140143

141-
if (nrfx_gpiote_channel_alloc(&pdn_gpiote, &pdn_gpiote_channel) != NRFX_SUCCESS) {
144+
if (nrfx_gpiote_channel_alloc(pdn_gpiote, &pdn_gpiote_channel) != 0) {
142145
return -ENOMEM;
143146
}
144147
#endif
@@ -177,7 +180,7 @@ static int fem_nrf21540_gpio_spi_configure(void)
177180
.active_high = MPSL_FEM_GPIO_POLARITY_GET(tx_en_gpios),
178181
.gpiote_ch_id = txen_gpiote_channel,
179182
#if defined(NRF54L_SERIES)
180-
.p_gpiote = txen_gpiote.p_reg,
183+
.p_gpiote = txen_gpiote->p_reg,
181184
#endif
182185
#else
183186
MPSL_FEM_DISABLED_GPIOTE_PIN_CONFIG_INIT
@@ -194,7 +197,7 @@ static int fem_nrf21540_gpio_spi_configure(void)
194197
.active_high = MPSL_FEM_GPIO_POLARITY_GET(rx_en_gpios),
195198
.gpiote_ch_id = rxen_gpiote_channel,
196199
#if defined(NRF54L_SERIES)
197-
.p_gpiote = rxen_gpiote.p_reg,
200+
.p_gpiote = rxen_gpiote->p_reg,
198201
#endif
199202
#else
200203
MPSL_FEM_DISABLED_GPIOTE_PIN_CONFIG_INIT
@@ -211,7 +214,7 @@ static int fem_nrf21540_gpio_spi_configure(void)
211214
.active_high = MPSL_FEM_GPIO_POLARITY_GET(pdn_gpios),
212215
.gpiote_ch_id = pdn_gpiote_channel,
213216
#if defined(NRF54L_SERIES)
214-
.p_gpiote = pdn_gpiote.p_reg,
217+
.p_gpiote = pdn_gpiote->p_reg,
215218
#endif
216219
#else
217220
MPSL_FEM_DISABLED_GPIOTE_PIN_CONFIG_INIT

subsys/mpsl/fem/nrf2220/mpsl_fem_nrf2220.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <mpsl_fem_config_nrf2220.h>
1717
#include <nrfx_gpiote.h>
18+
#include <gpiote_nrfx.h>
1819
#include <mpsl_fem_utils.h>
1920
#include <mpsl_fem_twi_drv.h>
2021

@@ -33,6 +34,8 @@
3334
#error "The nRF2220 driver must be used with CONFIG_PINCTRL! Set CONFIG_PINCTRL=y"
3435
#endif
3536

37+
#define RADIO_FEM_NODE DT_NODELABEL(nrf_radio_fem)
38+
3639
#if DT_NODE_HAS_PROP(DT_NODELABEL(nrf_radio_fem), twi_if)
3740
#define MPSL_FEM_TWI_IF DT_PHANDLE(DT_NODELABEL(nrf_radio_fem), twi_if)
3841
#define MPSL_FEM_TWI_ADDRESS DT_REG_ADDR(MPSL_FEM_TWI_IF)
@@ -97,15 +100,17 @@ static int fem_nrf2220_configure(void)
97100
{
98101
int err;
99102

100-
const nrfx_gpiote_t cs_gpiote = NRFX_GPIOTE_INSTANCE(
101-
NRF_DT_GPIOTE_INST(DT_NODELABEL(nrf_radio_fem), cs_gpios));
102-
if (nrfx_gpiote_channel_alloc(&cs_gpiote, &cs_gpiote_channel) != NRFX_SUCCESS) {
103+
nrfx_gpiote_t *cs_gpiote =
104+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(RADIO_FEM_NODE, cs_gpios));
105+
106+
if (nrfx_gpiote_channel_alloc(cs_gpiote, &cs_gpiote_channel) != 0) {
103107
return -ENOMEM;
104108
}
105109

106-
const nrfx_gpiote_t md_gpiote = NRFX_GPIOTE_INSTANCE(
107-
NRF_DT_GPIOTE_INST(DT_NODELABEL(nrf_radio_fem), md_gpios));
108-
if (nrfx_gpiote_channel_alloc(&md_gpiote, &md_gpiote_channel) != NRFX_SUCCESS) {
110+
nrfx_gpiote_t *md_gpiote =
111+
&GPIOTE_NRFX_INST_BY_NODE(NRF_DT_GPIOTE_NODE(RADIO_FEM_NODE, md_gpios));
112+
113+
if (nrfx_gpiote_channel_alloc(md_gpiote, &md_gpiote_channel) != 0) {
109114
return -ENOMEM;
110115
}
111116

@@ -124,7 +129,7 @@ static int fem_nrf2220_configure(void)
124129
.active_high = MPSL_FEM_GPIO_POLARITY_GET(cs_gpios),
125130
.gpiote_ch_id = cs_gpiote_channel,
126131
#if defined(NRF54L_SERIES)
127-
.p_gpiote = cs_gpiote.p_reg,
132+
.p_gpiote = cs_gpiote->p_reg,
128133
#endif
129134
},
130135
.md_pin_config = {
@@ -137,7 +142,7 @@ static int fem_nrf2220_configure(void)
137142
.active_high = MPSL_FEM_GPIO_POLARITY_GET(md_gpios),
138143
.gpiote_ch_id = md_gpiote_channel,
139144
#if defined(NRF54L_SERIES)
140-
.p_gpiote = md_gpiote.p_reg,
145+
.p_gpiote = md_gpiote->p_reg,
141146
#endif
142147
}
143148
};

0 commit comments

Comments
 (0)