2017-01-23 00:21:34 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Cadence Design Systems, Inc.
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2018-04-06 19:48:53 +08:00
|
|
|
#include <tracing.h>
|
2017-01-23 00:21:34 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @brief Put the CPU in low-power mode
|
|
|
|
*
|
|
|
|
* This function always exits with interrupts unlocked.
|
|
|
|
*
|
|
|
|
* void k_cpu_idle(void)
|
|
|
|
*/
|
|
|
|
void k_cpu_idle(void)
|
|
|
|
{
|
2018-04-06 09:06:33 +08:00
|
|
|
z_sys_trace_idle();
|
2017-02-16 06:57:29 +08:00
|
|
|
__asm__ volatile ("waiti 0");
|
2017-01-23 00:21:34 +08:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* @brief Put the CPU in low-power mode, entered with IRQs locked
|
|
|
|
*
|
|
|
|
* This function exits with interrupts restored to <key>.
|
|
|
|
*
|
2017-04-09 23:57:54 +08:00
|
|
|
* void k_cpu_atomic_idle(unsigned int key)
|
2017-01-23 00:21:34 +08:00
|
|
|
*/
|
|
|
|
void k_cpu_atomic_idle(unsigned int key)
|
|
|
|
{
|
2018-04-06 09:06:33 +08:00
|
|
|
z_sys_trace_idle();
|
2017-02-16 06:57:29 +08:00
|
|
|
__asm__ volatile ("waiti 0\n\t"
|
|
|
|
"wsr.ps %0\n\t"
|
|
|
|
"rsync" :: "a"(key));
|
2017-01-23 00:21:34 +08:00
|
|
|
}
|