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