Skip to content

Commit

Permalink
[nrf fromlist] samples: drivers: mbox: Allow coverage calculation
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
nordic-piks authored and nordicjm committed Jul 30, 2024
1 parent c784caa commit 5f98608
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions samples/drivers/mbox/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

0 comments on commit 5f98608

Please sign in to comment.