| /* |
| * Copyright (c) 2018 Nordic Semiconductor ASA |
| * Copyright (c) 2016 Intel Corporation |
| * |
| * SPDX-License-Identifier: Apache-2.0 |
| */ |
| |
| #include "kernel_shell.h" |
| |
| #include <zephyr/sys/reboot.h> |
| |
| static int cmd_kernel_reboot_warm(const struct shell *sh, |
| size_t argc, char **argv) |
| { |
| ARG_UNUSED(argc); |
| ARG_UNUSED(argv); |
| #if (CONFIG_KERNEL_SHELL_REBOOT_DELAY > 0) |
| k_sleep(K_MSEC(CONFIG_KERNEL_SHELL_REBOOT_DELAY)); |
| #endif |
| sys_reboot(SYS_REBOOT_WARM); |
| return 0; |
| } |
| |
| static int cmd_kernel_reboot_cold(const struct shell *sh, |
| size_t argc, char **argv) |
| { |
| ARG_UNUSED(argc); |
| ARG_UNUSED(argv); |
| #if (CONFIG_KERNEL_SHELL_REBOOT_DELAY > 0) |
| k_sleep(K_MSEC(CONFIG_KERNEL_SHELL_REBOOT_DELAY)); |
| #endif |
| sys_reboot(SYS_REBOOT_COLD); |
| return 0; |
| } |
| |
| SHELL_STATIC_SUBCMD_SET_CREATE(sub_kernel_reboot, |
| SHELL_CMD(cold, NULL, "Cold reboot.", cmd_kernel_reboot_cold), |
| SHELL_CMD(warm, NULL, "Warm reboot.", cmd_kernel_reboot_warm), |
| SHELL_SUBCMD_SET_END /* Array terminated. */ |
| ); |
| |
| KERNEL_CMD_ADD(reboot, &sub_kernel_reboot, "Reboot.", cmd_kernel_reboot_cold); |