Skip to content

Commit 9c8d625

Browse files
committed
Test interoperability of icmsg with old implementation.
1 parent f2a8725 commit 9c8d625

File tree

15 files changed

+1308
-1
lines changed

15 files changed

+1308
-1
lines changed

subsys/ipc/ipc_service/backends/ipc_icmsg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,15 @@ static int backend_init(const struct device *instance)
105105
DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE)
106106

107107
/* TODO: REMOVE THIS WORKAROUND!!! */
108-
108+
#include <string.h>
109109
static int workaround_ppr_reset(void)
110110
{
111111
#define _FIX_RESET_MEM(i) \
112112
memset(&backend_data_##i, 0, sizeof(backend_data_##i)); \
113113
backend_data_##i.tx_pb = &tx_pb_##i; \
114114
backend_data_##i.rx_pb = &rx_pb_##i;
115115
DT_INST_FOREACH_STATUS_OKAY(_FIX_RESET_MEM);
116+
return 0;
116117
}
117118

118119
SYS_INIT(workaround_ppr_reset, PRE_KERNEL_1, 0);

tests/subsys/ipc/ipc_sessions/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ zephyr_include_directories(./common)
1010

1111
FILE(GLOB app_sources src/*.c)
1212
target_sources(app PRIVATE ${app_sources})
13+
14+
zephyr_sources_ifdef(CONFIG_IPC_SERVICE_ICMSG_V1 interoperability/icmsg_v1.c)
15+
zephyr_sources_ifdef(CONFIG_PBUF_V1 interoperability/pbuf_v1.c)
16+
zephyr_sources_ifdef(CONFIG_IPC_SERVICE_BACKEND_ICMSG_V1 interoperability/ipc_icmsg_v1.c)

tests/subsys/ipc/ipc_sessions/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7+
rsource "interoperability/Kconfig"
8+
79
menu "Zephyr"
810
source "Kconfig.zephyr"
911
endmenu
@@ -20,3 +22,8 @@ config IPC_TEST_SKIP_CORE_RESET
2022
help
2123
Some of the cores cannot be safely restarted.
2224
Skip the tests that require it in such a cases.
25+
26+
config IPC_TEST_SKIP_UNBOUND
27+
bool "Skip unbound tests"
28+
help
29+
Whether to skip tests that requires unbound callback functionality.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
config IPC_SERVICE_BACKEND_ICMSG
8+
default n if IPC_SERVICE_BACKEND_ICMSG_V1
9+
10+
config IPC_SERVICE_ICMSG
11+
default n if IPC_SERVICE_ICMSG_V1
12+
13+
config IPC_SERVICE_BACKEND_ICMSG_V1
14+
bool "ICMSG backend with SPSC packet buffer (old implementation)"
15+
default y
16+
depends on MBOX
17+
select IPC_SERVICE_ICMSG_V1
18+
help
19+
Chosing this backend results in single endpoint implementation based
20+
on circular packet buffer.
21+
22+
menuconfig IPC_SERVICE_ICMSG_V1
23+
bool "icmsg IPC library (old implementation)"
24+
select PBUF_V1
25+
help
26+
Icmsg library
27+
28+
if IPC_SERVICE_ICMSG_V1
29+
rsource "Kconfig.icmsg_v1"
30+
endif
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Copyright (c) 2022 Nordic Semiconductor (ASA)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config IPC_SERVICE_ICMSG_SHMEM_ACCESS_SYNC_V1
5+
bool "Synchronize access to shared memory"
6+
depends on MULTITHREADING
7+
default y
8+
help
9+
Provide synchronization access to shared memory at a library level.
10+
This option is enabled by default to allow to use sending API from
11+
multiple contexts. Mutex is used to guard access to the memory.
12+
This option can be safely disabled if an application ensures data
13+
are sent from single context.
14+
15+
config IPC_SERVICE_ICMSG_SHMEM_ACCESS_TO_MS_V1
16+
int "Mutex lock timeout in milliseconds"
17+
depends on IPC_SERVICE_ICMSG_SHMEM_ACCESS_SYNC_V1
18+
range 1 5
19+
default 1
20+
help
21+
Maximum time to wait, in milliseconds, for access to send data with
22+
backends basing on icmsg library. This time should be relatively low.
23+
24+
config IPC_SERVICE_ICMSG_BOND_NOTIFY_REPEAT_TO_MS_V1
25+
int "Bond notification timeout in miliseconds"
26+
range 1 100
27+
default 1
28+
help
29+
Time to wait for remote bonding notification before the
30+
notification is repeated.
31+
32+
config IPC_SERVICE_BACKEND_ICMSG_WQ_ENABLE_V1
33+
bool "Use dedicated workqueue"
34+
depends on MULTITHREADING
35+
default y
36+
help
37+
Enable dedicated workqueue thread for the ICMsg backend.
38+
Disabling this configuration will cause the ICMsg backend to
39+
process incoming data through the system workqueue context, and
40+
therefore reduces the RAM footprint of the backend.
41+
Disabling this config may result in deadlocks in certain usage
42+
scenarios, such as when synchronous IPC is executed from the system
43+
workqueue context.
44+
The callbacks coming from the backend are executed from the workqueue
45+
context.
46+
When the option is disabled, the user must obey the restrictions
47+
imposed by the system workqueue, such as never performing blocking
48+
operations from within the callback.
49+
50+
if IPC_SERVICE_BACKEND_ICMSG_WQ_ENABLE_V1
51+
52+
config IPC_SERVICE_BACKEND_ICMSG_WQ_STACK_SIZE_V1
53+
int "Size of RX work queue stack"
54+
default 1280
55+
help
56+
Size of stack used by work queue RX thread. This work queue is
57+
created to prevent notifying service users about received data
58+
from the system work queue. The queue is shared among instances.
59+
60+
config IPC_SERVICE_BACKEND_ICMSG_WQ_PRIORITY_V1
61+
int "Priority of RX work queue thread"
62+
default -1
63+
range -256 -1
64+
help
65+
Priority of the ICMSG RX work queue thread.
66+
The ICMSG library in its simplicity requires the workqueue to execute
67+
at a cooperative priority.
68+
69+
endif
70+
71+
# The Icmsg library in its simplicity requires the system workqueue to execute
72+
# at a cooperative priority.
73+
config SYSTEM_WORKQUEUE_PRIORITY
74+
range -256 -1 if !IPC_SERVICE_BACKEND_ICMSG_WQ_ENABLE_V1
75+
76+
config PBUF_V1
77+
bool "Packed buffer support library (old implementation)"
78+
help
79+
The packet buffer implements lightweight unidirectional packet buffer
80+
with read/write semantics on top of a memory region shared by the
81+
reader and writer. It optionally embeds cache and memory barrier
82+
management to ensure correct data access.
83+
84+
if PBUF_V1
85+
86+
config PBUF_RX_READ_BUF_SIZE_V1
87+
int "Size of PBUF read buffer in bytes"
88+
default 128
89+
90+
endif # PBUF

0 commit comments

Comments
 (0)