Browse Source

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>
pull/92038/merge
Cong Nguyen Huu 2 months ago committed by Dan Kalowsky
parent
commit
2339c7c23c
  1. 5
      tests/drivers/mbox/mbox_data/CMakeLists.txt
  2. 7
      tests/drivers/mbox/mbox_data/Kconfig
  3. 20
      tests/drivers/mbox/mbox_data/boards/s32z2xxdc2_s32z270_rtu0.overlay
  4. 20
      tests/drivers/mbox/mbox_data/boards/s32z2xxdc2_s32z270_rtu1.overlay
  5. 12
      tests/drivers/mbox/mbox_data/src/main.c
  6. 17
      tests/drivers/mbox/mbox_data/testcase.yaml

5
tests/drivers/mbox/mbox_data/CMakeLists.txt

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# Copyright 2024 NXP
# Copyright 2024-2025 NXP
#
# SPDX-License-Identifier: Apache-2.0
#
@ -12,7 +12,8 @@ set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) @@ -12,7 +12,8 @@ set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr)
if(CONFIG_BOARD_MIMXRT1170_EVK_MIMXRT1176_CM7 OR
CONFIG_BOARD_MIMXRT1160_EVK_MIMXRT1166_CM7 OR
CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU0 OR
CONFIG_BOARD_MIMXRT1180_EVK_MIMXRT1189_CM33)
CONFIG_BOARD_MIMXRT1180_EVK_MIMXRT1189_CM33 OR
CONFIG_BOARD_S32Z2XXDC2)
message(STATUS "${BOARD}${BOARD_QUALIFIERS} compile as Main in this sample")
else()
message(FATAL_ERROR "${BOARD}${BOARD_QUALIFIERS} is not supported for this sample")

7
tests/drivers/mbox/mbox_data/Kconfig

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# Copyright 2024 NXP
# Copyright 2024-2025 NXP
#
# SPDX-License-Identifier: Apache-2.0
@ -9,3 +9,8 @@ config INCLUDE_REMOTE_DIR @@ -9,3 +9,8 @@ config INCLUDE_REMOTE_DIR
help
Include remote build header files. Can be used if primary image
needs to be aware of size or base address of secondary image
config TEST_SINGLE_CPU
bool "Enable mailbox test on single CPU core"
help
Perform a test in which a CPU uses a mailbox channel to exchange messages with itself

20
tests/drivers/mbox/mbox_data/boards/s32z2xxdc2_s32z270_rtu0.overlay

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
mbox-consumer {
compatible = "vnd,mbox-consumer";
mboxes = <&mru0 0>, <&mru0 0>, <&mru0 1>, <&mru0 1>,
<&mru0 2>, <&mru0 2>, <&mru0 3>, <&mru0 3>;
mbox-names = "tx0", "rx0", "tx1", "rx1",
"tx2", "rx2", "tx3", "rx3";
};
};
&mru0 {
rx-channels = <4>;
status = "okay";
};

20
tests/drivers/mbox/mbox_data/boards/s32z2xxdc2_s32z270_rtu1.overlay

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
mbox-consumer {
compatible = "vnd,mbox-consumer";
mboxes = <&mru4 0>, <&mru4 0>, <&mru4 1>, <&mru4 1>,
<&mru4 2>, <&mru4 2>, <&mru4 3>, <&mru4 3>;
mbox-names = "tx0", "rx0", "tx1", "rx1",
"tx2", "rx2", "tx3", "rx3";
};
};
&mru4 {
rx-channels = <4>;
status = "okay";
};

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2024 NXP
* Copyright 2024-2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -121,12 +121,16 @@ static void mbox_test(const uint32_t data) @@ -121,12 +121,16 @@ static void mbox_test(const uint32_t data)
ret_val = mbox_send_dt(tx_channel, &msg);
zassert_false(ret_val < 0, "mbox failed to send. ret_val: %d", ret_val);
/* Expect next received data will be incremented by one.
* And based on Maximum Transfer Unit determine expected data.
* Currently supported MTU's are 1, 2, 3, and 4 bytes.
/*
* Determine expected received data based on the configured Maximum
* Transfer Unit (MTU). Supported MTU sizes are 1, 2, 3, and 4 bytes.
* If CONFIG_TEST_SINGLE_CPU is enabled, the received data should match
* the sent data. Otherwise, it is expected to be incremented by one.
*/
g_mbox_expected_data = test_data & ~(0xFFFFFFFF << (g_max_transfer_size_bytes * 8));
#ifndef CONFIG_TEST_SINGLE_CPU
g_mbox_expected_data++;
#endif
k_sem_take(&g_mbox_data_rx_sem, K_FOREVER);

17
tests/drivers/mbox/mbox_data/testcase.yaml

@ -1,10 +1,19 @@ @@ -1,10 +1,19 @@
common:
tags:
- drivers
- mbox
filter: dt_compat_enabled("vnd,mbox-consumer")
tests:
drivers.mbox_data:
tags:
- drivers
- mbox
sysbuild: true
filter: dt_compat_enabled("vnd,mbox-consumer")
integration_platforms:
- mimxrt1170_evk/mimxrt1176/cm7
- lpcxpresso55s69/lpc55s69/cpu0
drivers.mbox_data.single_cpu:
platform_allow:
- s32z2xxdc2/s32z270/rtu0
- s32z2xxdc2/s32z270/rtu1
- s32z2xxdc2@D/s32z270/rtu0
- s32z2xxdc2@D/s32z270/rtu1
extra_configs:
- CONFIG_TEST_SINGLE_CPU=y

Loading…
Cancel
Save