1 /* 2 * Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. 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 #ifndef WDT_HAL_H 16 #define WDT_HAL_H 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 #include "plat_types.h" 23 24 enum HAL_WDT_ID_T { 25 HAL_WDT_ID_0 = 0, 26 HAL_WDT_ID_NUM, 27 }; 28 29 enum HAL_WDT_EVENT_T { 30 HAL_WDT_EVENT_FIRE = 0, 31 }; 32 33 typedef void (*HAL_WDT_IRQ_CALLBACK)(enum HAL_WDT_ID_T id, enum HAL_WDT_EVENT_T event); 34 /* hal api */ 35 void hal_wdt_set_irq_callback(enum HAL_WDT_ID_T id, HAL_WDT_IRQ_CALLBACK handler); 36 37 /* mandatory operations */ 38 int hal_wdt_start(enum HAL_WDT_ID_T id); 39 int hal_wdt_stop(enum HAL_WDT_ID_T id); 40 41 /* optional operations */ 42 int hal_wdt_ping(enum HAL_WDT_ID_T id); 43 int hal_wdt_set_timeout(enum HAL_WDT_ID_T id, unsigned int); 44 unsigned int hal_wdt_get_timeleft(enum HAL_WDT_ID_T id); 45 46 #ifdef __cplusplus 47 } 48 #endif 49 50 #endif /* WDT_HAL_H */ 51