Skip to content

Commit 251648a

Browse files
ananglcarlescufi
authored andcommitted
modules: Move nrfx glue code to main Zephyr repository
Move nrfx glue code (nrfx integration files, related Kconfig entries, and related part of CMakeLists.txt taken from the hal_nordic module) to modules/hal_nordic/nrfx/ directory. CMakeLists.txt located in modules/hal_nordic/ is now the main cmake file for the hal_nordic module. It points back to cmake stuff related to the nRF IEEE 802.15.4 driver that still remains in that module and it adds the extracted nrfx part as a subdirectory. Kconfig.nordic is renamed to Kconfig and moved to modules/hal_nordic/. It sources nrfx related entries from that separate file. Update also the manifest to point to accordingly modified hal_nordic revision. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 71025dd commit 251648a

21 files changed

+21159
-185
lines changed

modules/Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ source "modules/Kconfig.loramac-node"
2121
source "modules/Kconfig.mbedtls"
2222
source "modules/Kconfig.mcux"
2323
source "modules/Kconfig.microchip"
24-
source "modules/Kconfig.nordic"
2524
source "modules/Kconfig.nuvoton"
2625
source "modules/Kconfig.open-amp"
2726
source "modules/Kconfig.silabs"
@@ -50,6 +49,9 @@ comment "Unavailable modules, please install those via the project manifest."
5049
# config ZEPHYR_<MODULE_NAME_UPPER>_MODULE
5150
# bool
5251

52+
comment "hal_nordic module not available."
53+
depends on !ZEPHYR_HAL_NORDIC_MODULE
54+
5355
# This ensures that symbols are available in Kconfig for dependency checking
5456
# and referencing, while keeping the settings themselves unavailable when the
5557
# modules are not present in the workspace

modules/hal_nordic/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
if(CONFIG_HAS_NORDIC_DRIVERS OR CONFIG_HAS_NRFX)
2+
zephyr_library()
3+
endif()
4+
5+
if(CONFIG_HAS_NORDIC_DRIVERS)
6+
add_subdirectory(${ZEPHYR_CURRENT_MODULE_DIR}/drivers drivers)
7+
endif()
8+
9+
if(CONFIG_HAS_NRFX)
10+
add_subdirectory(nrfx)
11+
endif()

modules/hal_nordic/Kconfig

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
# Copyright (c) 2016 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config ZEPHYR_HAL_NORDIC_MODULE
5+
bool
6+
7+
config HAS_NORDIC_DRIVERS
8+
bool
9+
10+
menu "Nordic drivers"
11+
depends on HAS_NORDIC_DRIVERS
12+
13+
menuconfig NRF_802154_RADIO_DRIVER
14+
bool "Enable nRF IEEE 802.15.4 radio driver"
15+
depends on HAS_HW_NRF_RADIO_IEEE802154
16+
select DYNAMIC_INTERRUPTS
17+
select ENTROPY_GENERATOR
18+
select NRF_HW_TIMER1_RESERVED
19+
help
20+
This option enables nRF IEEE 802.15.4 radio driver in Zephyr. Note,
21+
that beside the radio peripheral itself, this drivers occupies several
22+
other peripherals. A complete list can be found in the hal_nordic
23+
repository, within drivers/nrf_radio_802154/nrf_802154_peripherals.h
24+
file. As the nRF IEEE 802.15.4 radio driver defines IRQ configuration
25+
abstraction layer API and its Zephyr-specific implementation uses dynamic
26+
interrupts, the DYNAMIC_INTERRUPTS switch is selected unconditionally.
27+
28+
if NRF_802154_RADIO_DRIVER
29+
30+
config NRF_802154_MULTIPROTOCOL_SUPPORT
31+
bool
32+
help
33+
In dynamic multiprotocol applications, access to the radio peripheral
34+
must be distributed by an arbiter. To support this arbitration
35+
in the driver, this option must be enabled. Otherwise, the driver
36+
assumes that access to the radio peripheral is granted indefinitely.
37+
38+
choice NRF_802154_CCA_MODE
39+
prompt "nRF IEEE 802.15.4 CCA mode"
40+
default NRF_802154_CCA_MODE_ED
41+
help
42+
CCA mode
43+
44+
config NRF_802154_CCA_MODE_ED
45+
bool "Energy Above Threshold"
46+
47+
config NRF_802154_CCA_MODE_CARRIER
48+
bool "Carrier Seen"
49+
50+
config NRF_802154_CCA_MODE_CARRIER_AND_ED
51+
bool "Energy Above Threshold AND Carrier Seen"
52+
53+
config NRF_802154_CCA_MODE_CARRIER_OR_ED
54+
bool "Energy Above Threshold OR Carrier Seen"
55+
56+
endchoice
57+
58+
choice NRF_802154_SL_TYPE
59+
prompt "nRF IEEE 802.15.4 Service Layer Type"
60+
default NRF_802154_SL_OPENSOURCE
61+
62+
config NRF_802154_SL_OPENSOURCE
63+
bool "nRF IEEE 802.15.4 Open source Service Layer"
64+
65+
endchoice
66+
67+
config NRF_802154_CCA_ED_THRESHOLD
68+
int "nRF IEEE 802.15.4 CCA Energy Detection threshold"
69+
default 45
70+
help
71+
If energy detected in a given channel is above the value then the
72+
channel is deemed busy. The unit is defined as per 802.15.4-2006 spec.
73+
74+
config NRF_802154_CCA_CORR_THRESHOLD
75+
int "nRF IEEE 802.15.4 CCA Correlator threshold"
76+
default 45
77+
78+
config NRF_802154_CCA_CORR_LIMIT
79+
int "nRF IEEE 802.15.4 CCA Correlator limit"
80+
default 2
81+
help
82+
Limit for occurrences above correlator threshold. When not equal to
83+
zero the correlator based signal detect is enabled.
84+
85+
config NRF_802154_PENDING_SHORT_ADDRESSES
86+
int "nRF 802.15.4 pending short addresses"
87+
default 16
88+
help
89+
Number of slots containing short addresses of nodes for which pending data is stored
90+
91+
config NRF_802154_PENDING_EXTENDED_ADDRESSES
92+
int "nRF 802.15.4 pending extended addresses"
93+
default 16
94+
help
95+
Number of slots containing extended addresses of nodes for which pending data is stored
96+
97+
config NRF_802154_RX_BUFFERS
98+
int "nRF 802.15.4 receive buffers"
99+
default 16
100+
help
101+
Number of buffers in nRF 802.15.4 driver receive queue. If this value is modified,
102+
its serialization host counterpart must be set to the exact same value.
103+
104+
endif # NRF_802154_RADIO_DRIVER
105+
106+
config NRF_802154_SER_HOST
107+
bool "nRF IEEE 802.15.4 Driver serialization host"
108+
depends on !NRF_802154_RADIO_DRIVER
109+
depends on !HAS_HW_NRF_RADIO_IEEE802154
110+
select IPM
111+
select IPM_NRFX
112+
select IPM_MSG_CH_0_ENABLE
113+
select IPM_MSG_CH_1_ENABLE
114+
select IPM_MSG_CH_0_TX
115+
select IPM_MSG_CH_1_RX
116+
select OPENAMP
117+
select IEEE802154_NRF5_EXT_IRQ_MGMT if IEEE802154_NRF5
118+
help
119+
Enable serialization of nRF IEEE 802.15.4 Driver. This option is to be
120+
used if radio is not available in the core, but radio services are
121+
provided by a serialization backend.
122+
123+
menuconfig NRF_802154_SER_RADIO
124+
bool "nRF IEEE 802.15.4 Driver serialization radio"
125+
depends on HAS_HW_NRF_RADIO_IEEE802154
126+
depends on !IEEE802154_NRF5
127+
select IPM
128+
select IPM_NRFX
129+
select IPM_MSG_CH_0_ENABLE
130+
select IPM_MSG_CH_1_ENABLE
131+
select IPM_MSG_CH_0_RX
132+
select IPM_MSG_CH_1_TX
133+
select OPENAMP
134+
select NRF_802154_RADIO_DRIVER
135+
help
136+
Enable serialization of nRF IEEE 802.15.4 Driver. This option is to be
137+
used if radio is available in the core to provide radio services over
138+
a serialization backend.
139+
140+
if NRF_802154_SER_RADIO
141+
142+
config NRF_802154_SER_RADIO_INIT_PRIO
143+
int "nRF52 IEEE 802.15.4 serialization initialization priority"
144+
default 81
145+
help
146+
Set the initialization priority number. Do not mess with it unless
147+
you know what you are doing.
148+
149+
endif
150+
151+
menu "nRF 802.15.4 serialization"
152+
depends on NRF_802154_SER_HOST || NRF_802154_SER_RADIO
153+
154+
config NRF_802154_SER_LOG
155+
bool "802.15.4 serialization logs"
156+
default n
157+
help
158+
This option enable debug logs of 802.15.4 serialization module.
159+
160+
config NRF_802154_SER_BUFFER_ALLOCATOR_THREAD_SAFE
161+
bool
162+
# Hidden option
163+
default y
164+
help
165+
This option specifies if buffers for 802.15.4 serialization are allocated
166+
in a thread-safe manner.
167+
168+
config NRF_802154_SER_DEFAULT_RESPONSE_TIMEOUT
169+
int "Default Spinel serialization response timeout in milliseconds"
170+
default 500
171+
help
172+
This option specifies default timeout of spinel status response
173+
in milliseconds.
174+
175+
if NRF_802154_SER_HOST
176+
177+
config NRF_802154_RX_BUFFERS
178+
int "nRF 802.15.4 receive buffers"
179+
default 16
180+
help
181+
Number of buffers in nRF 802.15.4 driver serialization host's receive queue.
182+
If this value is modified, its remote counterpart must be set to the exact same value.
183+
184+
endif
185+
186+
endmenu # NRF_802154_SER_HOST || NRF_802154_SER_RADIO
187+
188+
endmenu # HAS_NORDIC_DRIVERS
189+
190+
rsource "nrfx/Kconfig"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
set(NRFX_DIR ${ZEPHYR_CURRENT_MODULE_DIR}/nrfx)
2+
set(INC_DIR ${NRFX_DIR}/drivers/include)
3+
set(SRC_DIR ${NRFX_DIR}/drivers/src)
4+
set(MDK_DIR ${NRFX_DIR}/mdk)
5+
6+
zephyr_include_directories(${NRFX_DIR})
7+
zephyr_include_directories(${INC_DIR})
8+
zephyr_include_directories(${MDK_DIR})
9+
zephyr_include_directories(.)
10+
11+
# Define MDK defines globally
12+
zephyr_compile_definitions_ifdef(CONFIG_SOC_SERIES_NRF51X NRF51)
13+
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52805 NRF52805_XXAA)
14+
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52810 NRF52810_XXAA)
15+
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52811 NRF52811_XXAA)
16+
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52820 NRF52820_XXAA)
17+
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52832 NRF52832_XXAA)
18+
zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF52832 NRF52832_XXAA)
19+
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52833 NRF52833_XXAA)
20+
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52840 NRF52840_XXAA)
21+
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUAPP NRF5340_XXAA_APPLICATION)
22+
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUNET NRF5340_XXAA_NETWORK)
23+
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA)
24+
25+
# Connect Kconfig compilation option for Non-Secure software with option required by MDK/nrfx
26+
zephyr_compile_definitions_ifdef(CONFIG_ARM_NONSECURE_FIRMWARE NRF_TRUSTZONE_NONSECURE)
27+
28+
zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF51X ${MDK_DIR}/system_nrf51.c)
29+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52805 ${MDK_DIR}/system_nrf52805.c)
30+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52810 ${MDK_DIR}/system_nrf52810.c)
31+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52811 ${MDK_DIR}/system_nrf52811.c)
32+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52820 ${MDK_DIR}/system_nrf52820.c)
33+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52832 ${MDK_DIR}/system_nrf52.c)
34+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52833 ${MDK_DIR}/system_nrf52833.c)
35+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52840 ${MDK_DIR}/system_nrf52840.c)
36+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF5340_CPUAPP ${MDK_DIR}/system_nrf5340_application.c)
37+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF5340_CPUNET ${MDK_DIR}/system_nrf5340_network.c)
38+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF9160 ${MDK_DIR}/system_nrf9160.c)
39+
40+
zephyr_library_sources(nrfx_glue.c)
41+
42+
zephyr_library_sources_ifdef(CONFIG_NRFX_PRS ${SRC_DIR}/prs/nrfx_prs.c)
43+
44+
zephyr_library_sources_ifdef(CONFIG_NRFX_ADC ${SRC_DIR}/nrfx_adc.c)
45+
zephyr_library_sources_ifdef(CONFIG_NRFX_CLOCK ${SRC_DIR}/nrfx_clock.c)
46+
zephyr_library_sources_ifdef(CONFIG_NRFX_COMP ${SRC_DIR}/nrfx_comp.c)
47+
zephyr_library_sources_ifdef(CONFIG_NRFX_DPPI ${SRC_DIR}/nrfx_dppi.c)
48+
zephyr_library_sources_ifdef(CONFIG_NRFX_EGU ${SRC_DIR}/nrfx_egu.c)
49+
zephyr_library_sources_ifdef(CONFIG_NRFX_GPIOTE ${SRC_DIR}/nrfx_gpiote.c)
50+
zephyr_library_sources_ifdef(CONFIG_NRFX_I2S ${SRC_DIR}/nrfx_i2s.c)
51+
zephyr_library_sources_ifdef(CONFIG_NRFX_IPC ${SRC_DIR}/nrfx_ipc.c)
52+
zephyr_library_sources_ifdef(CONFIG_NRFX_LPCOMP ${SRC_DIR}/nrfx_lpcomp.c)
53+
zephyr_library_sources_ifdef(CONFIG_NRFX_NFCT ${SRC_DIR}/nrfx_nfct.c)
54+
zephyr_library_sources_ifdef(CONFIG_NRFX_NVMC ${SRC_DIR}/nrfx_nvmc.c)
55+
zephyr_library_sources_ifdef(CONFIG_NRFX_PDM ${SRC_DIR}/nrfx_pdm.c)
56+
zephyr_library_sources_ifdef(CONFIG_NRFX_POWER ${SRC_DIR}/nrfx_power.c)
57+
zephyr_library_sources_ifdef(CONFIG_NRFX_PPI ${SRC_DIR}/nrfx_ppi.c)
58+
zephyr_library_sources_ifdef(CONFIG_NRFX_PWM ${SRC_DIR}/nrfx_pwm.c)
59+
zephyr_library_sources_ifdef(CONFIG_NRFX_QDEC ${SRC_DIR}/nrfx_qdec.c)
60+
zephyr_library_sources_ifdef(CONFIG_NRFX_QSPI ${SRC_DIR}/nrfx_qspi.c)
61+
zephyr_library_sources_ifdef(CONFIG_NRFX_RNG ${SRC_DIR}/nrfx_rng.c)
62+
zephyr_library_sources_ifdef(CONFIG_NRFX_RTC ${SRC_DIR}/nrfx_rtc.c)
63+
zephyr_library_sources_ifdef(CONFIG_NRFX_SAADC ${SRC_DIR}/nrfx_saadc.c)
64+
zephyr_library_sources_ifdef(CONFIG_NRFX_SPI ${SRC_DIR}/nrfx_spi.c)
65+
zephyr_library_sources_ifdef(CONFIG_NRFX_SPIM ${SRC_DIR}/nrfx_spim.c)
66+
zephyr_library_sources_ifdef(CONFIG_NRFX_SPIS ${SRC_DIR}/nrfx_spis.c)
67+
zephyr_library_sources_ifdef(CONFIG_NRFX_SYSTICK ${SRC_DIR}/nrfx_systick.c)
68+
zephyr_library_sources_ifdef(CONFIG_NRFX_TEMP ${SRC_DIR}/nrfx_temp.c)
69+
zephyr_library_sources_ifdef(CONFIG_NRFX_TIMER ${SRC_DIR}/nrfx_timer.c)
70+
zephyr_library_sources_ifdef(CONFIG_NRFX_TWI ${SRC_DIR}/nrfx_twi.c)
71+
zephyr_library_sources_ifdef(CONFIG_NRFX_TWIM ${SRC_DIR}/nrfx_twim.c)
72+
zephyr_library_sources_ifdef(CONFIG_NRFX_TWIS ${SRC_DIR}/nrfx_twis.c)
73+
zephyr_library_sources_ifdef(CONFIG_NRFX_UART ${SRC_DIR}/nrfx_uart.c)
74+
zephyr_library_sources_ifdef(CONFIG_NRFX_UARTE ${SRC_DIR}/nrfx_uarte.c)
75+
zephyr_library_sources_ifdef(CONFIG_NRFX_USBD ${SRC_DIR}/nrfx_usbd.c)
76+
zephyr_library_sources_ifdef(CONFIG_NRFX_USBREG ${SRC_DIR}/nrfx_usbreg.c)
77+
zephyr_library_sources_ifdef(CONFIG_NRFX_WDT ${SRC_DIR}/nrfx_wdt.c)
78+
79+
if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM)
80+
zephyr_library_sources(${SRC_DIR}/nrfx_twi_twim.c)
81+
endif()

0 commit comments

Comments
 (0)