Benjamin Walsh | 826edfc | 2015-09-28 15:53:04 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 Wind River Systems, Inc. |
| 3 | * |
David B. Kinder | ac74d8b | 2017-01-18 17:01:01 -0800 | [diff] [blame] | 4 | * SPDX-License-Identifier: Apache-2.0 |
Benjamin Walsh | 826edfc | 2015-09-28 15:53:04 -0400 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | /** |
| 8 | * @file common target reboot functionality |
| 9 | * |
| 10 | * @details See misc/Kconfig and the reboot help for details. |
| 11 | */ |
| 12 | |
Anas Nashif | c1347b4 | 2016-12-23 08:35:34 -0500 | [diff] [blame] | 13 | #include <kernel.h> |
Benjamin Walsh | 826edfc | 2015-09-28 15:53:04 -0400 | [diff] [blame] | 14 | #include <drivers/system_timer.h> |
| 15 | #include <misc/printk.h> |
| 16 | #include <misc/reboot.h> |
| 17 | |
| 18 | extern void sys_arch_reboot(int type); |
| 19 | |
| 20 | void sys_reboot(int type) |
| 21 | { |
| 22 | (void)irq_lock(); |
| 23 | sys_clock_disable(); |
| 24 | |
| 25 | sys_arch_reboot(type); |
| 26 | |
| 27 | /* should never get here */ |
| 28 | printk("Failed to reboot: spinning endlessly...\n"); |
| 29 | for (;;) { |
Benjamin Walsh | c3a2bbb | 2016-12-14 13:04:36 -0500 | [diff] [blame] | 30 | k_cpu_idle(); |
Benjamin Walsh | 826edfc | 2015-09-28 15:53:04 -0400 | [diff] [blame] | 31 | } |
| 32 | } |