samples: tests: mbox: Add lpcpresso55s69 support

This commit adds support for NXP board LPCXpresso55S69 for mbox.
 - samples/drivers/mbox/ - mbox signaling mode
 - samples/drivers/mbox_data/ - mbox data transfer mode
 - tests/drivers/mbox/mbox_data/ - mbox test to verify functionality.

Signed-off-by: Tomas Galbicka <tomas.galbicka@nxp.com>
This commit is contained in:
Tomas Galbicka 2024-01-30 17:12:34 +01:00 committed by Maureen Helm
commit 73d6c336ca
31 changed files with 292 additions and 18 deletions

View file

@ -1,6 +1,6 @@
# #
# Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com> # Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
# Copyright 2023 NXP # Copyright 2023-2024 NXP
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
@ -17,7 +17,8 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR
("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR
("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR
("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR
("${BOARD}" STREQUAL "mimxrt595_evk_cm33")) ("${BOARD}" STREQUAL "mimxrt595_evk_cm33") OR
("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0"))
message(STATUS "${BOARD} compile as Main in this sample") message(STATUS "${BOARD} compile as Main in this sample")
else() else()
message(FATAL_ERROR "${BOARD} is not supported for this sample") message(FATAL_ERROR "${BOARD} is not supported for this sample")

View file

@ -1,5 +1,5 @@
# Copyright 2023 Nordic Semiconductor ASA # Copyright 2023 Nordic Semiconductor ASA
# Copyright 2023 NXP # Copyright 2023-2024 NXP
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
@ -14,3 +14,4 @@ string
default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7"
default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7"
default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7"
default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0"

View file

@ -0,0 +1,3 @@
CONFIG_SECOND_CORE_MCUX=y
CONFIG_MBOX_NXP_MAILBOX=y
CONFIG_BUILD_OUTPUT_HEX=y

View file

@ -0,0 +1,29 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/* Delete IPM Driver node nxp,lpc-mailbox */
/delete-node/ mailbox@8b000;
/* Attach MBOX driver to Mailbox Unit */
mbox:mailbox0@5008b000 {
compatible = "nxp,mbox-mailbox";
reg = <0x5008b000 0xEC>;
interrupts = <31 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};

View file

@ -1,6 +1,6 @@
# #
# Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com> # Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
# Copyright 2023 NXP # Copyright 2023-2024 NXP
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
@ -14,6 +14,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR
("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR
("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR
("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR
("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1") OR
("${BOARD}" STREQUAL "adp_xc7k_ae350")) ("${BOARD}" STREQUAL "adp_xc7k_ae350"))
message(STATUS "${BOARD} compile as remote in this sample") message(STATUS "${BOARD} compile as remote in this sample")
else() else()

View file

@ -0,0 +1,10 @@
CONFIG_SECOND_CORE_MCUX=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_MBOX_NXP_MAILBOX=y
# For purpose of sample enable UART Console on CPU1
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_CLOCK_CONTROL=y

View file

@ -0,0 +1,43 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
zephyr,console = &flexcomm0;
zephyr,shell-uart = &flexcomm0;
};
soc {
/* Delete IPM Driver node nxp,lpc-mailbox */
/delete-node/ mailbox@8b000;
/* Attach MBOX driver to Mailbox Unit */
mbox:mbox@5008b000 {
compatible = "nxp,mbox-mailbox";
reg = <0x5008b000 0xEC>;
interrupts = <31 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};
&flexcomm0 {
status = "okay";
};
&dma0 {
status = "okay";
};
&syscon {
status = "okay";
};

View file

@ -12,6 +12,7 @@ tests:
- mimxrt1170_evkb_cm7 - mimxrt1170_evkb_cm7
- mimxrt1170_evk_cm7 - mimxrt1170_evk_cm7
- mimxrt1160_evk_cm7 - mimxrt1160_evk_cm7
- lpcxpresso55s69_cpu0
integration_platforms: integration_platforms:
- nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpuapp
harness: console harness: console

View file

@ -1,5 +1,5 @@
# Copyright (c) 2023 Nordic Semiconductor ASA # Copyright (c) 2023 Nordic Semiconductor ASA
# Copyright 2023 NXP # Copyright 2023-2024 NXP
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "") if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "")
@ -22,7 +22,8 @@ native_simulator_set_final_executable(${DEFAULT_IMAGE})
if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR
"${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR "${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR
"${BOARD}" STREQUAL "mimxrt1160_evk_cm7" "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" OR
"${BOARD}" STREQUAL "lpcxpresso55s69_cpu0"
) )
# For these NXP boards the main core application is dependent on # For these NXP boards the main core application is dependent on
# 'zephyr_image_info.h' generated by remote application. # 'zephyr_image_info.h' generated by remote application.

View file

@ -11,7 +11,8 @@ set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr)
if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR
("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR
("${BOARD}" STREQUAL "mimxrt1160_evk_cm7")) ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR
("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0"))
message(STATUS "${BOARD} compile as Main in this sample") message(STATUS "${BOARD} compile as Main in this sample")
else() else()
message(FATAL_ERROR "${BOARD} is not supported for this sample") message(FATAL_ERROR "${BOARD} is not supported for this sample")

View file

@ -9,3 +9,4 @@ string
default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7"
default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7"
default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7"
default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0"

View file

@ -10,7 +10,7 @@ Overview
This sample demonstrates how to use the :ref:`MBOX API <mbox_api>` in data transfer mode. This sample demonstrates how to use the :ref:`MBOX API <mbox_api>` in data transfer mode.
It can be used only with mbox driver which supports data transfer mode. It can be used only with mbox driver which supports data transfer mode.
Sample will ping-pong 4 bytes of data between two cores via two mbox channels. Sample will ping-pong up to 4 bytes of data between two cores via two mbox channels.
After each core receives data, it increments it by one and sends it back to other core. After each core receives data, it increments it by one and sends it back to other core.
Building and Running Building and Running
@ -45,6 +45,15 @@ Building the application for mimxrt1170_evkb_cm7
:goals: debug :goals: debug
:west-args: --sysbuild :west-args: --sysbuild
Building the application for lpcxpresso55s69_cpu1
=================================================
.. zephyr-app-commands::
:zephyr-app: samples/drivers/mbox_data/
:board: lpcxpresso55s69_cpu1
:goals: debug
:west-args: --sysbuild
Sample Output Sample Output
============= =============

View file

@ -0,0 +1,3 @@
CONFIG_SECOND_CORE_MCUX=y
CONFIG_MBOX_NXP_MAILBOX=y
CONFIG_BUILD_OUTPUT_HEX=y

View file

@ -0,0 +1,29 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/* Delete IPM Driver node nxp,lpc-mailbox */
/delete-node/ mailbox@8b000;
/* Attach MBOX driver to Mailbox Unit */
mbox:mailbox0@5008b000 {
compatible = "nxp,mbox-mailbox";
reg = <0x5008b000 0xEC>;
interrupts = <31 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};

View file

@ -9,7 +9,8 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR
("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR
("${BOARD}" STREQUAL "mimxrt1160_evk_cm4")) ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR
("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1"))
message(STATUS "${BOARD} compile as remote in this sample") message(STATUS "${BOARD} compile as remote in this sample")
else() else()
message(FATAL_ERROR "${BOARD} is not supported for this sample") message(FATAL_ERROR "${BOARD} is not supported for this sample")

View file

@ -0,0 +1,3 @@
CONFIG_SECOND_CORE_MCUX=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_MBOX_NXP_MAILBOX=y

View file

@ -0,0 +1,29 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/* Delete IPM Driver node nxp,lpc-mailbox */
/delete-node/ mailbox@8b000;
/* Attach MBOX driver to Mailbox Unit */
mbox:mbox@5008b000 {
compatible = "nxp,mbox-mailbox";
reg = <0x5008b000 0xEC>;
interrupts = <31 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};

View file

@ -6,6 +6,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <zephyr/kernel.h> #include <zephyr/kernel.h>
#include <zephyr/drivers/mbox.h> #include <zephyr/drivers/mbox.h>
@ -41,6 +42,13 @@ int main(void)
mbox_init_channel(&tx_channel, dev, TX_ID); mbox_init_channel(&tx_channel, dev, TX_ID);
mbox_init_channel(&rx_channel, dev, RX_ID); mbox_init_channel(&rx_channel, dev, RX_ID);
const int max_transfer_size_bytes = mbox_mtu_get(dev);
/* Sample currently supports only transfer size up to 4 bytes */
if ((max_transfer_size_bytes <= 0) || (max_transfer_size_bytes > 4)) {
printk("mbox_mtu_get() error\n");
return 0;
}
if (mbox_register_callback(&rx_channel, callback, NULL)) { if (mbox_register_callback(&rx_channel, callback, NULL)) {
printk("mbox_register_callback() error\n"); printk("mbox_register_callback() error\n");
return 0; return 0;
@ -61,7 +69,7 @@ int main(void)
message++; message++;
msg.data = &message; msg.data = &message;
msg.size = 4; msg.size = max_transfer_size_bytes;
printk("Server send (on channel %d) value: %d\n", tx_channel.id, message); printk("Server send (on channel %d) value: %d\n", tx_channel.id, message);
if (mbox_send(&tx_channel, &msg) < 0) { if (mbox_send(&tx_channel, &msg) < 0) {

View file

@ -9,8 +9,10 @@ tests:
- mimxrt1170_evkb_cm7 - mimxrt1170_evkb_cm7
- mimxrt1170_evk_cm7 - mimxrt1170_evk_cm7
- mimxrt1160_evk_cm7 - mimxrt1160_evk_cm7
- lpcxpresso55s69_cpu0
integration_platforms: integration_platforms:
- mimxrt1160_evk_cm7 - mimxrt1160_evk_cm7
- lpcxpresso55s69_cpu0
harness: console harness: console
harness_config: harness_config:
type: multi_line type: multi_line

View file

@ -6,6 +6,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <zephyr/kernel.h> #include <zephyr/kernel.h>
#include <zephyr/drivers/mbox.h> #include <zephyr/drivers/mbox.h>
@ -41,6 +42,13 @@ int main(void)
mbox_init_channel(&tx_channel, dev, TX_ID); mbox_init_channel(&tx_channel, dev, TX_ID);
mbox_init_channel(&rx_channel, dev, RX_ID); mbox_init_channel(&rx_channel, dev, RX_ID);
const int max_transfer_size_bytes = mbox_mtu_get(dev);
/* Sample currently supports only transfer size up to 4 bytes */
if ((max_transfer_size_bytes < 0) || (max_transfer_size_bytes > 4)) {
printk("mbox_mtu_get() error\n");
return 0;
}
if (mbox_register_callback(&rx_channel, callback, NULL)) { if (mbox_register_callback(&rx_channel, callback, NULL)) {
printk("mbox_register_callback() error\n"); printk("mbox_register_callback() error\n");
return 0; return 0;
@ -53,7 +61,7 @@ int main(void)
while (message < 100) { while (message < 100) {
msg.data = &message; msg.data = &message;
msg.size = 4; msg.size = max_transfer_size_bytes;
printk("Client send (on channel %d) value: %d\n", tx_channel.id, message); printk("Client send (on channel %d) value: %d\n", tx_channel.id, message);
if (mbox_send(&tx_channel, &msg) < 0) { if (mbox_send(&tx_channel, &msg) < 0) {

View file

@ -11,7 +11,8 @@ set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr)
if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR
("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR
("${BOARD}" STREQUAL "mimxrt1160_evk_cm7")) ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR
("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0"))
message(STATUS "${BOARD} compile as Main in this sample") message(STATUS "${BOARD} compile as Main in this sample")
else() else()
message(FATAL_ERROR "${BOARD} is not supported for this sample") message(FATAL_ERROR "${BOARD} is not supported for this sample")

View file

@ -9,3 +9,4 @@ string
default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7"
default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7"
default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7"
default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0"

View file

@ -0,0 +1,3 @@
CONFIG_SECOND_CORE_MCUX=y
CONFIG_MBOX_NXP_MAILBOX=y
CONFIG_BUILD_OUTPUT_HEX=y

View file

@ -0,0 +1,29 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/* Delete IPM Driver node nxp,lpc-mailbox */
/delete-node/ mailbox@8b000;
/* Attach MBOX driver to Mailbox Unit */
mbox:mailbox0@5008b000 {
compatible = "nxp,mbox-mailbox";
reg = <0x5008b000 0xEC>;
interrupts = <31 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};

View file

@ -9,7 +9,8 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR
("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR
("${BOARD}" STREQUAL "mimxrt1160_evk_cm4")) ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR
("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1"))
message(STATUS "${BOARD} compile as remote in this sample") message(STATUS "${BOARD} compile as remote in this sample")
else() else()
message(FATAL_ERROR "${BOARD} is not supported for this sample") message(FATAL_ERROR "${BOARD} is not supported for this sample")

View file

@ -0,0 +1,3 @@
CONFIG_SECOND_CORE_MCUX=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_MBOX_NXP_MAILBOX=y

View file

@ -0,0 +1,29 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/* Delete IPM Driver node nxp,lpc-mailbox */
/delete-node/ mailbox@8b000;
/* Attach MBOX driver to Mailbox Unit */
mbox:mbox@5008b000 {
compatible = "nxp,mbox-mailbox";
reg = <0x5008b000 0xEC>;
interrupts = <31 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};

View file

@ -6,6 +6,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <zephyr/kernel.h> #include <zephyr/kernel.h>
#include <zephyr/drivers/mbox.h> #include <zephyr/drivers/mbox.h>
@ -50,6 +51,13 @@ int main(void)
dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); dev = DEVICE_DT_GET(DT_NODELABEL(mbox));
const int max_transfer_size_bytes = mbox_mtu_get(dev);
/* Sample currently supports only transfer size up to 4 bytes */
if ((max_transfer_size_bytes <= 0) || (max_transfer_size_bytes > 4)) {
printk("mbox_mtu_get() error\n");
return 0;
}
for (int i_test_channel = 0; i_test_channel < CHANNELS_TO_TEST; i_test_channel++) { for (int i_test_channel = 0; i_test_channel < CHANNELS_TO_TEST; i_test_channel++) {
mbox_init_channel(&tx_channel, dev, mbox_init_channel(&tx_channel, dev,
TEST_CHANNELS[i_test_channel][TX_CHANNEL_INDEX]); TEST_CHANNELS[i_test_channel][TX_CHANNEL_INDEX]);
@ -77,7 +85,7 @@ int main(void)
message++; message++;
msg.data = &message; msg.data = &message;
msg.size = 4; msg.size = max_transfer_size_bytes;
if (mbox_send(&tx_channel, &msg) < 0) { if (mbox_send(&tx_channel, &msg) < 0) {
printk("mbox_send() error\n"); printk("mbox_send() error\n");

View file

@ -6,6 +6,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <zephyr/kernel.h> #include <zephyr/kernel.h>
#include <zephyr/drivers/mbox.h> #include <zephyr/drivers/mbox.h>
@ -20,6 +21,7 @@ static uint32_t g_mbox_expected_channel;
static bool g_received_size_error; static bool g_received_size_error;
static size_t g_received_size; static size_t g_received_size;
static int g_max_transfer_size_bytes;
static struct mbox_channel g_tx_channel; static struct mbox_channel g_tx_channel;
static struct mbox_channel g_rx_channel; static struct mbox_channel g_rx_channel;
@ -65,6 +67,14 @@ static void mbox_data_tests_before(void *f)
dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); dev = DEVICE_DT_GET(DT_NODELABEL(mbox));
g_max_transfer_size_bytes = mbox_mtu_get(dev);
/* Test currently supports only transfer size up to 4 bytes */
if ((g_max_transfer_size_bytes < 0) || (g_max_transfer_size_bytes > 4)) {
printk("mbox_mtu_get() error\n");
zassert_false(1, "mbox invalid maximum transfer unit: %d",
g_max_transfer_size_bytes);
}
mbox_init_channel(&g_tx_channel, dev, mbox_init_channel(&g_tx_channel, dev,
TEST_CHANNELS[current_channel_index][TX_CHANNEL_INDEX]); TEST_CHANNELS[current_channel_index][TX_CHANNEL_INDEX]);
mbox_init_channel(&g_rx_channel, dev, mbox_init_channel(&g_rx_channel, dev,
@ -98,14 +108,17 @@ static void mbox_test(const uint32_t data)
while (test_count < 100) { while (test_count < 100) {
/* Main core prepare test data */ /* Main core prepare test data */
msg.data = &test_data; msg.data = &test_data;
msg.size = 4; msg.size = g_max_transfer_size_bytes;
/* Main core send test data */ /* Main core send test data */
ret_val = mbox_send(&g_tx_channel, &msg); ret_val = mbox_send(&g_tx_channel, &msg);
zassert_false(ret_val < 0, "mbox failed to send. ret_val: %d", ret_val); zassert_false(ret_val < 0, "mbox failed to send. ret_val: %d", ret_val);
/* Expect next received data will be incremented by one */ /* Expect next received data will be incremented by one.
g_mbox_expected_data = test_data; * And based on Maximum Transfer Unit determine expected data.
* Currently supported MTU's are 1, 2, 3, and 4 bytes.
*/
g_mbox_expected_data = test_data & ~(0xFFFFFFFF << (g_max_transfer_size_bytes * 8));
g_mbox_expected_data++; g_mbox_expected_data++;
k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); k_sem_take(&g_mbox_data_rx_sem, K_FOREVER);

View file

@ -8,5 +8,7 @@ tests:
- mimxrt1170_evkb_cm7 - mimxrt1170_evkb_cm7
- mimxrt1170_evk_cm7 - mimxrt1170_evk_cm7
- mimxrt1160_evk_cm7 - mimxrt1160_evk_cm7
- lpcxpresso55s69_cpu0
integration_platforms: integration_platforms:
- mimxrt1170_evkb_cm7 - mimxrt1170_evkb_cm7
- lpcxpresso55s69_cpu0

View file

@ -193,7 +193,7 @@ manifest:
groups: groups:
- hal - hal
- name: hal_nxp - name: hal_nxp
revision: ae438701d6029f4f989fe036abe4b91be51e6258 revision: 0463d6aa0de62761fb9ae56e3521c61b0e490374
path: modules/hal/nxp path: modules/hal/nxp
groups: groups:
- hal - hal