mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/stm32f4xx_hal.c@87:085cde657901, 2014-02-08 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 87:085cde657901 | 1 | /** |
mbed_official | 87:085cde657901 | 2 | ****************************************************************************** |
mbed_official | 87:085cde657901 | 3 | * @file stm32f4xx_hal.c |
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 HAL module driver. |
mbed_official | 87:085cde657901 | 8 | * This is the common part of the HAL initialization |
mbed_official | 87:085cde657901 | 9 | * |
mbed_official | 87:085cde657901 | 10 | @verbatim |
mbed_official | 87:085cde657901 | 11 | ============================================================================== |
mbed_official | 87:085cde657901 | 12 | ##### How to use this driver ##### |
mbed_official | 87:085cde657901 | 13 | ============================================================================== |
mbed_official | 87:085cde657901 | 14 | [..] |
mbed_official | 87:085cde657901 | 15 | The common HAL driver contains a set of generic and common APIs that can be |
mbed_official | 87:085cde657901 | 16 | used by the PPP peripheral drivers and the user to start using the HAL. |
mbed_official | 87:085cde657901 | 17 | [..] |
mbed_official | 87:085cde657901 | 18 | The HAL contains two APIs categories: |
mbed_official | 87:085cde657901 | 19 | (+) Common HAL APIs |
mbed_official | 87:085cde657901 | 20 | (+) Services HAL APIs |
mbed_official | 87:085cde657901 | 21 | |
mbed_official | 87:085cde657901 | 22 | @endverbatim |
mbed_official | 87:085cde657901 | 23 | ****************************************************************************** |
mbed_official | 87:085cde657901 | 24 | * @attention |
mbed_official | 87:085cde657901 | 25 | * |
mbed_official | 87:085cde657901 | 26 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 87:085cde657901 | 27 | * |
mbed_official | 87:085cde657901 | 28 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 87:085cde657901 | 29 | * are permitted provided that the following conditions are met: |
mbed_official | 87:085cde657901 | 30 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 87:085cde657901 | 31 | * this list of conditions and the following disclaimer. |
mbed_official | 87:085cde657901 | 32 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 87:085cde657901 | 33 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 87:085cde657901 | 34 | * and/or other materials provided with the distribution. |
mbed_official | 87:085cde657901 | 35 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 87:085cde657901 | 36 | * may be used to endorse or promote products derived from this software |
mbed_official | 87:085cde657901 | 37 | * without specific prior written permission. |
mbed_official | 87:085cde657901 | 38 | * |
mbed_official | 87:085cde657901 | 39 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 87:085cde657901 | 40 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 87:085cde657901 | 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 87:085cde657901 | 42 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 87:085cde657901 | 43 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 87:085cde657901 | 44 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 87:085cde657901 | 45 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 87:085cde657901 | 46 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 87:085cde657901 | 47 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 87:085cde657901 | 48 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 87:085cde657901 | 49 | * |
mbed_official | 87:085cde657901 | 50 | ****************************************************************************** |
mbed_official | 87:085cde657901 | 51 | */ |
mbed_official | 87:085cde657901 | 52 | |
mbed_official | 87:085cde657901 | 53 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 54 | #include "stm32f4xx_hal.h" |
mbed_official | 87:085cde657901 | 55 | |
mbed_official | 87:085cde657901 | 56 | /** @addtogroup STM32F4xx_HAL_Driver |
mbed_official | 87:085cde657901 | 57 | * @{ |
mbed_official | 87:085cde657901 | 58 | */ |
mbed_official | 87:085cde657901 | 59 | |
mbed_official | 87:085cde657901 | 60 | /** @defgroup HAL |
mbed_official | 87:085cde657901 | 61 | * @brief HAL module driver. |
mbed_official | 87:085cde657901 | 62 | * @{ |
mbed_official | 87:085cde657901 | 63 | */ |
mbed_official | 87:085cde657901 | 64 | |
mbed_official | 87:085cde657901 | 65 | #ifdef HAL_MODULE_ENABLED |
mbed_official | 87:085cde657901 | 66 | |
mbed_official | 87:085cde657901 | 67 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 68 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 69 | /** |
mbed_official | 87:085cde657901 | 70 | * @brief STM32F4xx HAL Driver version number V1.0.0RC1 |
mbed_official | 87:085cde657901 | 71 | */ |
mbed_official | 87:085cde657901 | 72 | #define __STM32F4xx_HAL_VERSION_MAIN (0x01) /*!< [31:24] main version */ |
mbed_official | 87:085cde657901 | 73 | #define __STM32F4xx_HAL_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */ |
mbed_official | 87:085cde657901 | 74 | #define __STM32F4xx_HAL_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ |
mbed_official | 87:085cde657901 | 75 | #define __STM32F4xx_HAL_VERSION_RC (0x01) /*!< [7:0] release candidate */ |
mbed_official | 87:085cde657901 | 76 | #define __STM32F4xx_HAL_VERSION ((__STM32F4xx_HAL_VERSION_MAIN << 24)\ |
mbed_official | 87:085cde657901 | 77 | |(__STM32F4xx_HAL_VERSION_SUB1 << 16)\ |
mbed_official | 87:085cde657901 | 78 | |(__STM32F4xx_HAL_VERSION_SUB2 << 8 )\ |
mbed_official | 87:085cde657901 | 79 | |(__STM32F4xx_HAL_VERSION_RC)) |
mbed_official | 87:085cde657901 | 80 | |
mbed_official | 87:085cde657901 | 81 | #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF) |
mbed_official | 87:085cde657901 | 82 | |
mbed_official | 87:085cde657901 | 83 | /* ------------ RCC registers bit address in the alias region ----------- */ |
mbed_official | 87:085cde657901 | 84 | #define SYSCFG_OFFSET (SYSCFG_BASE - PERIPH_BASE) |
mbed_official | 87:085cde657901 | 85 | /* --- MEMRMP Register ---*/ |
mbed_official | 87:085cde657901 | 86 | /* Alias word address of UFB_MODE bit */ |
mbed_official | 87:085cde657901 | 87 | #define MEMRMP_OFFSET SYSCFG_OFFSET |
mbed_official | 87:085cde657901 | 88 | #define UFB_MODE_BitNumber ((uint8_t)0x8) |
mbed_official | 87:085cde657901 | 89 | #define UFB_MODE_BB (PERIPH_BB_BASE + (MEMRMP_OFFSET * 32) + (UFB_MODE_BitNumber * 4)) |
mbed_official | 87:085cde657901 | 90 | |
mbed_official | 87:085cde657901 | 91 | /* --- CMPCR Register ---*/ |
mbed_official | 87:085cde657901 | 92 | /* Alias word address of CMP_PD bit */ |
mbed_official | 87:085cde657901 | 93 | #define CMPCR_OFFSET (SYSCFG_OFFSET + 0x20) |
mbed_official | 87:085cde657901 | 94 | #define CMP_PD_BitNumber ((uint8_t)0x00) |
mbed_official | 87:085cde657901 | 95 | #define CMPCR_CMP_PD_BB (PERIPH_BB_BASE + (CMPCR_OFFSET * 32) + (CMP_PD_BitNumber * 4)) |
mbed_official | 87:085cde657901 | 96 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 97 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 98 | static __IO uint32_t uwTick; |
mbed_official | 87:085cde657901 | 99 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 87:085cde657901 | 100 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 101 | |
mbed_official | 87:085cde657901 | 102 | /** @defgroup HAL_Private_Functions |
mbed_official | 87:085cde657901 | 103 | * @{ |
mbed_official | 87:085cde657901 | 104 | */ |
mbed_official | 87:085cde657901 | 105 | |
mbed_official | 87:085cde657901 | 106 | /** @defgroup HAL_Group1 Initialization and de-initialization Functions |
mbed_official | 87:085cde657901 | 107 | * @brief Initialization and de-initialization functions |
mbed_official | 87:085cde657901 | 108 | * |
mbed_official | 87:085cde657901 | 109 | @verbatim |
mbed_official | 87:085cde657901 | 110 | =============================================================================== |
mbed_official | 87:085cde657901 | 111 | ##### Initialization and de-initialization functions ##### |
mbed_official | 87:085cde657901 | 112 | =============================================================================== |
mbed_official | 87:085cde657901 | 113 | [..] This section provides functions allowing to: |
mbed_official | 87:085cde657901 | 114 | (+) Initializes the Flash interface the NVIC allocation and initial clock |
mbed_official | 87:085cde657901 | 115 | configuration. It initializes the systick also when timeout is needed |
mbed_official | 87:085cde657901 | 116 | and the backup domain when enabled. |
mbed_official | 87:085cde657901 | 117 | (+) de-Initializes common part of the HAL |
mbed_official | 87:085cde657901 | 118 | |
mbed_official | 87:085cde657901 | 119 | @endverbatim |
mbed_official | 87:085cde657901 | 120 | * @{ |
mbed_official | 87:085cde657901 | 121 | */ |
mbed_official | 87:085cde657901 | 122 | |
mbed_official | 87:085cde657901 | 123 | /** |
mbed_official | 87:085cde657901 | 124 | * @brief This function configures the Flash prefetch, instruction and Data caches, |
mbed_official | 87:085cde657901 | 125 | * Configures systick, NVIC and Low level hardware |
mbed_official | 87:085cde657901 | 126 | * |
mbed_official | 87:085cde657901 | 127 | * @note This function is called at the beginning of program after reset and before |
mbed_official | 87:085cde657901 | 128 | * the clock configuration |
mbed_official | 87:085cde657901 | 129 | * |
mbed_official | 87:085cde657901 | 130 | * @note The Systick configuration is based on HSI clock, as HSI is the clock |
mbed_official | 87:085cde657901 | 131 | * used after a system Reset and the NVIC configuration is set to Priority group 4 |
mbed_official | 87:085cde657901 | 132 | * |
mbed_official | 87:085cde657901 | 133 | * @note The Systick Interrupt is defined with the lowest priority in "core_cm4.h" file |
mbed_official | 87:085cde657901 | 134 | * In this case HAL_Delay() must not be used under interrupt with higher priority. |
mbed_official | 87:085cde657901 | 135 | * |
mbed_official | 87:085cde657901 | 136 | * @note |
mbed_official | 87:085cde657901 | 137 | * @param None |
mbed_official | 87:085cde657901 | 138 | * @retval HAL status |
mbed_official | 87:085cde657901 | 139 | */ |
mbed_official | 87:085cde657901 | 140 | HAL_StatusTypeDef HAL_Init(void) |
mbed_official | 87:085cde657901 | 141 | { |
mbed_official | 87:085cde657901 | 142 | /* Configure Flash prefetch, Instruction cache, Data cache */ |
mbed_official | 87:085cde657901 | 143 | #if (INSTRUCTION_CACHE_ENABLE != 0) |
mbed_official | 87:085cde657901 | 144 | __HAL_FLASH_INSTRUCTION_CACHE_ENABLE(); |
mbed_official | 87:085cde657901 | 145 | #endif /* INSTRUCTION_CACHE_ENABLE */ |
mbed_official | 87:085cde657901 | 146 | |
mbed_official | 87:085cde657901 | 147 | #if (DATA_CACHE_ENABLE != 0) |
mbed_official | 87:085cde657901 | 148 | __HAL_FLASH_DATA_CACHE_ENABLE(); |
mbed_official | 87:085cde657901 | 149 | #endif /* DATA_CACHE_ENABLE */ |
mbed_official | 87:085cde657901 | 150 | |
mbed_official | 87:085cde657901 | 151 | #if (PREFETCH_ENABLE != 0) |
mbed_official | 87:085cde657901 | 152 | __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); |
mbed_official | 87:085cde657901 | 153 | #endif /* PREFETCH_ENABLE */ |
mbed_official | 87:085cde657901 | 154 | |
mbed_official | 87:085cde657901 | 155 | /* Enable systick and configure 1ms tick (default clock after Reset is HSI) */ |
mbed_official | 87:085cde657901 | 156 | HAL_SYSTICK_Config(HSI_VALUE/ 1000); |
mbed_official | 87:085cde657901 | 157 | |
mbed_official | 87:085cde657901 | 158 | /* Set Interrupt Group Priority */ |
mbed_official | 87:085cde657901 | 159 | HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); |
mbed_official | 87:085cde657901 | 160 | |
mbed_official | 87:085cde657901 | 161 | /* Init the low level hardware */ |
mbed_official | 87:085cde657901 | 162 | HAL_MspInit(); |
mbed_official | 87:085cde657901 | 163 | |
mbed_official | 87:085cde657901 | 164 | /* Return function status */ |
mbed_official | 87:085cde657901 | 165 | return HAL_OK; |
mbed_official | 87:085cde657901 | 166 | } |
mbed_official | 87:085cde657901 | 167 | |
mbed_official | 87:085cde657901 | 168 | /** |
mbed_official | 87:085cde657901 | 169 | * @brief This function de-Initializes common part of the HAL and stops the systick. |
mbed_official | 87:085cde657901 | 170 | * This function is optional. |
mbed_official | 87:085cde657901 | 171 | * @param None |
mbed_official | 87:085cde657901 | 172 | * @retval HAL status |
mbed_official | 87:085cde657901 | 173 | */ |
mbed_official | 87:085cde657901 | 174 | HAL_StatusTypeDef HAL_DeInit(void) |
mbed_official | 87:085cde657901 | 175 | { |
mbed_official | 87:085cde657901 | 176 | /* Reset of all peripherals */ |
mbed_official | 87:085cde657901 | 177 | __APB1_FORCE_RESET(); |
mbed_official | 87:085cde657901 | 178 | __APB1_RELEASE_RESET(); |
mbed_official | 87:085cde657901 | 179 | |
mbed_official | 87:085cde657901 | 180 | __APB2_FORCE_RESET(); |
mbed_official | 87:085cde657901 | 181 | __APB2_RELEASE_RESET(); |
mbed_official | 87:085cde657901 | 182 | |
mbed_official | 87:085cde657901 | 183 | __AHB1_FORCE_RESET(); |
mbed_official | 87:085cde657901 | 184 | __AHB1_RELEASE_RESET(); |
mbed_official | 87:085cde657901 | 185 | |
mbed_official | 87:085cde657901 | 186 | __AHB2_FORCE_RESET(); |
mbed_official | 87:085cde657901 | 187 | __AHB2_RELEASE_RESET(); |
mbed_official | 87:085cde657901 | 188 | |
mbed_official | 87:085cde657901 | 189 | __AHB3_FORCE_RESET(); |
mbed_official | 87:085cde657901 | 190 | __AHB3_RELEASE_RESET(); |
mbed_official | 87:085cde657901 | 191 | |
mbed_official | 87:085cde657901 | 192 | /* De-Init the low level hardware */ |
mbed_official | 87:085cde657901 | 193 | HAL_MspDeInit(); |
mbed_official | 87:085cde657901 | 194 | |
mbed_official | 87:085cde657901 | 195 | /* Return function status */ |
mbed_official | 87:085cde657901 | 196 | return HAL_OK; |
mbed_official | 87:085cde657901 | 197 | } |
mbed_official | 87:085cde657901 | 198 | |
mbed_official | 87:085cde657901 | 199 | /** |
mbed_official | 87:085cde657901 | 200 | * @brief Initializes the MSP. |
mbed_official | 87:085cde657901 | 201 | * @param None |
mbed_official | 87:085cde657901 | 202 | * @retval None |
mbed_official | 87:085cde657901 | 203 | */ |
mbed_official | 87:085cde657901 | 204 | __weak void HAL_MspInit(void) |
mbed_official | 87:085cde657901 | 205 | { |
mbed_official | 87:085cde657901 | 206 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 87:085cde657901 | 207 | the HAL_MspInit could be implemented in the user file |
mbed_official | 87:085cde657901 | 208 | */ |
mbed_official | 87:085cde657901 | 209 | } |
mbed_official | 87:085cde657901 | 210 | |
mbed_official | 87:085cde657901 | 211 | /** |
mbed_official | 87:085cde657901 | 212 | * @brief DeInitializes the MSP. |
mbed_official | 87:085cde657901 | 213 | * @param None |
mbed_official | 87:085cde657901 | 214 | * @retval None |
mbed_official | 87:085cde657901 | 215 | */ |
mbed_official | 87:085cde657901 | 216 | __weak void HAL_MspDeInit(void) |
mbed_official | 87:085cde657901 | 217 | { |
mbed_official | 87:085cde657901 | 218 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 87:085cde657901 | 219 | the HAL_MspDeInit could be implemented in the user file |
mbed_official | 87:085cde657901 | 220 | */ |
mbed_official | 87:085cde657901 | 221 | } |
mbed_official | 87:085cde657901 | 222 | |
mbed_official | 87:085cde657901 | 223 | /** |
mbed_official | 87:085cde657901 | 224 | * @} |
mbed_official | 87:085cde657901 | 225 | */ |
mbed_official | 87:085cde657901 | 226 | |
mbed_official | 87:085cde657901 | 227 | /** @defgroup HAL_Group2 HAL Control functions |
mbed_official | 87:085cde657901 | 228 | * @brief HAL Control functions |
mbed_official | 87:085cde657901 | 229 | * |
mbed_official | 87:085cde657901 | 230 | @verbatim |
mbed_official | 87:085cde657901 | 231 | =============================================================================== |
mbed_official | 87:085cde657901 | 232 | ##### HAL Control functions ##### |
mbed_official | 87:085cde657901 | 233 | =============================================================================== |
mbed_official | 87:085cde657901 | 234 | [..] This section provides functions allowing to: |
mbed_official | 87:085cde657901 | 235 | (+) provide a tick value in millisecond |
mbed_official | 87:085cde657901 | 236 | (+) provide a blocking delay in millisecond |
mbed_official | 87:085cde657901 | 237 | (+) Get the HAL API driver version |
mbed_official | 87:085cde657901 | 238 | (+) Get the device identifier |
mbed_official | 87:085cde657901 | 239 | (+) Get the device revision identifier |
mbed_official | 87:085cde657901 | 240 | (+) Enable/Disable Debug module during Sleep mode |
mbed_official | 87:085cde657901 | 241 | (+) Enable/Disable Debug module during STOP mode |
mbed_official | 87:085cde657901 | 242 | (+) Enable/Disable Debug module during STANDBY mode |
mbed_official | 87:085cde657901 | 243 | |
mbed_official | 87:085cde657901 | 244 | |
mbed_official | 87:085cde657901 | 245 | @endverbatim |
mbed_official | 87:085cde657901 | 246 | * @{ |
mbed_official | 87:085cde657901 | 247 | */ |
mbed_official | 87:085cde657901 | 248 | |
mbed_official | 87:085cde657901 | 249 | /** |
mbed_official | 87:085cde657901 | 250 | * @brief This function is used when systick configuration should be changed. |
mbed_official | 87:085cde657901 | 251 | * It is used to provide the HAL a timer base service. |
mbed_official | 87:085cde657901 | 252 | * @param None |
mbed_official | 87:085cde657901 | 253 | * @retval None |
mbed_official | 87:085cde657901 | 254 | */ |
mbed_official | 87:085cde657901 | 255 | void HAL_IncTick(void) |
mbed_official | 87:085cde657901 | 256 | { |
mbed_official | 87:085cde657901 | 257 | uwTick++; |
mbed_official | 87:085cde657901 | 258 | } |
mbed_official | 87:085cde657901 | 259 | |
mbed_official | 87:085cde657901 | 260 | /** |
mbed_official | 87:085cde657901 | 261 | * @brief This method used to provide a tick value in millisecond. |
mbed_official | 87:085cde657901 | 262 | * @param Non |
mbed_official | 87:085cde657901 | 263 | * @retval tick value |
mbed_official | 87:085cde657901 | 264 | */ |
mbed_official | 87:085cde657901 | 265 | uint32_t HAL_GetTick(void) |
mbed_official | 87:085cde657901 | 266 | { |
mbed_official | 87:085cde657901 | 267 | return uwTick; |
mbed_official | 87:085cde657901 | 268 | } |
mbed_official | 87:085cde657901 | 269 | |
mbed_official | 87:085cde657901 | 270 | /** |
mbed_official | 87:085cde657901 | 271 | * @brief This method used to provide blocking delay |
mbed_official | 87:085cde657901 | 272 | * @param Delay : specifies the delay time length, in milliseconds. |
mbed_official | 87:085cde657901 | 273 | * @retval None |
mbed_official | 87:085cde657901 | 274 | */ |
mbed_official | 87:085cde657901 | 275 | void HAL_Delay(__IO uint32_t Delay) |
mbed_official | 87:085cde657901 | 276 | { |
mbed_official | 87:085cde657901 | 277 | uint32_t timingdelay; |
mbed_official | 87:085cde657901 | 278 | |
mbed_official | 87:085cde657901 | 279 | timingdelay = HAL_GetTick() + Delay; |
mbed_official | 87:085cde657901 | 280 | while(HAL_GetTick() < timingdelay) |
mbed_official | 87:085cde657901 | 281 | { |
mbed_official | 87:085cde657901 | 282 | } |
mbed_official | 87:085cde657901 | 283 | } |
mbed_official | 87:085cde657901 | 284 | |
mbed_official | 87:085cde657901 | 285 | /** |
mbed_official | 87:085cde657901 | 286 | * @brief This method returns the HAL revision |
mbed_official | 87:085cde657901 | 287 | * @param None |
mbed_official | 87:085cde657901 | 288 | * @retval version : 0xXYZR (8bits for each decimal, R for RC) |
mbed_official | 87:085cde657901 | 289 | */ |
mbed_official | 87:085cde657901 | 290 | uint32_t HAL_GetHalVersion(void) |
mbed_official | 87:085cde657901 | 291 | { |
mbed_official | 87:085cde657901 | 292 | return __STM32F4xx_HAL_VERSION; |
mbed_official | 87:085cde657901 | 293 | } |
mbed_official | 87:085cde657901 | 294 | |
mbed_official | 87:085cde657901 | 295 | /** |
mbed_official | 87:085cde657901 | 296 | * @brief Returns the device revision identifier. |
mbed_official | 87:085cde657901 | 297 | * @param None |
mbed_official | 87:085cde657901 | 298 | * @retval Device revision identifier |
mbed_official | 87:085cde657901 | 299 | */ |
mbed_official | 87:085cde657901 | 300 | uint32_t HAL_GetREVID(void) |
mbed_official | 87:085cde657901 | 301 | { |
mbed_official | 87:085cde657901 | 302 | return((DBGMCU->IDCODE) >> 16); |
mbed_official | 87:085cde657901 | 303 | } |
mbed_official | 87:085cde657901 | 304 | |
mbed_official | 87:085cde657901 | 305 | /** |
mbed_official | 87:085cde657901 | 306 | * @brief Returns the device identifier. |
mbed_official | 87:085cde657901 | 307 | * @param None |
mbed_official | 87:085cde657901 | 308 | * @retval Device identifier |
mbed_official | 87:085cde657901 | 309 | */ |
mbed_official | 87:085cde657901 | 310 | uint32_t HAL_GetDEVID(void) |
mbed_official | 87:085cde657901 | 311 | { |
mbed_official | 87:085cde657901 | 312 | return((DBGMCU->IDCODE) & IDCODE_DEVID_MASK); |
mbed_official | 87:085cde657901 | 313 | } |
mbed_official | 87:085cde657901 | 314 | |
mbed_official | 87:085cde657901 | 315 | /** |
mbed_official | 87:085cde657901 | 316 | * @brief Enable the Debug Module during SLEEP mode |
mbed_official | 87:085cde657901 | 317 | * @param None |
mbed_official | 87:085cde657901 | 318 | * @retval None |
mbed_official | 87:085cde657901 | 319 | */ |
mbed_official | 87:085cde657901 | 320 | void HAL_EnableDBGSleepMode(void) |
mbed_official | 87:085cde657901 | 321 | { |
mbed_official | 87:085cde657901 | 322 | SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); |
mbed_official | 87:085cde657901 | 323 | } |
mbed_official | 87:085cde657901 | 324 | |
mbed_official | 87:085cde657901 | 325 | /** |
mbed_official | 87:085cde657901 | 326 | * @brief Disable the Debug Module during SLEEP mode |
mbed_official | 87:085cde657901 | 327 | * @param None |
mbed_official | 87:085cde657901 | 328 | * @retval None |
mbed_official | 87:085cde657901 | 329 | */ |
mbed_official | 87:085cde657901 | 330 | void HAL_DisableDBGSleepMode(void) |
mbed_official | 87:085cde657901 | 331 | { |
mbed_official | 87:085cde657901 | 332 | CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); |
mbed_official | 87:085cde657901 | 333 | } |
mbed_official | 87:085cde657901 | 334 | |
mbed_official | 87:085cde657901 | 335 | /** |
mbed_official | 87:085cde657901 | 336 | * @brief Enable the Debug Module during STOP mode |
mbed_official | 87:085cde657901 | 337 | * @param None |
mbed_official | 87:085cde657901 | 338 | * @retval None |
mbed_official | 87:085cde657901 | 339 | */ |
mbed_official | 87:085cde657901 | 340 | void HAL_EnableDBGStopMode(void) |
mbed_official | 87:085cde657901 | 341 | { |
mbed_official | 87:085cde657901 | 342 | SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); |
mbed_official | 87:085cde657901 | 343 | } |
mbed_official | 87:085cde657901 | 344 | |
mbed_official | 87:085cde657901 | 345 | /** |
mbed_official | 87:085cde657901 | 346 | * @brief Disable the Debug Module during STOP mode |
mbed_official | 87:085cde657901 | 347 | * @param None |
mbed_official | 87:085cde657901 | 348 | * @retval None |
mbed_official | 87:085cde657901 | 349 | */ |
mbed_official | 87:085cde657901 | 350 | void HAL_DisableDBGStopMode(void) |
mbed_official | 87:085cde657901 | 351 | { |
mbed_official | 87:085cde657901 | 352 | CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); |
mbed_official | 87:085cde657901 | 353 | } |
mbed_official | 87:085cde657901 | 354 | |
mbed_official | 87:085cde657901 | 355 | /** |
mbed_official | 87:085cde657901 | 356 | * @brief Enable the Debug Module during STANDBY mode |
mbed_official | 87:085cde657901 | 357 | * @param None |
mbed_official | 87:085cde657901 | 358 | * @retval None |
mbed_official | 87:085cde657901 | 359 | */ |
mbed_official | 87:085cde657901 | 360 | void HAL_EnableDBGStandbyMode(void) |
mbed_official | 87:085cde657901 | 361 | { |
mbed_official | 87:085cde657901 | 362 | SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); |
mbed_official | 87:085cde657901 | 363 | } |
mbed_official | 87:085cde657901 | 364 | |
mbed_official | 87:085cde657901 | 365 | /** |
mbed_official | 87:085cde657901 | 366 | * @brief Disable the Debug Module during STANDBY mode |
mbed_official | 87:085cde657901 | 367 | * @param None |
mbed_official | 87:085cde657901 | 368 | * @retval None |
mbed_official | 87:085cde657901 | 369 | */ |
mbed_official | 87:085cde657901 | 370 | void HAL_DisableDBGStandbyMode(void) |
mbed_official | 87:085cde657901 | 371 | { |
mbed_official | 87:085cde657901 | 372 | CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); |
mbed_official | 87:085cde657901 | 373 | } |
mbed_official | 87:085cde657901 | 374 | |
mbed_official | 87:085cde657901 | 375 | /** |
mbed_official | 87:085cde657901 | 376 | * @brief Enables the I/O Compensation Cell. |
mbed_official | 87:085cde657901 | 377 | * @note The I/O compensation cell can be used only when the device supply |
mbed_official | 87:085cde657901 | 378 | * voltage ranges from 2.4 to 3.6 V. |
mbed_official | 87:085cde657901 | 379 | * @retval None |
mbed_official | 87:085cde657901 | 380 | */ |
mbed_official | 87:085cde657901 | 381 | void HAL_EnableCompensationCell(void) |
mbed_official | 87:085cde657901 | 382 | { |
mbed_official | 87:085cde657901 | 383 | *(__IO uint32_t *)CMPCR_CMP_PD_BB = (uint32_t)ENABLE; |
mbed_official | 87:085cde657901 | 384 | } |
mbed_official | 87:085cde657901 | 385 | |
mbed_official | 87:085cde657901 | 386 | /** |
mbed_official | 87:085cde657901 | 387 | * @brief Power-down the I/O Compensation Cell. |
mbed_official | 87:085cde657901 | 388 | * @note The I/O compensation cell can be used only when the device supply |
mbed_official | 87:085cde657901 | 389 | * voltage ranges from 2.4 to 3.6 V. |
mbed_official | 87:085cde657901 | 390 | * @retval None |
mbed_official | 87:085cde657901 | 391 | */ |
mbed_official | 87:085cde657901 | 392 | void HAL_DisableCompensationCell(void) |
mbed_official | 87:085cde657901 | 393 | { |
mbed_official | 87:085cde657901 | 394 | *(__IO uint32_t *)CMPCR_CMP_PD_BB = (uint32_t)DISABLE; |
mbed_official | 87:085cde657901 | 395 | } |
mbed_official | 87:085cde657901 | 396 | |
mbed_official | 87:085cde657901 | 397 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) |
mbed_official | 87:085cde657901 | 398 | /** |
mbed_official | 87:085cde657901 | 399 | * @brief Enables the Internal FLASH Bank Swapping. |
mbed_official | 87:085cde657901 | 400 | * |
mbed_official | 87:085cde657901 | 401 | * @note This function can be used only for STM32F42xxx/43xxx devices. |
mbed_official | 87:085cde657901 | 402 | * |
mbed_official | 87:085cde657901 | 403 | * @note Flash Bank2 mapped at 0x08000000 (and aliased @0x00000000) |
mbed_official | 87:085cde657901 | 404 | * and Flash Bank1 mapped at 0x08100000 (and aliased at 0x00100000) |
mbed_official | 87:085cde657901 | 405 | * |
mbed_official | 87:085cde657901 | 406 | * @retval None |
mbed_official | 87:085cde657901 | 407 | */ |
mbed_official | 87:085cde657901 | 408 | void HAL_EnableMemorySwappingBank(void) |
mbed_official | 87:085cde657901 | 409 | { |
mbed_official | 87:085cde657901 | 410 | *(__IO uint32_t *)UFB_MODE_BB = (uint32_t)ENABLE; |
mbed_official | 87:085cde657901 | 411 | } |
mbed_official | 87:085cde657901 | 412 | |
mbed_official | 87:085cde657901 | 413 | /** |
mbed_official | 87:085cde657901 | 414 | * @brief Disables the Internal FLASH Bank Swapping. |
mbed_official | 87:085cde657901 | 415 | * |
mbed_official | 87:085cde657901 | 416 | * @note This function can be used only for STM32F42xxx/43xxx devices. |
mbed_official | 87:085cde657901 | 417 | * |
mbed_official | 87:085cde657901 | 418 | * @note The default state : Flash Bank1 mapped at 0x08000000 (and aliased @0x0000 0000) |
mbed_official | 87:085cde657901 | 419 | * and Flash Bank2 mapped at 0x08100000 (and aliased at 0x00100000) |
mbed_official | 87:085cde657901 | 420 | * |
mbed_official | 87:085cde657901 | 421 | * @retval None |
mbed_official | 87:085cde657901 | 422 | */ |
mbed_official | 87:085cde657901 | 423 | void HAL_DisableMemorySwappingBank(void) |
mbed_official | 87:085cde657901 | 424 | { |
mbed_official | 87:085cde657901 | 425 | |
mbed_official | 87:085cde657901 | 426 | *(__IO uint32_t *)UFB_MODE_BB = (uint32_t)DISABLE; |
mbed_official | 87:085cde657901 | 427 | } |
mbed_official | 87:085cde657901 | 428 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ |
mbed_official | 87:085cde657901 | 429 | |
mbed_official | 87:085cde657901 | 430 | /** |
mbed_official | 87:085cde657901 | 431 | * @} |
mbed_official | 87:085cde657901 | 432 | */ |
mbed_official | 87:085cde657901 | 433 | |
mbed_official | 87:085cde657901 | 434 | /** |
mbed_official | 87:085cde657901 | 435 | * @} |
mbed_official | 87:085cde657901 | 436 | */ |
mbed_official | 87:085cde657901 | 437 | |
mbed_official | 87:085cde657901 | 438 | #endif /* HAL_MODULE_ENABLED */ |
mbed_official | 87:085cde657901 | 439 | /** |
mbed_official | 87:085cde657901 | 440 | * @} |
mbed_official | 87:085cde657901 | 441 | */ |
mbed_official | 87:085cde657901 | 442 | |
mbed_official | 87:085cde657901 | 443 | /** |
mbed_official | 87:085cde657901 | 444 | * @} |
mbed_official | 87:085cde657901 | 445 | */ |
mbed_official | 87:085cde657901 | 446 | |
mbed_official | 87:085cde657901 | 447 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |