cleanup: include/: move power.h to power/power.h

move power.h to power/power.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2019-06-25 12:26:13 -04:00
commit 190e368275
30 changed files with 356 additions and 341 deletions

View file

@ -10,7 +10,7 @@
#include <init.h> #include <init.h>
#include <drivers/interrupt_controller/ioapic.h> #include <drivers/interrupt_controller/ioapic.h>
#include <counter.h> #include <counter.h>
#include <power.h> #include <power/power.h>
#include <soc.h> #include <soc.h>
#include <misc/util.h> #include <misc/util.h>

View file

@ -11,7 +11,7 @@
#include <counter.h> #include <counter.h>
#include <init.h> #include <init.h>
#include <kernel.h> #include <kernel.h>
#include <power.h> #include <power/power.h>
#include <soc.h> #include <soc.h>
#include <misc/util.h> #include <misc/util.h>

View file

@ -27,7 +27,7 @@
#endif #endif
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT #ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#include <power.h> #include <power/power.h>
#endif #endif
/* /*

View file

@ -18,7 +18,7 @@
#include "qm_isr.h" #include "qm_isr.h"
#include "clk.h" #include "clk.h"
#include "soc.h" #include "soc.h"
#include <power.h> #include <power/power.h>
struct gpio_qmsi_config { struct gpio_qmsi_config {
qm_gpio_t gpio; qm_gpio_t gpio;

View file

@ -9,7 +9,7 @@
#include <device.h> #include <device.h>
#include <i2c.h> #include <i2c.h>
#include <drivers/interrupt_controller/ioapic.h> #include <drivers/interrupt_controller/ioapic.h>
#include <power.h> #include <power/power.h>
#include "qm_i2c.h" #include "qm_i2c.h"
#include "qm_isr.h" #include "qm_isr.h"

View file

@ -23,7 +23,7 @@
extern void *_VectorTable; extern void *_VectorTable;
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT #ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#include <power.h> #include <power/power.h>
#include <kernel_structs.h> #include <kernel_structs.h>
#include <v2/irq.h> #include <v2/irq.h>

View file

@ -70,7 +70,7 @@
#define SUSPEND_BITS_REQD (ROUND_UP((CONFIG_IOAPIC_NUM_RTES * BITS_PER_IRQ), 32)) #define SUSPEND_BITS_REQD (ROUND_UP((CONFIG_IOAPIC_NUM_RTES * BITS_PER_IRQ), 32))
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT #ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#include <power.h> #include <power/power.h>
u32_t ioapic_suspend_buf[SUSPEND_BITS_REQD / 32] = {0}; u32_t ioapic_suspend_buf[SUSPEND_BITS_REQD / 32] = {0};
static u32_t ioapic_device_power_state = DEVICE_PM_ACTIVE_STATE; static u32_t ioapic_device_power_state = DEVICE_PM_ACTIVE_STATE;
#endif #endif

View file

@ -60,7 +60,7 @@
#define LOPIC_SSPND_BITS_PER_IRQ 1 /* Just the one for enable disable*/ #define LOPIC_SSPND_BITS_PER_IRQ 1 /* Just the one for enable disable*/
#define LOPIC_SUSPEND_BITS_REQD (ROUND_UP((LOAPIC_IRQ_COUNT * LOPIC_SSPND_BITS_PER_IRQ), 32)) #define LOPIC_SUSPEND_BITS_REQD (ROUND_UP((LOAPIC_IRQ_COUNT * LOPIC_SSPND_BITS_PER_IRQ), 32))
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT #ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#include <power.h> #include <power/power.h>
u32_t loapic_suspend_buf[LOPIC_SUSPEND_BITS_REQD / 32] = {0}; u32_t loapic_suspend_buf[LOPIC_SUSPEND_BITS_REQD / 32] = {0};
static u32_t loapic_device_power_state = DEVICE_PM_ACTIVE_STATE; static u32_t loapic_device_power_state = DEVICE_PM_ACTIVE_STATE;
#endif #endif

View file

@ -10,7 +10,7 @@
#include <device.h> #include <device.h>
#include <kernel.h> #include <kernel.h>
#include <init.h> #include <init.h>
#include <power.h> #include <power/power.h>
#include <misc/util.h> #include <misc/util.h>
#include "qm_pwm.h" #include "qm_pwm.h"

View file

@ -13,7 +13,7 @@ LOG_MODULE_REGISTER(rtc_mcux);
#include <init.h> #include <init.h>
#include <kernel.h> #include <kernel.h>
#include <rtc.h> #include <rtc.h>
#include <power.h> #include <power/power.h>
#include <soc.h> #include <soc.h>
#include <misc/util.h> #include <misc/util.h>
#include <fsl_rtc.h> #include <fsl_rtc.h>

View file

@ -10,7 +10,7 @@
#include <drivers/interrupt_controller/ioapic.h> #include <drivers/interrupt_controller/ioapic.h>
#endif #endif
#include <uart.h> #include <uart.h>
#include <power.h> #include <power/power.h>
#include "qm_uart.h" #include "qm_uart.h"
#include "qm_isr.h" #include "qm_isr.h"

View file

@ -21,7 +21,7 @@ LOG_MODULE_REGISTER(spi_intel);
#include <init.h> #include <init.h>
#include <sys_io.h> #include <sys_io.h>
#include <power.h> #include <power/power.h>
#include <spi.h> #include <spi.h>
#include "spi_intel.h" #include "spi_intel.h"

View file

@ -62,7 +62,7 @@
#include <sys_clock.h> #include <sys_clock.h>
#include <drivers/timer/system_timer.h> #include <drivers/timer/system_timer.h>
#include <arch/x86/irq_controller.h> #include <arch/x86/irq_controller.h>
#include <power.h> #include <power/power.h>
#include <device.h> #include <device.h>
#include <kernel_structs.h> #include <kernel_structs.h>

View file

@ -9,7 +9,7 @@
#include <kernel.h> #include <kernel.h>
#include <watchdog.h> #include <watchdog.h>
#include <drivers/interrupt_controller/ioapic.h> #include <drivers/interrupt_controller/ioapic.h>
#include <power.h> #include <power/power.h>
#include <soc.h> #include <soc.h>
#include "clk.h" #include "clk.h"

View file

@ -1,324 +1,15 @@
/* /*
* Copyright (c) 2012-2014 Wind River Systems, Inc. * Copyright (c) 2019 Intel Corporation
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#ifndef ZEPHYR_INCLUDE_POWER_H_ #ifndef ZEPHYR_INCLUDE_POWER_H_
#define ZEPHYR_INCLUDE_POWER_H_ #define ZEPHYR_INCLUDE_POWER_H_
#include <zephyr/types.h> #ifndef CONFIG_COMPAT_INCLUDES
#include <stdbool.h> #warning "This header file has moved, include <power/power.h> instead."
#ifdef __cplusplus
extern "C" {
#endif #endif
/** #include <power/power.h>
* @defgroup power_management_api Power Management
* @{
* @}
*/
/**
* @brief System power states.
*/
enum power_states {
SYS_POWER_STATE_AUTO = (-2),
SYS_POWER_STATE_ACTIVE = (-1),
#ifdef CONFIG_SYS_POWER_SLEEP_STATES
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1
SYS_POWER_STATE_SLEEP_1,
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2
SYS_POWER_STATE_SLEEP_2,
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3
SYS_POWER_STATE_SLEEP_3,
# endif
#endif /* CONFIG_SYS_POWER_SLEEP_STATES */
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1
SYS_POWER_STATE_DEEP_SLEEP_1,
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_2
SYS_POWER_STATE_DEEP_SLEEP_2,
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_3
SYS_POWER_STATE_DEEP_SLEEP_3,
# endif
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */
SYS_POWER_STATE_MAX
};
#ifdef CONFIG_SYS_POWER_MANAGEMENT
extern unsigned char sys_pm_idle_exit_notify;
/**
* @brief System Power Management API
*
* @defgroup system_power_management_api System Power Management API
* @ingroup power_management_api
* @{
*/
/**
* @brief Check if particular power state is a sleep state.
*
* This function returns true if given power state is a sleep state.
*/
static inline bool sys_pm_is_sleep_state(enum power_states state)
{
bool ret = true;
switch (state) {
#ifdef CONFIG_SYS_POWER_SLEEP_STATES
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1
case SYS_POWER_STATE_SLEEP_1:
break;
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2
case SYS_POWER_STATE_SLEEP_2:
break;
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3
case SYS_POWER_STATE_SLEEP_3:
break;
# endif
#endif /* CONFIG_SYS_POWER_SLEEP_STATES */
default:
ret = false;
break;
}
return ret;
}
/**
* @brief Check if particular power state is a deep sleep state.
*
* This function returns true if given power state is a deep sleep state.
*/
static inline bool sys_pm_is_deep_sleep_state(enum power_states state)
{
bool ret = true;
switch (state) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1
case SYS_POWER_STATE_DEEP_SLEEP_1:
break;
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_2
case SYS_POWER_STATE_DEEP_SLEEP_2:
break;
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_3
case SYS_POWER_STATE_DEEP_SLEEP_3:
break;
# endif
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */
default:
ret = false;
break;
}
return ret;
}
/**
* @brief Function to disable power management idle exit notification
*
* The _sys_resume() would be called from the ISR of the event that caused
* exit from kernel idling after PM operations. For some power operations,
* this notification may not be necessary. This function can be called in
* _sys_suspend to disable the corresponding _sys_resume notification.
*
*/
static inline void _sys_pm_idle_exit_notification_disable(void)
{
sys_pm_idle_exit_notify = 0U;
}
/**
* @brief Force usage of given power state.
*
* This function overrides decision made by PM policy
* forcing usage of given power state in all subsequent
* suspend operations. Forcing the SYS_POWER_STATE_AUTO
* state restores normal operation.
*
* @param state Power state which should be used in all
* subsequent suspend operations or
* SYS_POWER_STATE_AUTO.
*/
extern void sys_pm_force_power_state(enum power_states state);
/**
* @brief Put processor into a power state.
*
* This function implements the SoC specific details necessary
* to put the processor into available power states.
*/
extern void sys_set_power_state(enum power_states state);
#ifdef CONFIG_SYS_PM_DEBUG
/**
* @brief Dump Low Power states related debug info
*
* Dump Low Power states debug info like LPS entry count and residencies.
*/
extern void sys_pm_dump_debug_info(void);
#endif /* CONFIG_SYS_PM_DEBUG */
#ifdef CONFIG_SYS_PM_STATE_LOCK
/**
* @brief Disable particular power state
*
* @details Disabled state cannot be selected by the Zephyr power
* management policies. Application defined policy should
* use the @ref sys_pm_ctrl_is_state_enabled function to
* check if given state could is enabled and could be used.
*
* @param [in] state Power state to be disabled.
*/
extern void sys_pm_ctrl_disable_state(enum power_states state);
/**
* @brief Enable particular power state
*
* @details Enabled state can be selected by the Zephyr power
* management policies. Application defined policy should
* use the @ref sys_pm_ctrl_is_state_enabled function to
* check if given state could is enabled and could be used.
* By default all power states are enabled.
*
* @param [in] state Power state to be enabled.
*/
extern void sys_pm_ctrl_enable_state(enum power_states state);
/**
* @brief Check if particular power state is enabled
*
* This function returns true if given power state is enabled.
*
* @param [in] state Power state.
*/
extern bool sys_pm_ctrl_is_state_enabled(enum power_states state);
#endif /* CONFIG_SYS_PM_STATE_LOCK */
/**
* @}
*/
/**
* @brief Power Management Hooks
*
* @defgroup power_management_hook_interface Power Management Hooks
* @ingroup power_management_api
* @{
*/
/**
* @brief Restore context to the point where system entered the deep sleep
* state.
*
* This function is optionally called when exiting from deep sleep if the SOC
* interface does not have bootloader support to handle resume from deep sleep.
* This function should restore context to the point where system entered
* the deep sleep state.
*
* If the function is called at cold boot it should return immediately.
*
* @note This function is not supported on all architectures.
*/
void _sys_resume_from_deep_sleep(void);
/**
* @brief Notify exit from kernel idling after PM operations
*
* This function would notify exit from kernel idling if a corresponding
* _sys_suspend() notification was handled and did not return
* SYS_POWER_STATE_ACTIVE.
*
* This function would be called from the ISR context of the event
* that caused the exit from kernel idling. This will be called immediately
* after interrupts are enabled. This is called to give a chance to do
* any operations before the kernel would switch tasks or processes nested
* interrupts. This is required for cpu low power states that would require
* interrupts to be enabled while entering low power states. e.g. C1 in x86. In
* those cases, the ISR would be invoked immediately after the event wakes up
* the CPU, before code following the CPU wait, gets a chance to execute. This
* can be ignored if no operation needs to be done at the wake event
* notification. Alternatively _sys_pm_idle_exit_notification_disable() can
* be called in _sys_suspend to disable this notification.
*/
void _sys_resume(void);
/**
* @brief Allow entry to power state
*
* When the kernel is about to go idle, it calls this function to notify the
* power management subsystem, that the kernel is ready to enter the idle state.
*
* At this point, the kernel has disabled interrupts and computed the maximum
* time the system can remain idle. The function passes the time that the system
* can remain idle. The SOC interface performs power operations that can be done
* in the available time. The power management operations must halt execution of
* the CPU.
*
* This function assumes that a wake up event has already been set up by the
* application.
*
* This function is entered with interrupts disabled. It should re-enable
* interrupts if it had entered a power state.
*
* @param ticks The upcoming kernel idle time.
*
* @return Power state which was entered or SYS_POWER_STATE_ACTIVE if SoC was
* kept in the active state.
*/
extern enum power_states _sys_suspend(s32_t ticks);
/**
* @brief Do any SoC or architecture specific post ops after sleep state exits.
*
* This function is a place holder to do any operations that may
* be needed to be done after sleep state exits. Currently it enables
* interrupts after resuming from sleep state. In future, the enabling
* of interrupts may be moved into the kernel.
*/
extern void _sys_pm_power_state_exit_post_ops(enum power_states state);
/**
* @brief Application defined function for power state entry
*
* Application defined function for doing any target specific operations
* for power state entry.
*/
extern void sys_pm_notify_power_state_entry(enum power_states state);
/**
* @brief Application defined function for sleep state exit
*
* Application defined function for doing any target specific operations
* for sleep state exit.
*/
extern void sys_pm_notify_power_state_exit(enum power_states state);
/**
* @}
*/
#endif /* CONFIG_SYS_POWER_MANAGEMENT */
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_POWER_H_ */ #endif /* ZEPHYR_INCLUDE_POWER_H_ */

324
include/power/power.h Normal file
View file

@ -0,0 +1,324 @@
/*
* Copyright (c) 2012-2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_POWER_POWER_H_
#define ZEPHYR_INCLUDE_POWER_POWER_H_
#include <zephyr/types.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup power_management_api Power Management
* @{
* @}
*/
/**
* @brief System power states.
*/
enum power_states {
SYS_POWER_STATE_AUTO = (-2),
SYS_POWER_STATE_ACTIVE = (-1),
#ifdef CONFIG_SYS_POWER_SLEEP_STATES
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1
SYS_POWER_STATE_SLEEP_1,
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2
SYS_POWER_STATE_SLEEP_2,
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3
SYS_POWER_STATE_SLEEP_3,
# endif
#endif /* CONFIG_SYS_POWER_SLEEP_STATES */
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1
SYS_POWER_STATE_DEEP_SLEEP_1,
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_2
SYS_POWER_STATE_DEEP_SLEEP_2,
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_3
SYS_POWER_STATE_DEEP_SLEEP_3,
# endif
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */
SYS_POWER_STATE_MAX
};
#ifdef CONFIG_SYS_POWER_MANAGEMENT
extern unsigned char sys_pm_idle_exit_notify;
/**
* @brief System Power Management API
*
* @defgroup system_power_management_api System Power Management API
* @ingroup power_management_api
* @{
*/
/**
* @brief Check if particular power state is a sleep state.
*
* This function returns true if given power state is a sleep state.
*/
static inline bool sys_pm_is_sleep_state(enum power_states state)
{
bool ret = true;
switch (state) {
#ifdef CONFIG_SYS_POWER_SLEEP_STATES
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_1
case SYS_POWER_STATE_SLEEP_1:
break;
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_2
case SYS_POWER_STATE_SLEEP_2:
break;
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_SLEEP_3
case SYS_POWER_STATE_SLEEP_3:
break;
# endif
#endif /* CONFIG_SYS_POWER_SLEEP_STATES */
default:
ret = false;
break;
}
return ret;
}
/**
* @brief Check if particular power state is a deep sleep state.
*
* This function returns true if given power state is a deep sleep state.
*/
static inline bool sys_pm_is_deep_sleep_state(enum power_states state)
{
bool ret = true;
switch (state) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1
case SYS_POWER_STATE_DEEP_SLEEP_1:
break;
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_2
case SYS_POWER_STATE_DEEP_SLEEP_2:
break;
# endif
# ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_3
case SYS_POWER_STATE_DEEP_SLEEP_3:
break;
# endif
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */
default:
ret = false;
break;
}
return ret;
}
/**
* @brief Function to disable power management idle exit notification
*
* The _sys_resume() would be called from the ISR of the event that caused
* exit from kernel idling after PM operations. For some power operations,
* this notification may not be necessary. This function can be called in
* _sys_suspend to disable the corresponding _sys_resume notification.
*
*/
static inline void _sys_pm_idle_exit_notification_disable(void)
{
sys_pm_idle_exit_notify = 0U;
}
/**
* @brief Force usage of given power state.
*
* This function overrides decision made by PM policy
* forcing usage of given power state in all subsequent
* suspend operations. Forcing the SYS_POWER_STATE_AUTO
* state restores normal operation.
*
* @param state Power state which should be used in all
* subsequent suspend operations or
* SYS_POWER_STATE_AUTO.
*/
extern void sys_pm_force_power_state(enum power_states state);
/**
* @brief Put processor into a power state.
*
* This function implements the SoC specific details necessary
* to put the processor into available power states.
*/
extern void sys_set_power_state(enum power_states state);
#ifdef CONFIG_SYS_PM_DEBUG
/**
* @brief Dump Low Power states related debug info
*
* Dump Low Power states debug info like LPS entry count and residencies.
*/
extern void sys_pm_dump_debug_info(void);
#endif /* CONFIG_SYS_PM_DEBUG */
#ifdef CONFIG_SYS_PM_STATE_LOCK
/**
* @brief Disable particular power state
*
* @details Disabled state cannot be selected by the Zephyr power
* management policies. Application defined policy should
* use the @ref sys_pm_ctrl_is_state_enabled function to
* check if given state could is enabled and could be used.
*
* @param [in] state Power state to be disabled.
*/
extern void sys_pm_ctrl_disable_state(enum power_states state);
/**
* @brief Enable particular power state
*
* @details Enabled state can be selected by the Zephyr power
* management policies. Application defined policy should
* use the @ref sys_pm_ctrl_is_state_enabled function to
* check if given state could is enabled and could be used.
* By default all power states are enabled.
*
* @param [in] state Power state to be enabled.
*/
extern void sys_pm_ctrl_enable_state(enum power_states state);
/**
* @brief Check if particular power state is enabled
*
* This function returns true if given power state is enabled.
*
* @param [in] state Power state.
*/
extern bool sys_pm_ctrl_is_state_enabled(enum power_states state);
#endif /* CONFIG_SYS_PM_STATE_LOCK */
/**
* @}
*/
/**
* @brief Power Management Hooks
*
* @defgroup power_management_hook_interface Power Management Hooks
* @ingroup power_management_api
* @{
*/
/**
* @brief Restore context to the point where system entered the deep sleep
* state.
*
* This function is optionally called when exiting from deep sleep if the SOC
* interface does not have bootloader support to handle resume from deep sleep.
* This function should restore context to the point where system entered
* the deep sleep state.
*
* If the function is called at cold boot it should return immediately.
*
* @note This function is not supported on all architectures.
*/
void _sys_resume_from_deep_sleep(void);
/**
* @brief Notify exit from kernel idling after PM operations
*
* This function would notify exit from kernel idling if a corresponding
* _sys_suspend() notification was handled and did not return
* SYS_POWER_STATE_ACTIVE.
*
* This function would be called from the ISR context of the event
* that caused the exit from kernel idling. This will be called immediately
* after interrupts are enabled. This is called to give a chance to do
* any operations before the kernel would switch tasks or processes nested
* interrupts. This is required for cpu low power states that would require
* interrupts to be enabled while entering low power states. e.g. C1 in x86. In
* those cases, the ISR would be invoked immediately after the event wakes up
* the CPU, before code following the CPU wait, gets a chance to execute. This
* can be ignored if no operation needs to be done at the wake event
* notification. Alternatively _sys_pm_idle_exit_notification_disable() can
* be called in _sys_suspend to disable this notification.
*/
void _sys_resume(void);
/**
* @brief Allow entry to power state
*
* When the kernel is about to go idle, it calls this function to notify the
* power management subsystem, that the kernel is ready to enter the idle state.
*
* At this point, the kernel has disabled interrupts and computed the maximum
* time the system can remain idle. The function passes the time that the system
* can remain idle. The SOC interface performs power operations that can be done
* in the available time. The power management operations must halt execution of
* the CPU.
*
* This function assumes that a wake up event has already been set up by the
* application.
*
* This function is entered with interrupts disabled. It should re-enable
* interrupts if it had entered a power state.
*
* @param ticks The upcoming kernel idle time.
*
* @return Power state which was entered or SYS_POWER_STATE_ACTIVE if SoC was
* kept in the active state.
*/
extern enum power_states _sys_suspend(s32_t ticks);
/**
* @brief Do any SoC or architecture specific post ops after sleep state exits.
*
* This function is a place holder to do any operations that may
* be needed to be done after sleep state exits. Currently it enables
* interrupts after resuming from sleep state. In future, the enabling
* of interrupts may be moved into the kernel.
*/
extern void _sys_pm_power_state_exit_post_ops(enum power_states state);
/**
* @brief Application defined function for power state entry
*
* Application defined function for doing any target specific operations
* for power state entry.
*/
extern void sys_pm_notify_power_state_entry(enum power_states state);
/**
* @brief Application defined function for sleep state exit
*
* Application defined function for doing any target specific operations
* for sleep state exit.
*/
extern void sys_pm_notify_power_state_exit(enum power_states state);
/**
* @}
*/
#endif /* CONFIG_SYS_POWER_MANAGEMENT */
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_POWER_POWER_H_ */

View file

@ -10,7 +10,7 @@
#include <linker/sections.h> #include <linker/sections.h>
#include <drivers/timer/system_timer.h> #include <drivers/timer/system_timer.h>
#include <wait_q.h> #include <wait_q.h>
#include <power.h> #include <power/power.h>
#include <stdbool.h> #include <stdbool.h>
#ifdef CONFIG_TICKLESS_IDLE_THRESH #ifdef CONFIG_TICKLESS_IDLE_THRESH

View file

@ -5,7 +5,7 @@
*/ */
#include <zephyr.h> #include <zephyr.h>
#include <power.h> #include <power/power.h>
#include <string.h> #include <string.h>
#include <soc.h> #include <soc.h>
#include <device.h> #include <device.h>

View file

@ -7,7 +7,7 @@
#include <zephyr.h> #include <zephyr.h>
#include <sys_io.h> #include <sys_io.h>
#include <misc/__assert.h> #include <misc/__assert.h>
#include <power.h> #include <power/power.h>
#include <soc_power.h> #include <soc_power.h>
#include <init.h> #include <init.h>
#include <kernel_structs.h> #include <kernel_structs.h>

View file

@ -7,7 +7,7 @@
#ifndef _SOC_POWER_H_ #ifndef _SOC_POWER_H_
#define _SOC_POWER_H_ #define _SOC_POWER_H_
#include <power.h> #include <power/power.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View file

@ -6,7 +6,7 @@
#include <device.h> #include <device.h>
#include <init.h> #include <init.h>
#include <power.h> #include <power/power.h>
#include <soc.h> #include <soc.h>
#include <soc_power.h> #include <soc_power.h>
#include <arch/cpu.h> #include <arch/cpu.h>

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <zephyr.h> #include <zephyr.h>
#include <power.h> #include <power/power.h>
#include <nrf_power.h> #include <nrf_power.h>
#include <logging/log.h> #include <logging/log.h>

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <zephyr.h> #include <zephyr.h>
#include <power.h> #include <power/power.h>
#include <nrf_power.h> #include <nrf_power.h>
#include <logging/log.h> #include <logging/log.h>

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <zephyr.h> #include <zephyr.h>
#include <power.h> #include <power/power.h>
#include <em_emu.h> #include <em_emu.h>
#include <logging/log.h> #include <logging/log.h>

View file

@ -7,7 +7,7 @@
#include <zephyr.h> #include <zephyr.h>
#include <sys_io.h> #include <sys_io.h>
#include <misc/__assert.h> #include <misc/__assert.h>
#include <power.h> #include <power/power.h>
#include <soc_power.h> #include <soc_power.h>
#include <soc.h> #include <soc.h>

View file

@ -7,7 +7,7 @@
#ifndef _SOC_POWER_H_ #ifndef _SOC_POWER_H_
#define _SOC_POWER_H_ #define _SOC_POWER_H_
#include <power.h> #include <power/power.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View file

@ -7,7 +7,7 @@
#ifndef _PM_POLICY_H_ #ifndef _PM_POLICY_H_
#define _PM_POLICY_H_ #define _PM_POLICY_H_
#include <power.h> #include <power/power.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View file

@ -8,7 +8,7 @@
#include <kernel.h> #include <kernel.h>
#include <init.h> #include <init.h>
#include <string.h> #include <string.h>
#include <power.h> #include <power/power.h>
#include "policy/pm_policy.h" #include "policy/pm_policy.h"
#define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL #define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL

View file

@ -5,7 +5,7 @@
*/ */
#include <ztest.h> #include <ztest.h>
#include <power.h> #include <power/power.h>
#include <irq_offload.h> #include <irq_offload.h>
#include <misc/stack.h> #include <misc/stack.h>

View file

@ -5,7 +5,7 @@
*/ */
#include <ztest.h> #include <ztest.h>
#include <power.h> #include <power/power.h>
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE) #define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
#define NUM_THREAD 4 #define NUM_THREAD 4