Skip to content

Commit 2339c7c

Browse files
congnguyenhuudkalowsk
authored andcommitted
tests: drivers: mbox: mbox_data: add support for s32z
The hardware MRU on SoC S32Z supports ping-pong data on a MBOX channel within one core. Added Kconfig TEST_SINGLE_CPU to enable test on single CPU to wrap the specific code for each testcase, As the expected received data must match the sent data when running test single CPU. This differs from the expected data in the current supported test transfer data between 2 other cores, where the remote core increments the data by one before transferring it back to the main core. Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
1 parent a4800be commit 2339c7c

File tree

6 files changed

+70
-11
lines changed

6 files changed

+70
-11
lines changed

tests/drivers/mbox/mbox_data/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 NXP
1+
# Copyright 2024-2025 NXP
22
#
33
# SPDX-License-Identifier: Apache-2.0
44
#
@@ -12,7 +12,8 @@ set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr)
1212
if(CONFIG_BOARD_MIMXRT1170_EVK_MIMXRT1176_CM7 OR
1313
CONFIG_BOARD_MIMXRT1160_EVK_MIMXRT1166_CM7 OR
1414
CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU0 OR
15-
CONFIG_BOARD_MIMXRT1180_EVK_MIMXRT1189_CM33)
15+
CONFIG_BOARD_MIMXRT1180_EVK_MIMXRT1189_CM33 OR
16+
CONFIG_BOARD_S32Z2XXDC2)
1617
message(STATUS "${BOARD}${BOARD_QUALIFIERS} compile as Main in this sample")
1718
else()
1819
message(FATAL_ERROR "${BOARD}${BOARD_QUALIFIERS} is not supported for this sample")

tests/drivers/mbox/mbox_data/Kconfig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 NXP
1+
# Copyright 2024-2025 NXP
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -9,3 +9,8 @@ config INCLUDE_REMOTE_DIR
99
help
1010
Include remote build header files. Can be used if primary image
1111
needs to be aware of size or base address of secondary image
12+
13+
config TEST_SINGLE_CPU
14+
bool "Enable mailbox test on single CPU core"
15+
help
16+
Perform a test in which a CPU uses a mailbox channel to exchange messages with itself
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2025 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
mbox-consumer {
9+
compatible = "vnd,mbox-consumer";
10+
mboxes = <&mru0 0>, <&mru0 0>, <&mru0 1>, <&mru0 1>,
11+
<&mru0 2>, <&mru0 2>, <&mru0 3>, <&mru0 3>;
12+
mbox-names = "tx0", "rx0", "tx1", "rx1",
13+
"tx2", "rx2", "tx3", "rx3";
14+
};
15+
};
16+
17+
&mru0 {
18+
rx-channels = <4>;
19+
status = "okay";
20+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2025 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
mbox-consumer {
9+
compatible = "vnd,mbox-consumer";
10+
mboxes = <&mru4 0>, <&mru4 0>, <&mru4 1>, <&mru4 1>,
11+
<&mru4 2>, <&mru4 2>, <&mru4 3>, <&mru4 3>;
12+
mbox-names = "tx0", "rx0", "tx1", "rx1",
13+
"tx2", "rx2", "tx3", "rx3";
14+
};
15+
};
16+
17+
&mru4 {
18+
rx-channels = <4>;
19+
status = "okay";
20+
};

tests/drivers/mbox/mbox_data/src/main.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 NXP
2+
* Copyright 2024-2025 NXP
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -121,12 +121,16 @@ static void mbox_test(const uint32_t data)
121121
ret_val = mbox_send_dt(tx_channel, &msg);
122122
zassert_false(ret_val < 0, "mbox failed to send. ret_val: %d", ret_val);
123123

124-
/* Expect next received data will be incremented by one.
125-
* And based on Maximum Transfer Unit determine expected data.
126-
* Currently supported MTU's are 1, 2, 3, and 4 bytes.
124+
/*
125+
* Determine expected received data based on the configured Maximum
126+
* Transfer Unit (MTU). Supported MTU sizes are 1, 2, 3, and 4 bytes.
127+
* If CONFIG_TEST_SINGLE_CPU is enabled, the received data should match
128+
* the sent data. Otherwise, it is expected to be incremented by one.
127129
*/
128130
g_mbox_expected_data = test_data & ~(0xFFFFFFFF << (g_max_transfer_size_bytes * 8));
131+
#ifndef CONFIG_TEST_SINGLE_CPU
129132
g_mbox_expected_data++;
133+
#endif
130134

131135
k_sem_take(&g_mbox_data_rx_sem, K_FOREVER);
132136

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1+
common:
2+
tags:
3+
- drivers
4+
- mbox
5+
filter: dt_compat_enabled("vnd,mbox-consumer")
16
tests:
27
drivers.mbox_data:
3-
tags:
4-
- drivers
5-
- mbox
68
sysbuild: true
7-
filter: dt_compat_enabled("vnd,mbox-consumer")
89
integration_platforms:
910
- mimxrt1170_evk/mimxrt1176/cm7
1011
- lpcxpresso55s69/lpc55s69/cpu0
12+
drivers.mbox_data.single_cpu:
13+
platform_allow:
14+
- s32z2xxdc2/s32z270/rtu0
15+
- s32z2xxdc2/s32z270/rtu1
16+
- s32z2xxdc2@D/s32z270/rtu0
17+
- s32z2xxdc2@D/s32z270/rtu1
18+
extra_configs:
19+
- CONFIG_TEST_SINGLE_CPU=y

0 commit comments

Comments
 (0)