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 "iot_watchdog.h" 16 17 #include <driver/wdt.h> 18 19 static int wdg_inited = 0; 20 21 #define DEFAULT_WDG_TIMEOUT_MS 1000 22 IoTWatchDogEnable(void)23void IoTWatchDogEnable(void) 24 { 25 if (wdg_inited) 26 return; 27 28 // bk_wdt_start(DEFAULT_WDG_TIMEOUT_MS); 29 wdg_inited = 1; 30 } 31 IoTWatchDogKick(void)32void IoTWatchDogKick(void) 33 { 34 if (!wdg_inited) 35 return; 36 37 bk_wdt_feed(); 38 } 39 IoTWatchDogDisable(void)40void IoTWatchDogDisable(void) 41 { 42 if (!wdg_inited) 43 return; 44 45 // bk_wdt_stop(); 46 wdg_inited = 0; 47 } 48 49