• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef _SYS_REBOOT_H
17 #define _SYS_REBOOT_H
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #define RB_AUTOBOOT 0x01234567
24 #define RB_HALT_SYSTEM 0xcdef0123
25 #define RB_ENABLE_CAD 0x89abcdef
26 #define RB_DISABLE_CAD 0
27 #define RB_POWER_OFF 0x4321fedc
28 #define RB_SW_SUSPEND 0xd000fce2
29 #define RB_KEXEC 0x45584543
30 #define RB_MAGIC1 0xfee1dead
31 #define RB_MAGIC2 672274793
32 
33 /**
34   * @brief reboots the device, or enables/disables the reboot keystroke.
35   * @param type commands accepted by the reboot() system call.
36   *    -- RESTART     Restart system using default command and mode.
37   *    -- HALT        Stop OS and give system control to ROM monitor, if any.
38   *    -- CAD_ON      Ctrl-Alt-Del sequence causes RESTART command.
39   *    -- CAD_OFF     Ctrl-Alt-Del sequence sends SIGINT to init task.
40   *    -- POWER_OFF   Stop OS and remove all power from system, if possible.
41   *    -- RESTART2    Restart system using given command string.
42   *    -- SW_SUSPEND  Suspend system using software suspend if compiled in.
43   *    -- KEXEC       Restart system using a previously loaded Linux kernel.
44   * @return reboot result.
45   * @retval 0 is returned on success, if CAD was successfully enabled/disabled.
46   * @retval -1 is returned on failure, and errno is set to indicate the error.
47   */
48 int reboot(int);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 #endif
54