mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-11 06:46:04 +00:00
XT_* macros are defined in xtensa HAL headers as xcc intrinsics. gcc does not have any of these intrinsics. Replace XT_* macros with inline assembly or provide gcc-compatible definitions. Change-Id: If823ea8a7898a11a3a8363b17efdba27dee4c6a4 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
40 lines
873 B
C
40 lines
873 B
C
/*
|
|
* Copyright (c) 2016 Cadence Design Systems, Inc.
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <xtensa/tie/xt_core.h>
|
|
#include <xtensa/tie/xt_interrupt.h>
|
|
#include <logging/kernel_event_logger.h>
|
|
|
|
/*
|
|
* @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)
|
|
{
|
|
#ifdef CONFIG_KERNEL_EVENT_LOGGER_SLEEP
|
|
_sys_k_event_logger_enter_sleep();
|
|
#endif
|
|
__asm__ volatile ("waiti 0");
|
|
}
|
|
/*
|
|
* @brief Put the CPU in low-power mode, entered with IRQs locked
|
|
*
|
|
* This function exits with interrupts restored to <key>.
|
|
*
|
|
* void k_cpu_atomic_idle(unsigned int key)
|
|
*/
|
|
void k_cpu_atomic_idle(unsigned int key)
|
|
{
|
|
#ifdef CONFIG_KERNEL_EVENT_LOGGER_SLEEP
|
|
_sys_k_event_logger_enter_sleep();
|
|
#endif
|
|
__asm__ volatile ("waiti 0\n\t"
|
|
"wsr.ps %0\n\t"
|
|
"rsync" :: "a"(key));
|
|
}
|