blob: 864aa0dd5ba7fe428e1531302df1b3800a3fa1c4 [file] [log] [blame]
Benjamin Walsh826edfc2015-09-28 15:53:04 -04001/*
2 * Copyright (c) 2015 Wind River Systems, Inc.
3 *
David B. Kinderac74d8b2017-01-18 17:01:01 -08004 * SPDX-License-Identifier: Apache-2.0
Benjamin Walsh826edfc2015-09-28 15:53:04 -04005 */
6
7/**
8 * @file common target reboot functionality
9 *
10 * @details See misc/Kconfig and the reboot help for details.
11 */
12
Anas Nashifc1347b42016-12-23 08:35:34 -050013#include <kernel.h>
Benjamin Walsh826edfc2015-09-28 15:53:04 -040014#include <drivers/system_timer.h>
15#include <misc/printk.h>
16#include <misc/reboot.h>
17
18extern void sys_arch_reboot(int type);
19
20void 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 Walshc3a2bbb2016-12-14 13:04:36 -050030 k_cpu_idle();
Benjamin Walsh826edfc2015-09-28 15:53:04 -040031 }
32}