1 /*
2  * Copyright (c) 2016 Cadence Design Systems, Inc.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #include <zephyr/toolchain.h>
7 #include <zephyr/tracing/tracing.h>
8 
9 #ifndef CONFIG_ARCH_HAS_CUSTOM_CPU_IDLE
arch_cpu_idle(void)10 void arch_cpu_idle(void)
11 {
12 	sys_trace_idle();
13 	__asm__ volatile ("waiti 0");
14 }
15 #endif
16 
17 #ifndef CONFIG_ARCH_HAS_CUSTOM_CPU_ATOMIC_IDLE
arch_cpu_atomic_idle(unsigned int key)18 void arch_cpu_atomic_idle(unsigned int key)
19 {
20 	sys_trace_idle();
21 	__asm__ volatile ("waiti 0\n\t"
22 			  "wsr.ps %0\n\t"
23 			  "rsync" :: "a"(key));
24 }
25 #endif
26