mbed library sources

Dependents:   bare

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Sat Feb 08 19:45:06 2014 +0000
Revision:
87:085cde657901
Child:
106:ced8cbb51063
Synchronized with git revision 9272cdeb45ec7e6077641536509413da8fd2ebc2

Full URL: https://github.com/mbedmicro/mbed/commit/9272cdeb45ec7e6077641536509413da8fd2ebc2/

Add NUCLEO_F401RE, improvements

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 87:085cde657901 1 /**
mbed_official 87:085cde657901 2 ******************************************************************************
mbed_official 87:085cde657901 3 * @file stm32f4xx_hal_pwr_ex.h
mbed_official 87:085cde657901 4 * @author MCD Application Team
mbed_official 87:085cde657901 5 * @version V1.0.0RC2
mbed_official 87:085cde657901 6 * @date 04-February-2014
mbed_official 87:085cde657901 7 * @brief Header file of PWR HAL Extension module.
mbed_official 87:085cde657901 8 ******************************************************************************
mbed_official 87:085cde657901 9 * @attention
mbed_official 87:085cde657901 10 *
mbed_official 87:085cde657901 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 87:085cde657901 12 *
mbed_official 87:085cde657901 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 87:085cde657901 14 * are permitted provided that the following conditions are met:
mbed_official 87:085cde657901 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 87:085cde657901 16 * this list of conditions and the following disclaimer.
mbed_official 87:085cde657901 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 87:085cde657901 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 87:085cde657901 19 * and/or other materials provided with the distribution.
mbed_official 87:085cde657901 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 87:085cde657901 21 * may be used to endorse or promote products derived from this software
mbed_official 87:085cde657901 22 * without specific prior written permission.
mbed_official 87:085cde657901 23 *
mbed_official 87:085cde657901 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 87:085cde657901 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 87:085cde657901 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 87:085cde657901 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 87:085cde657901 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 87:085cde657901 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 87:085cde657901 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 87:085cde657901 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 87:085cde657901 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 87:085cde657901 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 87:085cde657901 34 *
mbed_official 87:085cde657901 35 ******************************************************************************
mbed_official 87:085cde657901 36 */
mbed_official 87:085cde657901 37
mbed_official 87:085cde657901 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 87:085cde657901 39 #ifndef __STM32F4xx_HAL_PWR_EX_H
mbed_official 87:085cde657901 40 #define __STM32F4xx_HAL_PWR_EX_H
mbed_official 87:085cde657901 41
mbed_official 87:085cde657901 42 #ifdef __cplusplus
mbed_official 87:085cde657901 43 extern "C" {
mbed_official 87:085cde657901 44 #endif
mbed_official 87:085cde657901 45
mbed_official 87:085cde657901 46 /* Includes ------------------------------------------------------------------*/
mbed_official 87:085cde657901 47 #include "stm32f4xx_hal_def.h"
mbed_official 87:085cde657901 48
mbed_official 87:085cde657901 49 /** @addtogroup STM32F4xx_HAL_Driver
mbed_official 87:085cde657901 50 * @{
mbed_official 87:085cde657901 51 */
mbed_official 87:085cde657901 52
mbed_official 87:085cde657901 53 /** @addtogroup PWREx
mbed_official 87:085cde657901 54 * @{
mbed_official 87:085cde657901 55 */
mbed_official 87:085cde657901 56
mbed_official 87:085cde657901 57 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
mbed_official 87:085cde657901 58
mbed_official 87:085cde657901 59 /* Exported types ------------------------------------------------------------*/
mbed_official 87:085cde657901 60 /* Exported constants --------------------------------------------------------*/
mbed_official 87:085cde657901 61 /* ------------- PWR registers bit address in the alias region ---------------*/
mbed_official 87:085cde657901 62 /* --- CR Register ---*/
mbed_official 87:085cde657901 63
mbed_official 87:085cde657901 64 /* Alias word address of ODEN bit */
mbed_official 87:085cde657901 65 #define ODEN_BitNumber 0x10
mbed_official 87:085cde657901 66 #define CR_ODEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODEN_BitNumber * 4))
mbed_official 87:085cde657901 67
mbed_official 87:085cde657901 68 /* Alias word address of ODSWEN bit */
mbed_official 87:085cde657901 69 #define ODSWEN_BitNumber 0x11
mbed_official 87:085cde657901 70 #define CR_ODSWEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODSWEN_BitNumber * 4))
mbed_official 87:085cde657901 71
mbed_official 87:085cde657901 72
mbed_official 87:085cde657901 73 /** @defgroup PWREx_Over_Under_Drive_Flag
mbed_official 87:085cde657901 74 * @{
mbed_official 87:085cde657901 75 */
mbed_official 87:085cde657901 76 #define PWR_FLAG_ODRDY PWR_CSR_ODRDY
mbed_official 87:085cde657901 77 #define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY
mbed_official 87:085cde657901 78 #define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY
mbed_official 87:085cde657901 79 /**
mbed_official 87:085cde657901 80 * @}
mbed_official 87:085cde657901 81 */
mbed_official 87:085cde657901 82
mbed_official 87:085cde657901 83 /**
mbed_official 87:085cde657901 84 * @}
mbed_official 87:085cde657901 85 */
mbed_official 87:085cde657901 86
mbed_official 87:085cde657901 87 /* Exported macro ------------------------------------------------------------*/
mbed_official 87:085cde657901 88
mbed_official 87:085cde657901 89 /** @brief Macros to enable or disable the Over drive mode.
mbed_official 87:085cde657901 90 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
mbed_official 87:085cde657901 91 */
mbed_official 87:085cde657901 92 #define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE)
mbed_official 87:085cde657901 93 #define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE)
mbed_official 87:085cde657901 94
mbed_official 87:085cde657901 95 /** @brief Macros to enable or disable the Over drive switching.
mbed_official 87:085cde657901 96 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
mbed_official 87:085cde657901 97 */
mbed_official 87:085cde657901 98 #define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE)
mbed_official 87:085cde657901 99 #define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE)
mbed_official 87:085cde657901 100
mbed_official 87:085cde657901 101 /** @brief Macros to enable or disable the Under drive mode.
mbed_official 87:085cde657901 102 * @note This mode is enabled only with STOP low power mode.
mbed_official 87:085cde657901 103 * In this mode, the 1.2V domain is preserved in reduced leakage mode. This
mbed_official 87:085cde657901 104 * mode is only available when the main regulator or the low power regulator
mbed_official 87:085cde657901 105 * is in low voltage mode.
mbed_official 87:085cde657901 106 * @note If the Under-drive mode was enabled, it is automatically disabled after
mbed_official 87:085cde657901 107 * exiting Stop mode.
mbed_official 87:085cde657901 108 * When the voltage regulator operates in Under-drive mode, an additional
mbed_official 87:085cde657901 109 * startup delay is induced when waking up from Stop mode.
mbed_official 87:085cde657901 110 */
mbed_official 87:085cde657901 111 #define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN)
mbed_official 87:085cde657901 112 #define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN))
mbed_official 87:085cde657901 113
mbed_official 87:085cde657901 114 /** @brief Check PWR flag is set or not.
mbed_official 87:085cde657901 115 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
mbed_official 87:085cde657901 116 * @param __FLAG__: specifies the flag to check.
mbed_official 87:085cde657901 117 * This parameter can be one of the following values:
mbed_official 87:085cde657901 118 * @arg PWR_FLAG_ODRDY: This flag indicates that the Over-drive mode
mbed_official 87:085cde657901 119 * is ready
mbed_official 87:085cde657901 120 * @arg PWR_FLAG_ODSWRDY: This flag indicates that the Over-drive mode
mbed_official 87:085cde657901 121 * switching is ready
mbed_official 87:085cde657901 122 * @arg PWR_FLAG_UDRDY: This flag indicates that the Under-drive mode
mbed_official 87:085cde657901 123 * is enabled in Stop mode
mbed_official 87:085cde657901 124 * @retval The new state of __FLAG__ (TRUE or FALSE).
mbed_official 87:085cde657901 125 */
mbed_official 87:085cde657901 126 #define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
mbed_official 87:085cde657901 127
mbed_official 87:085cde657901 128 /** @brief Clear the Under-Drive Ready flag.
mbed_official 87:085cde657901 129 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
mbed_official 87:085cde657901 130 */
mbed_official 87:085cde657901 131 #define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY)
mbed_official 87:085cde657901 132
mbed_official 87:085cde657901 133 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
mbed_official 87:085cde657901 134
mbed_official 87:085cde657901 135 /* Exported functions --------------------------------------------------------*/
mbed_official 87:085cde657901 136 void HAL_PWREx_EnableFlashPowerDown(void);
mbed_official 87:085cde657901 137 void HAL_PWREx_DisableFlashPowerDown(void);
mbed_official 87:085cde657901 138 HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void);
mbed_official 87:085cde657901 139 HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void);
mbed_official 87:085cde657901 140
mbed_official 87:085cde657901 141 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
mbed_official 87:085cde657901 142 HAL_StatusTypeDef HAL_PWREx_ActivateOverDrive(void);
mbed_official 87:085cde657901 143 HAL_StatusTypeDef HAL_PWREx_DeactivateOverDrive(void);
mbed_official 87:085cde657901 144 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
mbed_official 87:085cde657901 145
mbed_official 87:085cde657901 146 /**
mbed_official 87:085cde657901 147 * @}
mbed_official 87:085cde657901 148 */
mbed_official 87:085cde657901 149
mbed_official 87:085cde657901 150 /**
mbed_official 87:085cde657901 151 * @}
mbed_official 87:085cde657901 152 */
mbed_official 87:085cde657901 153
mbed_official 87:085cde657901 154 #ifdef __cplusplus
mbed_official 87:085cde657901 155 }
mbed_official 87:085cde657901 156 #endif
mbed_official 87:085cde657901 157
mbed_official 87:085cde657901 158
mbed_official 87:085cde657901 159 #endif /* __STM32F4xx_HAL_PWR_EX_H */
mbed_official 87:085cde657901 160
mbed_official 87:085cde657901 161 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/