• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 ASR Microelectronics (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 
16 #ifndef _DUET_WDG_H_
17 #define _DUET_WDG_H_
18 #include <stdint.h>
19 
20 typedef struct {
21     uint32_t timeout;  /* Watchdag timeout */
22 } duet_wdg_config_t;
23 
24 typedef struct {
25     uint8_t      port;   /* wdg port */
26     duet_wdg_config_t config; /* wdg config */
27     void        *priv;   /* priv data */
28 } duet_wdg_dev_t;
29 
30 /**
31  * This function will initialize the on board CPU hardware watch dog
32  *
33  * @param[in]  wdg  the watch dog device
34  *
35  * @return  0 : on success, EIO : if an error occurred with any step
36  */
37 int32_t duet_wdg_init(duet_wdg_dev_t *wdg);
38 
39 /**
40  * Reload watchdog counter.
41  *
42  * @param[in]  wdg  the watch dog device
43  */
44 void duet_wdg_reload(duet_wdg_dev_t *wdg);
45 
46 /**
47  * This function performs any platform-specific cleanup needed for hardware watch dog.
48  *
49  * @param[in]  wdg  the watch dog device
50  *
51  * @return  0 : on success, EIO : if an error occurred with any step
52  */
53 int32_t duet_wdg_finalize(duet_wdg_dev_t *wdg);
54 
55 #endif // _LEGA_WDG_H_