From 7e0f1d08e4024b07b8e33c63d9fc67065ed77c3a Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Mon, 22 Nov 2021 14:50:47 +0100 Subject: [PATCH] modules: hal_nordic: Update nrfx to version 2.6.0 Update the hal_nordic module revision, to switch to nrfx v2.6.0. nrfx 2.6.0 includes extended API in nrfx_gpiote which can be used by the zephyr shim. Signed-off-by: Krzysztof Chruscinski --- modules/hal_nordic/nrfx/CMakeLists.txt | 2 ++ modules/hal_nordic/nrfx/nrfx_config_nrf51.h | 13 +++++-- .../hal_nordic/nrfx/nrfx_config_nrf52805.h | 13 +++++-- .../hal_nordic/nrfx/nrfx_config_nrf52810.h | 13 +++++-- .../hal_nordic/nrfx/nrfx_config_nrf52811.h | 13 +++++-- .../hal_nordic/nrfx/nrfx_config_nrf52820.h | 13 +++++-- .../hal_nordic/nrfx/nrfx_config_nrf52832.h | 13 +++++-- .../hal_nordic/nrfx/nrfx_config_nrf52833.h | 13 +++++-- .../hal_nordic/nrfx/nrfx_config_nrf52840.h | 13 +++++-- .../nrfx/nrfx_config_nrf5340_application.h | 7 ++-- .../nrfx/nrfx_config_nrf5340_network.h | 7 ++-- modules/hal_nordic/nrfx/nrfx_config_nrf9160.h | 7 ++-- modules/hal_nordic/nrfx/nrfx_glue.h | 35 +++++++++++++++++++ west.yml | 2 +- 14 files changed, 130 insertions(+), 34 deletions(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 4860f1ea37..4b0184fbf2 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -7,6 +7,7 @@ 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) +set(HELPERS_DIR ${NRFX_DIR}/helpers) zephyr_include_directories(${NRFX_DIR}) zephyr_include_directories(${INC_DIR}) @@ -58,6 +59,7 @@ zephyr_library_sources_ifdef(CONFIG_SOC_NRF5340_CPUNET ${MDK_DIR}/system_nrf5340 zephyr_library_sources_ifdef(CONFIG_SOC_NRF9160 ${MDK_DIR}/system_nrf9160.c) zephyr_library_sources(nrfx_glue.c) +zephyr_library_sources(${HELPERS_DIR}/nrfx_flag32_allocator.c) zephyr_library_sources_ifdef(CONFIG_NRFX_PRS ${SRC_DIR}/prs/nrfx_prs.c) diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf51.h b/modules/hal_nordic/nrfx/nrfx_config_nrf51.h index a6fa2a3131..f9b68675cc 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf51.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf51.h @@ -105,6 +105,12 @@ #define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 #endif +// NRFX_CLOCK_CONFIG_CT_ENABLED - Enables Calibration Timer Support + +#ifndef NRFX_CLOCK_CONFIG_CT_ENABLED +#define NRFX_CLOCK_CONFIG_CT_ENABLED 0 +#endif + // NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED - Enables two-stage LFXO start procedure // If set to a non-zero value, LFRC will be started before LFXO and corresponding @@ -185,9 +191,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf52805.h b/modules/hal_nordic/nrfx/nrfx_config_nrf52805.h index ff01391370..b81ff4f4a7 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf52805.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf52805.h @@ -38,6 +38,12 @@ #define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 #endif +// NRFX_CLOCK_CONFIG_CT_ENABLED - Enables Calibration Timer Support + +#ifndef NRFX_CLOCK_CONFIG_CT_ENABLED +#define NRFX_CLOCK_CONFIG_CT_ENABLED 0 +#endif + // NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED - Enables two-stage LFXO start procedure // If set to a non-zero value, LFRC will be started before LFXO and corresponding @@ -157,9 +163,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf52810.h b/modules/hal_nordic/nrfx/nrfx_config_nrf52810.h index c9d178394d..fad6c32df7 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf52810.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf52810.h @@ -38,6 +38,12 @@ #define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 #endif +// NRFX_CLOCK_CONFIG_CT_ENABLED - Enables Calibration Timer Support + +#ifndef NRFX_CLOCK_CONFIG_CT_ENABLED +#define NRFX_CLOCK_CONFIG_CT_ENABLED 0 +#endif + // NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED - Enables two-stage LFXO start procedure // If set to a non-zero value, LFRC will be started before LFXO and corresponding @@ -231,9 +237,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf52811.h b/modules/hal_nordic/nrfx/nrfx_config_nrf52811.h index 013f861725..1513e3f40a 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf52811.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf52811.h @@ -38,6 +38,12 @@ #define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 #endif +// NRFX_CLOCK_CONFIG_CT_ENABLED - Enables Calibration Timer Support + +#ifndef NRFX_CLOCK_CONFIG_CT_ENABLED +#define NRFX_CLOCK_CONFIG_CT_ENABLED 0 +#endif + // NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED - Enables two-stage LFXO start procedure // If set to a non-zero value, LFRC will be started before LFXO and corresponding @@ -232,9 +238,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf52820.h b/modules/hal_nordic/nrfx/nrfx_config_nrf52820.h index bff650da63..983c64e1f2 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf52820.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf52820.h @@ -38,6 +38,12 @@ #define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 #endif +// NRFX_CLOCK_CONFIG_CT_ENABLED - Enables Calibration Timer Support + +#ifndef NRFX_CLOCK_CONFIG_CT_ENABLED +#define NRFX_CLOCK_CONFIG_CT_ENABLED 0 +#endif + // NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED - Enables two-stage LFXO start procedure // If set to a non-zero value, LFRC will be started before LFXO and corresponding @@ -256,9 +262,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf52832.h b/modules/hal_nordic/nrfx/nrfx_config_nrf52832.h index 0bd5799407..4f5ed60b80 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf52832.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf52832.h @@ -38,6 +38,12 @@ #define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 #endif +// NRFX_CLOCK_CONFIG_CT_ENABLED - Enables Calibration Timer Support + +#ifndef NRFX_CLOCK_CONFIG_CT_ENABLED +#define NRFX_CLOCK_CONFIG_CT_ENABLED 0 +#endif + // NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED - Enables two-stage LFXO start procedure // If set to a non-zero value, LFRC will be started before LFXO and corresponding @@ -256,9 +262,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf52833.h b/modules/hal_nordic/nrfx/nrfx_config_nrf52833.h index f7331db02e..94a6d56fdc 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf52833.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf52833.h @@ -38,6 +38,12 @@ #define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 #endif +// NRFX_CLOCK_CONFIG_CT_ENABLED - Enables Calibration Timer Support + +#ifndef NRFX_CLOCK_CONFIG_CT_ENABLED +#define NRFX_CLOCK_CONFIG_CT_ENABLED 0 +#endif + // NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED - Enables two-stage LFXO start procedure // If set to a non-zero value, LFRC will be started before LFXO and corresponding @@ -256,9 +262,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf52840.h b/modules/hal_nordic/nrfx/nrfx_config_nrf52840.h index 3847549878..f02b714e04 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf52840.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf52840.h @@ -38,6 +38,12 @@ #define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 #endif +// NRFX_CLOCK_CONFIG_CT_ENABLED - Enables Calibration Timer Support + +#ifndef NRFX_CLOCK_CONFIG_CT_ENABLED +#define NRFX_CLOCK_CONFIG_CT_ENABLED 0 +#endif + // NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED - Enables two-stage LFXO start procedure // If set to a non-zero value, LFRC will be started before LFXO and corresponding @@ -256,9 +262,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h index 5a52f5b9f4..eddc83cc3e 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h @@ -419,9 +419,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins. -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority. diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf5340_network.h b/modules/hal_nordic/nrfx/nrfx_config_nrf5340_network.h index 9861309e75..5623d2643c 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf5340_network.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf5340_network.h @@ -266,9 +266,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins. -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority. diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf9160.h b/modules/hal_nordic/nrfx/nrfx_config_nrf9160.h index 31866289bc..57ef9c4c59 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf9160.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf9160.h @@ -307,9 +307,10 @@ #ifndef NRFX_GPIOTE_ENABLED #define NRFX_GPIOTE_ENABLED 0 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins. -#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 + +// NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS - Number of dedicated handlers +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 1 #endif // NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority. diff --git a/modules/hal_nordic/nrfx/nrfx_glue.h b/modules/hal_nordic/nrfx/nrfx_glue.h index 5b45edc298..1d6d319991 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.h +++ b/modules/hal_nordic/nrfx/nrfx_glue.h @@ -195,6 +195,41 @@ void nrfx_busy_wait(uint32_t usec_to_wait); */ #define NRFX_ATOMIC_FETCH_SUB(p_data, value) atomic_sub(p_data, value) +/** + * @brief Macro for running compare and swap on an atomic object. + * + * Value is updated to the new value only if it previously equaled old value. + * + * @param[in,out] p_data Atomic memory pointer. + * @param[in] old_value Expected old value. + * @param[in] new_value New value. + * + * @retval true If value was updated. + * @retval false If value was not updated because location was not equal to @p old_value. + */ +#define NRFX_ATOMIC_CAS(p_data, old_value, new_value) \ + atomic_cas(p_data, old_value, new_value) + +/** + * @brief Macro for counting leading zeros. + * + * @param[in] value A word value. + * + * @return Number of leading 0-bits in @p value, starting at the most significant bit position. + * If x is 0, the result is undefined. + */ +#define NRFX_CLZ(value) __builtin_clz(value) + +/** + * @brief Macro for counting trailing zeros. + * + * @param[in] value A word value. + * + * @return Number of trailing 0-bits in @p value, starting at the least significant bit position. + * If x is 0, the result is undefined. + */ +#define NRFX_CTZ(value) __builtin_ctz(value) + //------------------------------------------------------------------------------ /** diff --git a/west.yml b/west.yml index e4373d087f..877681ef4c 100644 --- a/west.yml +++ b/west.yml @@ -88,7 +88,7 @@ manifest: groups: - hal - name: hal_nordic - revision: cad21db72a61b8dde0aabf95301dfd9dee119018 + revision: 077031bf6eaac5352e304ad0f1a0c5b16b4dd115 path: modules/hal/nordic groups: - hal