Skip to content

Commit cb1e59b

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

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

subsys/debug/ppi_trace/ppi_trace.c

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <hal/nrf_gpiote.h>
88
#include <nrfx_gpiote.h>
9+
#include <gpiote_nrfx.h>
910
#include <helpers/nrfx_gppi.h>
1011

1112
#include <debug/ppi_trace.h>
@@ -14,36 +15,26 @@
1415
LOG_MODULE_REGISTER(ppi_trace, CONFIG_PPI_TRACE_LOG_LEVEL);
1516

1617
#define GPIOTE_NODE(gpio_node) DT_PHANDLE(gpio_node, gpiote_instance)
17-
#define INVALID_NRFX_GPIOTE_INSTANCE \
18-
{ .p_reg = NULL }
19-
#define GPIOTE_INST_AND_COMMA(gpio_node) \
20-
[DT_PROP(gpio_node, port)] = \
21-
COND_CODE_1(DT_NODE_HAS_PROP(gpio_node, gpiote_instance), \
22-
(NRFX_GPIOTE_INSTANCE(DT_PROP(GPIOTE_NODE(gpio_node), instance))), \
23-
(INVALID_NRFX_GPIOTE_INSTANCE)),
18+
#define GPIOTE_INST_AND_COMMA(gpio_node) [DT_PROP(gpio_node, port)] = \
19+
COND_CODE_1(DT_NODE_HAS_PROP(gpio_node, gpiote_instance), \
20+
(&GPIOTE_NRFX_INST_BY_NODE(GPIOTE_NODE(gpio_node))), \
21+
(NULL)),
2422

2523
typedef struct {
26-
const nrfx_gpiote_t *gpiote;
27-
uint8_t gpiote_channel;
24+
nrfx_gpiote_t *gpiote;
25+
uint8_t gpiote_channel;
2826
} ppi_trace_gpiote_pin_t;
2927

3028
static atomic_t alloc_cnt;
3129
static uint32_t handle_pool[CONFIG_PPI_TRACE_PIN_CNT];
3230

33-
static const nrfx_gpiote_t *get_gpiote(nrfx_gpiote_pin_t pin)
31+
static nrfx_gpiote_t *get_gpiote(nrfx_gpiote_pin_t pin)
3432
{
35-
static const nrfx_gpiote_t gpiote[GPIO_COUNT] = {
33+
static nrfx_gpiote_t * const gpiote_per_port[GPIO_COUNT] = {
3634
DT_FOREACH_STATUS_OKAY(nordic_nrf_gpio, GPIOTE_INST_AND_COMMA)
3735
};
3836

39-
const nrfx_gpiote_t *result = &gpiote[pin >> 5];
40-
41-
if (result->p_reg == NULL) {
42-
/* On given pin's port there is no GPIOTE. */
43-
result = NULL;
44-
}
45-
46-
return result;
37+
return gpiote_per_port[NRF_PIN_NUMBER_TO_PORT(pin)];
4738
}
4839

4940
static bool ppi_trace_gpiote_pin_init(

0 commit comments

Comments
 (0)