Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a734f84
[nrf fromlist] drivers: flash: nrf_qspi_nor: Prevent CPU hang when XI…
anangl Apr 23, 2025
07e10c6
[nrf noup] tests: bluetooth: tester: Enable PSA RNG on nRF54H20
gordonklaus Apr 8, 2025
0afd70b
[nrf fromlist] tests: drivers: clock_control_api: Adjust to nRF54L09 …
mstasiaknordic Apr 23, 2025
785502f
Revert "[nrf fromlist] tests: drivers: i2s: Align tests to TDM periph…
adamkondraciuk Apr 23, 2025
5c1fbf9
Revert "[nrf fromlist] drivers: i2s: Add support for nRF TDM peripher…
adamkondraciuk Apr 23, 2025
e22c042
[nrf fromlist] drivers: i2s: Add support for nRF TDM peripherals
adamkondraciuk Nov 27, 2024
7221211
[nrf fromlist] tests: drivers: i2s: Align tests to TDM peripheral
adamkondraciuk Jan 14, 2025
d771a3a
Revert "[nrf noup] moduled: hal_nordic: require nrf-regtool"
jonathannilsen Apr 22, 2025
2d72746
[nrf fromlist] modules: hal_nordic: bump regtool to 9.1.0
jonathannilsen Apr 22, 2025
4e9869f
[nrf noup] modules: hal_nordic: require nrf-regtool
jonathannilsen Apr 22, 2025
60cac62
Revert "[nrf fromlist] tests: drivers: clock_control_api: Adjust to n…
mstasiaknordic Apr 24, 2025
0955031
[nrf fromlist] tests: drivers: clock_control_api: move startup time t…
mstasiaknordic Apr 24, 2025
c82f741
[nrf fromtree] modules: avoid fetching external repo in TF-M
wearyzen Dec 24, 2024
a97c5a1
[nrf fromtree] west.yml : update modules/tee/tf-m/trusted-firmware-m
FRASTM Feb 4, 2025
6e16b34
[nrf fromtree] modules: tf-m: fix build verbosity
JordanYates Feb 17, 2025
5b1d1dc
[nrf fromtree] west.yml: Update TrustedFirmware-M with Flash Area che…
de-nordic Feb 26, 2025
0ae7d3d
[nrf fromtree] manifest: Bring TF-M with nRF54L15 upstream support
Vge0rge Feb 20, 2025
8ac2b70
[nrf fromtree] manifest: Bring TF-M with initial nRF54L10 support
Vge0rge Apr 10, 2025
532da2e
[nrf fromtree] manifest: tf-m: update to 2.1.2
tomi-font Apr 14, 2025
a6f08b2
[nrf fromlist] west: runners: nrf_common: Temp hack for NRF54H20_IRON
SebastianBoe Apr 22, 2025
310e043
openthread: Move OpenThread implementation from net to modules
ArekBalysNordic Apr 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions drivers/flash/nrf_qspi_nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,18 @@ void z_impl_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable)
#endif
if (enable) {
(void)nrfx_qspi_activate(false);
} else {
/* It turns out that when the QSPI peripheral is deactivated
* after a XIP transaction, it cannot be later successfully
* reactivated and an attempt to perform another XIP transaction
* results in the CPU being hung; even a debug session cannot be
* started then and the SoC has to be recovered.
* As a workaround, at least until the cause of such behavior
* is fully clarified, perform a simple non-XIP transaction
* (a read of the status register) before deactivating the QSPI.
* This prevents the issue from occurring.
*/
(void)qspi_rdsr(dev, 1);
}
dev_data->xip_enabled = enable;

Expand Down
2 changes: 1 addition & 1 deletion drivers/i2s/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ zephyr_library_sources_ifdef(CONFIG_I2S_STM32 i2s_ll_stm32.c)
zephyr_library_sources_ifdef(CONFIG_I2S_LITEX i2s_litex.c)
zephyr_library_sources_ifdef(CONFIG_I2S_MCUX_FLEXCOMM i2s_mcux_flexcomm.c)
zephyr_library_sources_ifdef(CONFIG_I2S_NRFX i2s_nrfx.c)
zephyr_library_sources_ifdef(CONFIG_TDM_NRFX i2s_nrfx_tdm.c)
zephyr_library_sources_ifdef(CONFIG_TDM_NRF i2s_nrfx_tdm.c)
zephyr_library_sources_ifdef(CONFIG_I2S_MCUX_SAI i2s_mcux_sai.c)
zephyr_library_sources_ifdef(CONFIG_I2S_ESP32 i2s_esp32.c)
zephyr_library_sources_ifdef(CONFIG_I2S_TEST i2s_test.c)
6 changes: 3 additions & 3 deletions drivers/i2s/Kconfig.nrfx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ config I2S_NRFX_TX_BLOCK_COUNT

endif # I2S_NRFX

menuconfig TDM_NRFX
menuconfig TDM_NRF
bool "nRF TDM nrfx driver"
default y
depends on DT_HAS_NORDIC_NRF_TDM_ENABLED
Expand All @@ -33,7 +33,7 @@ menuconfig TDM_NRFX
help
Enable support for nrfx TDM driver for nRF MCU series.

if TDM_NRFX
if TDM_NRF

config TDM_NRFX_RX_BLOCK_COUNT
int "RX queue length"
Expand All @@ -43,4 +43,4 @@ config TDM_NRFX_TX_BLOCK_COUNT
int "TX queue length"
default 4

endif # TDM_NRFX
endif # TDM_NRF
1 change: 1 addition & 0 deletions drivers/i2s/i2s_nrfx_tdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ static void tdm_start(struct tdm_drv_data *drv_data, tdm_buffers_t const *p_init
ctrl_data->rx_ready = false;
ctrl_data->tx_ready = false;
ctrl_data->buffers_needed = false;
ctrl_data->buffers_reused = false;

ctrl_data->next_buffers = *p_initial_buffers;
ctrl_data->current_buffers.p_rx_buffer = NULL;
Expand Down
183 changes: 165 additions & 18 deletions include/zephyr/net/openthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
*/

#include <zephyr/kernel.h>

#include <zephyr/net/net_if.h>
#include <zephyr/kernel/thread.h>

#include <openthread/instance.h>
#include <openthread/message.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -44,8 +45,10 @@ struct pkt_list_elem {
* @brief OpenThread l2 private data.
*/
struct openthread_context {
/** Pointer to OpenThread stack instance */
otInstance *instance;
/** @deprecated Pointer to OpenThread stack instance. This is deprecated and will be removed
* in a future release. This field must not be used outside anymore.
*/
__deprecated otInstance *instance;

/** Pointer to OpenThread network interface */
struct net_if *iface;
Expand All @@ -62,22 +65,40 @@ struct openthread_context {
/** Array for storing net_pkt for OpenThread internal usage */
struct pkt_list_elem pkt_list[CONFIG_OPENTHREAD_PKT_LIST_SIZE];

/** A mutex to protect API calls from being preempted. */
struct k_mutex api_lock;
/** @deprecated A mutex to protect API calls from being preempted. This is deprecated and
* will be removed in a future release. This field must not be used outside anymore.
*/
__deprecated struct k_mutex api_lock;

/** A work queue for all OpenThread activity */
struct k_work_q work_q;
/** @deprecated A work queue for all OpenThread activity. This is deprecated and will be
* removed in a future release. This field must not be used outside anymore.
*/
__deprecated struct k_work_q work_q;

/** Work object for OpenThread internal usage */
struct k_work api_work;
/** @deprecated Work object for OpenThread internal usage. This is deprecated and will be
* removed in a future release. This field must not be used outside anymore.
*/
__deprecated struct k_work api_work;

/** A list for state change callbacks */
/** @deprecated A list for state change callbacks. This is deprecated and will be removed in
* a future release.
*/
sys_slist_t state_change_cbs;
};
/**
* INTERNAL_HIDDEN @endcond
*/

/**
* @brief The common callback type for IPv4 (translated by NAT64) and IPv6 datagrams.
*
* This callback is called when a datagram is received.
*
* @param aMessage The message to receive.
* @param aContext The context to pass to the callback.
*/
typedef void (*openthread_receive_cb)(otMessage *aMessage, void *aContext);

/** OpenThread state change callback */

/**
Expand All @@ -88,6 +109,38 @@ struct openthread_context {
* are unique pointers of struct openthread_state_changed_cb.
* Beware such structure should not be allocated on stack.
*/
struct openthread_state_changed_callback {
/**
* @brief Callback for notifying configuration or state changes.
*
* @param flags as per OpenThread otStateChangedCallback() aFlags parameter.
* See https://openthread.io/reference/group/api-instance#otstatechangedcallback
* @param instance the OpenThread instance the callback is registered with.
* @param user_data Data to pass to the callback.
*/
void (*openthread_state_changed_cb)(otChangedFlags flags, struct otInstance *instance,
void *user_data);

/** User data if required */
void *user_data;

/**
* Internally used field for list handling
* - user must not directly modify
*/
sys_snode_t node;
};

/**
* @deprecated use @ref openthread_state_changed_callback instead.
*
* @brief OpenThread state change callback structure
*
* Used to register a callback in the callback list. As many
* callbacks as needed can be added as long as each of them
* are unique pointers of struct openthread_state_changed_cb.
* Beware such structure should not be allocated on stack.
*/
struct openthread_state_changed_cb {
/**
* @brief Callback for notifying configuration or state changes.
Expand All @@ -111,23 +164,44 @@ struct openthread_state_changed_cb {
};

/**
* @brief Registers callbacks which will be called when certain configuration
* or state changes occur within OpenThread.
*
* @param cb callback struct to register.
*/
int openthread_state_change_callback_register(struct openthread_state_changed_callback *cb);

/**
* @brief Unregisters OpenThread configuration or state changed callbacks.
*
* @param cb callback struct to unregister.
*/
int openthread_state_change_callback_unregister(struct openthread_state_changed_callback *cb);

/**
* @deprecated use @ref openthread_platform_state_changed_cb_register from modules/openthread
* instead.
*
* @brief Registers callbacks which will be called when certain configuration
* or state changes occur within OpenThread.
*
* @param ot_context the OpenThread context to register the callback with.
* @param cb callback struct to register.
*/
int openthread_state_changed_cb_register(struct openthread_context *ot_context,
struct openthread_state_changed_cb *cb);
__deprecated int openthread_state_changed_cb_register(struct openthread_context *ot_context,
struct openthread_state_changed_cb *cb);

/**
* @deprecated use @ref openthread_platform_state_changed_cb_unregister from modules/openthread
* instead.
*
* @brief Unregisters OpenThread configuration or state changed callbacks.
*
* @param ot_context the OpenThread context to unregister the callback from.
* @param cb callback struct to unregister.
*/
int openthread_state_changed_cb_unregister(struct openthread_context *ot_context,
struct openthread_state_changed_cb *cb);
__deprecated int openthread_state_changed_cb_unregister(struct openthread_context *ot_context,
struct openthread_state_changed_cb *cb);

/**
* @brief Get OpenThread thread identification.
Expand All @@ -151,6 +225,46 @@ struct openthread_context *openthread_get_default_context(void);
struct otInstance *openthread_get_default_instance(void);

/**
* @brief Initialize the OpenThread module.
*
* This function:
* - Initializes the OpenThread module.
* - Creates an OpenThread single instance.
* - Starts the shell.
* - Enables the UART and NCP HDLC for coprocessor purposes.
* - Initializes the NAT64 translator.
* - Creates a work queue for the OpenThread module.
* - Initializes the state change callback list.
*
* @note This function is automatically called by Zephyr's networking layer.
* If you want to initialize the OpenThread independently, call this function
* in your application init code and then call openthread_run() to prepare and run
* the OpenThread network.
*
* @param rx_handler The receive callback for the OpenThread module.
* @param context The context to pass to the callback.
* @return true if initialization succeeded, false otherwise.
*/
bool openthread_init(openthread_receive_cb rx_handler, void *context);

/**
* @brief Runs the OpenThread network.
*
* @details Prepares the OpenThread network and enables it.
* Depends on active settings: it uses stored network configuration,
* start joining procedure or uses default network configuration. Additionally
* when the device is MTD, it sets the SED mode to properly attach the network.
*/
int openthread_run(void);

/**
* @brief Disables the OpenThread network.
*/
int openthread_stop(void);

/**
* @deprecated use @ref openthread_run instead.
*
* @brief Starts the OpenThread network.
*
* @details Depends on active settings: it uses stored network configuration,
Expand All @@ -159,7 +273,7 @@ struct otInstance *openthread_get_default_instance(void);
*
* @param ot_context
*/
int openthread_start(struct openthread_context *ot_context);
__deprecated int openthread_start(struct openthread_context *ot_context);

/**
* @brief Lock internal mutex before accessing OT API.
Expand All @@ -170,9 +284,40 @@ int openthread_start(struct openthread_context *ot_context);
*
* @param ot_context Context to lock.
*/
void openthread_api_mutex_lock(struct openthread_context *ot_context);
void openthread_mutex_lock(void);

/**
* @brief Try to lock internal mutex before accessing OT API.
*
* @details This function behaves like openthread_mutex_lock() provided that
* the internal mutex is unlocked. Otherwise, it exists immediately and returns
* a negative value.
*/
int openthread_mutex_try_lock(void);

/**
* @brief Unlock internal mutex after accessing OT API.
*
* @param ot_context Context to unlock.
*/
void openthread_mutex_unlock(void);

/**
* @deprecated use @ref openthread_mutex_lock.
*
* @brief Lock internal mutex before accessing OT API.
*
* @details OpenThread API is not thread-safe, therefore before accessing any
* API function, it's needed to lock the internal mutex, to prevent the
* OpenThread thread from preempting the API call.
*
* @param ot_context Context to lock.
*/
__deprecated void openthread_api_mutex_lock(struct openthread_context *ot_context);

/**
* @deprecated use @ref openthread_mutex_try_lock instead.
*
* @brief Try to lock internal mutex before accessing OT API.
*
* @details This function behaves like openthread_api_mutex_lock() provided that
Expand All @@ -183,14 +328,16 @@ void openthread_api_mutex_lock(struct openthread_context *ot_context);
* @retval 0 On success.
* @retval <0 On failure.
*/
int openthread_api_mutex_try_lock(struct openthread_context *ot_context);
__deprecated int openthread_api_mutex_try_lock(struct openthread_context *ot_context);

/**
* @deprecated use @ref openthread_mutex_unlock instead.
*
* @brief Unlock internal mutex after accessing OT API.
*
* @param ot_context Context to unlock.
*/
void openthread_api_mutex_unlock(struct openthread_context *ot_context);
__deprecated void openthread_api_mutex_unlock(struct openthread_context *ot_context);

/** @cond INTERNAL_HIDDEN */

Expand Down
3 changes: 2 additions & 1 deletion modules/hal_nordic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ if(CONFIG_NRF_REGTOOL_GENERATE_UICR)
list(APPEND nrf_regtool_components GENERATE:UICR)
endif()
if(DEFINED nrf_regtool_components)
find_package(nrf-regtool 9.0.1 REQUIRED
find_package(nrf-regtool 9.1.0
REQUIRED
COMPONENTS ${nrf_regtool_components}
PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool
NO_CMAKE_PATH
Expand Down
1 change: 1 addition & 0 deletions modules/openthread/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ zephyr_library_sources(
entropy.c
misc.c
platform.c
openthread.c
)

zephyr_library_sources_ifndef(CONFIG_HDLC_RCP_IF
Expand Down
Loading
Loading