1 /*
2  * Copyright (c) 2016 Jean-Paul Etienne <fractalclone@gmail.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/irq.h>
8 #include <zephyr/tracing/tracing.h>
9 
10 #ifndef CONFIG_ARCH_HAS_CUSTOM_CPU_IDLE
arch_cpu_idle(void)11 void arch_cpu_idle(void)
12 {
13 	sys_trace_idle();
14 	__asm__ volatile("wfi");
15 	irq_unlock(MSTATUS_IEN);
16 }
17 #endif
18 
19 #ifndef CONFIG_ARCH_HAS_CUSTOM_CPU_ATOMIC_IDLE
arch_cpu_atomic_idle(unsigned int key)20 void arch_cpu_atomic_idle(unsigned int key)
21 {
22 	sys_trace_idle();
23 	__asm__ volatile("wfi");
24 	irq_unlock(key);
25 }
26 #endif
27