1 /*
2  * Copyright (c) 2020 Antony Pavlov <antonynpavlov@gmail.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/irq.h>
8 
9 #include <zephyr/tracing/tracing.h>
10 
mips_idle(unsigned int key)11 static ALWAYS_INLINE void mips_idle(unsigned int key)
12 {
13 	sys_trace_idle();
14 
15 	/* unlock interrupts */
16 	irq_unlock(key);
17 
18 	/* wait for interrupt */
19 	__asm__ volatile("wait");
20 }
21 
22 #ifndef CONFIG_ARCH_HAS_CUSTOM_CPU_IDLE
arch_cpu_idle(void)23 void arch_cpu_idle(void)
24 {
25 	mips_idle(1);
26 }
27 #endif
28 
29 #ifndef CONFIG_ARCH_HAS_CUSTOM_CPU_ATOMIC_IDLE
arch_cpu_atomic_idle(unsigned int key)30 void arch_cpu_atomic_idle(unsigned int key)
31 {
32 	mips_idle(key);
33 }
34 #endif
35