mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Thu Aug 21 15:00:08 2014 +0100
Revision:
296:ec1b66a3d094
Parent:
targets/cmsis/TARGET_STM/TARGET_DISCO_F407VG/stm32f4xx_hal_wwdg.h@242:7074e42da0b2
Synchronized with git revision bbc120c4786e99dfa586e7a13f8638064f1e5938

Full URL: https://github.com/mbedmicro/mbed/commit/bbc120c4786e99dfa586e7a13f8638064f1e5938/

DISCO_F407VG - add USBDevice support and a variant - ARCH_MAX

Who changed what in which revision?

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