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 <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2021-01-11 12:53:21 +01:00 committed by Carles Cufí
commit 251648afb4
21 changed files with 21159 additions and 185 deletions

View file

@ -21,7 +21,6 @@ source "modules/Kconfig.loramac-node"
source "modules/Kconfig.mbedtls" source "modules/Kconfig.mbedtls"
source "modules/Kconfig.mcux" source "modules/Kconfig.mcux"
source "modules/Kconfig.microchip" source "modules/Kconfig.microchip"
source "modules/Kconfig.nordic"
source "modules/Kconfig.nuvoton" source "modules/Kconfig.nuvoton"
source "modules/Kconfig.open-amp" source "modules/Kconfig.open-amp"
source "modules/Kconfig.silabs" source "modules/Kconfig.silabs"
@ -50,6 +49,9 @@ comment "Unavailable modules, please install those via the project manifest."
# config ZEPHYR_<MODULE_NAME_UPPER>_MODULE # config ZEPHYR_<MODULE_NAME_UPPER>_MODULE
# bool # bool
comment "hal_nordic module not available."
depends on !ZEPHYR_HAL_NORDIC_MODULE
# This ensures that symbols are available in Kconfig for dependency checking # This ensures that symbols are available in Kconfig for dependency checking
# and referencing, while keeping the settings themselves unavailable when the # and referencing, while keeping the settings themselves unavailable when the
# modules are not present in the workspace # modules are not present in the workspace

View file

@ -0,0 +1,11 @@
if(CONFIG_HAS_NORDIC_DRIVERS OR CONFIG_HAS_NRFX)
zephyr_library()
endif()
if(CONFIG_HAS_NORDIC_DRIVERS)
add_subdirectory(${ZEPHYR_CURRENT_MODULE_DIR}/drivers drivers)
endif()
if(CONFIG_HAS_NRFX)
add_subdirectory(nrfx)
endif()

190
modules/hal_nordic/Kconfig Normal file
View file

@ -0,0 +1,190 @@
# Copyright (c) 2016 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
config ZEPHYR_HAL_NORDIC_MODULE
bool
config HAS_NORDIC_DRIVERS
bool
menu "Nordic drivers"
depends on HAS_NORDIC_DRIVERS
menuconfig NRF_802154_RADIO_DRIVER
bool "Enable nRF IEEE 802.15.4 radio driver"
depends on HAS_HW_NRF_RADIO_IEEE802154
select DYNAMIC_INTERRUPTS
select ENTROPY_GENERATOR
select NRF_HW_TIMER1_RESERVED
help
This option enables nRF IEEE 802.15.4 radio driver in Zephyr. Note,
that beside the radio peripheral itself, this drivers occupies several
other peripherals. A complete list can be found in the hal_nordic
repository, within drivers/nrf_radio_802154/nrf_802154_peripherals.h
file. As the nRF IEEE 802.15.4 radio driver defines IRQ configuration
abstraction layer API and its Zephyr-specific implementation uses dynamic
interrupts, the DYNAMIC_INTERRUPTS switch is selected unconditionally.
if NRF_802154_RADIO_DRIVER
config NRF_802154_MULTIPROTOCOL_SUPPORT
bool
help
In dynamic multiprotocol applications, access to the radio peripheral
must be distributed by an arbiter. To support this arbitration
in the driver, this option must be enabled. Otherwise, the driver
assumes that access to the radio peripheral is granted indefinitely.
choice NRF_802154_CCA_MODE
prompt "nRF IEEE 802.15.4 CCA mode"
default NRF_802154_CCA_MODE_ED
help
CCA mode
config NRF_802154_CCA_MODE_ED
bool "Energy Above Threshold"
config NRF_802154_CCA_MODE_CARRIER
bool "Carrier Seen"
config NRF_802154_CCA_MODE_CARRIER_AND_ED
bool "Energy Above Threshold AND Carrier Seen"
config NRF_802154_CCA_MODE_CARRIER_OR_ED
bool "Energy Above Threshold OR Carrier Seen"
endchoice
choice NRF_802154_SL_TYPE
prompt "nRF IEEE 802.15.4 Service Layer Type"
default NRF_802154_SL_OPENSOURCE
config NRF_802154_SL_OPENSOURCE
bool "nRF IEEE 802.15.4 Open source Service Layer"
endchoice
config NRF_802154_CCA_ED_THRESHOLD
int "nRF IEEE 802.15.4 CCA Energy Detection threshold"
default 45
help
If energy detected in a given channel is above the value then the
channel is deemed busy. The unit is defined as per 802.15.4-2006 spec.
config NRF_802154_CCA_CORR_THRESHOLD
int "nRF IEEE 802.15.4 CCA Correlator threshold"
default 45
config NRF_802154_CCA_CORR_LIMIT
int "nRF IEEE 802.15.4 CCA Correlator limit"
default 2
help
Limit for occurrences above correlator threshold. When not equal to
zero the correlator based signal detect is enabled.
config NRF_802154_PENDING_SHORT_ADDRESSES
int "nRF 802.15.4 pending short addresses"
default 16
help
Number of slots containing short addresses of nodes for which pending data is stored
config NRF_802154_PENDING_EXTENDED_ADDRESSES
int "nRF 802.15.4 pending extended addresses"
default 16
help
Number of slots containing extended addresses of nodes for which pending data is stored
config NRF_802154_RX_BUFFERS
int "nRF 802.15.4 receive buffers"
default 16
help
Number of buffers in nRF 802.15.4 driver receive queue. If this value is modified,
its serialization host counterpart must be set to the exact same value.
endif # NRF_802154_RADIO_DRIVER
config NRF_802154_SER_HOST
bool "nRF IEEE 802.15.4 Driver serialization host"
depends on !NRF_802154_RADIO_DRIVER
depends on !HAS_HW_NRF_RADIO_IEEE802154
select IPM
select IPM_NRFX
select IPM_MSG_CH_0_ENABLE
select IPM_MSG_CH_1_ENABLE
select IPM_MSG_CH_0_TX
select IPM_MSG_CH_1_RX
select OPENAMP
select IEEE802154_NRF5_EXT_IRQ_MGMT if IEEE802154_NRF5
help
Enable serialization of nRF IEEE 802.15.4 Driver. This option is to be
used if radio is not available in the core, but radio services are
provided by a serialization backend.
menuconfig NRF_802154_SER_RADIO
bool "nRF IEEE 802.15.4 Driver serialization radio"
depends on HAS_HW_NRF_RADIO_IEEE802154
depends on !IEEE802154_NRF5
select IPM
select IPM_NRFX
select IPM_MSG_CH_0_ENABLE
select IPM_MSG_CH_1_ENABLE
select IPM_MSG_CH_0_RX
select IPM_MSG_CH_1_TX
select OPENAMP
select NRF_802154_RADIO_DRIVER
help
Enable serialization of nRF IEEE 802.15.4 Driver. This option is to be
used if radio is available in the core to provide radio services over
a serialization backend.
if NRF_802154_SER_RADIO
config NRF_802154_SER_RADIO_INIT_PRIO
int "nRF52 IEEE 802.15.4 serialization initialization priority"
default 81
help
Set the initialization priority number. Do not mess with it unless
you know what you are doing.
endif
menu "nRF 802.15.4 serialization"
depends on NRF_802154_SER_HOST || NRF_802154_SER_RADIO
config NRF_802154_SER_LOG
bool "802.15.4 serialization logs"
default n
help
This option enable debug logs of 802.15.4 serialization module.
config NRF_802154_SER_BUFFER_ALLOCATOR_THREAD_SAFE
bool
# Hidden option
default y
help
This option specifies if buffers for 802.15.4 serialization are allocated
in a thread-safe manner.
config NRF_802154_SER_DEFAULT_RESPONSE_TIMEOUT
int "Default Spinel serialization response timeout in milliseconds"
default 500
help
This option specifies default timeout of spinel status response
in milliseconds.
if NRF_802154_SER_HOST
config NRF_802154_RX_BUFFERS
int "nRF 802.15.4 receive buffers"
default 16
help
Number of buffers in nRF 802.15.4 driver serialization host's receive queue.
If this value is modified, its remote counterpart must be set to the exact same value.
endif
endmenu # NRF_802154_SER_HOST || NRF_802154_SER_RADIO
endmenu # HAS_NORDIC_DRIVERS
rsource "nrfx/Kconfig"

View file

@ -0,0 +1,81 @@
set(NRFX_DIR ${ZEPHYR_CURRENT_MODULE_DIR}/nrfx)
set(INC_DIR ${NRFX_DIR}/drivers/include)
set(SRC_DIR ${NRFX_DIR}/drivers/src)
set(MDK_DIR ${NRFX_DIR}/mdk)
zephyr_include_directories(${NRFX_DIR})
zephyr_include_directories(${INC_DIR})
zephyr_include_directories(${MDK_DIR})
zephyr_include_directories(.)
# Define MDK defines globally
zephyr_compile_definitions_ifdef(CONFIG_SOC_SERIES_NRF51X NRF51)
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52805 NRF52805_XXAA)
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52810 NRF52810_XXAA)
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52811 NRF52811_XXAA)
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52820 NRF52820_XXAA)
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52832 NRF52832_XXAA)
zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF52832 NRF52832_XXAA)
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52833 NRF52833_XXAA)
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52840 NRF52840_XXAA)
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUAPP NRF5340_XXAA_APPLICATION)
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUNET NRF5340_XXAA_NETWORK)
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA)
# Connect Kconfig compilation option for Non-Secure software with option required by MDK/nrfx
zephyr_compile_definitions_ifdef(CONFIG_ARM_NONSECURE_FIRMWARE NRF_TRUSTZONE_NONSECURE)
zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF51X ${MDK_DIR}/system_nrf51.c)
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52805 ${MDK_DIR}/system_nrf52805.c)
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52810 ${MDK_DIR}/system_nrf52810.c)
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52811 ${MDK_DIR}/system_nrf52811.c)
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52820 ${MDK_DIR}/system_nrf52820.c)
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52832 ${MDK_DIR}/system_nrf52.c)
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52833 ${MDK_DIR}/system_nrf52833.c)
zephyr_library_sources_ifdef(CONFIG_SOC_NRF52840 ${MDK_DIR}/system_nrf52840.c)
zephyr_library_sources_ifdef(CONFIG_SOC_NRF5340_CPUAPP ${MDK_DIR}/system_nrf5340_application.c)
zephyr_library_sources_ifdef(CONFIG_SOC_NRF5340_CPUNET ${MDK_DIR}/system_nrf5340_network.c)
zephyr_library_sources_ifdef(CONFIG_SOC_NRF9160 ${MDK_DIR}/system_nrf9160.c)
zephyr_library_sources(nrfx_glue.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_PRS ${SRC_DIR}/prs/nrfx_prs.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_ADC ${SRC_DIR}/nrfx_adc.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_CLOCK ${SRC_DIR}/nrfx_clock.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_COMP ${SRC_DIR}/nrfx_comp.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_DPPI ${SRC_DIR}/nrfx_dppi.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_EGU ${SRC_DIR}/nrfx_egu.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_GPIOTE ${SRC_DIR}/nrfx_gpiote.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_I2S ${SRC_DIR}/nrfx_i2s.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_IPC ${SRC_DIR}/nrfx_ipc.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_LPCOMP ${SRC_DIR}/nrfx_lpcomp.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_NFCT ${SRC_DIR}/nrfx_nfct.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_NVMC ${SRC_DIR}/nrfx_nvmc.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_PDM ${SRC_DIR}/nrfx_pdm.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_POWER ${SRC_DIR}/nrfx_power.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_PPI ${SRC_DIR}/nrfx_ppi.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_PWM ${SRC_DIR}/nrfx_pwm.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_QDEC ${SRC_DIR}/nrfx_qdec.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_QSPI ${SRC_DIR}/nrfx_qspi.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_RNG ${SRC_DIR}/nrfx_rng.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_RTC ${SRC_DIR}/nrfx_rtc.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_SAADC ${SRC_DIR}/nrfx_saadc.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_SPI ${SRC_DIR}/nrfx_spi.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_SPIM ${SRC_DIR}/nrfx_spim.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_SPIS ${SRC_DIR}/nrfx_spis.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_SYSTICK ${SRC_DIR}/nrfx_systick.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_TEMP ${SRC_DIR}/nrfx_temp.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_TIMER ${SRC_DIR}/nrfx_timer.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_TWI ${SRC_DIR}/nrfx_twi.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_TWIM ${SRC_DIR}/nrfx_twim.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_TWIS ${SRC_DIR}/nrfx_twis.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_UART ${SRC_DIR}/nrfx_uart.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_UARTE ${SRC_DIR}/nrfx_uarte.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_USBD ${SRC_DIR}/nrfx_usbd.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_USBREG ${SRC_DIR}/nrfx_usbreg.c)
zephyr_library_sources_ifdef(CONFIG_NRFX_WDT ${SRC_DIR}/nrfx_wdt.c)
if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM)
zephyr_library_sources(${SRC_DIR}/nrfx_twi_twim.c)
endif()

View file

@ -1,189 +1,6 @@
# Copyright (c) 2016 Nordic Semiconductor ASA # Copyright (c) 2016 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
config HAS_NORDIC_DRIVERS
bool
menu "Nordic drivers"
depends on HAS_NORDIC_DRIVERS
menuconfig NRF_802154_RADIO_DRIVER
bool "Enable nRF IEEE 802.15.4 radio driver"
depends on HAS_HW_NRF_RADIO_IEEE802154
select DYNAMIC_INTERRUPTS
select ENTROPY_GENERATOR
select NRF_HW_TIMER1_RESERVED
help
This option enables nRF IEEE 802.15.4 radio driver in Zephyr. Note,
that beside the radio peripheral itself, this drivers occupies several
other peripherals. A complete list can be found in the hal_nordic
repository, within drivers/nrf_radio_802154/nrf_802154_peripherals.h
file. As the nRF IEEE 802.15.4 radio driver defines IRQ configuration
abstraction layer API and its Zephyr-specific implementation uses dynamic
interrupts, the DYNAMIC_INTERRUPTS switch is selected unconditionally.
if NRF_802154_RADIO_DRIVER
config NRF_802154_MULTIPROTOCOL_SUPPORT
bool
help
In dynamic multiprotocol applications, access to the radio peripheral
must be distributed by an arbiter. To support this arbitration
in the driver, this option must be enabled. Otherwise, the driver
assumes that access to the radio peripheral is granted indefinitely.
choice NRF_802154_CCA_MODE
prompt "nRF IEEE 802.15.4 CCA mode"
default NRF_802154_CCA_MODE_ED
help
CCA mode
config NRF_802154_CCA_MODE_ED
bool "Energy Above Threshold"
config NRF_802154_CCA_MODE_CARRIER
bool "Carrier Seen"
config NRF_802154_CCA_MODE_CARRIER_AND_ED
bool "Energy Above Threshold AND Carrier Seen"
config NRF_802154_CCA_MODE_CARRIER_OR_ED
bool "Energy Above Threshold OR Carrier Seen"
endchoice
choice NRF_802154_SL_TYPE
prompt "nRF IEEE 802.15.4 Service Layer Type"
default NRF_802154_SL_OPENSOURCE
config NRF_802154_SL_OPENSOURCE
bool "nRF IEEE 802.15.4 Open source Service Layer"
endchoice
config NRF_802154_CCA_ED_THRESHOLD
int "nRF IEEE 802.15.4 CCA Energy Detection threshold"
default 45
help
If energy detected in a given channel is above the value then the
channel is deemed busy. The unit is defined as per 802.15.4-2006 spec.
config NRF_802154_CCA_CORR_THRESHOLD
int "nRF IEEE 802.15.4 CCA Correlator threshold"
default 45
config NRF_802154_CCA_CORR_LIMIT
int "nRF IEEE 802.15.4 CCA Correlator limit"
default 2
help
Limit for occurrences above correlator threshold. When not equal to
zero the correlator based signal detect is enabled.
config NRF_802154_PENDING_SHORT_ADDRESSES
int "nRF 802.15.4 pending short addresses"
default 16
help
Number of slots containing short addresses of nodes for which pending data is stored
config NRF_802154_PENDING_EXTENDED_ADDRESSES
int "nRF 802.15.4 pending extended addresses"
default 16
help
Number of slots containing extended addresses of nodes for which pending data is stored
config NRF_802154_RX_BUFFERS
int "nRF 802.15.4 receive buffers"
default 16
help
Number of buffers in nRF 802.15.4 driver receive queue. If this value is modified,
its serialization host counterpart must be set to the exact same value.
endif # NRF_802154_RADIO_DRIVER
config NRF_802154_SER_HOST
bool "nRF IEEE 802.15.4 Driver serialization host"
depends on !NRF_802154_RADIO_DRIVER
depends on !HAS_HW_NRF_RADIO_IEEE802154
select IPM
select IPM_NRFX
select IPM_MSG_CH_0_ENABLE
select IPM_MSG_CH_1_ENABLE
select IPM_MSG_CH_0_TX
select IPM_MSG_CH_1_RX
select OPENAMP
select IEEE802154_NRF5_EXT_IRQ_MGMT if IEEE802154_NRF5
help
Enable serialization of nRF IEEE 802.15.4 Driver. This option is to be
used if radio is not available in the core, but radio services are
provided by a serialization backend.
menuconfig NRF_802154_SER_RADIO
bool "nRF IEEE 802.15.4 Driver serialization radio"
depends on HAS_HW_NRF_RADIO_IEEE802154
depends on !IEEE802154_NRF5
select IPM
select IPM_NRFX
select IPM_MSG_CH_0_ENABLE
select IPM_MSG_CH_1_ENABLE
select IPM_MSG_CH_0_RX
select IPM_MSG_CH_1_TX
select OPENAMP
select NRF_802154_RADIO_DRIVER
help
Enable serialization of nRF IEEE 802.15.4 Driver. This option is to be
used if radio is available in the core to provide radio services over
a serialization backend.
if NRF_802154_SER_RADIO
config NRF_802154_SER_RADIO_INIT_PRIO
int "nRF52 IEEE 802.15.4 serialization initialization priority"
default 81
help
Set the initialization priority number. Do not mess with it unless
you know what you are doing.
endif
menu "nRF 802.15.4 serialization"
depends on NRF_802154_SER_HOST || NRF_802154_SER_RADIO
config NRF_802154_SER_LOG
bool "802.15.4 serialization logs"
default n
help
This option enable debug logs of 802.15.4 serialization module.
config NRF_802154_SER_BUFFER_ALLOCATOR_THREAD_SAFE
bool
# Hidden option
default y
help
This option specifies if buffers for 802.15.4 serialization are allocated
in a thread-safe manner.
config NRF_802154_SER_DEFAULT_RESPONSE_TIMEOUT
int "Default Spinel serialization response timeout in milliseconds"
default 500
help
This option specifies default timeout of spinel status response
in milliseconds.
if NRF_802154_SER_HOST
config NRF_802154_RX_BUFFERS
int "nRF 802.15.4 receive buffers"
default 16
help
Number of buffers in nRF 802.15.4 driver serialization host's receive queue.
If this value is modified, its remote counterpart must be set to the exact same value.
endif
endmenu # NRF_802154_SER_HOST || NRF_802154_SER_RADIO
endmenu # HAS_NORDIC_DRIVERS
config HAS_NRFX config HAS_NRFX
bool bool

View file

@ -0,0 +1,403 @@
/*
* Copyright (c) 2019 - 2020, Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef NRFX_CONFIG_H__
#define NRFX_CONFIG_H__
/*
* These are mappings of Kconfig options enabling nrfx drivers and particular
* peripheral instances to the corresponding symbols used inside of nrfx.
* Please note that only subsets of these entries are used for particular SoCs
* supported by nrfx (see the corresponding nrfx_config_*.h files).
*/
#ifdef CONFIG_NRFX_ADC
#define NRFX_ADC_ENABLED 1
#endif
#ifdef CONFIG_NRFX_CLOCK
#define NRFX_CLOCK_ENABLED 1
#endif
#ifdef CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC
#if defined(CONFIG_SOC_SERIES_NRF91X) || defined(CONFIG_SOC_SERIES_NRF53X)
#define NRFX_CLOCK_CONFIG_LF_SRC 1
#else
#define NRFX_CLOCK_CONFIG_LF_SRC 0
#endif
#endif // CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC
#ifdef CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL
#if defined(CONFIG_SOC_SERIES_NRF91X) || defined(CONFIG_SOC_SERIES_NRF53X)
#define NRFX_CLOCK_CONFIG_LF_SRC 2
#else
#define NRFX_CLOCK_CONFIG_LF_SRC 1
#endif
#endif // CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL
#ifdef CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH
#ifdef CONFIG_SOC_SERIES_NRF53X
#define NRFX_CLOCK_CONFIG_LF_SRC 3
#else
#define NRFX_CLOCK_CONFIG_LF_SRC 2
#endif
#endif // CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH
#ifdef CONFIG_CLOCK_CONTROL_NRF_K32SRC_EXT_LOW_SWING
#define NRFX_CLOCK_CONFIG_LF_SRC 131073
#endif
#ifdef CONFIG_CLOCK_CONTROL_NRF_K32SRC_EXT_FULL_SWING
#define NRFX_CLOCK_CONFIG_LF_SRC 196609
#endif
#ifdef CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION
#define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 1
#endif
#ifdef CONFIG_NRFX_CLOCK_LFXO_TWO_STAGE_ENABLED
#define NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED 1
#endif
#ifdef CONFIG_NRFX_COMP
#define NRFX_COMP_ENABLED 1
#endif
#ifdef CONFIG_NRFX_DPPI
#define NRFX_DPPI_ENABLED 1
#endif
#ifdef CONFIG_NRFX_EGU
#define NRFX_EGU_ENABLED 1
#endif
#ifdef CONFIG_NRFX_EGU0
#define NRFX_EGU0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_EGU1
#define NRFX_EGU1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_EGU2
#define NRFX_EGU2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_EGU3
#define NRFX_EGU3_ENABLED 1
#endif
#ifdef CONFIG_NRFX_EGU4
#define NRFX_EGU4_ENABLED 1
#endif
#ifdef CONFIG_NRFX_EGU5
#define NRFX_EGU5_ENABLED 1
#endif
#ifdef CONFIG_NRFX_GPIOTE
#define NRFX_GPIOTE_ENABLED 1
#endif
#ifdef CONFIG_NRFX_I2S
#define NRFX_I2S_ENABLED 1
#endif
#ifdef CONFIG_NRFX_IPC
#define NRFX_IPC_ENABLED 1
#endif
#ifdef CONFIG_NRFX_LPCOMP
#define NRFX_LPCOMP_ENABLED 1
#endif
#ifdef CONFIG_NRFX_NFCT
#define NRFX_NFCT_ENABLED 1
#endif
#ifdef CONFIG_NRFX_NVMC
#define NRFX_NVMC_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PDM
#define NRFX_PDM_ENABLED 1
#endif
#ifdef CONFIG_NRFX_POWER
#define NRFX_POWER_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PPI
#define NRFX_PPI_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PRS
#define NRFX_PRS_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PRS_BOX_0
#define NRFX_PRS_BOX_0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PRS_BOX_1
#define NRFX_PRS_BOX_1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PRS_BOX_2
#define NRFX_PRS_BOX_2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PRS_BOX_3
#define NRFX_PRS_BOX_3_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PRS_BOX_4
#define NRFX_PRS_BOX_4_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PWM
#define NRFX_PWM_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PWM0
#define NRFX_PWM0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PWM1
#define NRFX_PWM1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PWM2
#define NRFX_PWM2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_PWM3
#define NRFX_PWM3_ENABLED 1
#endif
#ifdef CONFIG_NRFX_QDEC
#define NRFX_QDEC_ENABLED 1
#endif
#ifdef CONFIG_NRFX_QSPI
#define NRFX_QSPI_ENABLED 1
#endif
#ifdef CONFIG_NRFX_RNG
#define NRFX_RNG_ENABLED 1
#endif
#ifdef CONFIG_NRFX_RTC
#define NRFX_RTC_ENABLED 1
#endif
#ifdef CONFIG_NRFX_RTC0
#define NRFX_RTC0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_RTC1
#define NRFX_RTC1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_RTC2
#define NRFX_RTC2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SAADC
#define NRFX_SAADC_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPI
#define NRFX_SPI_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPI0
#define NRFX_SPI0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPI1
#define NRFX_SPI1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPI2
#define NRFX_SPI2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIM
#define NRFX_SPIM_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIM0
#define NRFX_SPIM0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIM1
#define NRFX_SPIM1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIM2
#define NRFX_SPIM2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIM3
#define NRFX_SPIM3_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIM4
#define NRFX_SPIM4_ENABLED 1
#endif
#if defined(CONFIG_SPI_3_NRF_RX_DELAY) || defined(CONFIG_SPI_4_NRF_RX_DELAY)
#define NRFX_SPIM_EXTENDED_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIS
#define NRFX_SPIS_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIS0
#define NRFX_SPIS0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIS1
#define NRFX_SPIS1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIS2
#define NRFX_SPIS2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SPIS3
#define NRFX_SPIS3_ENABLED 1
#endif
#ifdef CONFIG_NRFX_SYSTICK
#define NRFX_SYSTICK_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TEMP
#define NRFX_TEMP_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TIMER
#define NRFX_TIMER_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TIMER0
#define NRFX_TIMER0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TIMER1
#define NRFX_TIMER1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TIMER2
#define NRFX_TIMER2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TIMER3
#define NRFX_TIMER3_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TIMER4
#define NRFX_TIMER4_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWI
#define NRFX_TWI_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWI0
#define NRFX_TWI0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWI1
#define NRFX_TWI1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWIM
#define NRFX_TWIM_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWIM0
#define NRFX_TWIM0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWIM1
#define NRFX_TWIM1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWIM2
#define NRFX_TWIM2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWIM3
#define NRFX_TWIM3_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWIS
#define NRFX_TWIS_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWIS0
#define NRFX_TWIS0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWIS1
#define NRFX_TWIS1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWIS2
#define NRFX_TWIS2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_TWIS3
#define NRFX_TWIS3_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UART
#define NRFX_UART_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UART0
#define NRFX_UART0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE
#define NRFX_UARTE_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE0
#define NRFX_UARTE0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE1
#define NRFX_UARTE1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE2
#define NRFX_UARTE2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE3
#define NRFX_UARTE3_ENABLED 1
#endif
#ifdef CONFIG_NRFX_USBD
#define NRFX_USBD_ENABLED 1
#endif
#ifdef CONFIG_NRFX_USBREG
#define NRFX_USBREG_ENABLED 1
#endif
#ifdef CONFIG_NRFX_WDT
#define NRFX_WDT_ENABLED 1
#endif
#ifdef CONFIG_NRFX_WDT0
#define NRFX_WDT0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_WDT1
#define NRFX_WDT1_ENABLED 1
#endif
#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
#include "nrfx_config_bsim.h"
#endif
/*
* For chips with TrustZone support, MDK provides CMSIS-Core peripheral
* accessing symbols in two flavors, with secure and non-secure base address
* mappings. Their names contain the suffix _S or _NS, respectively.
* Because nrfx HALs and drivers require these peripheral accessing symbols
* without any suffixes, the following macro is provided that will translate
* their names according to the kind of the target that is built.
*/
#if defined(NRF_TRUSTZONE_NONSECURE)
#define NRF_PERIPH(P) P##_NS
#else
#define NRF_PERIPH(P) P##_S
#endif
#if defined(NRF51)
#include <nrfx_config_nrf51.h>
#elif defined(NRF52805_XXAA)
#include <nrfx_config_nrf52805.h>
#elif defined(NRF52810_XXAA)
#include <nrfx_config_nrf52810.h>
#elif defined(NRF52811_XXAA)
#include <nrfx_config_nrf52811.h>
#elif defined(NRF52820_XXAA)
#include <nrfx_config_nrf52820.h>
#elif defined(NRF52832_XXAA) || defined (NRF52832_XXAB)
#include <nrfx_config_nrf52832.h>
#elif defined(NRF52833_XXAA)
#include <nrfx_config_nrf52833.h>
#elif defined(NRF52840_XXAA)
#include <nrfx_config_nrf52840.h>
#elif defined(NRF5340_XXAA_APPLICATION)
#include <nrfx_config_nrf5340_application.h>
#elif defined(NRF5340_XXAA_NETWORK)
#include <nrfx_config_nrf5340_network.h>
#elif defined(NRF9160_XXAA)
#include <nrfx_config_nrf9160.h>
#else
#error "Unknown device."
#endif
#endif // NRFX_CONFIG_H__

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2018, Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <nrfx.h>
#include <kernel.h>
void nrfx_isr(const void *irq_handler)
{
((nrfx_irq_handler_t)irq_handler)();
}
void nrfx_busy_wait(uint32_t usec_to_wait)
{
k_busy_wait(usec_to_wait);
}
char const *nrfx_error_string_get(nrfx_err_t code)
{
#define NRFX_ERROR_STRING_CASE(code) case code: return #code
switch (code) {
NRFX_ERROR_STRING_CASE(NRFX_SUCCESS);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_INTERNAL);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_NO_MEM);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_NOT_SUPPORTED);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_INVALID_PARAM);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_INVALID_STATE);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_INVALID_LENGTH);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_TIMEOUT);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_FORBIDDEN);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_NULL);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_INVALID_ADDR);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_BUSY);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_ALREADY_INITIALIZED);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_DRV_TWI_ERR_OVERRUN);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_DRV_TWI_ERR_ANACK);
NRFX_ERROR_STRING_CASE(NRFX_ERROR_DRV_TWI_ERR_DNACK);
default: return "unknown";
}
}

View file

@ -0,0 +1,293 @@
/*
* Copyright (c) 2018, Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef NRFX_GLUE_H__
#define NRFX_GLUE_H__
#include <sys/__assert.h>
#include <sys/atomic.h>
#include <irq.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup nrfx_glue nrfx_glue.h
* @{
* @ingroup nrfx
*
* @brief This file contains macros that should be implemented according to
* the needs of the host environment into which @em nrfx is integrated.
*/
//------------------------------------------------------------------------------
/**
* @brief Macro for placing a runtime assertion.
*
* @param expression Expression to be evaluated.
*/
#ifndef NRFX_ASSERT
#define NRFX_ASSERT(expression) __ASSERT_NO_MSG(expression)
#endif
/**
* @brief Macro for placing a compile time assertion.
*
* @param expression Expression to be evaluated.
*/
#define NRFX_STATIC_ASSERT(expression) \
BUILD_ASSERT(expression, "assertion failed")
//------------------------------------------------------------------------------
/**
* @brief Macro for setting the priority of a specific IRQ.
*
* @param irq_number IRQ number.
* @param priority Priority to be set.
*/
#define NRFX_IRQ_PRIORITY_SET(irq_number, priority) // Intentionally empty.
// Priorities of IRQs are
// set through IRQ_CONNECT.
/**
* @brief Macro for enabling a specific IRQ.
*
* @param irq_number IRQ number.
*/
#define NRFX_IRQ_ENABLE(irq_number) irq_enable(irq_number)
/**
* @brief Macro for checking if a specific IRQ is enabled.
*
* @param irq_number IRQ number.
*
* @retval true If the IRQ is enabled.
* @retval false Otherwise.
*/
#define NRFX_IRQ_IS_ENABLED(irq_number) irq_is_enabled(irq_number)
/**
* @brief Macro for disabling a specific IRQ.
*
* @param irq_number IRQ number.
*/
#define NRFX_IRQ_DISABLE(irq_number) irq_disable(irq_number)
/**
* @brief Macro for setting a specific IRQ as pending.
*
* @param irq_number IRQ number.
*/
#define NRFX_IRQ_PENDING_SET(irq_number) NVIC_SetPendingIRQ(irq_number)
/**
* @brief Macro for clearing the pending status of a specific IRQ.
*
* @param irq_number IRQ number.
*/
#define NRFX_IRQ_PENDING_CLEAR(irq_number) NVIC_ClearPendingIRQ(irq_number)
/**
* @brief Macro for checking the pending status of a specific IRQ.
*
* @retval true If the IRQ is pending.
* @retval false Otherwise.
*/
#define NRFX_IRQ_IS_PENDING(irq_number) (NVIC_GetPendingIRQ(irq_number) == 1)
/** @brief Macro for entering into a critical section. */
#define NRFX_CRITICAL_SECTION_ENTER() { unsigned int irq_lock_key = irq_lock();
/** @brief Macro for exiting from a critical section. */
#define NRFX_CRITICAL_SECTION_EXIT() irq_unlock(irq_lock_key); }
//------------------------------------------------------------------------------
/**
* @brief When set to a non-zero value, this macro specifies that
* @ref nrfx_coredep_delay_us uses a precise DWT-based solution.
* A compilation error is generated if the DWT unit is not present
* in the SoC used.
*/
#define NRFX_DELAY_DWT_BASED 0
/**
* @brief Macro for delaying the code execution for at least the specified time.
*
* @param us_time Number of microseconds to wait.
*/
#define NRFX_DELAY_US(us_time) nrfx_busy_wait(us_time)
/* This is a k_busy_wait wrapper, added to avoid the inclusion of kernel.h */
void nrfx_busy_wait(uint32_t usec_to_wait);
//------------------------------------------------------------------------------
/** @brief Atomic 32-bit unsigned type. */
#define nrfx_atomic_t atomic_t
/**
* @brief Macro for storing a value to an atomic object and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value to store.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_STORE(p_data, value) atomic_set(p_data, value)
/**
* @brief Macro for running a bitwise OR operation on an atomic object and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value of the second operand in the OR operation.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_OR(p_data, value) atomic_or(p_data, value)
/**
* @brief Macro for running a bitwise AND operation on an atomic object
* and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value of the second operand in the AND operation.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_AND(p_data, value) atomic_and(p_data, value)
/**
* @brief Macro for running a bitwise XOR operation on an atomic object
* and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value of the second operand in the XOR operation.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_XOR(p_data, value) atomic_xor(p_data, value)
/**
* @brief Macro for running an addition operation on an atomic object
* and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value of the second operand in the ADD operation.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_ADD(p_data, value) atomic_add(p_data, value)
/**
* @brief Macro for running a subtraction operation on an atomic object
* and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value of the second operand in the SUB operation.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_SUB(p_data, value) atomic_sub(p_data, value)
//------------------------------------------------------------------------------
/**
* @brief When set to a non-zero value, this macro specifies that the
* @ref nrfx_error_codes and the @ref nrfx_err_t type itself are defined
* in a customized way and the default definitions from @c <nrfx_error.h>
* should not be used.
*/
#define NRFX_CUSTOM_ERROR_CODES 0
//------------------------------------------------------------------------------
/**
* @brief When set to a non-zero value, this macro specifies that inside HALs
* the event registers are read back after clearing, on devices that
* otherwise could defer the actual register modification.
*/
#define NRFX_EVENT_READBACK_ENABLED 1
//------------------------------------------------------------------------------
/** @brief Bitmask that defines DPPI channels that are reserved for use outside of the nrfx library. */
#define NRFX_DPPI_CHANNELS_USED NRFX_PPI_CHANNELS_USED_BY_BT_CTLR
/** @brief Bitmask that defines DPPI groups that are reserved for use outside of the nrfx library. */
#define NRFX_DPPI_GROUPS_USED NRFX_PPI_GROUPS_USED_BY_BT_CTLR
/** @brief Bitmask that defines PPI channels that are reserved for use outside of the nrfx library. */
#define NRFX_PPI_CHANNELS_USED (NRFX_PPI_CHANNELS_USED_BY_BT_CTLR | \
NRFX_PPI_CHANNELS_USED_BY_PWM_SW)
/** @brief Bitmask that defines PPI groups that are reserved for use outside of the nrfx library. */
#define NRFX_PPI_GROUPS_USED NRFX_PPI_GROUPS_USED_BY_BT_CTLR
/** @brief Bitmask that defines GPIOTE channels that are reserved for use outside of the nrfx library. */
#define NRFX_GPIOTE_CHANNELS_USED NRFX_GPIOTE_CHANNELS_USED_BY_PWM_SW
#if defined(CONFIG_BT_CTLR)
extern const uint32_t z_bt_ctlr_used_nrf_ppi_channels;
extern const uint32_t z_bt_ctlr_used_nrf_ppi_groups;
#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR z_bt_ctlr_used_nrf_ppi_channels
#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR z_bt_ctlr_used_nrf_ppi_groups
#else
#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR 0
#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR 0
#endif
#if defined(CONFIG_PWM_NRF5_SW)
#define PWM_NRF5_SW_NODE DT_INST(0, nordic_nrf_sw_pwm)
#define PWM_NRF5_SW_GENERATOR_NODE DT_PHANDLE(PWM_NRF5_SW_NODE, generator)
#if DT_NODE_HAS_COMPAT(PWM_NRF5_SW_GENERATOR_NODE, nordic_nrf_rtc)
#define PWM_NRF5_SW_PPI_CHANNELS_PER_PIN 3
#else
#define PWM_NRF5_SW_PPI_CHANNELS_PER_PIN 2
#endif /* DT_NODE_HAS_COMPAT(PWM_NRF5_SW_GENERATOR_NODE, nordic_nrf_rtc) */
#define NRFX_PPI_CHANNELS_USED_BY_PWM_SW \
(BIT_MASK(DT_PROP(PWM_NRF5_SW_NODE, channel_count) * \
PWM_NRF5_SW_PPI_CHANNELS_PER_PIN) \
<< DT_PROP(PWM_NRF5_SW_NODE, ppi_base))
#define NRFX_GPIOTE_CHANNELS_USED_BY_PWM_SW \
DT_PROP(PWM_NRF5_SW_NODE, channel_count)
#else
#define NRFX_PPI_CHANNELS_USED_BY_PWM_SW 0
#define NRFX_GPIOTE_CHANNELS_USED_BY_PWM_SW 0
#endif
/** @brief Bitmask that defines EGU instances that are reserved for use outside of the nrfx library. */
#define NRFX_EGUS_USED 0
/** @brief Bitmask that defines TIMER instances that are reserved for use outside of the nrfx library. */
#define NRFX_TIMERS_USED 0
//------------------------------------------------------------------------------
/**
* @brief Function helping to integrate nrfx IRQ handlers with IRQ_CONNECT.
*
* This function simply calls the nrfx IRQ handler supplied as the parameter.
* It is intended to be used in the following way:
* IRQ_CONNECT(IRQ_NUM, IRQ_PRI, nrfx_isr, nrfx_..._irq_handler, 0);
*
* @param[in] irq_handler Pointer to the nrfx IRQ handler to be called.
*/
void nrfx_isr(const void *irq_handler);
#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
#include "nrfx_glue_bsim.h"
#endif
/** @} */
#ifdef __cplusplus
}
#endif
#endif // NRFX_GLUE_H__

View file

@ -0,0 +1,137 @@
/*
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef NRFX_LOG_H__
#define NRFX_LOG_H__
#include <logging/log.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NRFX_MODULE_PREFIX _CONCAT(NRFX_, NRFX_LOG_MODULE)
/*
* The following macros from nrfx_config control the log messages coming from
* a given module:
* - NRFX_<module>_CONFIG_LOG_ENABLED enables the messages (when set to 1)
* - NRFX_<module>_CONFIG_LOG_LEVEL specifies the severity level of the messages
* that are to be output.
*/
#if !IS_ENABLED(_CONCAT(NRFX_MODULE_PREFIX, _CONFIG_LOG_ENABLED))
#define NRFX_MODULE_CONFIG_LOG_LEVEL 0
#else
#define NRFX_MODULE_CONFIG_LOG_LEVEL \
_CONCAT(NRFX_MODULE_PREFIX, _CONFIG_LOG_LEVEL)
#endif
#if NRFX_MODULE_CONFIG_LOG_LEVEL == 0
#define NRFX_MODULE_LOG_LEVEL LOG_LEVEL_NONE
#elif NRFX_MODULE_CONFIG_LOG_LEVEL == 1
#define NRFX_MODULE_LOG_LEVEL LOG_LEVEL_ERR
#elif NRFX_MODULE_CONFIG_LOG_LEVEL == 2
#define NRFX_MODULE_LOG_LEVEL LOG_LEVEL_WRN
#elif NRFX_MODULE_CONFIG_LOG_LEVEL == 3
#define NRFX_MODULE_LOG_LEVEL LOG_LEVEL_INF
#elif NRFX_MODULE_CONFIG_LOG_LEVEL == 4
#define NRFX_MODULE_LOG_LEVEL LOG_LEVEL_DBG
#endif
LOG_MODULE_REGISTER(NRFX_MODULE_PREFIX, NRFX_MODULE_LOG_LEVEL);
/**
* @defgroup nrfx_log nrfx_log.h
* @{
* @ingroup nrfx
*
* @brief This file contains macros that should be implemented according to
* the needs of the host environment into which @em nrfx is integrated.
*/
/**
* @brief Macro for logging a message with the severity level ERROR.
*
* @param ... printf-style format string, optionally followed by arguments
* to be formatted and inserted in the resulting string.
*/
#define NRFX_LOG_ERROR(...) LOG_ERR(__VA_ARGS__)
/**
* @brief Macro for logging a message with the severity level WARNING.
*
* @param ... printf-style format string, optionally followed by arguments
* to be formatted and inserted in the resulting string.
*/
#define NRFX_LOG_WARNING(...) LOG_WRN(__VA_ARGS__)
/**
* @brief Macro for logging a message with the severity level INFO.
*
* @param ... printf-style format string, optionally followed by arguments
* to be formatted and inserted in the resulting string.
*/
#define NRFX_LOG_INFO(...) LOG_INF(__VA_ARGS__)
/**
* @brief Macro for logging a message with the severity level DEBUG.
*
* @param ... printf-style format string, optionally followed by arguments
* to be formatted and inserted in the resulting string.
*/
#define NRFX_LOG_DEBUG(...) LOG_DBG(__VA_ARGS__)
/**
* @brief Macro for logging a memory dump with the severity level ERROR.
*
* @param[in] p_memory Pointer to the memory region to be dumped.
* @param[in] length Length of the memory region in bytes.
*/
#define NRFX_LOG_HEXDUMP_ERROR(p_memory, length) \
LOG_HEXDUMP_ERR(p_memory, length, "")
/**
* @brief Macro for logging a memory dump with the severity level WARNING.
*
* @param[in] p_memory Pointer to the memory region to be dumped.
* @param[in] length Length of the memory region in bytes.
*/
#define NRFX_LOG_HEXDUMP_WARNING(p_memory, length) \
LOG_HEXDUMP_WRN(p_memory, length, "")
/**
* @brief Macro for logging a memory dump with the severity level INFO.
*
* @param[in] p_memory Pointer to the memory region to be dumped.
* @param[in] length Length of the memory region in bytes.
*/
#define NRFX_LOG_HEXDUMP_INFO(p_memory, length) \
LOG_HEXDUMP_INF(p_memory, length, "")
/**
* @brief Macro for logging a memory dump with the severity level DEBUG.
*
* @param[in] p_memory Pointer to the memory region to be dumped.
* @param[in] length Length of the memory region in bytes.
*/
#define NRFX_LOG_HEXDUMP_DEBUG(p_memory, length) \
LOG_HEXDUMP_DBG(p_memory, length, "")
/**
* @brief Macro for getting the textual representation of a given error code.
*
* @param[in] error_code Error code.
*
* @return String containing the textual representation of the error code.
*/
#define NRFX_LOG_ERROR_STRING_GET(error_code) nrfx_error_string_get(error_code)
extern char const *nrfx_error_string_get(nrfx_err_t code);
/** @} */
#ifdef __cplusplus
}
#endif
#endif // NRFX_LOG_H__

View file

@ -57,7 +57,7 @@ manifest:
revision: f1fa8241f8786198ba41155413243de36ed878a5 revision: f1fa8241f8786198ba41155413243de36ed878a5
path: modules/hal/infineon path: modules/hal/infineon
- name: hal_nordic - name: hal_nordic
revision: 8e132fee9794fcc8b809f3d7479b17031c156317 revision: f163c53b88c33070cb28150ba20200e4aa5fdc49
path: modules/hal/nordic path: modules/hal/nordic
- name: hal_openisa - name: hal_openisa
revision: 40d049f69c50b58ea20473bee14cf93f518bf262 revision: 40d049f69c50b58ea20473bee14cf93f518bf262