mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_STM32F407VG/stm32f4xx_hal_pwr_ex.h@296:ec1b66a3d094, 2014-08-21 (annotated)
- 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_pwr_ex.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?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 133:d4dda5c437f0 | 1 | /** |
mbed_official | 133:d4dda5c437f0 | 2 | ****************************************************************************** |
mbed_official | 133:d4dda5c437f0 | 3 | * @file stm32f4xx_hal_pwr_ex.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 PWR HAL Extension module. |
mbed_official | 133:d4dda5c437f0 | 8 | ****************************************************************************** |
mbed_official | 133:d4dda5c437f0 | 9 | * @attention |
mbed_official | 133:d4dda5c437f0 | 10 | * |
mbed_official | 133:d4dda5c437f0 | 11 | * <h2><center>© 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_PWR_EX_H |
mbed_official | 133:d4dda5c437f0 | 40 | #define __STM32F4xx_HAL_PWR_EX_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 PWREx |
mbed_official | 133:d4dda5c437f0 | 54 | * @{ |
mbed_official | 133:d4dda5c437f0 | 55 | */ |
mbed_official | 133:d4dda5c437f0 | 56 | |
mbed_official | 133:d4dda5c437f0 | 57 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) |
mbed_official | 133:d4dda5c437f0 | 58 | |
mbed_official | 133:d4dda5c437f0 | 59 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 60 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 61 | /* ------------- PWR registers bit address in the alias region ---------------*/ |
mbed_official | 133:d4dda5c437f0 | 62 | /* --- CR Register ---*/ |
mbed_official | 133:d4dda5c437f0 | 63 | |
mbed_official | 133:d4dda5c437f0 | 64 | /* Alias word address of ODEN bit */ |
mbed_official | 133:d4dda5c437f0 | 65 | #define ODEN_BitNumber 0x10 |
mbed_official | 133:d4dda5c437f0 | 66 | #define CR_ODEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODEN_BitNumber * 4)) |
mbed_official | 133:d4dda5c437f0 | 67 | |
mbed_official | 133:d4dda5c437f0 | 68 | /* Alias word address of ODSWEN bit */ |
mbed_official | 133:d4dda5c437f0 | 69 | #define ODSWEN_BitNumber 0x11 |
mbed_official | 133:d4dda5c437f0 | 70 | #define CR_ODSWEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODSWEN_BitNumber * 4)) |
mbed_official | 133:d4dda5c437f0 | 71 | |
mbed_official | 133:d4dda5c437f0 | 72 | |
mbed_official | 133:d4dda5c437f0 | 73 | /** @defgroup PWREx_Over_Under_Drive_Flag |
mbed_official | 133:d4dda5c437f0 | 74 | * @{ |
mbed_official | 133:d4dda5c437f0 | 75 | */ |
mbed_official | 133:d4dda5c437f0 | 76 | #define PWR_FLAG_ODRDY PWR_CSR_ODRDY |
mbed_official | 133:d4dda5c437f0 | 77 | #define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY |
mbed_official | 133:d4dda5c437f0 | 78 | #define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY |
mbed_official | 133:d4dda5c437f0 | 79 | /** |
mbed_official | 133:d4dda5c437f0 | 80 | * @} |
mbed_official | 133:d4dda5c437f0 | 81 | */ |
mbed_official | 133:d4dda5c437f0 | 82 | |
mbed_official | 133:d4dda5c437f0 | 83 | /** |
mbed_official | 133:d4dda5c437f0 | 84 | * @} |
mbed_official | 133:d4dda5c437f0 | 85 | */ |
mbed_official | 133:d4dda5c437f0 | 86 | |
mbed_official | 133:d4dda5c437f0 | 87 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 88 | |
mbed_official | 133:d4dda5c437f0 | 89 | /** @brief Macros to enable or disable the Over drive mode. |
mbed_official | 133:d4dda5c437f0 | 90 | * @note These macros can be used only for STM32F42xx/STM3243xx devices. |
mbed_official | 133:d4dda5c437f0 | 91 | */ |
mbed_official | 133:d4dda5c437f0 | 92 | #define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE) |
mbed_official | 133:d4dda5c437f0 | 93 | #define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE) |
mbed_official | 133:d4dda5c437f0 | 94 | |
mbed_official | 133:d4dda5c437f0 | 95 | /** @brief Macros to enable or disable the Over drive switching. |
mbed_official | 133:d4dda5c437f0 | 96 | * @note These macros can be used only for STM32F42xx/STM3243xx devices. |
mbed_official | 133:d4dda5c437f0 | 97 | */ |
mbed_official | 133:d4dda5c437f0 | 98 | #define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE) |
mbed_official | 133:d4dda5c437f0 | 99 | #define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE) |
mbed_official | 133:d4dda5c437f0 | 100 | |
mbed_official | 133:d4dda5c437f0 | 101 | /** @brief Macros to enable or disable the Under drive mode. |
mbed_official | 133:d4dda5c437f0 | 102 | * @note This mode is enabled only with STOP low power mode. |
mbed_official | 133:d4dda5c437f0 | 103 | * In this mode, the 1.2V domain is preserved in reduced leakage mode. This |
mbed_official | 133:d4dda5c437f0 | 104 | * mode is only available when the main regulator or the low power regulator |
mbed_official | 133:d4dda5c437f0 | 105 | * is in low voltage mode. |
mbed_official | 133:d4dda5c437f0 | 106 | * @note If the Under-drive mode was enabled, it is automatically disabled after |
mbed_official | 133:d4dda5c437f0 | 107 | * exiting Stop mode. |
mbed_official | 133:d4dda5c437f0 | 108 | * When the voltage regulator operates in Under-drive mode, an additional |
mbed_official | 133:d4dda5c437f0 | 109 | * startup delay is induced when waking up from Stop mode. |
mbed_official | 133:d4dda5c437f0 | 110 | */ |
mbed_official | 133:d4dda5c437f0 | 111 | #define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN) |
mbed_official | 133:d4dda5c437f0 | 112 | #define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN)) |
mbed_official | 133:d4dda5c437f0 | 113 | |
mbed_official | 133:d4dda5c437f0 | 114 | /** @brief Check PWR flag is set or not. |
mbed_official | 133:d4dda5c437f0 | 115 | * @note These macros can be used only for STM32F42xx/STM3243xx devices. |
mbed_official | 133:d4dda5c437f0 | 116 | * @param __FLAG__: specifies the flag to check. |
mbed_official | 133:d4dda5c437f0 | 117 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 118 | * @arg PWR_FLAG_ODRDY: This flag indicates that the Over-drive mode |
mbed_official | 133:d4dda5c437f0 | 119 | * is ready |
mbed_official | 133:d4dda5c437f0 | 120 | * @arg PWR_FLAG_ODSWRDY: This flag indicates that the Over-drive mode |
mbed_official | 133:d4dda5c437f0 | 121 | * switching is ready |
mbed_official | 133:d4dda5c437f0 | 122 | * @arg PWR_FLAG_UDRDY: This flag indicates that the Under-drive mode |
mbed_official | 133:d4dda5c437f0 | 123 | * is enabled in Stop mode |
mbed_official | 133:d4dda5c437f0 | 124 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
mbed_official | 133:d4dda5c437f0 | 125 | */ |
mbed_official | 133:d4dda5c437f0 | 126 | #define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) |
mbed_official | 133:d4dda5c437f0 | 127 | |
mbed_official | 133:d4dda5c437f0 | 128 | /** @brief Clear the Under-Drive Ready flag. |
mbed_official | 133:d4dda5c437f0 | 129 | * @note These macros can be used only for STM32F42xx/STM3243xx devices. |
mbed_official | 133:d4dda5c437f0 | 130 | */ |
mbed_official | 133:d4dda5c437f0 | 131 | #define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY) |
mbed_official | 133:d4dda5c437f0 | 132 | |
mbed_official | 133:d4dda5c437f0 | 133 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ |
mbed_official | 133:d4dda5c437f0 | 134 | |
mbed_official | 133:d4dda5c437f0 | 135 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 136 | void HAL_PWREx_EnableFlashPowerDown(void); |
mbed_official | 133:d4dda5c437f0 | 137 | void HAL_PWREx_DisableFlashPowerDown(void); |
mbed_official | 133:d4dda5c437f0 | 138 | HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void); |
mbed_official | 133:d4dda5c437f0 | 139 | HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void); |
mbed_official | 133:d4dda5c437f0 | 140 | |
mbed_official | 133:d4dda5c437f0 | 141 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) |
mbed_official | 133:d4dda5c437f0 | 142 | HAL_StatusTypeDef HAL_PWREx_ActivateOverDrive(void); |
mbed_official | 133:d4dda5c437f0 | 143 | HAL_StatusTypeDef HAL_PWREx_DeactivateOverDrive(void); |
mbed_official | 133:d4dda5c437f0 | 144 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ |
mbed_official | 133:d4dda5c437f0 | 145 | |
mbed_official | 133:d4dda5c437f0 | 146 | /** |
mbed_official | 133:d4dda5c437f0 | 147 | * @} |
mbed_official | 133:d4dda5c437f0 | 148 | */ |
mbed_official | 133:d4dda5c437f0 | 149 | |
mbed_official | 133:d4dda5c437f0 | 150 | /** |
mbed_official | 133:d4dda5c437f0 | 151 | * @} |
mbed_official | 133:d4dda5c437f0 | 152 | */ |
mbed_official | 133:d4dda5c437f0 | 153 | |
mbed_official | 133:d4dda5c437f0 | 154 | #ifdef __cplusplus |
mbed_official | 133:d4dda5c437f0 | 155 | } |
mbed_official | 133:d4dda5c437f0 | 156 | #endif |
mbed_official | 133:d4dda5c437f0 | 157 | |
mbed_official | 133:d4dda5c437f0 | 158 | |
mbed_official | 133:d4dda5c437f0 | 159 | #endif /* __STM32F4xx_HAL_PWR_EX_H */ |
mbed_official | 133:d4dda5c437f0 | 160 | |
mbed_official | 133:d4dda5c437f0 | 161 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |