Skip to content

Commit 5f98608

Browse files
nordic-piksnordicjm
authored andcommitted
[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: zephyrproject-rtos/zephyr#76415 Signed-off-by: Piotr Kosycarz <[email protected]>
1 parent c784caa commit 5f98608

File tree

1 file changed

+12
-0
lines changed
  • samples/drivers/mbox/src

1 file changed

+12
-0
lines changed

samples/drivers/mbox/src/main.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ int main(void)
4646
printk("Maximum bytes of data in the TX message: %d\n", mbox_mtu_get_dt(&tx_channel));
4747
printk("Maximum TX channels: %d\n", mbox_max_channels_get_dt(&tx_channel));
4848

49+
#ifndef CONFIG_COVERAGE
4950
while (1) {
51+
#else
52+
for (int i = 0; i < 5; i++) {
53+
#endif
5054
#if defined(CONFIG_MULTITHREADING)
5155
k_sleep(K_MSEC(2000));
5256
#else
@@ -62,5 +66,13 @@ int main(void)
6266
}
6367
}
6468
#endif /* CONFIG_TX_ENABLED */
69+
70+
#ifdef CONFIG_RX_ENABLED
71+
ret = mbox_set_enabled_dt(&rx_channel, false);
72+
if (ret < 0) {
73+
printk("Could not disable RX channel %d (%d)\n", rx_channel.channel_id, ret);
74+
return 0;
75+
}
76+
#endif /* CONFIG_RX_ENABLED */
6577
return 0;
6678
}

0 commit comments

Comments
 (0)