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 
158 #ifdef __cplusplus
159 extern "C" {
160 #endif
161 
162 
170 #define HAL_WDT_ENABLE_MAGIC (3405691582)
171 
172 
176 #define HAL_WDT_DISABLE_MAGIC (3405643877)
177 
178 
182 #define HAL_WDT_FEED_MAGIC (3735931646)
183 
194 typedef enum {
199 
200 
202 typedef enum {
207 
208 
210 typedef enum {
214 
215 
225 typedef struct {
227  uint32_t seconds;
229 
246 typedef void (*hal_wdt_callback_t)(hal_wdt_reset_status_t wdt_reset_status);
247 
248 
267 
268 
278 
279 
290 hal_wdt_status_t hal_wdt_enable(uint32_t magic);
291 
292 
303 hal_wdt_status_t hal_wdt_disable(uint32_t magic);
304 
305 
315 
316 
326 hal_wdt_status_t hal_wdt_feed(uint32_t magic);
327 
328 
362 
363 
388 
389 
405 bool hal_wdt_get_enable_status(void);
406 
407 
426 
427 
428 #ifdef __cplusplus
429 }
430 #endif
431 
432 
437 #endif /*HAL_WDT_MODULE_ENABLED*/
438 #endif /* __HAL_WDT_H__ */
439 
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:203
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:205
void(* hal_wdt_callback_t)(hal_wdt_reset_status_t wdt_reset_status)
This defines the callback function prototype.
Definition: hal_wdt.h:246
This structure defines the init config structure.
Definition: hal_wdt.h:225
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:204
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:202
hal_wdt_mode_t mode
Specify watchdog to reset mode or interrupt mode.
Definition: hal_wdt.h:226
uint32_t seconds
Specify the watchdog timer timeout value in seconds.
Definition: hal_wdt.h:227
hal_wdt_status_t
This enum define the API return type.
Definition: hal_wdt.h:194
WDT reset mode.
Definition: hal_wdt.h:211
A wrong parameter is given.
Definition: hal_wdt.h:195
No error occurred during the function call.
Definition: hal_wdt.h:197
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:210
WDT interrupt mode.
Definition: hal_wdt.h:212
A wrong magic number is given.
Definition: hal_wdt.h:196
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.