The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Oct 28 16:40:41 2014 +0000
Revision:
90:cb3d968589d8
Parent:
85:024bf7f99721
Release 90 of the mbed library

Changes:

- Freescale KSDK update (v1.0)
- K22 - new target addition
- KL43Z - new target addition
- Nucleo F091RC - new target addition
- Nucleo L152RE - STM32Cube driver
- Nordic - Softdevice v7.1.0
- Nvic files - BSD License
- LPC824 - various HAL fixes
- Nucleo F411RE - CMSIS - IAR files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 77:869cf507173a 1 /**
emilmont 77:869cf507173a 2 ******************************************************************************
emilmont 77:869cf507173a 3 * @file stm32f4xx_hal_wwdg.h
emilmont 77:869cf507173a 4 * @author MCD Application Team
Kojto 90:cb3d968589d8 5 * @version V1.1.0
Kojto 90:cb3d968589d8 6 * @date 19-June-2014
emilmont 77:869cf507173a 7 * @brief Header file of WWDG HAL module.
emilmont 77:869cf507173a 8 ******************************************************************************
emilmont 77:869cf507173a 9 * @attention
emilmont 77:869cf507173a 10 *
emilmont 77:869cf507173a 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
emilmont 77:869cf507173a 12 *
emilmont 77:869cf507173a 13 * Redistribution and use in source and binary forms, with or without modification,
emilmont 77:869cf507173a 14 * are permitted provided that the following conditions are met:
emilmont 77:869cf507173a 15 * 1. Redistributions of source code must retain the above copyright notice,
emilmont 77:869cf507173a 16 * this list of conditions and the following disclaimer.
emilmont 77:869cf507173a 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
emilmont 77:869cf507173a 18 * this list of conditions and the following disclaimer in the documentation
emilmont 77:869cf507173a 19 * and/or other materials provided with the distribution.
emilmont 77:869cf507173a 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
emilmont 77:869cf507173a 21 * may be used to endorse or promote products derived from this software
emilmont 77:869cf507173a 22 * without specific prior written permission.
emilmont 77:869cf507173a 23 *
emilmont 77:869cf507173a 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
emilmont 77:869cf507173a 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
emilmont 77:869cf507173a 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
emilmont 77:869cf507173a 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
emilmont 77:869cf507173a 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
emilmont 77:869cf507173a 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
emilmont 77:869cf507173a 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emilmont 77:869cf507173a 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
emilmont 77:869cf507173a 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
emilmont 77:869cf507173a 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
emilmont 77:869cf507173a 34 *
emilmont 77:869cf507173a 35 ******************************************************************************
emilmont 77:869cf507173a 36 */
emilmont 77:869cf507173a 37
emilmont 77:869cf507173a 38 /* Define to prevent recursive inclusion -------------------------------------*/
emilmont 77:869cf507173a 39 #ifndef __STM32F4xx_HAL_WWDG_H
emilmont 77:869cf507173a 40 #define __STM32F4xx_HAL_WWDG_H
emilmont 77:869cf507173a 41
emilmont 77:869cf507173a 42 #ifdef __cplusplus
emilmont 77:869cf507173a 43 extern "C" {
emilmont 77:869cf507173a 44 #endif
emilmont 77:869cf507173a 45
emilmont 77:869cf507173a 46 /* Includes ------------------------------------------------------------------*/
emilmont 77:869cf507173a 47 #include "stm32f4xx_hal_def.h"
emilmont 77:869cf507173a 48
emilmont 77:869cf507173a 49 /** @addtogroup STM32F4xx_HAL_Driver
emilmont 77:869cf507173a 50 * @{
emilmont 77:869cf507173a 51 */
emilmont 77:869cf507173a 52
emilmont 77:869cf507173a 53 /** @addtogroup WWDG
emilmont 77:869cf507173a 54 * @{
emilmont 77:869cf507173a 55 */
emilmont 77:869cf507173a 56
Kojto 90:cb3d968589d8 57 /* Exported types ------------------------------------------------------------*/
emilmont 77:869cf507173a 58
Kojto 90:cb3d968589d8 59 /**
Kojto 90:cb3d968589d8 60 * @brief WWDG HAL State Structure definition
Kojto 90:cb3d968589d8 61 */
emilmont 77:869cf507173a 62 typedef enum
emilmont 77:869cf507173a 63 {
emilmont 77:869cf507173a 64 HAL_WWDG_STATE_RESET = 0x00, /*!< WWDG not yet initialized or disabled */
emilmont 77:869cf507173a 65 HAL_WWDG_STATE_READY = 0x01, /*!< WWDG initialized and ready for use */
Kojto 90:cb3d968589d8 66 HAL_WWDG_STATE_BUSY = 0x02, /*!< WWDG internal process is ongoing */
emilmont 77:869cf507173a 67 HAL_WWDG_STATE_TIMEOUT = 0x03, /*!< WWDG timeout state */
emilmont 77:869cf507173a 68 HAL_WWDG_STATE_ERROR = 0x04 /*!< WWDG error state */
emilmont 77:869cf507173a 69 }HAL_WWDG_StateTypeDef;
emilmont 77:869cf507173a 70
emilmont 77:869cf507173a 71 /**
emilmont 77:869cf507173a 72 * @brief WWDG Init structure definition
emilmont 77:869cf507173a 73 */
emilmont 77:869cf507173a 74 typedef struct
emilmont 77:869cf507173a 75 {
Kojto 90:cb3d968589d8 76 uint32_t Prescaler; /*!< Specifies the prescaler value of the WWDG.
emilmont 77:869cf507173a 77 This parameter can be a value of @ref WWDG_Prescaler */
emilmont 77:869cf507173a 78
emilmont 77:869cf507173a 79 uint32_t Window; /*!< Specifies the WWDG window value to be compared to the downcounter.
emilmont 77:869cf507173a 80 This parameter must be a number lower than Max_Data = 0x80 */
emilmont 77:869cf507173a 81
bogdanm 85:024bf7f99721 82 uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value.
Kojto 90:cb3d968589d8 83 This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */
emilmont 77:869cf507173a 84
emilmont 77:869cf507173a 85 }WWDG_InitTypeDef;
emilmont 77:869cf507173a 86
emilmont 77:869cf507173a 87 /**
emilmont 77:869cf507173a 88 * @brief WWDG handle Structure definition
emilmont 77:869cf507173a 89 */
emilmont 77:869cf507173a 90 typedef struct
emilmont 77:869cf507173a 91 {
Kojto 90:cb3d968589d8 92 WWDG_TypeDef *Instance; /*!< Register base address */
emilmont 77:869cf507173a 93
emilmont 77:869cf507173a 94 WWDG_InitTypeDef Init; /*!< WWDG required parameters */
emilmont 77:869cf507173a 95
emilmont 77:869cf507173a 96 HAL_LockTypeDef Lock; /*!< WWDG locking object */
emilmont 77:869cf507173a 97
emilmont 77:869cf507173a 98 __IO HAL_WWDG_StateTypeDef State; /*!< WWDG communication state */
emilmont 77:869cf507173a 99
emilmont 77:869cf507173a 100 }WWDG_HandleTypeDef;
emilmont 77:869cf507173a 101
emilmont 77:869cf507173a 102 /* Exported constants --------------------------------------------------------*/
emilmont 77:869cf507173a 103
Kojto 90:cb3d968589d8 104 /** @defgroup WWDG_Exported_Constants
Kojto 90:cb3d968589d8 105 * @{
Kojto 90:cb3d968589d8 106 */
Kojto 90:cb3d968589d8 107
emilmont 77:869cf507173a 108 /** @defgroup WWDG_BitAddress_AliasRegion
Kojto 90:cb3d968589d8 109 * @brief WWDG registers bit address in the alias region
emilmont 77:869cf507173a 110 * @{
emilmont 77:869cf507173a 111 */
emilmont 77:869cf507173a 112
emilmont 77:869cf507173a 113 /* --- CFR Register ---*/
emilmont 77:869cf507173a 114 /* Alias word address of EWI bit */
emilmont 77:869cf507173a 115 #define CFR_BASE (uint32_t)(WWDG_BASE + 0x04)
emilmont 77:869cf507173a 116
emilmont 77:869cf507173a 117 /**
emilmont 77:869cf507173a 118 * @}
emilmont 77:869cf507173a 119 */
emilmont 77:869cf507173a 120
emilmont 77:869cf507173a 121 /** @defgroup WWDG_Interrupt_definition
emilmont 77:869cf507173a 122 * @{
emilmont 77:869cf507173a 123 */
emilmont 77:869cf507173a 124 #define WWDG_IT_EWI ((uint32_t)WWDG_CFR_EWI)
emilmont 77:869cf507173a 125
Kojto 90:cb3d968589d8 126 #define IS_WWDG_IT(__IT__) ((__IT__) == WWDG_IT_EWI)
emilmont 77:869cf507173a 127
emilmont 77:869cf507173a 128 /**
emilmont 77:869cf507173a 129 * @}
emilmont 77:869cf507173a 130 */
emilmont 77:869cf507173a 131
emilmont 77:869cf507173a 132 /** @defgroup WWDG_Flag_definition
emilmont 77:869cf507173a 133 * @brief WWDG Flag definition
emilmont 77:869cf507173a 134 * @{
emilmont 77:869cf507173a 135 */
Kojto 90:cb3d968589d8 136 #define WWDG_FLAG_EWIF ((uint32_t)WWDG_SR_EWIF) /*!< Early wakeup interrupt flag */
Kojto 90:cb3d968589d8 137 #define IS_WWDG_FLAG(__FLAG__) ((__FLAG__) == WWDG_FLAG_EWIF))
emilmont 77:869cf507173a 138
emilmont 77:869cf507173a 139
emilmont 77:869cf507173a 140 /**
emilmont 77:869cf507173a 141 * @}
emilmont 77:869cf507173a 142 */
bogdanm 85:024bf7f99721 143
emilmont 77:869cf507173a 144 /** @defgroup WWDG_Prescaler
emilmont 77:869cf507173a 145 * @{
emilmont 77:869cf507173a 146 */
emilmont 77:869cf507173a 147 #define WWDG_PRESCALER_1 ((uint32_t)0x00000000) /*!< WWDG counter clock = (PCLK1/4096)/1 */
Kojto 90:cb3d968589d8 148 #define WWDG_PRESCALER_2 ((uint32_t)WWDG_CFR_WDGTB0) /*!< WWDG counter clock = (PCLK1/4096)/2 */
Kojto 90:cb3d968589d8 149 #define WWDG_PRESCALER_4 ((uint32_t)WWDG_CFR_WDGTB1) /*!< WWDG counter clock = (PCLK1/4096)/4 */
Kojto 90:cb3d968589d8 150 #define WWDG_PRESCALER_8 ((uint32_t)WWDG_CFR_WDGTB) /*!< WWDG counter clock = (PCLK1/4096)/8 */
emilmont 77:869cf507173a 151
Kojto 90:cb3d968589d8 152 #define IS_WWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == WWDG_PRESCALER_1) || \
Kojto 90:cb3d968589d8 153 ((__PRESCALER__) == WWDG_PRESCALER_2) || \
Kojto 90:cb3d968589d8 154 ((__PRESCALER__) == WWDG_PRESCALER_4) || \
Kojto 90:cb3d968589d8 155 ((__PRESCALER__) == WWDG_PRESCALER_8))
emilmont 77:869cf507173a 156
emilmont 77:869cf507173a 157 /**
emilmont 77:869cf507173a 158 * @}
emilmont 77:869cf507173a 159 */
emilmont 77:869cf507173a 160
emilmont 77:869cf507173a 161 /** @defgroup WWDG_Window
emilmont 77:869cf507173a 162 * @{
emilmont 77:869cf507173a 163 */
Kojto 90:cb3d968589d8 164 #define IS_WWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= 0x7F)
emilmont 77:869cf507173a 165
emilmont 77:869cf507173a 166 /**
emilmont 77:869cf507173a 167 * @}
emilmont 77:869cf507173a 168 */
emilmont 77:869cf507173a 169
emilmont 77:869cf507173a 170 /** @defgroup WWDG_Counter
emilmont 77:869cf507173a 171 * @{
emilmont 77:869cf507173a 172 */
Kojto 90:cb3d968589d8 173 #define IS_WWDG_COUNTER(__COUNTER__) (((__COUNTER__) >= 0x40) && ((__COUNTER__) <= 0x7F))
Kojto 90:cb3d968589d8 174
Kojto 90:cb3d968589d8 175 /**
Kojto 90:cb3d968589d8 176 * @}
Kojto 90:cb3d968589d8 177 */
emilmont 77:869cf507173a 178
emilmont 77:869cf507173a 179 /**
emilmont 77:869cf507173a 180 * @}
emilmont 77:869cf507173a 181 */
emilmont 77:869cf507173a 182
bogdanm 85:024bf7f99721 183 /* Exported macro ------------------------------------------------------------*/
bogdanm 85:024bf7f99721 184
bogdanm 85:024bf7f99721 185 /** @brief Reset WWDG handle state
bogdanm 85:024bf7f99721 186 * @param __HANDLE__: WWDG handle
bogdanm 85:024bf7f99721 187 * @retval None
emilmont 77:869cf507173a 188 */
bogdanm 85:024bf7f99721 189 #define __HAL_WWDG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_WWDG_STATE_RESET)
emilmont 77:869cf507173a 190
emilmont 77:869cf507173a 191 /**
emilmont 77:869cf507173a 192 * @brief Enables the WWDG peripheral.
emilmont 77:869cf507173a 193 * @param __HANDLE__: WWDG handle
emilmont 77:869cf507173a 194 * @retval None
emilmont 77:869cf507173a 195 */
Kojto 90:cb3d968589d8 196 #define __HAL_WWDG_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA)
emilmont 77:869cf507173a 197
emilmont 77:869cf507173a 198 /**
emilmont 77:869cf507173a 199 * @brief Gets the selected WWDG's flag status.
emilmont 77:869cf507173a 200 * @param __HANDLE__: WWDG handle
emilmont 77:869cf507173a 201 * @param __FLAG__: specifies the flag to check.
emilmont 77:869cf507173a 202 * This parameter can be one of the following values:
emilmont 77:869cf507173a 203 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
emilmont 77:869cf507173a 204 * @retval The new state of WWDG_FLAG (SET or RESET).
emilmont 77:869cf507173a 205 */
emilmont 77:869cf507173a 206 #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
emilmont 77:869cf507173a 207
emilmont 77:869cf507173a 208 /**
emilmont 77:869cf507173a 209 * @brief Clears the WWDG's pending flags.
emilmont 77:869cf507173a 210 * @param __HANDLE__: WWDG handle
emilmont 77:869cf507173a 211 * @param __FLAG__: specifies the flag to clear.
emilmont 77:869cf507173a 212 * This parameter can be one of the following values:
emilmont 77:869cf507173a 213 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
emilmont 77:869cf507173a 214 * @retval None
emilmont 77:869cf507173a 215 */
Kojto 90:cb3d968589d8 216 #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__))
emilmont 77:869cf507173a 217
emilmont 77:869cf507173a 218 /**
emilmont 77:869cf507173a 219 * @brief Enables the WWDG early wakeup interrupt.
Kojto 90:cb3d968589d8 220 * @param __INTERRUPT__: specifies the interrupt to enable.
Kojto 90:cb3d968589d8 221 * This parameter can be one of the following values:
Kojto 90:cb3d968589d8 222 * @arg WWDG_IT_EWI: Early wakeup interrupt
emilmont 77:869cf507173a 223 * @note Once enabled this interrupt cannot be disabled except by a system reset.
emilmont 77:869cf507173a 224 * @retval None
emilmont 77:869cf507173a 225 */
emilmont 77:869cf507173a 226 #define __HAL_WWDG_ENABLE_IT(__INTERRUPT__) (*(__IO uint32_t *) CFR_BASE |= (__INTERRUPT__))
emilmont 77:869cf507173a 227
Kojto 90:cb3d968589d8 228 /** @brief Clear the WWDG's interrupt pending bits
Kojto 90:cb3d968589d8 229 * bits to clear the selected interrupt pending bits.
Kojto 90:cb3d968589d8 230 * @param __HANDLE__: WWDG handle
Kojto 90:cb3d968589d8 231 * @param __INTERRUPT__: specifies the interrupt pending bit to clear.
Kojto 90:cb3d968589d8 232 * This parameter can be one of the following values:
Kojto 90:cb3d968589d8 233 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
Kojto 90:cb3d968589d8 234 */
Kojto 90:cb3d968589d8 235 #define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__))
emilmont 77:869cf507173a 236 /* Exported functions --------------------------------------------------------*/
emilmont 77:869cf507173a 237
emilmont 77:869cf507173a 238 /* Initialization/de-initialization functions **********************************/
emilmont 77:869cf507173a 239 HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 240 HAL_StatusTypeDef HAL_WWDG_DeInit(WWDG_HandleTypeDef *hwwdg);
bogdanm 81:7d30d6019079 241 void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg);
bogdanm 81:7d30d6019079 242 void HAL_WWDG_MspDeInit(WWDG_HandleTypeDef *hwwdg);
bogdanm 81:7d30d6019079 243 void HAL_WWDG_WakeupCallback(WWDG_HandleTypeDef* hwwdg);
emilmont 77:869cf507173a 244
emilmont 77:869cf507173a 245 /* I/O operation functions ******************************************************/
emilmont 77:869cf507173a 246 HAL_StatusTypeDef HAL_WWDG_Start(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 247 HAL_StatusTypeDef HAL_WWDG_Start_IT(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 248 HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg, uint32_t Counter);
emilmont 77:869cf507173a 249 void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 250
emilmont 77:869cf507173a 251 /* Peripheral State functions **************************************************/
emilmont 77:869cf507173a 252 HAL_WWDG_StateTypeDef HAL_WWDG_GetState(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 253
emilmont 77:869cf507173a 254 /**
emilmont 77:869cf507173a 255 * @}
emilmont 77:869cf507173a 256 */
emilmont 77:869cf507173a 257
emilmont 77:869cf507173a 258 /**
emilmont 77:869cf507173a 259 * @}
emilmont 77:869cf507173a 260 */
emilmont 77:869cf507173a 261
emilmont 77:869cf507173a 262 #ifdef __cplusplus
emilmont 77:869cf507173a 263 }
emilmont 77:869cf507173a 264 #endif
emilmont 77:869cf507173a 265
emilmont 77:869cf507173a 266 #endif /* __STM32F4xx_HAL_WWDG_H */
emilmont 77:869cf507173a 267
emilmont 77:869cf507173a 268 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/