MT2523 API Reference  LinkIt SDK v4
hal_wdt.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __HAL_WDT_H__
36 #define __HAL_WDT_H__
37 #include "hal_platform.h"
38 
39 #ifdef HAL_WDT_MODULE_ENABLED
40 
156 #ifdef __cplusplus
157 extern "C" {
158 #endif
159 
160 
168 #define HAL_WDT_ENABLE_MAGIC (3405691582)
169 
170 
174 #define HAL_WDT_DISABLE_MAGIC (3405643877)
175 
176 
180 #define HAL_WDT_FEED_MAGIC (3735931646)
181 
192 typedef enum {
197 
198 
200 typedef enum {
205 
206 
208 typedef enum {
212 
213 
223 typedef struct {
225  uint32_t seconds;
227 
244 typedef void (*hal_wdt_callback_t)(hal_wdt_reset_status_t wdt_reset_status);
245 
246 
265 
266 
276 
277 
288 hal_wdt_status_t hal_wdt_enable(uint32_t magic);
289 
290 
301 hal_wdt_status_t hal_wdt_disable(uint32_t magic);
302 
303 
313 
314 
324 hal_wdt_status_t hal_wdt_feed(uint32_t magic);
325 
326 
360 
361 
386 
387 
403 bool hal_wdt_get_enable_status(void);
404 
405 
424 
425 
426 #ifdef __cplusplus
427 }
428 #endif
429 
430 
435 #endif /*HAL_WDT_MODULE_ENABLED*/
436 #endif /* __HAL_WDT_H__ */
437 
hal_wdt_status_t hal_wdt_deinit(void)
De-initialize the watchdog.
The WDT reset/interrupt occurred because the timer counts down to 0 .
Definition: hal_wdt.h:201
hal_wdt_status_t hal_wdt_feed(uint32_t magic)
This function is used to feed the watchdog(restart the watchdog timer).
hal_wdt_status_t hal_wdt_enable(uint32_t magic)
Enable the watchdog timer.
The no WDT reset/interrupt occurred.
Definition: hal_wdt.h:203
void(* hal_wdt_callback_t)(hal_wdt_reset_status_t wdt_reset_status)
This defines the callback function prototype.
Definition: hal_wdt.h:244
This structure defines the init config structure.
Definition: hal_wdt.h:223
hal_wdt_mode_t hal_wdt_get_mode(void)
Get the current mode of the WDT.
The WDT reset/interrupt occurred because the software reset register is set .
Definition: hal_wdt.h:202
hal_wdt_reset_status_t hal_wdt_get_reset_status(void)
Get the status of last watchdog reset/interrupt.
hal_wdt_reset_status_t
This enum define the WDT reset status.
Definition: hal_wdt.h:200
hal_wdt_mode_t mode
Specify watchdog to reset mode or interrupt mode.
Definition: hal_wdt.h:224
uint32_t seconds
Specify the watchdog timer timeout value in seconds.
Definition: hal_wdt.h:225
hal_wdt_status_t
This enum define the API return type.
Definition: hal_wdt.h:192
WDT reset mode.
Definition: hal_wdt.h:209
A wrong parameter is given.
Definition: hal_wdt.h:193
No error occurred during the function call.
Definition: hal_wdt.h:195
hal_wdt_status_t hal_wdt_software_reset(void)
This function is used to trigger a watchdog reset manually.
hal_wdt_status_t hal_wdt_disable(uint32_t magic)
Disable the watchdog timer.
hal_wdt_status_t hal_wdt_init(hal_wdt_config_t *wdt_config)
This function is mainly used to initialize the watchdog hardware.
hal_wdt_mode_t
This enum defines the WDT mode.
Definition: hal_wdt.h:208
WDT interrupt mode.
Definition: hal_wdt.h:210
A wrong magic number is given.
Definition: hal_wdt.h:194
hal_wdt_callback_t hal_wdt_register_callback(hal_wdt_callback_t wdt_callback)
Register a callback function while using interrupt mode.
bool hal_wdt_get_enable_status(void)
Get the enable status of the WDT.