Zeroday Hong / mbed-dev

Fork of mbed-dev by mbed official

Committer:
funshine
Date:
Sat Apr 08 17:03:55 2017 +0000
Revision:
162:16168a1438f3
Parent:
149:156823d33999
add code to handle serial port rx error in uart_irq()

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /**
<> 149:156823d33999 2 ******************************************************************************
<> 149:156823d33999 3 * @file stm32l1xx_hal_pwr_ex.c
<> 149:156823d33999 4 * @author MCD Application Team
<> 149:156823d33999 5 * @version V1.2.0
<> 149:156823d33999 6 * @date 01-July-2016
<> 149:156823d33999 7 * @brief Extended PWR HAL module driver.
<> 149:156823d33999 8 * This file provides firmware functions to manage the following
<> 149:156823d33999 9 * functionalities of the Power Controller (PWR) peripheral:
<> 149:156823d33999 10 * + Extended Initialization and de-initialization functions
<> 149:156823d33999 11 * + Extended Peripheral Control functions
<> 149:156823d33999 12 *
<> 149:156823d33999 13 ******************************************************************************
<> 149:156823d33999 14 * @attention
<> 149:156823d33999 15 *
<> 149:156823d33999 16 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
<> 149:156823d33999 17 *
<> 149:156823d33999 18 * Redistribution and use in source and binary forms, with or without modification,
<> 149:156823d33999 19 * are permitted provided that the following conditions are met:
<> 149:156823d33999 20 * 1. Redistributions of source code must retain the above copyright notice,
<> 149:156823d33999 21 * this list of conditions and the following disclaimer.
<> 149:156823d33999 22 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 149:156823d33999 23 * this list of conditions and the following disclaimer in the documentation
<> 149:156823d33999 24 * and/or other materials provided with the distribution.
<> 149:156823d33999 25 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 149:156823d33999 26 * may be used to endorse or promote products derived from this software
<> 149:156823d33999 27 * without specific prior written permission.
<> 149:156823d33999 28 *
<> 149:156823d33999 29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 149:156823d33999 30 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 149:156823d33999 31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 149:156823d33999 32 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 149:156823d33999 33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 149:156823d33999 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 149:156823d33999 35 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 149:156823d33999 36 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 149:156823d33999 37 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 149:156823d33999 38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 149:156823d33999 39 *
<> 149:156823d33999 40 ******************************************************************************
<> 149:156823d33999 41 */
<> 149:156823d33999 42
<> 149:156823d33999 43 /* Includes ------------------------------------------------------------------*/
<> 149:156823d33999 44 #include "stm32l1xx_hal.h"
<> 149:156823d33999 45
<> 149:156823d33999 46 /** @addtogroup STM32L1xx_HAL_Driver
<> 149:156823d33999 47 * @{
<> 149:156823d33999 48 */
<> 149:156823d33999 49
<> 149:156823d33999 50 /** @defgroup PWREx PWREx
<> 149:156823d33999 51 * @brief PWR HAL module driver
<> 149:156823d33999 52 * @{
<> 149:156823d33999 53 */
<> 149:156823d33999 54
<> 149:156823d33999 55 #ifdef HAL_PWR_MODULE_ENABLED
<> 149:156823d33999 56
<> 149:156823d33999 57 /* Private typedef -----------------------------------------------------------*/
<> 149:156823d33999 58 /* Private define ------------------------------------------------------------*/
<> 149:156823d33999 59 /* Private macro -------------------------------------------------------------*/
<> 149:156823d33999 60 /* Private variables ---------------------------------------------------------*/
<> 149:156823d33999 61 /* Private function prototypes -----------------------------------------------*/
<> 149:156823d33999 62 /* Private functions ---------------------------------------------------------*/
<> 149:156823d33999 63
<> 149:156823d33999 64 /** @defgroup PWREx_Exported_Functions PWREx Exported Functions
<> 149:156823d33999 65 * @{
<> 149:156823d33999 66 */
<> 149:156823d33999 67
<> 149:156823d33999 68 /** @defgroup PWREx_Exported_Functions_Group1 Peripheral Extended Features Functions
<> 149:156823d33999 69 * @brief Low Power modes configuration functions
<> 149:156823d33999 70 *
<> 149:156823d33999 71 @verbatim
<> 149:156823d33999 72
<> 149:156823d33999 73 ===============================================================================
<> 149:156823d33999 74 ##### Peripheral extended features functions #####
<> 149:156823d33999 75 ===============================================================================
<> 149:156823d33999 76 @endverbatim
<> 149:156823d33999 77 * @{
<> 149:156823d33999 78 */
<> 149:156823d33999 79
<> 149:156823d33999 80 /**
<> 149:156823d33999 81 * @brief Return Voltage Scaling Range.
<> 149:156823d33999 82 * @retval VOS bit field (PWR_REGULATOR_VOLTAGE_SCALE1, PWR_REGULATOR_VOLTAGE_SCALE2 or PWR_REGULATOR_VOLTAGE_SCALE3)
<> 149:156823d33999 83 */
<> 149:156823d33999 84 uint32_t HAL_PWREx_GetVoltageRange(void)
<> 149:156823d33999 85 {
<> 149:156823d33999 86 return (PWR->CR & PWR_CR_VOS);
<> 149:156823d33999 87 }
<> 149:156823d33999 88
<> 149:156823d33999 89
<> 149:156823d33999 90 /**
<> 149:156823d33999 91 * @brief Enables the Fast WakeUp from Ultra Low Power mode.
<> 149:156823d33999 92 * @note This bit works in conjunction with ULP bit.
<> 149:156823d33999 93 * Means, when ULP = 1 and FWU = 1 :VREFINT startup time is ignored when
<> 149:156823d33999 94 * exiting from low power mode.
<> 149:156823d33999 95 * @retval None
<> 149:156823d33999 96 */
<> 149:156823d33999 97 void HAL_PWREx_EnableFastWakeUp(void)
<> 149:156823d33999 98 {
<> 149:156823d33999 99 /* Enable the fast wake up */
<> 149:156823d33999 100 *(__IO uint32_t *) CR_FWU_BB = (uint32_t)ENABLE;
<> 149:156823d33999 101 }
<> 149:156823d33999 102
<> 149:156823d33999 103 /**
<> 149:156823d33999 104 * @brief Disables the Fast WakeUp from Ultra Low Power mode.
<> 149:156823d33999 105 * @retval None
<> 149:156823d33999 106 */
<> 149:156823d33999 107 void HAL_PWREx_DisableFastWakeUp(void)
<> 149:156823d33999 108 {
<> 149:156823d33999 109 /* Disable the fast wake up */
<> 149:156823d33999 110 *(__IO uint32_t *) CR_FWU_BB = (uint32_t)DISABLE;
<> 149:156823d33999 111 }
<> 149:156823d33999 112
<> 149:156823d33999 113 /**
<> 149:156823d33999 114 * @brief Enables the Ultra Low Power mode
<> 149:156823d33999 115 * @retval None
<> 149:156823d33999 116 */
<> 149:156823d33999 117 void HAL_PWREx_EnableUltraLowPower(void)
<> 149:156823d33999 118 {
<> 149:156823d33999 119 /* Enable the Ultra Low Power mode */
<> 149:156823d33999 120 *(__IO uint32_t *) CR_ULP_BB = (uint32_t)ENABLE;
<> 149:156823d33999 121 }
<> 149:156823d33999 122
<> 149:156823d33999 123 /**
<> 149:156823d33999 124 * @brief Disables the Ultra Low Power mode
<> 149:156823d33999 125 * @retval None
<> 149:156823d33999 126 */
<> 149:156823d33999 127 void HAL_PWREx_DisableUltraLowPower(void)
<> 149:156823d33999 128 {
<> 149:156823d33999 129 /* Disable the Ultra Low Power mode */
<> 149:156823d33999 130 *(__IO uint32_t *) CR_ULP_BB = (uint32_t)DISABLE;
<> 149:156823d33999 131 }
<> 149:156823d33999 132
<> 149:156823d33999 133 /**
<> 149:156823d33999 134 * @brief Enters the Low Power Run mode.
<> 149:156823d33999 135 * @note Low power run mode can only be entered when VCORE is in range 2.
<> 149:156823d33999 136 * In addition, the dynamic voltage scaling must not be used when Low
<> 149:156823d33999 137 * power run mode is selected. Only Stop and Sleep modes with regulator
<> 149:156823d33999 138 * configured in Low power mode is allowed when Low power run mode is
<> 149:156823d33999 139 * selected.
<> 149:156823d33999 140 * @note In Low power run mode, all I/O pins keep the same state as in Run mode.
<> 149:156823d33999 141 * @retval None
<> 149:156823d33999 142 */
<> 149:156823d33999 143 void HAL_PWREx_EnableLowPowerRunMode(void)
<> 149:156823d33999 144 {
<> 149:156823d33999 145 /* Enters the Low Power Run mode */
<> 149:156823d33999 146 *(__IO uint32_t *) CR_LPSDSR_BB = (uint32_t)ENABLE;
<> 149:156823d33999 147 *(__IO uint32_t *) CR_LPRUN_BB = (uint32_t)ENABLE;
<> 149:156823d33999 148 }
<> 149:156823d33999 149
<> 149:156823d33999 150 /**
<> 149:156823d33999 151 * @brief Exits the Low Power Run mode.
<> 149:156823d33999 152 * @retval None
<> 149:156823d33999 153 */
<> 149:156823d33999 154 HAL_StatusTypeDef HAL_PWREx_DisableLowPowerRunMode(void)
<> 149:156823d33999 155 {
<> 149:156823d33999 156 /* Exits the Low Power Run mode */
<> 149:156823d33999 157 *(__IO uint32_t *) CR_LPRUN_BB = (uint32_t)DISABLE;
<> 149:156823d33999 158 *(__IO uint32_t *) CR_LPSDSR_BB = (uint32_t)DISABLE;
<> 149:156823d33999 159 return HAL_OK;
<> 149:156823d33999 160 }
<> 149:156823d33999 161
<> 149:156823d33999 162 /**
<> 149:156823d33999 163 * @}
<> 149:156823d33999 164 */
<> 149:156823d33999 165
<> 149:156823d33999 166 /**
<> 149:156823d33999 167 * @}
<> 149:156823d33999 168 */
<> 149:156823d33999 169
<> 149:156823d33999 170 #endif /* HAL_PWR_MODULE_ENABLED */
<> 149:156823d33999 171 /**
<> 149:156823d33999 172 * @}
<> 149:156823d33999 173 */
<> 149:156823d33999 174
<> 149:156823d33999 175 /**
<> 149:156823d33999 176 * @}
<> 149:156823d33999 177 */
<> 149:156823d33999 178
<> 149:156823d33999 179 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/