From d9299ae1b4db5154e15ffe7306698d1d4b921dc1 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Mon, 29 Jul 2024 12:21:55 +0200 Subject: [PATCH] [nrf fromlist] samples: drivers: mbox: Allow coverage calculation The sample must end to dump coverage data. Stop receiving to prevent callback from interrupting coverage dump. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/76415 Signed-off-by: Piotr Kosycarz --- samples/drivers/mbox/src/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index 33430dcdd199..06e10721fc71 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -46,7 +46,11 @@ int main(void) printk("Maximum bytes of data in the TX message: %d\n", mbox_mtu_get_dt(&tx_channel)); printk("Maximum TX channels: %d\n", mbox_max_channels_get_dt(&tx_channel)); +#ifndef CONFIG_COVERAGE while (1) { +#else + for (int i = 0; i < 5; i++) { +#endif #if defined(CONFIG_MULTITHREADING) k_sleep(K_MSEC(2000)); #else @@ -62,5 +66,13 @@ int main(void) } } #endif /* CONFIG_TX_ENABLED */ + +#ifdef CONFIG_RX_ENABLED + ret = mbox_set_enabled_dt(&rx_channel, false); + if (ret < 0) { + printk("Could not disable RX channel %d (%d)\n", rx_channel.channel_id, ret); + return 0; + } +#endif /* CONFIG_RX_ENABLED */ return 0; }