1 /**
2  * @file wdg.h
3  * @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited
4  */
5 
6 #ifndef AOS_HAL_WDG_H
7 #define AOS_HAL_WDG_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /** @addtogroup hal_wdg WDG
14  *  wdg hal API.
15  *
16  *  @{
17  */
18 
19 #include <stdint.h>
20 
21 /* Define wdt expired time */
22 typedef struct {
23     uint32_t timeout; /**< Watchdag timeout */
24 } wdg_config_t;
25 
26 /* Define wdg dev handle */
27 typedef struct {
28     uint8_t       port;   /**< wdg port */
29     wdg_config_t  config; /**< wdg config */
30     void         *priv;   /**< priv data */
31 } wdg_dev_t;
32 
33 /**
34  * This function will initialize the on board CPU hardware watch dog
35  *
36  * @param[in]  wdg  the watch dog device
37  *
38  * @return  0 : on success,  otherwise is error
39  */
40 int32_t aos_hal_wdg_init(wdg_dev_t *wdg);
41 
42 /**
43  * Reload watchdog counter.
44  *
45  * @param[in]  wdg  the watch dog device
46  */
47 void aos_hal_wdg_reload(wdg_dev_t *wdg);
48 
49 /**
50  * This function performs any platform-specific cleanup needed for hardware watch dog.
51  *
52  * @param[in]  wdg  the watch dog device
53  *
54  * @return  0 : on success,  otherwise is error
55  */
56 int32_t aos_hal_wdg_finalize(wdg_dev_t *wdg);
57 
58 /** @} */
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 
64 #endif /* AOS_HAL_WDG_H */
65 
66