Skip to content

Commit 4b2a6db

Browse files
alexstanoev-nordicsean-madigan
authored andcommitted
mpsl: cx: Skip direct GPIO access in CX on bsim platforms
bsim hardware models don't support direct peripheral address writes. Restore the behavior for bsim to before 69749d0. Signed-off-by: Aleksandar Stanoev <[email protected]>
1 parent b3e3757 commit 4b2a6db

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ static const struct gpio_dt_spec req_spec = GPIO_DT_SPEC_GET(CX_NODE, req_gp
6565
static const struct gpio_dt_spec status0_spec = GPIO_DT_SPEC_GET(CX_NODE, status0_gpios);
6666
static const struct gpio_dt_spec grant_spec = GPIO_DT_SPEC_GET(CX_NODE, grant_gpios);
6767

68+
#if !defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
6869
/* Direct register access pointers for ISR-safe GPIO control from DT */
6970
static NRF_GPIO_Type *req_port =
7071
((NRF_GPIO_Type *)DT_REG_ADDR(DT_GPIO_CTLR(CX_NODE, req_gpios)));
7172
static NRF_GPIO_Type *status0_port =
7273
((NRF_GPIO_Type *)DT_REG_ADDR(DT_GPIO_CTLR(CX_NODE, status0_gpios)));
7374
static uint32_t req_pin_mask = BIT(DT_GPIO_PIN(CX_NODE, req_gpios));
7475
static uint32_t status0_pin_mask = BIT(DT_GPIO_PIN(CX_NODE, status0_gpios));
76+
#endif
7577

7678
static mpsl_cx_cb_t callback;
7779
static struct gpio_callback grant_cb;
@@ -174,6 +176,9 @@ static int sig_dir_level_calc(mpsl_cx_op_map_t ops)
174176
*/
175177
static int32_t gpio_drive_status0_to_dir(mpsl_cx_op_map_t ops)
176178
{
179+
#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
180+
return gpio_pin_set_dt(&status0_spec, sig_dir_level_calc(ops));
181+
#else
177182
if (status0_port == NULL) {
178183
return -NRF_EINVAL;
179184
}
@@ -186,6 +191,7 @@ static int32_t gpio_drive_status0_to_dir(mpsl_cx_op_map_t ops)
186191
nrf_gpio_port_out_clear(status0_port, status0_pin_mask);
187192
}
188193
return 0;
194+
#endif
189195
}
190196

191197
/**
@@ -196,6 +202,9 @@ static int32_t gpio_drive_status0_to_dir(mpsl_cx_op_map_t ops)
196202
*/
197203
static int32_t gpio_drive_request(int active)
198204
{
205+
#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
206+
return gpio_pin_set_dt(&req_spec, active);
207+
#else
199208
if (req_port == NULL) {
200209
return -NRF_EINVAL;
201210
}
@@ -206,6 +215,7 @@ static int32_t gpio_drive_request(int active)
206215
nrf_gpio_port_out_clear(req_port, req_pin_mask);
207216
}
208217
return 0;
218+
#endif
209219
}
210220

211221
static int32_t request(const mpsl_cx_request_t *req_params)

0 commit comments

Comments
 (0)