1 /** mbed Microcontroller Library 2 ****************************************************************************** 3 * @file wdt_api.h 4 * @author 5 * @version V1.0.0 6 * @brief This file provides following mbed WDT API 7 ****************************************************************************** 8 * @attention 9 * 10 * Copyright (c) 2015, Realtek Semiconductor Corp. 11 * All rights reserved. 12 * 13 * This module is a confidential and proprietary property of RealTek and 14 * possession or use of this module requires written permission of RealTek. 15 ****************************************************************************** 16 */ 17 #ifndef MBED_WATCHDOG_API_H 18 #define MBED_WATCHDOG_API_H 19 20 #include "device.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /** @addtogroup wdt WDT 27 * @ingroup hal 28 * @brief wdt functions 29 * @{ 30 */ 31 32 33 ///@name Ameba Common 34 ///@{ 35 36 typedef void (*wdt_irq_handler)(uint32_t id); 37 /** 38 * @brief Initializes the watch dog, include time setting, mode register 39 * @param timeout_ms: the watch-dog timer timeout value, in ms. 40 * default action of timeout is to reset the whole system. 41 * @retval none 42 */ 43 void watchdog_init(uint32_t timeout_ms); 44 45 /** 46 * @brief Start the watchdog counting 47 * @param None 48 * @retval none 49 */ 50 void watchdog_start(void); 51 52 /** 53 * @brief Stop the watchdog counting 54 * @param None 55 * @retval none 56 */ 57 void watchdog_stop(void); 58 59 /** 60 * @brief Refresh the watchdog counting to prevent WDT timeout 61 * @param None 62 * @retval none 63 */ 64 void watchdog_refresh(void); 65 66 /** 67 * @brief Switch the watchdog timer to interrupt mode and 68 * register a watchdog timer timeout interrupt handler. 69 * The interrupt handler will be called when the watch-dog 70 * timer is timeout. 71 * @param handler: the callback function for WDT timeout interrupt. 72 * @param id: the parameter for the callback function 73 * @retval none 74 */ 75 void watchdog_irq_init(wdt_irq_handler handler, uint32_t id); 76 ///@} 77 78 /*\@}*/ 79 80 #ifdef __cplusplus 81 } 82 #endif 83 84 #endif 85