meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jun 11 15:14:05 2014 +0100
Revision:
85:024bf7f99721
Parent:
81:7d30d6019079
Child:
90:cb3d968589d8
Release 85 of the mbed library

Main changes:

- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F

There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.

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
bogdanm 85:024bf7f99721 5 * @version V1.1.0RC2
bogdanm 85:024bf7f99721 6 * @date 14-May-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
emilmont 77:869cf507173a 57 /* Exported types ------------------------------------------------------------*/
emilmont 77:869cf507173a 58
emilmont 77:869cf507173a 59 /**
emilmont 77:869cf507173a 60 * @brief WWDG HAL State Structure definition
emilmont 77:869cf507173a 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 */
emilmont 77:869cf507173a 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
emilmont 77:869cf507173a 70 }HAL_WWDG_StateTypeDef;
emilmont 77:869cf507173a 71
emilmont 77:869cf507173a 72 /**
emilmont 77:869cf507173a 73 * @brief WWDG Init structure definition
emilmont 77:869cf507173a 74 */
emilmont 77:869cf507173a 75 typedef struct
emilmont 77:869cf507173a 76 {
bogdanm 85:024bf7f99721 77 uint32_t Prescaler; /*!< Specifies the prescaler.
emilmont 77:869cf507173a 78 This parameter can be a value of @ref WWDG_Prescaler */
emilmont 77:869cf507173a 79
emilmont 77:869cf507173a 80 uint32_t Window; /*!< Specifies the WWDG window value to be compared to the downcounter.
emilmont 77:869cf507173a 81 This parameter must be a number lower than Max_Data = 0x80 */
emilmont 77:869cf507173a 82
bogdanm 85:024bf7f99721 83 uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value.
emilmont 77:869cf507173a 84 This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */
emilmont 77:869cf507173a 85
emilmont 77:869cf507173a 86 }WWDG_InitTypeDef;
emilmont 77:869cf507173a 87
emilmont 77:869cf507173a 88 /**
emilmont 77:869cf507173a 89 * @brief WWDG handle Structure definition
emilmont 77:869cf507173a 90 */
emilmont 77:869cf507173a 91 typedef struct
emilmont 77:869cf507173a 92 {
emilmont 77:869cf507173a 93 WWDG_TypeDef *Instance; /*!< Register base address */
emilmont 77:869cf507173a 94
emilmont 77:869cf507173a 95 WWDG_InitTypeDef Init; /*!< WWDG required parameters */
emilmont 77:869cf507173a 96
emilmont 77:869cf507173a 97 HAL_LockTypeDef Lock; /*!< WWDG locking object */
emilmont 77:869cf507173a 98
emilmont 77:869cf507173a 99 __IO HAL_WWDG_StateTypeDef State; /*!< WWDG communication state */
emilmont 77:869cf507173a 100
emilmont 77:869cf507173a 101 }WWDG_HandleTypeDef;
emilmont 77:869cf507173a 102
emilmont 77:869cf507173a 103 /* Exported constants --------------------------------------------------------*/
emilmont 77:869cf507173a 104
emilmont 77:869cf507173a 105 /** @defgroup WWDG_BitAddress_AliasRegion
emilmont 77:869cf507173a 106 * @{
emilmont 77:869cf507173a 107 */
emilmont 77:869cf507173a 108
emilmont 77:869cf507173a 109 /* --- CFR Register ---*/
emilmont 77:869cf507173a 110 /* Alias word address of EWI bit */
emilmont 77:869cf507173a 111 #define CFR_BASE (uint32_t)(WWDG_BASE + 0x04)
emilmont 77:869cf507173a 112
emilmont 77:869cf507173a 113 /**
emilmont 77:869cf507173a 114 * @}
emilmont 77:869cf507173a 115 */
emilmont 77:869cf507173a 116
emilmont 77:869cf507173a 117 /** @defgroup WWDG_Interrupt_definition
emilmont 77:869cf507173a 118 * @{
emilmont 77:869cf507173a 119 */
emilmont 77:869cf507173a 120 #define WWDG_IT_EWI ((uint32_t)WWDG_CFR_EWI)
emilmont 77:869cf507173a 121
emilmont 77:869cf507173a 122 #define IS_WWDG_IT(IT) ((IT) == WWDG_IT_EWI)
emilmont 77:869cf507173a 123
emilmont 77:869cf507173a 124 /**
emilmont 77:869cf507173a 125 * @}
emilmont 77:869cf507173a 126 */
emilmont 77:869cf507173a 127
emilmont 77:869cf507173a 128 /** @defgroup WWDG_Flag_definition
emilmont 77:869cf507173a 129 * @brief WWDG Flag definition
emilmont 77:869cf507173a 130 * @{
emilmont 77:869cf507173a 131 */
emilmont 77:869cf507173a 132 #define WWDG_FLAG_EWIF ((uint32_t)0x0001) /*!< Early wakeup interrupt flag */
emilmont 77:869cf507173a 133
emilmont 77:869cf507173a 134 #define IS_WWDG_FLAG(FLAG) ((FLAG) == WWDG_FLAG_EWIF))
emilmont 77:869cf507173a 135
emilmont 77:869cf507173a 136 /**
emilmont 77:869cf507173a 137 * @}
emilmont 77:869cf507173a 138 */
bogdanm 85:024bf7f99721 139
emilmont 77:869cf507173a 140 /** @defgroup WWDG_Prescaler
emilmont 77:869cf507173a 141 * @{
emilmont 77:869cf507173a 142 */
emilmont 77:869cf507173a 143 #define WWDG_PRESCALER_1 ((uint32_t)0x00000000) /*!< WWDG counter clock = (PCLK1/4096)/1 */
emilmont 77:869cf507173a 144 #define WWDG_PRESCALER_2 ((uint32_t)0x00000080) /*!< WWDG counter clock = (PCLK1/4096)/2 */
emilmont 77:869cf507173a 145 #define WWDG_PRESCALER_4 ((uint32_t)0x00000100) /*!< WWDG counter clock = (PCLK1/4096)/4 */
emilmont 77:869cf507173a 146 #define WWDG_PRESCALER_8 ((uint32_t)0x00000180) /*!< WWDG counter clock = (PCLK1/4096)/8 */
emilmont 77:869cf507173a 147
emilmont 77:869cf507173a 148 #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_PRESCALER_1) || \
emilmont 77:869cf507173a 149 ((PRESCALER) == WWDG_PRESCALER_2) || \
emilmont 77:869cf507173a 150 ((PRESCALER) == WWDG_PRESCALER_4) || \
bogdanm 85:024bf7f99721 151 ((PRESCALER) == WWDG_PRESCALER_8))
emilmont 77:869cf507173a 152
emilmont 77:869cf507173a 153 /**
emilmont 77:869cf507173a 154 * @}
emilmont 77:869cf507173a 155 */
emilmont 77:869cf507173a 156
emilmont 77:869cf507173a 157 /** @defgroup WWDG_Window
emilmont 77:869cf507173a 158 * @{
emilmont 77:869cf507173a 159 */
emilmont 77:869cf507173a 160 #define IS_WWDG_WINDOW(WINDOW) ((WINDOW) <= 0x7F)
emilmont 77:869cf507173a 161
emilmont 77:869cf507173a 162 /**
emilmont 77:869cf507173a 163 * @}
emilmont 77:869cf507173a 164 */
emilmont 77:869cf507173a 165
emilmont 77:869cf507173a 166 /** @defgroup WWDG_Counter
emilmont 77:869cf507173a 167 * @{
emilmont 77:869cf507173a 168 */
emilmont 77:869cf507173a 169 #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
emilmont 77:869cf507173a 170
emilmont 77:869cf507173a 171 /**
emilmont 77:869cf507173a 172 * @}
emilmont 77:869cf507173a 173 */
emilmont 77:869cf507173a 174
bogdanm 85:024bf7f99721 175 /* Exported macro ------------------------------------------------------------*/
bogdanm 85:024bf7f99721 176
bogdanm 85:024bf7f99721 177 /** @brief Reset WWDG handle state
bogdanm 85:024bf7f99721 178 * @param __HANDLE__: WWDG handle
bogdanm 85:024bf7f99721 179 * @retval None
emilmont 77:869cf507173a 180 */
bogdanm 85:024bf7f99721 181 #define __HAL_WWDG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_WWDG_STATE_RESET)
emilmont 77:869cf507173a 182
emilmont 77:869cf507173a 183 /**
emilmont 77:869cf507173a 184 * @brief Enables the WWDG peripheral.
emilmont 77:869cf507173a 185 * @param __HANDLE__: WWDG handle
emilmont 77:869cf507173a 186 * @retval None
emilmont 77:869cf507173a 187 */
emilmont 77:869cf507173a 188 #define __HAL_WWDG_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= WWDG_CR_WDGA)
emilmont 77:869cf507173a 189
emilmont 77:869cf507173a 190 /**
emilmont 77:869cf507173a 191 * @brief Gets the selected WWDG's flag status.
emilmont 77:869cf507173a 192 * @param __HANDLE__: WWDG handle
emilmont 77:869cf507173a 193 * @param __FLAG__: specifies the flag to check.
emilmont 77:869cf507173a 194 * This parameter can be one of the following values:
emilmont 77:869cf507173a 195 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
emilmont 77:869cf507173a 196 * @retval The new state of WWDG_FLAG (SET or RESET).
emilmont 77:869cf507173a 197 */
emilmont 77:869cf507173a 198 #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
emilmont 77:869cf507173a 199
emilmont 77:869cf507173a 200 /**
emilmont 77:869cf507173a 201 * @brief Clears the WWDG's pending flags.
emilmont 77:869cf507173a 202 * @param __HANDLE__: WWDG handle
emilmont 77:869cf507173a 203 * @param __FLAG__: specifies the flag to clear.
emilmont 77:869cf507173a 204 * This parameter can be one of the following values:
emilmont 77:869cf507173a 205 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
emilmont 77:869cf507173a 206 * @retval None
emilmont 77:869cf507173a 207 */
emilmont 77:869cf507173a 208 #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) &= ~(__FLAG__))
emilmont 77:869cf507173a 209
emilmont 77:869cf507173a 210 /**
emilmont 77:869cf507173a 211 * @brief Enables the WWDG early wakeup interrupt.
emilmont 77:869cf507173a 212 * @note Once enabled this interrupt cannot be disabled except by a system reset.
emilmont 77:869cf507173a 213 * @retval None
emilmont 77:869cf507173a 214 */
emilmont 77:869cf507173a 215 #define __HAL_WWDG_ENABLE_IT(__INTERRUPT__) (*(__IO uint32_t *) CFR_BASE |= (__INTERRUPT__))
emilmont 77:869cf507173a 216
emilmont 77:869cf507173a 217 /* Exported functions --------------------------------------------------------*/
emilmont 77:869cf507173a 218
emilmont 77:869cf507173a 219 /* Initialization/de-initialization functions **********************************/
emilmont 77:869cf507173a 220 HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 221 HAL_StatusTypeDef HAL_WWDG_DeInit(WWDG_HandleTypeDef *hwwdg);
bogdanm 81:7d30d6019079 222 void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg);
bogdanm 81:7d30d6019079 223 void HAL_WWDG_MspDeInit(WWDG_HandleTypeDef *hwwdg);
bogdanm 81:7d30d6019079 224 void HAL_WWDG_WakeupCallback(WWDG_HandleTypeDef* hwwdg);
emilmont 77:869cf507173a 225
emilmont 77:869cf507173a 226 /* I/O operation functions ******************************************************/
emilmont 77:869cf507173a 227 HAL_StatusTypeDef HAL_WWDG_Start(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 228 HAL_StatusTypeDef HAL_WWDG_Start_IT(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 229 HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg, uint32_t Counter);
emilmont 77:869cf507173a 230 void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 231
emilmont 77:869cf507173a 232 /* Peripheral State functions **************************************************/
emilmont 77:869cf507173a 233 HAL_WWDG_StateTypeDef HAL_WWDG_GetState(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 234
emilmont 77:869cf507173a 235 /**
emilmont 77:869cf507173a 236 * @}
emilmont 77:869cf507173a 237 */
emilmont 77:869cf507173a 238
emilmont 77:869cf507173a 239 /**
emilmont 77:869cf507173a 240 * @}
emilmont 77:869cf507173a 241 */
emilmont 77:869cf507173a 242
emilmont 77:869cf507173a 243 #ifdef __cplusplus
emilmont 77:869cf507173a 244 }
emilmont 77:869cf507173a 245 #endif
emilmont 77:869cf507173a 246
emilmont 77:869cf507173a 247 #endif /* __STM32F4xx_HAL_WWDG_H */
emilmont 77:869cf507173a 248
emilmont 77:869cf507173a 249 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/