The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_SDT32620B/TOOLCHAIN_IAR/wdt.h@172:65be27845400, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 20:53:29 2019 +0000
- Revision:
- 172:65be27845400
- Parent:
- 171:3a7713b1edbc
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 167:84c0a372a020 | 1 | /** |
AnnaBridge | 167:84c0a372a020 | 2 | * @file |
AnnaBridge | 167:84c0a372a020 | 3 | * @brief This is the high level API for the watchdog timer interface module |
AnnaBridge | 167:84c0a372a020 | 4 | */ |
AnnaBridge | 167:84c0a372a020 | 5 | /* **************************************************************************** |
AnnaBridge | 167:84c0a372a020 | 6 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
AnnaBridge | 167:84c0a372a020 | 7 | * |
AnnaBridge | 167:84c0a372a020 | 8 | * Permission is hereby granted, free of charge, to any person obtaining a |
AnnaBridge | 167:84c0a372a020 | 9 | * copy of this software and associated documentation files (the "Software"), |
AnnaBridge | 167:84c0a372a020 | 10 | * to deal in the Software without restriction, including without limitation |
AnnaBridge | 167:84c0a372a020 | 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
AnnaBridge | 167:84c0a372a020 | 12 | * and/or sell copies of the Software, and to permit persons to whom the |
AnnaBridge | 167:84c0a372a020 | 13 | * Software is furnished to do so, subject to the following conditions: |
AnnaBridge | 167:84c0a372a020 | 14 | * |
AnnaBridge | 167:84c0a372a020 | 15 | * The above copyright notice and this permission notice shall be included |
AnnaBridge | 167:84c0a372a020 | 16 | * in all copies or substantial portions of the Software. |
AnnaBridge | 167:84c0a372a020 | 17 | * |
AnnaBridge | 167:84c0a372a020 | 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
AnnaBridge | 167:84c0a372a020 | 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
AnnaBridge | 167:84c0a372a020 | 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
AnnaBridge | 167:84c0a372a020 | 21 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
AnnaBridge | 167:84c0a372a020 | 22 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
AnnaBridge | 167:84c0a372a020 | 23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
AnnaBridge | 167:84c0a372a020 | 24 | * OTHER DEALINGS IN THE SOFTWARE. |
AnnaBridge | 167:84c0a372a020 | 25 | * |
AnnaBridge | 167:84c0a372a020 | 26 | * Except as contained in this notice, the name of Maxim Integrated |
AnnaBridge | 167:84c0a372a020 | 27 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
AnnaBridge | 167:84c0a372a020 | 28 | * Products, Inc. Branding Policy. |
AnnaBridge | 167:84c0a372a020 | 29 | * |
AnnaBridge | 167:84c0a372a020 | 30 | * The mere transfer of this software does not imply any licenses |
AnnaBridge | 167:84c0a372a020 | 31 | * of trade secrets, proprietary technology, copyrights, patents, |
AnnaBridge | 167:84c0a372a020 | 32 | * trademarks, maskwork rights, or any other form of intellectual |
AnnaBridge | 167:84c0a372a020 | 33 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
AnnaBridge | 167:84c0a372a020 | 34 | * ownership rights. |
AnnaBridge | 167:84c0a372a020 | 35 | * |
AnnaBridge | 167:84c0a372a020 | 36 | * $Date: 2017-02-16 12:00:47 -0600 (Thu, 16 Feb 2017) $ |
AnnaBridge | 167:84c0a372a020 | 37 | * $Revision: 26461 $ |
AnnaBridge | 167:84c0a372a020 | 38 | * |
AnnaBridge | 167:84c0a372a020 | 39 | **************************************************************************** */ |
AnnaBridge | 167:84c0a372a020 | 40 | |
AnnaBridge | 167:84c0a372a020 | 41 | /* Define to prevent redundant inclusion */ |
AnnaBridge | 167:84c0a372a020 | 42 | #ifndef _WDT_H |
AnnaBridge | 167:84c0a372a020 | 43 | #define _WDT_H |
AnnaBridge | 167:84c0a372a020 | 44 | |
AnnaBridge | 167:84c0a372a020 | 45 | /* **** Includes **** */ |
AnnaBridge | 167:84c0a372a020 | 46 | #include "mxc_config.h" |
AnnaBridge | 167:84c0a372a020 | 47 | #include "wdt_regs.h" |
AnnaBridge | 167:84c0a372a020 | 48 | #include "mxc_assert.h" |
AnnaBridge | 167:84c0a372a020 | 49 | #include "mxc_sys.h" |
AnnaBridge | 167:84c0a372a020 | 50 | |
AnnaBridge | 167:84c0a372a020 | 51 | #ifdef __cplusplus |
AnnaBridge | 167:84c0a372a020 | 52 | extern "C" { |
AnnaBridge | 167:84c0a372a020 | 53 | #endif |
AnnaBridge | 167:84c0a372a020 | 54 | /** |
AnnaBridge | 167:84c0a372a020 | 55 | * @ingroup periphlibs |
AnnaBridge | 167:84c0a372a020 | 56 | * @defgroup wdttimers Watch Dog Timers |
AnnaBridge | 167:84c0a372a020 | 57 | * @brief Watch Dog Timer High Level APIs. |
AnnaBridge | 167:84c0a372a020 | 58 | */ |
AnnaBridge | 167:84c0a372a020 | 59 | /** |
AnnaBridge | 167:84c0a372a020 | 60 | * @ingroup wdttimers |
AnnaBridge | 167:84c0a372a020 | 61 | * @defgroup wdt0 Watch Dog Timer 0/1 |
AnnaBridge | 167:84c0a372a020 | 62 | * @brief WDT0/WDT1 configuration and control API. |
AnnaBridge | 167:84c0a372a020 | 63 | * @{ |
AnnaBridge | 167:84c0a372a020 | 64 | */ |
AnnaBridge | 167:84c0a372a020 | 65 | |
AnnaBridge | 167:84c0a372a020 | 66 | /** |
AnnaBridge | 167:84c0a372a020 | 67 | * Definition used for clearing all of the WDT instances flags for Timeout, Pre-Window and Reset Out. |
AnnaBridge | 167:84c0a372a020 | 68 | */ |
AnnaBridge | 167:84c0a372a020 | 69 | #define WDT_FLAGS_CLEAR_ALL (MXC_F_WDT_FLAGS_TIMEOUT| MXC_F_WDT_FLAGS_PRE_WIN | MXC_F_WDT_FLAGS_RESET_OUT) |
AnnaBridge | 167:84c0a372a020 | 70 | /** |
AnnaBridge | 167:84c0a372a020 | 71 | * Enumeration type to define the Watchdog Timer's Period |
AnnaBridge | 167:84c0a372a020 | 72 | */ |
AnnaBridge | 167:84c0a372a020 | 73 | typedef enum { |
AnnaBridge | 167:84c0a372a020 | 74 | WDT_PERIOD_2_31_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_31_CLKS, /**< \f$ 2^{31} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 75 | WDT_PERIOD_2_30_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_30_CLKS, /**< \f$ 2^{30} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 76 | WDT_PERIOD_2_29_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_29_CLKS, /**< \f$ 2^{29} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 77 | WDT_PERIOD_2_28_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_28_CLKS, /**< \f$ 2^{28} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 78 | WDT_PERIOD_2_27_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_27_CLKS, /**< \f$ 2^{27} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 79 | WDT_PERIOD_2_26_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_26_CLKS, /**< \f$ 2^{26} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 80 | WDT_PERIOD_2_25_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_25_CLKS, /**< \f$ 2^{25} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 81 | WDT_PERIOD_2_24_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_24_CLKS, /**< \f$ 2^{24} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 82 | WDT_PERIOD_2_23_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_23_CLKS, /**< \f$ 2^{23} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 83 | WDT_PERIOD_2_22_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_22_CLKS, /**< \f$ 2^{22} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 84 | WDT_PERIOD_2_21_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_21_CLKS, /**< \f$ 2^{21} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 85 | WDT_PERIOD_2_20_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_20_CLKS, /**< \f$ 2^{20} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 86 | WDT_PERIOD_2_19_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_19_CLKS, /**< \f$ 2^{19} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 87 | WDT_PERIOD_2_18_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_18_CLKS, /**< \f$ 2^{18} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 88 | WDT_PERIOD_2_17_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_17_CLKS, /**< \f$ 2^{17} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 89 | WDT_PERIOD_2_16_CLKS = MXC_V_WDT_CTRL_INT_PERIOD_2_16_CLKS, /**< \f$ 2^{16} \f$ WDT clocks. */ |
AnnaBridge | 167:84c0a372a020 | 90 | WDT_PERIOD_MAX /**< Maximum Period is Max - 1 */ |
AnnaBridge | 167:84c0a372a020 | 91 | } wdt_period_t; |
AnnaBridge | 167:84c0a372a020 | 92 | |
AnnaBridge | 167:84c0a372a020 | 93 | /** |
AnnaBridge | 167:84c0a372a020 | 94 | * @brief Initializes system level clocks and sets watchdog in a known disabled state |
AnnaBridge | 167:84c0a372a020 | 95 | * @note The clk_scale in cfg is only used if the system clock is selected for clk. |
AnnaBridge | 167:84c0a372a020 | 96 | * |
AnnaBridge | 167:84c0a372a020 | 97 | * @param wdt Pointer to the Watchdog Timer Instance |
AnnaBridge | 167:84c0a372a020 | 98 | * @param cfg Watchdog system configuration, see sys_cfg_wdt_t. |
AnnaBridge | 167:84c0a372a020 | 99 | * @param unlock_key Watchdog unlock key |
AnnaBridge | 167:84c0a372a020 | 100 | * |
AnnaBridge | 167:84c0a372a020 | 101 | * @retval #E_NO_ERROR Watchdog Timer initialized as requested |
AnnaBridge | 167:84c0a372a020 | 102 | * @retval #E_NULL_PTR NULL pointer for Watchdog Timer Instance or Configuration parameters. |
AnnaBridge | 167:84c0a372a020 | 103 | * @retval #E_BAD_STATE Invalid unlock_key, WDT failed to unlock. |
AnnaBridge | 167:84c0a372a020 | 104 | */ |
AnnaBridge | 167:84c0a372a020 | 105 | int WDT_Init(mxc_wdt_regs_t *wdt, const sys_cfg_wdt_t *cfg, uint8_t unlock_key); |
AnnaBridge | 167:84c0a372a020 | 106 | |
AnnaBridge | 167:84c0a372a020 | 107 | /** |
AnnaBridge | 167:84c0a372a020 | 108 | * @brief Configures and enables the interrupt timeout for the watchdog specified. |
AnnaBridge | 167:84c0a372a020 | 109 | * |
AnnaBridge | 167:84c0a372a020 | 110 | * @param wdt Watchdog module to operate on |
AnnaBridge | 167:84c0a372a020 | 111 | * @param int_period Interrupt period as defined by wdt_period_t. |
AnnaBridge | 167:84c0a372a020 | 112 | * @param unlock_key Key to unlock watchdog. See #MXC_V_WDT_UNLOCK_KEY. |
AnnaBridge | 167:84c0a372a020 | 113 | * |
AnnaBridge | 167:84c0a372a020 | 114 | * @retval #E_NO_ERROR Interrupt enabled |
AnnaBridge | 167:84c0a372a020 | 115 | * @retval #E_BAD_STATE Invalid unlock_key, WDT failed to unlock. |
AnnaBridge | 167:84c0a372a020 | 116 | */ |
AnnaBridge | 167:84c0a372a020 | 117 | int WDT_EnableInt(mxc_wdt_regs_t *wdt, wdt_period_t int_period, uint8_t unlock_key); |
AnnaBridge | 167:84c0a372a020 | 118 | |
AnnaBridge | 167:84c0a372a020 | 119 | /** |
AnnaBridge | 167:84c0a372a020 | 120 | * @brief Disables the interrupt timeout for the watchdog specified. |
AnnaBridge | 167:84c0a372a020 | 121 | * |
AnnaBridge | 167:84c0a372a020 | 122 | * @param wdt Pointer to the Watchdog Timer Instance |
AnnaBridge | 167:84c0a372a020 | 123 | * @param unlock_key Key to unlock watchdog. See #MXC_V_WDT_UNLOCK_KEY. |
AnnaBridge | 167:84c0a372a020 | 124 | * |
AnnaBridge | 167:84c0a372a020 | 125 | * @retval #E_NO_ERROR Interrupt disabled. |
AnnaBridge | 167:84c0a372a020 | 126 | * @retval #E_BAD_STATE Invalid unlock_key, WDT failed to unlock. |
AnnaBridge | 167:84c0a372a020 | 127 | */ |
AnnaBridge | 167:84c0a372a020 | 128 | int WDT_DisableInt(mxc_wdt_regs_t *wdt, uint8_t unlock_key); |
AnnaBridge | 167:84c0a372a020 | 129 | |
AnnaBridge | 167:84c0a372a020 | 130 | /** |
AnnaBridge | 167:84c0a372a020 | 131 | * @brief Configures and enables the pre-window timeout for the watchdog specified. |
AnnaBridge | 167:84c0a372a020 | 132 | * |
AnnaBridge | 167:84c0a372a020 | 133 | * @param wdt Pointer to the Watchdog Timer Instance |
AnnaBridge | 167:84c0a372a020 | 134 | * @param wait_period Pre-window period, see wdt_period_t for accepted values. |
AnnaBridge | 167:84c0a372a020 | 135 | * @param unlock_key Key to unlock watchdog. See #MXC_V_WDT_UNLOCK_KEY. |
AnnaBridge | 167:84c0a372a020 | 136 | * |
AnnaBridge | 167:84c0a372a020 | 137 | * @retval #E_NO_ERROR Pre-window timeout set to wait_period |
AnnaBridge | 167:84c0a372a020 | 138 | * @retval #E_BAD_STATE WDT unable to be unlocked |
AnnaBridge | 167:84c0a372a020 | 139 | * @retval #E_INVALID Requested Period is greater than the maximum supported |
AnnaBridge | 167:84c0a372a020 | 140 | */ |
AnnaBridge | 167:84c0a372a020 | 141 | int WDT_EnableWait(mxc_wdt_regs_t *wdt, wdt_period_t wait_period, uint8_t unlock_key); |
AnnaBridge | 167:84c0a372a020 | 142 | |
AnnaBridge | 167:84c0a372a020 | 143 | /** |
AnnaBridge | 167:84c0a372a020 | 144 | * @brief Disables the pre-window timeout for the watchdog specified. |
AnnaBridge | 167:84c0a372a020 | 145 | * |
AnnaBridge | 167:84c0a372a020 | 146 | * @param wdt Pointer to the Watchdog Timer Instance |
AnnaBridge | 167:84c0a372a020 | 147 | * @param unlock_key Key to unlock watchdog. See #MXC_V_WDT_UNLOCK_KEY. |
AnnaBridge | 167:84c0a372a020 | 148 | * |
AnnaBridge | 167:84c0a372a020 | 149 | * @retval #E_NO_ERROR Wait disabled. |
AnnaBridge | 167:84c0a372a020 | 150 | * @retval #E_BAD_STATE Invalid unlock_key, WDT failed to unlock. |
AnnaBridge | 167:84c0a372a020 | 151 | */ |
AnnaBridge | 167:84c0a372a020 | 152 | int WDT_DisableWait(mxc_wdt_regs_t *wdt, uint8_t unlock_key); |
AnnaBridge | 167:84c0a372a020 | 153 | |
AnnaBridge | 167:84c0a372a020 | 154 | /** |
AnnaBridge | 167:84c0a372a020 | 155 | * @brief Configures and enables the reset timeout for the watchdog specified. |
AnnaBridge | 167:84c0a372a020 | 156 | * |
AnnaBridge | 167:84c0a372a020 | 157 | * @param wdt Pointer to the Watchdog Timer Instance |
AnnaBridge | 167:84c0a372a020 | 158 | * @param rst_period Reset period, see wdt_period_t for accepted values. |
AnnaBridge | 167:84c0a372a020 | 159 | * @param unlock_key Key to unlock watchdog. See #MXC_V_WDT_UNLOCK_KEY. |
AnnaBridge | 167:84c0a372a020 | 160 | * |
AnnaBridge | 167:84c0a372a020 | 161 | * @retval #E_NO_ERROR Watchdog Timer Reset enabled with the rst_period time. |
AnnaBridge | 167:84c0a372a020 | 162 | * @retval #E_BAD_STATE Invalid unlock_key, WDT failed to unlock. |
AnnaBridge | 167:84c0a372a020 | 163 | * @retval #E_INVALID Requested Period is greater than the maximum supported |
AnnaBridge | 167:84c0a372a020 | 164 | */ |
AnnaBridge | 167:84c0a372a020 | 165 | int WDT_EnableReset(mxc_wdt_regs_t *wdt, wdt_period_t rst_period, uint8_t unlock_key); |
AnnaBridge | 167:84c0a372a020 | 166 | |
AnnaBridge | 167:84c0a372a020 | 167 | /** |
AnnaBridge | 167:84c0a372a020 | 168 | * @brief Disables the reset timeout for the watchdog specified. |
AnnaBridge | 167:84c0a372a020 | 169 | * |
AnnaBridge | 167:84c0a372a020 | 170 | * @param wdt Pointer to the Watchdog Timer Instance |
AnnaBridge | 167:84c0a372a020 | 171 | * @param unlock_key Key to unlock watchdog. See #MXC_V_WDT_UNLOCK_KEY. |
AnnaBridge | 167:84c0a372a020 | 172 | * |
AnnaBridge | 167:84c0a372a020 | 173 | * @retval #E_NO_ERROR Reset disabled. |
AnnaBridge | 167:84c0a372a020 | 174 | * @retval #E_BAD_STATE Invalid unlock_key, WDT failed to unlock. |
AnnaBridge | 167:84c0a372a020 | 175 | */ |
AnnaBridge | 167:84c0a372a020 | 176 | int WDT_DisableReset(mxc_wdt_regs_t *wdt, uint8_t unlock_key); |
AnnaBridge | 167:84c0a372a020 | 177 | |
AnnaBridge | 167:84c0a372a020 | 178 | /** |
AnnaBridge | 167:84c0a372a020 | 179 | * @brief Gets the watchdog interrupt flags |
AnnaBridge | 167:84c0a372a020 | 180 | * |
AnnaBridge | 167:84c0a372a020 | 181 | * @param wdt Pointer to the Watchdog Timer Instance. |
AnnaBridge | 167:84c0a372a020 | 182 | * |
AnnaBridge | 167:84c0a372a020 | 183 | * @retval uint32_t Value of the Watchdog Timer Flags. |
AnnaBridge | 167:84c0a372a020 | 184 | * |
AnnaBridge | 167:84c0a372a020 | 185 | */ |
AnnaBridge | 167:84c0a372a020 | 186 | __STATIC_INLINE uint32_t WDT_GetFlags(mxc_wdt_regs_t *wdt) |
AnnaBridge | 167:84c0a372a020 | 187 | { |
AnnaBridge | 167:84c0a372a020 | 188 | return (wdt->flags); |
AnnaBridge | 167:84c0a372a020 | 189 | } |
AnnaBridge | 167:84c0a372a020 | 190 | |
AnnaBridge | 167:84c0a372a020 | 191 | /** |
AnnaBridge | 167:84c0a372a020 | 192 | * @brief Clears the watchdog interrupt flags based on the mask |
AnnaBridge | 167:84c0a372a020 | 193 | * |
AnnaBridge | 167:84c0a372a020 | 194 | * @param wdt Pointer to the Watchdog Timer Instance |
AnnaBridge | 167:84c0a372a020 | 195 | * @param mask Watchdog Flags to clear |
AnnaBridge | 167:84c0a372a020 | 196 | * |
AnnaBridge | 167:84c0a372a020 | 197 | */ |
AnnaBridge | 167:84c0a372a020 | 198 | __STATIC_INLINE void WDT_ClearFlags(mxc_wdt_regs_t *wdt, uint32_t mask) |
AnnaBridge | 167:84c0a372a020 | 199 | { |
AnnaBridge | 167:84c0a372a020 | 200 | wdt->flags = mask; |
AnnaBridge | 167:84c0a372a020 | 201 | } |
AnnaBridge | 167:84c0a372a020 | 202 | |
AnnaBridge | 167:84c0a372a020 | 203 | /** |
AnnaBridge | 167:84c0a372a020 | 204 | * @brief Starts the specified Watchdog Timer instance. |
AnnaBridge | 167:84c0a372a020 | 205 | * |
AnnaBridge | 167:84c0a372a020 | 206 | * @param wdt Pointer to the Watchdog Timer instance |
AnnaBridge | 167:84c0a372a020 | 207 | * @param unlock_key Key to unlock watchdog. |
AnnaBridge | 167:84c0a372a020 | 208 | * |
AnnaBridge | 167:84c0a372a020 | 209 | * @retval #E_NO_ERROR Interrupt enabled. |
AnnaBridge | 167:84c0a372a020 | 210 | * @retval #E_BAD_STATE WDT1 Already Running |
AnnaBridge | 167:84c0a372a020 | 211 | * @retval #E_BAD_STATE Invalid unlock_key, WDT failed to unlock. |
AnnaBridge | 167:84c0a372a020 | 212 | * |
AnnaBridge | 167:84c0a372a020 | 213 | */ |
AnnaBridge | 167:84c0a372a020 | 214 | int WDT_Start(mxc_wdt_regs_t *wdt, uint8_t unlock_key); |
AnnaBridge | 167:84c0a372a020 | 215 | |
AnnaBridge | 167:84c0a372a020 | 216 | /** |
AnnaBridge | 167:84c0a372a020 | 217 | * @brief Feeds the watchdog specified. |
AnnaBridge | 167:84c0a372a020 | 218 | * |
AnnaBridge | 167:84c0a372a020 | 219 | * @param wdt Watchdog module to operate on |
AnnaBridge | 167:84c0a372a020 | 220 | * |
AnnaBridge | 167:84c0a372a020 | 221 | */ |
AnnaBridge | 167:84c0a372a020 | 222 | void WDT_Reset(mxc_wdt_regs_t *wdt); |
AnnaBridge | 167:84c0a372a020 | 223 | |
AnnaBridge | 167:84c0a372a020 | 224 | /** |
AnnaBridge | 167:84c0a372a020 | 225 | * @brief Stops the watchdog specified. |
AnnaBridge | 167:84c0a372a020 | 226 | * |
AnnaBridge | 167:84c0a372a020 | 227 | * @param wdt Pointer to the Watchdog Timer Instance |
AnnaBridge | 167:84c0a372a020 | 228 | * @param unlock_key Key to unlock watchdog. |
AnnaBridge | 167:84c0a372a020 | 229 | * |
AnnaBridge | 167:84c0a372a020 | 230 | * @retval #E_NO_ERROR Interrupt enabled. |
AnnaBridge | 167:84c0a372a020 | 231 | * @retval #E_BAD_STATE Invalid unlock_key, WDT failed to unlock. |
AnnaBridge | 167:84c0a372a020 | 232 | */ |
AnnaBridge | 167:84c0a372a020 | 233 | int WDT_Stop(mxc_wdt_regs_t *wdt, uint8_t unlock_key); |
AnnaBridge | 167:84c0a372a020 | 234 | |
AnnaBridge | 167:84c0a372a020 | 235 | /** |
AnnaBridge | 167:84c0a372a020 | 236 | * @brief Determines if the watchdog is running |
AnnaBridge | 167:84c0a372a020 | 237 | * |
AnnaBridge | 167:84c0a372a020 | 238 | * @param wdt Pointer to the Watchdog Timer Instance |
AnnaBridge | 167:84c0a372a020 | 239 | * |
AnnaBridge | 167:84c0a372a020 | 240 | * @retval 0 Watchdog timer is Disabled. |
AnnaBridge | 167:84c0a372a020 | 241 | * @retval non-zero Watchdog timer is Active |
AnnaBridge | 167:84c0a372a020 | 242 | */ |
AnnaBridge | 167:84c0a372a020 | 243 | __STATIC_INLINE int WDT_IsActive(mxc_wdt_regs_t *wdt) |
AnnaBridge | 167:84c0a372a020 | 244 | { |
AnnaBridge | 167:84c0a372a020 | 245 | return (!!(wdt->ctrl & MXC_F_WDT_CTRL_EN_TIMER)); |
AnnaBridge | 167:84c0a372a020 | 246 | } |
AnnaBridge | 167:84c0a372a020 | 247 | |
AnnaBridge | 167:84c0a372a020 | 248 | /**@} end of group wdt*/ |
AnnaBridge | 167:84c0a372a020 | 249 | |
AnnaBridge | 167:84c0a372a020 | 250 | #ifdef __cplusplus |
AnnaBridge | 167:84c0a372a020 | 251 | } |
AnnaBridge | 167:84c0a372a020 | 252 | #endif |
AnnaBridge | 167:84c0a372a020 | 253 | |
AnnaBridge | 167:84c0a372a020 | 254 | #endif /* _WDT_H */ |