Skip to content

Commit ea3b856

Browse files
committed
[nrf fromlist] soc: nordic: common: add nrfx gpiote instantiation component
GPIOTE driver instances are no longer defined within nrfx. Add a component supplementing missing functionality, as GPIOTE driver instances are often shared across the system. Upstream PR #: 98527 Signed-off-by: Nikodem Kastelik <[email protected]>
1 parent cda5636 commit ea3b856

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

soc/nordic/common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ endif()
4040

4141
zephyr_library_sources_ifdef(CONFIG_NRF_SYS_EVENT nrf_sys_event.c)
4242
zephyr_library_sources_ifdef(CONFIG_MRAM_LATENCY mram_latency.c)
43+
zephyr_library_sources(gpiote_nrfx.c)

soc/nordic/common/gpiote_nrfx.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <zephyr/kernel.h>
7+
#include <nrfx_gpiote.h>
8+
#include "gpiote_nrfx.h"
9+
10+
#define GPIOTE_NRFX_INST_DEF(instname, reg) \
11+
nrfx_gpiote_t instname = NRFX_GPIOTE_INSTANCE(reg);
12+
#define GPIOTE_NRFX_INST_DEFINE(node_id) \
13+
GPIOTE_NRFX_INST_DEF(GPIOTE_NRFX_INST_BY_NODE(node_id), DT_REG_ADDR(node_id))
14+
15+
DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_NRFX_INST_DEFINE)

soc/nordic/common/gpiote_nrfx.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#ifndef SOC_NORDIC_COMMON_GPIOTE_NRFX_H_
7+
#define SOC_NORDIC_COMMON_GPIOTE_NRFX_H_
8+
9+
#include <nrfx_gpiote.h>
10+
11+
#define GPIOTE_NRFX_INST_BY_REG_CONCAT(reg) g_nrfx_gpiote##reg
12+
#define GPIOTE_NRFX_INST_BY_REG(reg) GPIOTE_NRFX_INST_BY_REG_CONCAT(reg)
13+
#define GPIOTE_NRFX_INST_BY_NODE(node) GPIOTE_NRFX_INST_BY_REG(DT_REG_ADDR(node))
14+
15+
#define GPIOTE_NRFX_INST_DECL(instname) \
16+
extern nrfx_gpiote_t instname;
17+
#define GPIOTE_NRFX_INST_DECLARE(node_id) \
18+
GPIOTE_NRFX_INST_DECL(GPIOTE_NRFX_INST_BY_NODE(node_id))
19+
20+
DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_NRFX_INST_DECLARE)
21+
22+
#endif /* SOC_NORDIC_COMMON_GPIOTE_NRFX_H_ */

0 commit comments

Comments
 (0)