From 485a2cc0bf7e0957458ff50c5a989e5963d90bb4 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Fri, 14 Jun 2024 11:31:32 +0200 Subject: [PATCH] samples: mbox: Align to NO MULTITHREADING Removed k_sleep dependencies in non-multithreaded runs. Signed-off-by: Jakub Zymelka --- samples/drivers/mbox/remote/src/main.c | 9 ++++--- samples/drivers/mbox/sample.yaml | 35 ++++++++++++++++++++++++++ samples/drivers/mbox/src/main.c | 4 +++ 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index ee2a26c41c3..4ff1a81f5bf 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -51,6 +51,12 @@ int main(void) printk("Maximum TX channels: %d\n", mbox_max_channels_get_dt(&tx_channel)); while (1) { +#if defined(CONFIG_MULTITHREADING) + k_sleep(K_MSEC(3000)); +#else + k_busy_wait(3000000); +#endif + printk("Ping (on channel %d)\n", tx_channel.channel_id); ret = mbox_send_dt(&tx_channel, NULL); @@ -58,10 +64,7 @@ int main(void) printk("Could not send (%d)\n", ret); return 0; } - - k_sleep(K_MSEC(3000)); } #endif /* CONFIG_TX_ENABLED */ - return 0; } diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index f4e4bc0f1de..40425495b38 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -78,3 +78,38 @@ tests: regex: - "Ping \\(on channel 16\\)" - "Pong \\(on channel 15\\)" + + sample.drivers.mbox.nrf54l15_no_multithreading: + platform_allow: + - nrf54l15pdk/nrf54l15/cpuapp + integration_platforms: + - nrf54l15pdk/nrf54l15/cpuapp + extra_args: + mbox_SNIPPET=nordic-flpr + mbox_CONFIG_MULTITHREADING=n + remote_CONFIG_MULTITHREADING=n + sysbuild: true + harness: console + harness_config: + type: multi_line + ordered: false + regex: + - "Ping \\(on channel 16\\)" + - "Pong \\(on channel 15\\)" + + sample.drivers.mbox.nrf54l15_remote_no_multithreading: + platform_allow: + - nrf54l15pdk/nrf54l15/cpuapp + integration_platforms: + - nrf54l15pdk/nrf54l15/cpuapp + extra_args: + mbox_SNIPPET=nordic-flpr + remote_CONFIG_MULTITHREADING=n + sysbuild: true + harness: console + harness_config: + type: multi_line + ordered: false + regex: + - "Ping \\(on channel 16\\)" + - "Pong \\(on channel 15\\)" diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index bf9690c868f..33430dcdd19 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -47,7 +47,11 @@ int main(void) printk("Maximum TX channels: %d\n", mbox_max_channels_get_dt(&tx_channel)); while (1) { +#if defined(CONFIG_MULTITHREADING) k_sleep(K_MSEC(2000)); +#else + k_busy_wait(2000000); +#endif printk("Ping (on channel %d)\n", tx_channel.channel_id);