mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F411RE/stm32f4xx_hal_iwdg.h@310:6188e0254baa, 2014-09-16 (annotated)
- Committer:
- janekm
- Date:
- Tue Sep 16 22:42:01 2014 +0000
- Revision:
- 310:6188e0254baa
- Parent:
- 235:685d5f11838f
N/A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 235:685d5f11838f | 1 | /** |
mbed_official | 235:685d5f11838f | 2 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 3 | * @file stm32f4xx_hal_iwdg.h |
mbed_official | 235:685d5f11838f | 4 | * @author MCD Application Team |
mbed_official | 235:685d5f11838f | 5 | * @version V1.1.0 |
mbed_official | 235:685d5f11838f | 6 | * @date 19-June-2014 |
mbed_official | 235:685d5f11838f | 7 | * @brief Header file of IWDG HAL module. |
mbed_official | 235:685d5f11838f | 8 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 9 | * @attention |
mbed_official | 235:685d5f11838f | 10 | * |
mbed_official | 235:685d5f11838f | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 235:685d5f11838f | 12 | * |
mbed_official | 235:685d5f11838f | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 235:685d5f11838f | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 235:685d5f11838f | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 235:685d5f11838f | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 235:685d5f11838f | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 235:685d5f11838f | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 235:685d5f11838f | 19 | * and/or other materials provided with the distribution. |
mbed_official | 235:685d5f11838f | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 235:685d5f11838f | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 235:685d5f11838f | 22 | * without specific prior written permission. |
mbed_official | 235:685d5f11838f | 23 | * |
mbed_official | 235:685d5f11838f | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 235:685d5f11838f | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 235:685d5f11838f | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 235:685d5f11838f | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 235:685d5f11838f | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 235:685d5f11838f | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 235:685d5f11838f | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 235:685d5f11838f | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 235:685d5f11838f | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 235:685d5f11838f | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 235:685d5f11838f | 34 | * |
mbed_official | 235:685d5f11838f | 35 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 36 | */ |
mbed_official | 235:685d5f11838f | 37 | |
mbed_official | 235:685d5f11838f | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 235:685d5f11838f | 39 | #ifndef __STM32F4xx_HAL_IWDG_H |
mbed_official | 235:685d5f11838f | 40 | #define __STM32F4xx_HAL_IWDG_H |
mbed_official | 235:685d5f11838f | 41 | |
mbed_official | 235:685d5f11838f | 42 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 43 | extern "C" { |
mbed_official | 235:685d5f11838f | 44 | #endif |
mbed_official | 235:685d5f11838f | 45 | |
mbed_official | 235:685d5f11838f | 46 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 47 | #include "stm32f4xx_hal_def.h" |
mbed_official | 235:685d5f11838f | 48 | |
mbed_official | 235:685d5f11838f | 49 | /** @addtogroup STM32F4xx_HAL_Driver |
mbed_official | 235:685d5f11838f | 50 | * @{ |
mbed_official | 235:685d5f11838f | 51 | */ |
mbed_official | 235:685d5f11838f | 52 | |
mbed_official | 235:685d5f11838f | 53 | /** @addtogroup IWDG |
mbed_official | 235:685d5f11838f | 54 | * @{ |
mbed_official | 235:685d5f11838f | 55 | */ |
mbed_official | 235:685d5f11838f | 56 | |
mbed_official | 235:685d5f11838f | 57 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 58 | |
mbed_official | 235:685d5f11838f | 59 | /** |
mbed_official | 235:685d5f11838f | 60 | * @brief IWDG HAL State Structure definition |
mbed_official | 235:685d5f11838f | 61 | */ |
mbed_official | 235:685d5f11838f | 62 | typedef enum |
mbed_official | 235:685d5f11838f | 63 | { |
mbed_official | 235:685d5f11838f | 64 | HAL_IWDG_STATE_RESET = 0x00, /*!< IWDG not yet initialized or disabled */ |
mbed_official | 235:685d5f11838f | 65 | HAL_IWDG_STATE_READY = 0x01, /*!< IWDG initialized and ready for use */ |
mbed_official | 235:685d5f11838f | 66 | HAL_IWDG_STATE_BUSY = 0x02, /*!< IWDG internal process is ongoing */ |
mbed_official | 235:685d5f11838f | 67 | HAL_IWDG_STATE_TIMEOUT = 0x03, /*!< IWDG timeout state */ |
mbed_official | 235:685d5f11838f | 68 | HAL_IWDG_STATE_ERROR = 0x04 /*!< IWDG error state */ |
mbed_official | 235:685d5f11838f | 69 | |
mbed_official | 235:685d5f11838f | 70 | }HAL_IWDG_StateTypeDef; |
mbed_official | 235:685d5f11838f | 71 | |
mbed_official | 235:685d5f11838f | 72 | /** |
mbed_official | 235:685d5f11838f | 73 | * @brief IWDG Init structure definition |
mbed_official | 235:685d5f11838f | 74 | */ |
mbed_official | 235:685d5f11838f | 75 | typedef struct |
mbed_official | 235:685d5f11838f | 76 | { |
mbed_official | 235:685d5f11838f | 77 | uint32_t Prescaler; /*!< Select the prescaler of the IWDG. |
mbed_official | 235:685d5f11838f | 78 | This parameter can be a value of @ref IWDG_Prescaler */ |
mbed_official | 235:685d5f11838f | 79 | |
mbed_official | 235:685d5f11838f | 80 | uint32_t Reload; /*!< Specifies the IWDG down-counter reload value. |
mbed_official | 235:685d5f11838f | 81 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */ |
mbed_official | 235:685d5f11838f | 82 | |
mbed_official | 235:685d5f11838f | 83 | }IWDG_InitTypeDef; |
mbed_official | 235:685d5f11838f | 84 | |
mbed_official | 235:685d5f11838f | 85 | /** |
mbed_official | 235:685d5f11838f | 86 | * @brief IWDG handle Structure definition |
mbed_official | 235:685d5f11838f | 87 | */ |
mbed_official | 235:685d5f11838f | 88 | typedef struct |
mbed_official | 235:685d5f11838f | 89 | { |
mbed_official | 235:685d5f11838f | 90 | IWDG_TypeDef *Instance; /*!< Register base address */ |
mbed_official | 235:685d5f11838f | 91 | |
mbed_official | 235:685d5f11838f | 92 | IWDG_InitTypeDef Init; /*!< IWDG required parameters */ |
mbed_official | 235:685d5f11838f | 93 | |
mbed_official | 235:685d5f11838f | 94 | HAL_LockTypeDef Lock; /*!< IWDG locking object */ |
mbed_official | 235:685d5f11838f | 95 | |
mbed_official | 235:685d5f11838f | 96 | __IO HAL_IWDG_StateTypeDef State; /*!< IWDG communication state */ |
mbed_official | 235:685d5f11838f | 97 | |
mbed_official | 235:685d5f11838f | 98 | }IWDG_HandleTypeDef; |
mbed_official | 235:685d5f11838f | 99 | |
mbed_official | 235:685d5f11838f | 100 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 101 | /** @defgroup IWDG_Exported_Constants |
mbed_official | 235:685d5f11838f | 102 | * @{ |
mbed_official | 235:685d5f11838f | 103 | */ |
mbed_official | 235:685d5f11838f | 104 | |
mbed_official | 235:685d5f11838f | 105 | /** @defgroup IWDG_Registers_BitMask |
mbed_official | 235:685d5f11838f | 106 | * @{ |
mbed_official | 235:685d5f11838f | 107 | */ |
mbed_official | 235:685d5f11838f | 108 | /* --- KR Register ---*/ |
mbed_official | 235:685d5f11838f | 109 | /* KR register bit mask */ |
mbed_official | 235:685d5f11838f | 110 | #define KR_KEY_RELOAD ((uint32_t)0xAAAA) /*!< IWDG reload counter enable */ |
mbed_official | 235:685d5f11838f | 111 | #define KR_KEY_ENABLE ((uint32_t)0xCCCC) /*!< IWDG peripheral enable */ |
mbed_official | 235:685d5f11838f | 112 | #define KR_KEY_EWA ((uint32_t)0x5555) /*!< IWDG KR write Access enable */ |
mbed_official | 235:685d5f11838f | 113 | #define KR_KEY_DWA ((uint32_t)0x0000) /*!< IWDG KR write Access disable */ |
mbed_official | 235:685d5f11838f | 114 | |
mbed_official | 235:685d5f11838f | 115 | #define IS_IWDG_KR(__KR__) (((__KR__) == KR_KEY_RELOAD) || \ |
mbed_official | 235:685d5f11838f | 116 | ((__KR__) == KR_KEY_ENABLE))|| \ |
mbed_official | 235:685d5f11838f | 117 | ((__KR__) == KR_KEY_EWA)) || \ |
mbed_official | 235:685d5f11838f | 118 | ((__KR__) == KR_KEY_DWA)) |
mbed_official | 235:685d5f11838f | 119 | /** |
mbed_official | 235:685d5f11838f | 120 | * @} |
mbed_official | 235:685d5f11838f | 121 | */ |
mbed_official | 235:685d5f11838f | 122 | |
mbed_official | 235:685d5f11838f | 123 | /** @defgroup IWDG_Flag_definition |
mbed_official | 235:685d5f11838f | 124 | * @{ |
mbed_official | 235:685d5f11838f | 125 | */ |
mbed_official | 235:685d5f11838f | 126 | #define IWDG_FLAG_PVU ((uint32_t)0x0001) /*!< Watchdog counter prescaler value update flag */ |
mbed_official | 235:685d5f11838f | 127 | #define IWDG_FLAG_RVU ((uint32_t)0x0002) /*!< Watchdog counter reload value update flag */ |
mbed_official | 235:685d5f11838f | 128 | |
mbed_official | 235:685d5f11838f | 129 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || \ |
mbed_official | 235:685d5f11838f | 130 | ((FLAG) == IWDG_FLAG_RVU)) |
mbed_official | 235:685d5f11838f | 131 | |
mbed_official | 235:685d5f11838f | 132 | /** |
mbed_official | 235:685d5f11838f | 133 | * @} |
mbed_official | 235:685d5f11838f | 134 | */ |
mbed_official | 235:685d5f11838f | 135 | |
mbed_official | 235:685d5f11838f | 136 | /** @defgroup IWDG_Prescaler |
mbed_official | 235:685d5f11838f | 137 | * @{ |
mbed_official | 235:685d5f11838f | 138 | */ |
mbed_official | 235:685d5f11838f | 139 | #define IWDG_PRESCALER_4 ((uint8_t)0x00) /*!< IWDG prescaler set to 4 */ |
mbed_official | 235:685d5f11838f | 140 | #define IWDG_PRESCALER_8 ((uint8_t)(IWDG_PR_PR_0)) /*!< IWDG prescaler set to 8 */ |
mbed_official | 235:685d5f11838f | 141 | #define IWDG_PRESCALER_16 ((uint8_t)(IWDG_PR_PR_1)) /*!< IWDG prescaler set to 16 */ |
mbed_official | 235:685d5f11838f | 142 | #define IWDG_PRESCALER_32 ((uint8_t)(IWDG_PR_PR_1 | IWDG_PR_PR_0)) /*!< IWDG prescaler set to 32 */ |
mbed_official | 235:685d5f11838f | 143 | #define IWDG_PRESCALER_64 ((uint8_t)(IWDG_PR_PR_2)) /*!< IWDG prescaler set to 64 */ |
mbed_official | 235:685d5f11838f | 144 | #define IWDG_PRESCALER_128 ((uint8_t)(IWDG_PR_PR_2 | IWDG_PR_PR_0)) /*!< IWDG prescaler set to 128 */ |
mbed_official | 235:685d5f11838f | 145 | #define IWDG_PRESCALER_256 ((uint8_t)(IWDG_PR_PR_2 | IWDG_PR_PR_1)) /*!< IWDG prescaler set to 256 */ |
mbed_official | 235:685d5f11838f | 146 | |
mbed_official | 235:685d5f11838f | 147 | |
mbed_official | 235:685d5f11838f | 148 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_PRESCALER_4) || \ |
mbed_official | 235:685d5f11838f | 149 | ((PRESCALER) == IWDG_PRESCALER_8) || \ |
mbed_official | 235:685d5f11838f | 150 | ((PRESCALER) == IWDG_PRESCALER_16) || \ |
mbed_official | 235:685d5f11838f | 151 | ((PRESCALER) == IWDG_PRESCALER_32) || \ |
mbed_official | 235:685d5f11838f | 152 | ((PRESCALER) == IWDG_PRESCALER_64) || \ |
mbed_official | 235:685d5f11838f | 153 | ((PRESCALER) == IWDG_PRESCALER_128)|| \ |
mbed_official | 235:685d5f11838f | 154 | ((PRESCALER) == IWDG_PRESCALER_256)) |
mbed_official | 235:685d5f11838f | 155 | |
mbed_official | 235:685d5f11838f | 156 | /** |
mbed_official | 235:685d5f11838f | 157 | * @} |
mbed_official | 235:685d5f11838f | 158 | */ |
mbed_official | 235:685d5f11838f | 159 | |
mbed_official | 235:685d5f11838f | 160 | /** @defgroup IWDG_Reload_Value |
mbed_official | 235:685d5f11838f | 161 | * @{ |
mbed_official | 235:685d5f11838f | 162 | */ |
mbed_official | 235:685d5f11838f | 163 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) |
mbed_official | 235:685d5f11838f | 164 | |
mbed_official | 235:685d5f11838f | 165 | /** |
mbed_official | 235:685d5f11838f | 166 | * @} |
mbed_official | 235:685d5f11838f | 167 | */ |
mbed_official | 235:685d5f11838f | 168 | |
mbed_official | 235:685d5f11838f | 169 | /** |
mbed_official | 235:685d5f11838f | 170 | * @} |
mbed_official | 235:685d5f11838f | 171 | */ |
mbed_official | 235:685d5f11838f | 172 | |
mbed_official | 235:685d5f11838f | 173 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 174 | |
mbed_official | 235:685d5f11838f | 175 | /** @brief Reset IWDG handle state |
mbed_official | 235:685d5f11838f | 176 | * @param __HANDLE__: IWDG handle |
mbed_official | 235:685d5f11838f | 177 | * @retval None |
mbed_official | 235:685d5f11838f | 178 | */ |
mbed_official | 235:685d5f11838f | 179 | #define __HAL_IWDG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_IWDG_STATE_RESET) |
mbed_official | 235:685d5f11838f | 180 | |
mbed_official | 235:685d5f11838f | 181 | /** |
mbed_official | 235:685d5f11838f | 182 | * @brief Enables the IWDG peripheral. |
mbed_official | 235:685d5f11838f | 183 | * @param __HANDLE__: IWDG handle |
mbed_official | 235:685d5f11838f | 184 | * @retval None |
mbed_official | 235:685d5f11838f | 185 | */ |
mbed_official | 235:685d5f11838f | 186 | #define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, KR_KEY_ENABLE) |
mbed_official | 235:685d5f11838f | 187 | |
mbed_official | 235:685d5f11838f | 188 | /** |
mbed_official | 235:685d5f11838f | 189 | * @brief Reloads IWDG counter with value defined in the reload register |
mbed_official | 235:685d5f11838f | 190 | * (write access to IWDG_PR and IWDG_RLR registers disabled). |
mbed_official | 235:685d5f11838f | 191 | * @param __HANDLE__: IWDG handle |
mbed_official | 235:685d5f11838f | 192 | * @retval None |
mbed_official | 235:685d5f11838f | 193 | */ |
mbed_official | 235:685d5f11838f | 194 | #define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, KR_KEY_RELOAD) |
mbed_official | 235:685d5f11838f | 195 | |
mbed_official | 235:685d5f11838f | 196 | /** |
mbed_official | 235:685d5f11838f | 197 | * @brief Enables write access to IWDG_PR and IWDG_RLR registers. |
mbed_official | 235:685d5f11838f | 198 | * @param __HANDLE__: IWDG handle |
mbed_official | 235:685d5f11838f | 199 | * @retval None |
mbed_official | 235:685d5f11838f | 200 | */ |
mbed_official | 235:685d5f11838f | 201 | #define __HAL_IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, KR_KEY_EWA) |
mbed_official | 235:685d5f11838f | 202 | |
mbed_official | 235:685d5f11838f | 203 | /** |
mbed_official | 235:685d5f11838f | 204 | * @brief Disables write access to IWDG_PR and IWDG_RLR registers. |
mbed_official | 235:685d5f11838f | 205 | * @param __HANDLE__: IWDG handle |
mbed_official | 235:685d5f11838f | 206 | * @retval None |
mbed_official | 235:685d5f11838f | 207 | */ |
mbed_official | 235:685d5f11838f | 208 | #define __HAL_IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, KR_KEY_DWA) |
mbed_official | 235:685d5f11838f | 209 | |
mbed_official | 235:685d5f11838f | 210 | /** |
mbed_official | 235:685d5f11838f | 211 | * @brief Gets the selected IWDG's flag status. |
mbed_official | 235:685d5f11838f | 212 | * @param __HANDLE__: IWDG handle |
mbed_official | 235:685d5f11838f | 213 | * @param __FLAG__: specifies the flag to check. |
mbed_official | 235:685d5f11838f | 214 | * This parameter can be one of the following values: |
mbed_official | 235:685d5f11838f | 215 | * @arg IWDG_FLAG_PVU: Watchdog counter reload value update flag |
mbed_official | 235:685d5f11838f | 216 | * @arg IWDG_FLAG_RVU: Watchdog counter prescaler value flag |
mbed_official | 235:685d5f11838f | 217 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
mbed_official | 235:685d5f11838f | 218 | */ |
mbed_official | 235:685d5f11838f | 219 | #define __HAL_IWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) |
mbed_official | 235:685d5f11838f | 220 | |
mbed_official | 235:685d5f11838f | 221 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 222 | |
mbed_official | 235:685d5f11838f | 223 | /* Initialization/de-initialization functions ********************************/ |
mbed_official | 235:685d5f11838f | 224 | HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg); |
mbed_official | 235:685d5f11838f | 225 | void HAL_IWDG_MspInit(IWDG_HandleTypeDef *hiwdg); |
mbed_official | 235:685d5f11838f | 226 | |
mbed_official | 235:685d5f11838f | 227 | /* I/O operation functions ****************************************************/ |
mbed_official | 235:685d5f11838f | 228 | HAL_StatusTypeDef HAL_IWDG_Start(IWDG_HandleTypeDef *hiwdg); |
mbed_official | 235:685d5f11838f | 229 | HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg); |
mbed_official | 235:685d5f11838f | 230 | |
mbed_official | 235:685d5f11838f | 231 | /* Peripheral State functions ************************************************/ |
mbed_official | 235:685d5f11838f | 232 | HAL_IWDG_StateTypeDef HAL_IWDG_GetState(IWDG_HandleTypeDef *hiwdg); |
mbed_official | 235:685d5f11838f | 233 | |
mbed_official | 235:685d5f11838f | 234 | /** |
mbed_official | 235:685d5f11838f | 235 | * @} |
mbed_official | 235:685d5f11838f | 236 | */ |
mbed_official | 235:685d5f11838f | 237 | |
mbed_official | 235:685d5f11838f | 238 | /** |
mbed_official | 235:685d5f11838f | 239 | * @} |
mbed_official | 235:685d5f11838f | 240 | */ |
mbed_official | 235:685d5f11838f | 241 | |
mbed_official | 235:685d5f11838f | 242 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 243 | } |
mbed_official | 235:685d5f11838f | 244 | #endif |
mbed_official | 235:685d5f11838f | 245 | |
mbed_official | 235:685d5f11838f | 246 | #endif /* __STM32F4xx_HAL_IWDG_H */ |
mbed_official | 235:685d5f11838f | 247 | |
mbed_official | 235:685d5f11838f | 248 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |