soc: nordic: vpr: finish pending transactions before calling `wfi`

To minimize time the CPU spends when preparing for sleep, make sure
the pending transactions are finished before calling `wfi`.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
This commit is contained in:
Marcin Szymczyk 2024-03-25 14:30:12 +01:00 committed by Fabio Baltieri
parent 04a74ce107
commit 1de13cc96a
1 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,7 @@
*/
#include <zephyr/irq.h>
#include <zephyr/sys/barrier.h>
#include <zephyr/tracing/tracing.h>
/*
@ -13,6 +14,7 @@
void arch_cpu_idle(void)
{
sys_trace_idle();
barrier_dsync_fence_full();
irq_unlock(MSTATUS_IEN);
__asm__ volatile("wfi");
}
@ -20,6 +22,7 @@ void arch_cpu_idle(void)
void arch_cpu_atomic_idle(unsigned int key)
{
sys_trace_idle();
barrier_dsync_fence_full();
irq_unlock(MSTATUS_IEN);
__asm__ volatile("wfi");