mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Jun 23 14:00:09 2014 +0100
Revision:
235:685d5f11838f
Synchronized with git revision 9728c76667962b289ee9c4c687ef9f115db48cd3

Full URL: https://github.com/mbedmicro/mbed/commit/9728c76667962b289ee9c4c687ef9f115db48cd3/

[NUCLEO_F411RE] Add all target files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 235:685d5f11838f 1 /**
mbed_official 235:685d5f11838f 2 ******************************************************************************
mbed_official 235:685d5f11838f 3 * @file stm32f4xx_hal_pwr_ex.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 PWR HAL Extension module.
mbed_official 235:685d5f11838f 8 ******************************************************************************
mbed_official 235:685d5f11838f 9 * @attention
mbed_official 235:685d5f11838f 10 *
mbed_official 235:685d5f11838f 11 * <h2><center>&copy; 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_PWR_EX_H
mbed_official 235:685d5f11838f 40 #define __STM32F4xx_HAL_PWR_EX_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 PWREx
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 /* Exported constants --------------------------------------------------------*/
mbed_official 235:685d5f11838f 59 /* ------------- PWR registers bit address in the alias region ---------------*/
mbed_official 235:685d5f11838f 60 /* --- CR Register ---*/
mbed_official 235:685d5f11838f 61 /* Alias word address of FPDS bit */
mbed_official 235:685d5f11838f 62 #define FPDS_BitNumber 0x09
mbed_official 235:685d5f11838f 63 #define CR_FPDS_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (FPDS_BitNumber * 4))
mbed_official 235:685d5f11838f 64
mbed_official 235:685d5f11838f 65 /* Alias word address of ODEN bit */
mbed_official 235:685d5f11838f 66 #define ODEN_BitNumber 0x10
mbed_official 235:685d5f11838f 67 #define CR_ODEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODEN_BitNumber * 4))
mbed_official 235:685d5f11838f 68
mbed_official 235:685d5f11838f 69 /* Alias word address of ODSWEN bit */
mbed_official 235:685d5f11838f 70 #define ODSWEN_BitNumber 0x11
mbed_official 235:685d5f11838f 71 #define CR_ODSWEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODSWEN_BitNumber * 4))
mbed_official 235:685d5f11838f 72
mbed_official 235:685d5f11838f 73 /* Alias word address of MRLVDS bit */
mbed_official 235:685d5f11838f 74 #define MRLVDS_BitNumber 0x0B
mbed_official 235:685d5f11838f 75 #define CR_MRLVDS_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (MRLVDS_BitNumber * 4))
mbed_official 235:685d5f11838f 76
mbed_official 235:685d5f11838f 77 /* Alias word address of LPLVDS bit */
mbed_official 235:685d5f11838f 78 #define LPLVDS_BitNumber 0x0A
mbed_official 235:685d5f11838f 79 #define CR_LPLVDS_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (LPLVDS_BitNumber * 4))
mbed_official 235:685d5f11838f 80
mbed_official 235:685d5f11838f 81 /* --- CSR Register ---*/
mbed_official 235:685d5f11838f 82 /* Alias word address of BRE bit */
mbed_official 235:685d5f11838f 83 #define BRE_BitNumber 0x09
mbed_official 235:685d5f11838f 84 #define CSR_BRE_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (BRE_BitNumber * 4))
mbed_official 235:685d5f11838f 85
mbed_official 235:685d5f11838f 86 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
mbed_official 235:685d5f11838f 87
mbed_official 235:685d5f11838f 88 /** @defgroup PWREx_Regulator_state_in_UnderDrive_mode
mbed_official 235:685d5f11838f 89 * @{
mbed_official 235:685d5f11838f 90 */
mbed_official 235:685d5f11838f 91 #define PWR_MAINREGULATOR_UNDERDRIVE_ON PWR_CR_MRUDS
mbed_official 235:685d5f11838f 92 #define PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON ((uint32_t)(PWR_CR_LPDS | PWR_CR_LPUDS))
mbed_official 235:685d5f11838f 93
mbed_official 235:685d5f11838f 94 #define IS_PWR_REGULATOR_UNDERDRIVE(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_UNDERDRIVE_ON) || \
mbed_official 235:685d5f11838f 95 ((REGULATOR) == PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON))
mbed_official 235:685d5f11838f 96 /**
mbed_official 235:685d5f11838f 97 * @}
mbed_official 235:685d5f11838f 98 */
mbed_official 235:685d5f11838f 99
mbed_official 235:685d5f11838f 100 /** @defgroup PWREx_Over_Under_Drive_Flag
mbed_official 235:685d5f11838f 101 * @{
mbed_official 235:685d5f11838f 102 */
mbed_official 235:685d5f11838f 103 #define PWR_FLAG_ODRDY PWR_CSR_ODRDY
mbed_official 235:685d5f11838f 104 #define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY
mbed_official 235:685d5f11838f 105 #define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY
mbed_official 235:685d5f11838f 106 /**
mbed_official 235:685d5f11838f 107 * @}
mbed_official 235:685d5f11838f 108 */
mbed_official 235:685d5f11838f 109 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
mbed_official 235:685d5f11838f 110 /**
mbed_official 235:685d5f11838f 111 * @}
mbed_official 235:685d5f11838f 112 */
mbed_official 235:685d5f11838f 113
mbed_official 235:685d5f11838f 114 /* Exported macro ------------------------------------------------------------*/
mbed_official 235:685d5f11838f 115
mbed_official 235:685d5f11838f 116 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
mbed_official 235:685d5f11838f 117 /** @brief Macros to enable or disable the Over drive mode.
mbed_official 235:685d5f11838f 118 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
mbed_official 235:685d5f11838f 119 */
mbed_official 235:685d5f11838f 120 #define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE)
mbed_official 235:685d5f11838f 121 #define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE)
mbed_official 235:685d5f11838f 122
mbed_official 235:685d5f11838f 123 /** @brief Macros to enable or disable the Over drive switching.
mbed_official 235:685d5f11838f 124 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
mbed_official 235:685d5f11838f 125 */
mbed_official 235:685d5f11838f 126 #define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE)
mbed_official 235:685d5f11838f 127 #define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE)
mbed_official 235:685d5f11838f 128
mbed_official 235:685d5f11838f 129 /** @brief Macros to enable or disable the Under drive mode.
mbed_official 235:685d5f11838f 130 * @note This mode is enabled only with STOP low power mode.
mbed_official 235:685d5f11838f 131 * In this mode, the 1.2V domain is preserved in reduced leakage mode. This
mbed_official 235:685d5f11838f 132 * mode is only available when the main regulator or the low power regulator
mbed_official 235:685d5f11838f 133 * is in low voltage mode.
mbed_official 235:685d5f11838f 134 * @note If the Under-drive mode was enabled, it is automatically disabled after
mbed_official 235:685d5f11838f 135 * exiting Stop mode.
mbed_official 235:685d5f11838f 136 * When the voltage regulator operates in Under-drive mode, an additional
mbed_official 235:685d5f11838f 137 * startup delay is induced when waking up from Stop mode.
mbed_official 235:685d5f11838f 138 */
mbed_official 235:685d5f11838f 139 #define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN)
mbed_official 235:685d5f11838f 140 #define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN))
mbed_official 235:685d5f11838f 141
mbed_official 235:685d5f11838f 142 /** @brief Check PWR flag is set or not.
mbed_official 235:685d5f11838f 143 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
mbed_official 235:685d5f11838f 144 * @param __FLAG__: specifies the flag to check.
mbed_official 235:685d5f11838f 145 * This parameter can be one of the following values:
mbed_official 235:685d5f11838f 146 * @arg PWR_FLAG_ODRDY: This flag indicates that the Over-drive mode
mbed_official 235:685d5f11838f 147 * is ready
mbed_official 235:685d5f11838f 148 * @arg PWR_FLAG_ODSWRDY: This flag indicates that the Over-drive mode
mbed_official 235:685d5f11838f 149 * switching is ready
mbed_official 235:685d5f11838f 150 * @arg PWR_FLAG_UDRDY: This flag indicates that the Under-drive mode
mbed_official 235:685d5f11838f 151 * is enabled in Stop mode
mbed_official 235:685d5f11838f 152 * @retval The new state of __FLAG__ (TRUE or FALSE).
mbed_official 235:685d5f11838f 153 */
mbed_official 235:685d5f11838f 154 #define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
mbed_official 235:685d5f11838f 155
mbed_official 235:685d5f11838f 156 /** @brief Clear the Under-Drive Ready flag.
mbed_official 235:685d5f11838f 157 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
mbed_official 235:685d5f11838f 158 */
mbed_official 235:685d5f11838f 159 #define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY)
mbed_official 235:685d5f11838f 160
mbed_official 235:685d5f11838f 161 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
mbed_official 235:685d5f11838f 162
mbed_official 235:685d5f11838f 163 /* Exported functions --------------------------------------------------------*/
mbed_official 235:685d5f11838f 164 void HAL_PWREx_EnableFlashPowerDown(void);
mbed_official 235:685d5f11838f 165 void HAL_PWREx_DisableFlashPowerDown(void);
mbed_official 235:685d5f11838f 166 HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void);
mbed_official 235:685d5f11838f 167 HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void);
mbed_official 235:685d5f11838f 168
mbed_official 235:685d5f11838f 169 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
mbed_official 235:685d5f11838f 170 void HAL_PWREx_EnableMainRegulatorLowVoltage(void);
mbed_official 235:685d5f11838f 171 void HAL_PWREx_DisableMainRegulatorLowVoltage(void);
mbed_official 235:685d5f11838f 172 void HAL_PWREx_EnableLowRegulatorLowVoltage(void);
mbed_official 235:685d5f11838f 173 void HAL_PWREx_DisableLowRegulatorLowVoltage(void);
mbed_official 235:685d5f11838f 174 #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
mbed_official 235:685d5f11838f 175
mbed_official 235:685d5f11838f 176 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
mbed_official 235:685d5f11838f 177 HAL_StatusTypeDef HAL_PWREx_ActivateOverDrive(void);
mbed_official 235:685d5f11838f 178 HAL_StatusTypeDef HAL_PWREx_DeactivateOverDrive(void);
mbed_official 235:685d5f11838f 179 HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
mbed_official 235:685d5f11838f 180 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
mbed_official 235:685d5f11838f 181
mbed_official 235:685d5f11838f 182 /**
mbed_official 235:685d5f11838f 183 * @}
mbed_official 235:685d5f11838f 184 */
mbed_official 235:685d5f11838f 185
mbed_official 235:685d5f11838f 186 /**
mbed_official 235:685d5f11838f 187 * @}
mbed_official 235:685d5f11838f 188 */
mbed_official 235:685d5f11838f 189
mbed_official 235:685d5f11838f 190 #ifdef __cplusplus
mbed_official 235:685d5f11838f 191 }
mbed_official 235:685d5f11838f 192 #endif
mbed_official 235:685d5f11838f 193
mbed_official 235:685d5f11838f 194
mbed_official 235:685d5f11838f 195 #endif /* __STM32F4xx_HAL_PWR_EX_H */
mbed_official 235:685d5f11838f 196
mbed_official 235:685d5f11838f 197 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/