This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 34e5adb hw/ipc_nrf5340: Assert on ipc_nrf5340_recv if channel is
already in use
34e5adb is described below
commit 34e5adb009e652959c0e59e22d860ec212396779
Author: Szymon Janc <[email protected]>
AuthorDate: Thu Jun 24 08:23:53 2021 +0200
hw/ipc_nrf5340: Assert on ipc_nrf5340_recv if channel is already in use
Calling ipc_nrf5340_recv on channel which is already enabled is always
an application error which leads to confusing behaviour (or crashes).
If application want to change receive handler for specified channel it
shall first unregister old one by passing NULL pointer.
---
hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c
b/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c
index 786a85a..a44f267 100644
--- a/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c
+++ b/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c
@@ -249,6 +249,8 @@ ipc_nrf5340_recv(int channel, ipc_nrf5340_recv_cb cb, void
*user_data)
assert(channel < IPC_MAX_CHANS);
if (cb) {
+ assert(ipcs[channel].cb == NULL);
+
ipcs[channel].cb = cb;
ipcs[channel].user_data = user_data;
NRF_IPC->RECEIVE_CNF[channel] = (0x1UL << channel);