power: move reboot functionality to os lib
Reboot functionality has nothing to do with PM, so move it out to the subsys/os folder. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
0f19812ce0
commit
f163bdb280
22 changed files with 31 additions and 30 deletions
|
@ -571,14 +571,6 @@ config BOOTLOADER_BOSSA_ADAFRUIT_UF2
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config REBOOT
|
|
||||||
bool "Reboot functionality"
|
|
||||||
select SYSTEM_CLOCK_DISABLE
|
|
||||||
help
|
|
||||||
Enable the sys_reboot() API. Enabling this can drag in other subsystems
|
|
||||||
needed to perform a "safe" reboot (e.g. SYSTEM_CLOCK_DISABLE, to stop the
|
|
||||||
system clock before issuing a reset).
|
|
||||||
|
|
||||||
config MISRA_SANE
|
config MISRA_SANE
|
||||||
bool "MISRA standards compliance features"
|
bool "MISRA standards compliance features"
|
||||||
help
|
help
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <sys/printk.h>
|
#include <sys/printk.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <toolchain.h>
|
#include <toolchain.h>
|
||||||
#include <linker/sections.h>
|
#include <linker/sections.h>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
|
|
||||||
/* reboot through Reset Control Register (I/O port 0xcf9) */
|
/* reboot through Reset Control Register (I/O port 0xcf9) */
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ up from where it was before restart.
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <settings/settings.h>
|
#include <settings/settings.h>
|
||||||
#include <sys/printk.h>
|
#include <sys/printk.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include <drivers/watchdog.h>
|
#include <drivers/watchdog.h>
|
||||||
#include <sys/printk.h>
|
#include <sys/printk.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
|
|
||||||
struct wdog_cmsdk_apb {
|
struct wdog_cmsdk_apb {
|
||||||
/* offset: 0x000 (r/w) watchdog load register */
|
/* offset: 0x000 (r/w) watchdog load register */
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
* @file
|
* @file
|
||||||
* @brief Common target reboot functionality
|
* @brief Common target reboot functionality
|
||||||
*
|
*
|
||||||
* @details See misc/Kconfig and the reboot help for details.
|
* @details See subsys/os/Kconfig and the reboot help for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ZEPHYR_INCLUDE_POWER_REBOOT_H_
|
#ifndef ZEPHYR_INCLUDE_SYS_REBOOT_H_
|
||||||
#define ZEPHYR_INCLUDE_POWER_REBOOT_H_
|
#define ZEPHYR_INCLUDE_SYS_REBOOT_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -39,4 +39,4 @@ extern void sys_reboot(int type);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ZEPHYR_INCLUDE_POWER_REBOOT_H_ */
|
#endif /* ZEPHYR_INCLUDE_SYS_REBOOT_H_ */
|
|
@ -39,6 +39,8 @@ zephyr_sources_ifdef(CONFIG_MPSC_PBUF mpsc_pbuf.c)
|
||||||
|
|
||||||
zephyr_sources_ifdef(CONFIG_SCHED_DEADLINE p4wq.c)
|
zephyr_sources_ifdef(CONFIG_SCHED_DEADLINE p4wq.c)
|
||||||
|
|
||||||
|
zephyr_sources_ifdef(CONFIG_REBOOT reboot.c)
|
||||||
|
|
||||||
zephyr_library_include_directories(
|
zephyr_library_include_directories(
|
||||||
${ZEPHYR_BASE}/kernel/include
|
${ZEPHYR_BASE}/kernel/include
|
||||||
${ZEPHYR_BASE}/arch/${ARCH}/include
|
${ZEPHYR_BASE}/arch/${ARCH}/include
|
||||||
|
|
|
@ -75,6 +75,14 @@ config MPSC_CLEAR_ALLOCATED
|
||||||
When enabled packet space is zeroed before returning from allocation.
|
When enabled packet space is zeroed before returning from allocation.
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
config REBOOT
|
||||||
|
bool "Reboot functionality"
|
||||||
|
select SYSTEM_CLOCK_DISABLE
|
||||||
|
help
|
||||||
|
Enable the sys_reboot() API. Enabling this can drag in other subsystems
|
||||||
|
needed to perform a "safe" reboot (e.g. SYSTEM_CLOCK_DISABLE, to stop the
|
||||||
|
system clock before issuing a reset).
|
||||||
|
|
||||||
rsource "Kconfig.cbprintf"
|
rsource "Kconfig.cbprintf"
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <drivers/timer/system_timer.h>
|
#include <drivers/timer/system_timer.h>
|
||||||
#include <sys/printk.h>
|
#include <sys/printk.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
|
|
||||||
extern void sys_arch_reboot(int type);
|
extern void sys_arch_reboot(int type);
|
||||||
extern void sys_clock_disable(void);
|
extern void sys_clock_disable(void);
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <drivers/gpio.h>
|
#include <drivers/gpio.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <settings/settings.h>
|
#include <settings/settings.h>
|
||||||
#include <canbus/canopen.h>
|
#include <canbus/canopen.h>
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <drivers/flash.h>
|
#include <drivers/flash.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <drivers/watchdog.h>
|
#include <drivers/watchdog.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <task_wdt/task_wdt.h>
|
#include <task_wdt/task_wdt.h>
|
||||||
#include <sys/printk.h>
|
#include <sys/printk.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
|
@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(hawkbit);
|
||||||
#include <net/net_ip.h>
|
#include <net/net_ip.h>
|
||||||
#include <net/socket.h>
|
#include <net/socket.h>
|
||||||
#include <net/net_mgmt.h>
|
#include <net/net_mgmt.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <drivers/flash.h>
|
#include <drivers/flash.h>
|
||||||
#include <net/http_client.h>
|
#include <net/http_client.h>
|
||||||
#include <net/dns_resolve.h>
|
#include <net/dns_resolve.h>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <drivers/flash.h>
|
#include <drivers/flash.h>
|
||||||
#include <dfu/mcuboot.h>
|
#include <dfu/mcuboot.h>
|
||||||
#include <dfu/flash_img.h>
|
#include <dfu/flash_img.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include "mgmt/hawkbit.h"
|
#include "mgmt/hawkbit.h"
|
||||||
#include "hawkbit_firmware.h"
|
#include "hawkbit_firmware.h"
|
||||||
#include "hawkbit_device.h"
|
#include "hawkbit_device.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(updatehub, CONFIG_UPDATEHUB_LOG_LEVEL);
|
||||||
#include <net/coap.h>
|
#include <net/coap.h>
|
||||||
#include <net/dns_resolve.h>
|
#include <net/dns_resolve.h>
|
||||||
#include <drivers/flash.h>
|
#include <drivers/flash.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <tinycrypt/sha256.h>
|
#include <tinycrypt/sha256.h>
|
||||||
#include <data/json.h>
|
#include <data/json.h>
|
||||||
#include <storage/flash_map.h>
|
#include <storage/flash_map.h>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <openthread/instance.h>
|
#include <openthread/instance.h>
|
||||||
#include <openthread/platform/misc.h>
|
#include <openthread/platform/misc.h>
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,4 @@ zephyr_sources_ifdef(CONFIG_PM power.c)
|
||||||
zephyr_sources_ifdef(CONFIG_PM pm_ctrl.c)
|
zephyr_sources_ifdef(CONFIG_PM pm_ctrl.c)
|
||||||
zephyr_sources_ifdef(CONFIG_PM_DEVICE device.c)
|
zephyr_sources_ifdef(CONFIG_PM_DEVICE device.c)
|
||||||
zephyr_sources_ifdef(CONFIG_PM_DEVICE_IDLE device_pm.c)
|
zephyr_sources_ifdef(CONFIG_PM_DEVICE_IDLE device_pm.c)
|
||||||
zephyr_sources_ifdef(CONFIG_REBOOT reboot.c)
|
|
||||||
add_subdirectory(policy)
|
add_subdirectory(policy)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <shell/shell.h>
|
#include <shell/shell.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <debug/object_tracing.h>
|
#include <debug/object_tracing.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <debug/stack.h>
|
#include <debug/stack.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "task_wdt/task_wdt.h"
|
#include "task_wdt/task_wdt.h"
|
||||||
|
|
||||||
#include <drivers/watchdog.h>
|
#include <drivers/watchdog.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
#include <sys/libc-hooks.h>
|
#include <sys/libc-hooks.h>
|
||||||
#endif
|
#endif
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
static struct k_thread ztest_thread;
|
static struct k_thread ztest_thread;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <sys/printk.h>
|
#include <sys/printk.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <arch/arm/aarch32/cortex_m/cmsis.h>
|
#include <arch/arm/aarch32/cortex_m/cmsis.h>
|
||||||
#include <ztest.h>
|
#include <ztest.h>
|
||||||
#include <tc_util.h>
|
#include <tc_util.h>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <ztest.h>
|
#include <ztest.h>
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <power/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <settings/settings.h>
|
#include <settings/settings.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue