1 // Copyright (C) 2022 Beken Corporation
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13
14 #include "iot_errno.h"
15 #include "reset.h"
16 #include <common/bk_typedef.h>
17 #include <sys/types.h>
18 #include "reset_reason.h"
19 //#include <driver/wdt.h>
20
21 typedef enum {
22 HI_SYS_REBOOT_CAUSE_UNKNOWN = 0,
23 HI_SYS_REBOOT_CAUSE_CMD, /**< system reset begin. */
24 HI_SYS_REBOOT_CAUSE_UPG, /**< upgrade reset begin. */
25 HI_SYS_REBOOT_CAUSE_UPG_B, /**< upgrade backup image reset. */
26 HI_SYS_REBOOT_CAUSE_WIFI_MODE, /**< wifi module reset begin. */
27 HI_SYS_REBOOT_CAUSE_USR_NORMAL_REBOOT, /**< user reset begin. */
28 HI_SYS_REBOOT_CAUSE_USR0,
29 HI_SYS_REBOOT_CAUSE_USR1,
30 HI_SYS_REBOOT_CAUSE_AT_BUSY,
31 } hi_sys_reboot_cause;
32
33
RebootDevice(unsigned int cause)34 void RebootDevice(unsigned int cause)
35 {
36 RESET_SOURCE_STATUS reset_source;
37
38 /*
39 switch(cause) {
40 case :
41 break;
42 default:
43 break;
44 }
45 */
46
47 reset_source = RESET_SOURCE_REBOOT;
48 bk_misc_update_set_type(reset_source);
49
50 bk_wdt_start(5);
51 while(1)
52 ;
53 }
54
55