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 
arch_cpu_idle(void)22 void arch_cpu_idle(void)
23 {
24 	mips_idle(1);
25 }
26 
arch_cpu_atomic_idle(unsigned int key)27 void arch_cpu_atomic_idle(unsigned int key)
28 {
29 	mips_idle(key);
30 }
31