001
targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_ll_utils.h@0:13413ea9a877, 2022-06-12 (annotated)
- Committer:
- ganlikun
- Date:
- Sun Jun 12 14:02:44 2022 +0000
- Revision:
- 0:13413ea9a877
00
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ganlikun | 0:13413ea9a877 | 1 | /** |
ganlikun | 0:13413ea9a877 | 2 | ****************************************************************************** |
ganlikun | 0:13413ea9a877 | 3 | * @file stm32f4xx_ll_utils.h |
ganlikun | 0:13413ea9a877 | 4 | * @author MCD Application Team |
ganlikun | 0:13413ea9a877 | 5 | * @version V1.7.1 |
ganlikun | 0:13413ea9a877 | 6 | * @date 14-April-2017 |
ganlikun | 0:13413ea9a877 | 7 | * @brief Header file of UTILS LL module. |
ganlikun | 0:13413ea9a877 | 8 | @verbatim |
ganlikun | 0:13413ea9a877 | 9 | ============================================================================== |
ganlikun | 0:13413ea9a877 | 10 | ##### How to use this driver ##### |
ganlikun | 0:13413ea9a877 | 11 | ============================================================================== |
ganlikun | 0:13413ea9a877 | 12 | [..] |
ganlikun | 0:13413ea9a877 | 13 | The LL UTILS driver contains a set of generic APIs that can be |
ganlikun | 0:13413ea9a877 | 14 | used by user: |
ganlikun | 0:13413ea9a877 | 15 | (+) Device electronic signature |
ganlikun | 0:13413ea9a877 | 16 | (+) Timing functions |
ganlikun | 0:13413ea9a877 | 17 | (+) PLL configuration functions |
ganlikun | 0:13413ea9a877 | 18 | |
ganlikun | 0:13413ea9a877 | 19 | @endverbatim |
ganlikun | 0:13413ea9a877 | 20 | ****************************************************************************** |
ganlikun | 0:13413ea9a877 | 21 | * @attention |
ganlikun | 0:13413ea9a877 | 22 | * |
ganlikun | 0:13413ea9a877 | 23 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
ganlikun | 0:13413ea9a877 | 24 | * |
ganlikun | 0:13413ea9a877 | 25 | * Redistribution and use in source and binary forms, with or without modification, |
ganlikun | 0:13413ea9a877 | 26 | * are permitted provided that the following conditions are met: |
ganlikun | 0:13413ea9a877 | 27 | * 1. Redistributions of source code must retain the above copyright notice, |
ganlikun | 0:13413ea9a877 | 28 | * this list of conditions and the following disclaimer. |
ganlikun | 0:13413ea9a877 | 29 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
ganlikun | 0:13413ea9a877 | 30 | * this list of conditions and the following disclaimer in the documentation |
ganlikun | 0:13413ea9a877 | 31 | * and/or other materials provided with the distribution. |
ganlikun | 0:13413ea9a877 | 32 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
ganlikun | 0:13413ea9a877 | 33 | * may be used to endorse or promote products derived from this software |
ganlikun | 0:13413ea9a877 | 34 | * without specific prior written permission. |
ganlikun | 0:13413ea9a877 | 35 | * |
ganlikun | 0:13413ea9a877 | 36 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
ganlikun | 0:13413ea9a877 | 37 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
ganlikun | 0:13413ea9a877 | 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
ganlikun | 0:13413ea9a877 | 39 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
ganlikun | 0:13413ea9a877 | 40 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
ganlikun | 0:13413ea9a877 | 41 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
ganlikun | 0:13413ea9a877 | 42 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
ganlikun | 0:13413ea9a877 | 43 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
ganlikun | 0:13413ea9a877 | 44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
ganlikun | 0:13413ea9a877 | 45 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
ganlikun | 0:13413ea9a877 | 46 | * |
ganlikun | 0:13413ea9a877 | 47 | ****************************************************************************** |
ganlikun | 0:13413ea9a877 | 48 | */ |
ganlikun | 0:13413ea9a877 | 49 | |
ganlikun | 0:13413ea9a877 | 50 | /* Define to prevent recursive inclusion -------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 51 | #ifndef __STM32F4xx_LL_UTILS_H |
ganlikun | 0:13413ea9a877 | 52 | #define __STM32F4xx_LL_UTILS_H |
ganlikun | 0:13413ea9a877 | 53 | |
ganlikun | 0:13413ea9a877 | 54 | #ifdef __cplusplus |
ganlikun | 0:13413ea9a877 | 55 | extern "C" { |
ganlikun | 0:13413ea9a877 | 56 | #endif |
ganlikun | 0:13413ea9a877 | 57 | |
ganlikun | 0:13413ea9a877 | 58 | /* Includes ------------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 59 | #include "stm32f4xx.h" |
ganlikun | 0:13413ea9a877 | 60 | |
ganlikun | 0:13413ea9a877 | 61 | /** @addtogroup STM32F4xx_LL_Driver |
ganlikun | 0:13413ea9a877 | 62 | * @{ |
ganlikun | 0:13413ea9a877 | 63 | */ |
ganlikun | 0:13413ea9a877 | 64 | |
ganlikun | 0:13413ea9a877 | 65 | /** @defgroup UTILS_LL UTILS |
ganlikun | 0:13413ea9a877 | 66 | * @{ |
ganlikun | 0:13413ea9a877 | 67 | */ |
ganlikun | 0:13413ea9a877 | 68 | |
ganlikun | 0:13413ea9a877 | 69 | /* Private types -------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 70 | /* Private variables ---------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 71 | |
ganlikun | 0:13413ea9a877 | 72 | /* Private constants ---------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 73 | /** @defgroup UTILS_LL_Private_Constants UTILS Private Constants |
ganlikun | 0:13413ea9a877 | 74 | * @{ |
ganlikun | 0:13413ea9a877 | 75 | */ |
ganlikun | 0:13413ea9a877 | 76 | |
ganlikun | 0:13413ea9a877 | 77 | /* Max delay can be used in LL_mDelay */ |
ganlikun | 0:13413ea9a877 | 78 | #define LL_MAX_DELAY 0xFFFFFFFFU |
ganlikun | 0:13413ea9a877 | 79 | |
ganlikun | 0:13413ea9a877 | 80 | /** |
ganlikun | 0:13413ea9a877 | 81 | * @brief Unique device ID register base address |
ganlikun | 0:13413ea9a877 | 82 | */ |
ganlikun | 0:13413ea9a877 | 83 | #define UID_BASE_ADDRESS UID_BASE |
ganlikun | 0:13413ea9a877 | 84 | |
ganlikun | 0:13413ea9a877 | 85 | /** |
ganlikun | 0:13413ea9a877 | 86 | * @brief Flash size data register base address |
ganlikun | 0:13413ea9a877 | 87 | */ |
ganlikun | 0:13413ea9a877 | 88 | #define FLASHSIZE_BASE_ADDRESS FLASHSIZE_BASE |
ganlikun | 0:13413ea9a877 | 89 | |
ganlikun | 0:13413ea9a877 | 90 | /** |
ganlikun | 0:13413ea9a877 | 91 | * @brief Package data register base address |
ganlikun | 0:13413ea9a877 | 92 | */ |
ganlikun | 0:13413ea9a877 | 93 | #define PACKAGE_BASE_ADDRESS PACKAGE_BASE |
ganlikun | 0:13413ea9a877 | 94 | |
ganlikun | 0:13413ea9a877 | 95 | /** |
ganlikun | 0:13413ea9a877 | 96 | * @} |
ganlikun | 0:13413ea9a877 | 97 | */ |
ganlikun | 0:13413ea9a877 | 98 | |
ganlikun | 0:13413ea9a877 | 99 | /* Private macros ------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 100 | /** @defgroup UTILS_LL_Private_Macros UTILS Private Macros |
ganlikun | 0:13413ea9a877 | 101 | * @{ |
ganlikun | 0:13413ea9a877 | 102 | */ |
ganlikun | 0:13413ea9a877 | 103 | /** |
ganlikun | 0:13413ea9a877 | 104 | * @} |
ganlikun | 0:13413ea9a877 | 105 | */ |
ganlikun | 0:13413ea9a877 | 106 | /* Exported types ------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 107 | /** @defgroup UTILS_LL_ES_INIT UTILS Exported structures |
ganlikun | 0:13413ea9a877 | 108 | * @{ |
ganlikun | 0:13413ea9a877 | 109 | */ |
ganlikun | 0:13413ea9a877 | 110 | /** |
ganlikun | 0:13413ea9a877 | 111 | * @brief UTILS PLL structure definition |
ganlikun | 0:13413ea9a877 | 112 | */ |
ganlikun | 0:13413ea9a877 | 113 | typedef struct |
ganlikun | 0:13413ea9a877 | 114 | { |
ganlikun | 0:13413ea9a877 | 115 | uint32_t PLLM; /*!< Division factor for PLL VCO input clock. |
ganlikun | 0:13413ea9a877 | 116 | This parameter can be a value of @ref RCC_LL_EC_PLLM_DIV |
ganlikun | 0:13413ea9a877 | 117 | |
ganlikun | 0:13413ea9a877 | 118 | This feature can be modified afterwards using unitary function |
ganlikun | 0:13413ea9a877 | 119 | @ref LL_RCC_PLL_ConfigDomain_SYS(). */ |
ganlikun | 0:13413ea9a877 | 120 | |
ganlikun | 0:13413ea9a877 | 121 | uint32_t PLLN; /*!< Multiplication factor for PLL VCO output clock. |
ganlikun | 0:13413ea9a877 | 122 | This parameter must be a number between Min_Data = @ref RCC_PLLN_MIN_VALUE |
ganlikun | 0:13413ea9a877 | 123 | and Max_Data = @ref RCC_PLLN_MIN_VALUE |
ganlikun | 0:13413ea9a877 | 124 | |
ganlikun | 0:13413ea9a877 | 125 | This feature can be modified afterwards using unitary function |
ganlikun | 0:13413ea9a877 | 126 | @ref LL_RCC_PLL_ConfigDomain_SYS(). */ |
ganlikun | 0:13413ea9a877 | 127 | |
ganlikun | 0:13413ea9a877 | 128 | uint32_t PLLP; /*!< Division for the main system clock. |
ganlikun | 0:13413ea9a877 | 129 | This parameter can be a value of @ref RCC_LL_EC_PLLP_DIV |
ganlikun | 0:13413ea9a877 | 130 | |
ganlikun | 0:13413ea9a877 | 131 | This feature can be modified afterwards using unitary function |
ganlikun | 0:13413ea9a877 | 132 | @ref LL_RCC_PLL_ConfigDomain_SYS(). */ |
ganlikun | 0:13413ea9a877 | 133 | } LL_UTILS_PLLInitTypeDef; |
ganlikun | 0:13413ea9a877 | 134 | |
ganlikun | 0:13413ea9a877 | 135 | /** |
ganlikun | 0:13413ea9a877 | 136 | * @brief UTILS System, AHB and APB buses clock configuration structure definition |
ganlikun | 0:13413ea9a877 | 137 | */ |
ganlikun | 0:13413ea9a877 | 138 | typedef struct |
ganlikun | 0:13413ea9a877 | 139 | { |
ganlikun | 0:13413ea9a877 | 140 | uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK). |
ganlikun | 0:13413ea9a877 | 141 | This parameter can be a value of @ref RCC_LL_EC_SYSCLK_DIV |
ganlikun | 0:13413ea9a877 | 142 | |
ganlikun | 0:13413ea9a877 | 143 | This feature can be modified afterwards using unitary function |
ganlikun | 0:13413ea9a877 | 144 | @ref LL_RCC_SetAHBPrescaler(). */ |
ganlikun | 0:13413ea9a877 | 145 | |
ganlikun | 0:13413ea9a877 | 146 | uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK). |
ganlikun | 0:13413ea9a877 | 147 | This parameter can be a value of @ref RCC_LL_EC_APB1_DIV |
ganlikun | 0:13413ea9a877 | 148 | |
ganlikun | 0:13413ea9a877 | 149 | This feature can be modified afterwards using unitary function |
ganlikun | 0:13413ea9a877 | 150 | @ref LL_RCC_SetAPB1Prescaler(). */ |
ganlikun | 0:13413ea9a877 | 151 | |
ganlikun | 0:13413ea9a877 | 152 | uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK). |
ganlikun | 0:13413ea9a877 | 153 | This parameter can be a value of @ref RCC_LL_EC_APB2_DIV |
ganlikun | 0:13413ea9a877 | 154 | |
ganlikun | 0:13413ea9a877 | 155 | This feature can be modified afterwards using unitary function |
ganlikun | 0:13413ea9a877 | 156 | @ref LL_RCC_SetAPB2Prescaler(). */ |
ganlikun | 0:13413ea9a877 | 157 | |
ganlikun | 0:13413ea9a877 | 158 | } LL_UTILS_ClkInitTypeDef; |
ganlikun | 0:13413ea9a877 | 159 | |
ganlikun | 0:13413ea9a877 | 160 | /** |
ganlikun | 0:13413ea9a877 | 161 | * @} |
ganlikun | 0:13413ea9a877 | 162 | */ |
ganlikun | 0:13413ea9a877 | 163 | |
ganlikun | 0:13413ea9a877 | 164 | /* Exported constants --------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 165 | /** @defgroup UTILS_LL_Exported_Constants UTILS Exported Constants |
ganlikun | 0:13413ea9a877 | 166 | * @{ |
ganlikun | 0:13413ea9a877 | 167 | */ |
ganlikun | 0:13413ea9a877 | 168 | |
ganlikun | 0:13413ea9a877 | 169 | /** @defgroup UTILS_EC_HSE_BYPASS HSE Bypass activation |
ganlikun | 0:13413ea9a877 | 170 | * @{ |
ganlikun | 0:13413ea9a877 | 171 | */ |
ganlikun | 0:13413ea9a877 | 172 | #define LL_UTILS_HSEBYPASS_OFF 0x00000000U /*!< HSE Bypass is not enabled */ |
ganlikun | 0:13413ea9a877 | 173 | #define LL_UTILS_HSEBYPASS_ON 0x00000001U /*!< HSE Bypass is enabled */ |
ganlikun | 0:13413ea9a877 | 174 | /** |
ganlikun | 0:13413ea9a877 | 175 | * @} |
ganlikun | 0:13413ea9a877 | 176 | */ |
ganlikun | 0:13413ea9a877 | 177 | |
ganlikun | 0:13413ea9a877 | 178 | /** @defgroup UTILS_EC_PACKAGETYPE PACKAGE TYPE |
ganlikun | 0:13413ea9a877 | 179 | * @{ |
ganlikun | 0:13413ea9a877 | 180 | */ |
ganlikun | 0:13413ea9a877 | 181 | #define LL_UTILS_PACKAGETYPE_WLCSP36_UFQFPN48_LQFP64 0x00000000U /*!< WLCSP36 or UFQFPN48 or LQFP64 package type */ |
ganlikun | 0:13413ea9a877 | 182 | #define LL_UTILS_PACKAGETYPE_WLCSP168_FBGA169_LQFP100_LQFP64_UFQFPN48 0x00000100U /*!< WLCSP168 or FBGA169 or LQFP100 or LQFP64 or UFQFPN48 package type */ |
ganlikun | 0:13413ea9a877 | 183 | #define LL_UTILS_PACKAGETYPE_WLCSP64_WLCSP81_LQFP176_UFBGA176 0x00000200U /*!< WLCSP64 or WLCSP81 or LQFP176 or UFBGA176 package type */ |
ganlikun | 0:13413ea9a877 | 184 | #define LL_UTILS_PACKAGETYPE_LQFP144_UFBGA144_UFBGA144_UFBGA100 0x00000300U /*!< LQFP144 or UFBGA144 or UFBGA144 or UFBGA100 package type */ |
ganlikun | 0:13413ea9a877 | 185 | #define LL_UTILS_PACKAGETYPE_LQFP100_LQFP208_TFBGA216 0x00000400U /*!< LQFP100 or LQFP208 or TFBGA216 package type */ |
ganlikun | 0:13413ea9a877 | 186 | #define LL_UTILS_PACKAGETYPE_LQFP208_TFBGA216 0x00000500U /*!< LQFP208 or TFBGA216 package type */ |
ganlikun | 0:13413ea9a877 | 187 | #define LL_UTILS_PACKAGETYPE_TQFP64_UFBGA144_LQFP144 0x00000700U /*!< TQFP64 or UFBGA144 or LQFP144 package type */ |
ganlikun | 0:13413ea9a877 | 188 | /** |
ganlikun | 0:13413ea9a877 | 189 | * @} |
ganlikun | 0:13413ea9a877 | 190 | */ |
ganlikun | 0:13413ea9a877 | 191 | |
ganlikun | 0:13413ea9a877 | 192 | /** |
ganlikun | 0:13413ea9a877 | 193 | * @} |
ganlikun | 0:13413ea9a877 | 194 | */ |
ganlikun | 0:13413ea9a877 | 195 | |
ganlikun | 0:13413ea9a877 | 196 | /* Exported macro ------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 197 | |
ganlikun | 0:13413ea9a877 | 198 | /* Exported functions --------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 199 | /** @defgroup UTILS_LL_Exported_Functions UTILS Exported Functions |
ganlikun | 0:13413ea9a877 | 200 | * @{ |
ganlikun | 0:13413ea9a877 | 201 | */ |
ganlikun | 0:13413ea9a877 | 202 | |
ganlikun | 0:13413ea9a877 | 203 | /** @defgroup UTILS_EF_DEVICE_ELECTRONIC_SIGNATURE DEVICE ELECTRONIC SIGNATURE |
ganlikun | 0:13413ea9a877 | 204 | * @{ |
ganlikun | 0:13413ea9a877 | 205 | */ |
ganlikun | 0:13413ea9a877 | 206 | |
ganlikun | 0:13413ea9a877 | 207 | /** |
ganlikun | 0:13413ea9a877 | 208 | * @brief Get Word0 of the unique device identifier (UID based on 96 bits) |
ganlikun | 0:13413ea9a877 | 209 | * @retval UID[31:0] |
ganlikun | 0:13413ea9a877 | 210 | */ |
ganlikun | 0:13413ea9a877 | 211 | __STATIC_INLINE uint32_t LL_GetUID_Word0(void) |
ganlikun | 0:13413ea9a877 | 212 | { |
ganlikun | 0:13413ea9a877 | 213 | return (uint32_t)(READ_REG(*((uint32_t *)UID_BASE_ADDRESS))); |
ganlikun | 0:13413ea9a877 | 214 | } |
ganlikun | 0:13413ea9a877 | 215 | |
ganlikun | 0:13413ea9a877 | 216 | /** |
ganlikun | 0:13413ea9a877 | 217 | * @brief Get Word1 of the unique device identifier (UID based on 96 bits) |
ganlikun | 0:13413ea9a877 | 218 | * @retval UID[63:32] |
ganlikun | 0:13413ea9a877 | 219 | */ |
ganlikun | 0:13413ea9a877 | 220 | __STATIC_INLINE uint32_t LL_GetUID_Word1(void) |
ganlikun | 0:13413ea9a877 | 221 | { |
ganlikun | 0:13413ea9a877 | 222 | return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 4U)))); |
ganlikun | 0:13413ea9a877 | 223 | } |
ganlikun | 0:13413ea9a877 | 224 | |
ganlikun | 0:13413ea9a877 | 225 | /** |
ganlikun | 0:13413ea9a877 | 226 | * @brief Get Word2 of the unique device identifier (UID based on 96 bits) |
ganlikun | 0:13413ea9a877 | 227 | * @retval UID[95:64] |
ganlikun | 0:13413ea9a877 | 228 | */ |
ganlikun | 0:13413ea9a877 | 229 | __STATIC_INLINE uint32_t LL_GetUID_Word2(void) |
ganlikun | 0:13413ea9a877 | 230 | { |
ganlikun | 0:13413ea9a877 | 231 | return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 8U)))); |
ganlikun | 0:13413ea9a877 | 232 | } |
ganlikun | 0:13413ea9a877 | 233 | |
ganlikun | 0:13413ea9a877 | 234 | /** |
ganlikun | 0:13413ea9a877 | 235 | * @brief Get Flash memory size |
ganlikun | 0:13413ea9a877 | 236 | * @note This bitfield indicates the size of the device Flash memory expressed in |
ganlikun | 0:13413ea9a877 | 237 | * Kbytes. As an example, 0x040 corresponds to 64 Kbytes. |
ganlikun | 0:13413ea9a877 | 238 | * @retval FLASH_SIZE[15:0]: Flash memory size |
ganlikun | 0:13413ea9a877 | 239 | */ |
ganlikun | 0:13413ea9a877 | 240 | __STATIC_INLINE uint32_t LL_GetFlashSize(void) |
ganlikun | 0:13413ea9a877 | 241 | { |
ganlikun | 0:13413ea9a877 | 242 | return (uint16_t)(READ_REG(*((uint32_t *)FLASHSIZE_BASE_ADDRESS))); |
ganlikun | 0:13413ea9a877 | 243 | } |
ganlikun | 0:13413ea9a877 | 244 | |
ganlikun | 0:13413ea9a877 | 245 | /** |
ganlikun | 0:13413ea9a877 | 246 | * @brief Get Package type |
ganlikun | 0:13413ea9a877 | 247 | * @retval Returned value can be one of the following values: |
ganlikun | 0:13413ea9a877 | 248 | * @arg @ref LL_UTILS_PACKAGETYPE_WLCSP36_UFQFPN48_LQFP64 (*) |
ganlikun | 0:13413ea9a877 | 249 | * @arg @ref LL_UTILS_PACKAGETYPE_WLCSP168_FBGA169_LQFP100_LQFP64_UFQFPN48 (*) |
ganlikun | 0:13413ea9a877 | 250 | * @arg @ref LL_UTILS_PACKAGETYPE_WLCSP64_WLCSP81_LQFP176_UFBGA176 (*) |
ganlikun | 0:13413ea9a877 | 251 | * @arg @ref LL_UTILS_PACKAGETYPE_LQFP144_UFBGA144_UFBGA144_UFBGA100 (*) |
ganlikun | 0:13413ea9a877 | 252 | * @arg @ref LL_UTILS_PACKAGETYPE_LQFP100_LQFP208_TFBGA216 (*) |
ganlikun | 0:13413ea9a877 | 253 | * @arg @ref LL_UTILS_PACKAGETYPE_LQFP208_TFBGA216 (*) |
ganlikun | 0:13413ea9a877 | 254 | * @arg @ref LL_UTILS_PACKAGETYPE_TQFP64_UFBGA144_LQFP144 (*) |
ganlikun | 0:13413ea9a877 | 255 | * |
ganlikun | 0:13413ea9a877 | 256 | * (*) value not defined in all devices. |
ganlikun | 0:13413ea9a877 | 257 | */ |
ganlikun | 0:13413ea9a877 | 258 | __STATIC_INLINE uint32_t LL_GetPackageType(void) |
ganlikun | 0:13413ea9a877 | 259 | { |
ganlikun | 0:13413ea9a877 | 260 | return (uint8_t)(READ_REG(*((uint32_t *)PACKAGE_BASE_ADDRESS)) & 0x0700U); |
ganlikun | 0:13413ea9a877 | 261 | } |
ganlikun | 0:13413ea9a877 | 262 | |
ganlikun | 0:13413ea9a877 | 263 | /** |
ganlikun | 0:13413ea9a877 | 264 | * @} |
ganlikun | 0:13413ea9a877 | 265 | */ |
ganlikun | 0:13413ea9a877 | 266 | |
ganlikun | 0:13413ea9a877 | 267 | /** @defgroup UTILS_LL_EF_DELAY DELAY |
ganlikun | 0:13413ea9a877 | 268 | * @{ |
ganlikun | 0:13413ea9a877 | 269 | */ |
ganlikun | 0:13413ea9a877 | 270 | |
ganlikun | 0:13413ea9a877 | 271 | /** |
ganlikun | 0:13413ea9a877 | 272 | * @brief This function configures the Cortex-M SysTick source of the time base. |
ganlikun | 0:13413ea9a877 | 273 | * @param HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro) |
ganlikun | 0:13413ea9a877 | 274 | * @note When a RTOS is used, it is recommended to avoid changing the SysTick |
ganlikun | 0:13413ea9a877 | 275 | * configuration by calling this function, for a delay use rather osDelay RTOS service. |
ganlikun | 0:13413ea9a877 | 276 | * @param Ticks Number of ticks |
ganlikun | 0:13413ea9a877 | 277 | * @retval None |
ganlikun | 0:13413ea9a877 | 278 | */ |
ganlikun | 0:13413ea9a877 | 279 | __STATIC_INLINE void LL_InitTick(uint32_t HCLKFrequency, uint32_t Ticks) |
ganlikun | 0:13413ea9a877 | 280 | { |
ganlikun | 0:13413ea9a877 | 281 | /* Configure the SysTick to have interrupt in 1ms time base */ |
ganlikun | 0:13413ea9a877 | 282 | SysTick->LOAD = (uint32_t)((HCLKFrequency / Ticks) - 1UL); /* set reload register */ |
ganlikun | 0:13413ea9a877 | 283 | SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ |
ganlikun | 0:13413ea9a877 | 284 | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | |
ganlikun | 0:13413ea9a877 | 285 | SysTick_CTRL_ENABLE_Msk; /* Enable the Systick Timer */ |
ganlikun | 0:13413ea9a877 | 286 | } |
ganlikun | 0:13413ea9a877 | 287 | |
ganlikun | 0:13413ea9a877 | 288 | void LL_Init1msTick(uint32_t HCLKFrequency); |
ganlikun | 0:13413ea9a877 | 289 | void LL_mDelay(uint32_t Delay); |
ganlikun | 0:13413ea9a877 | 290 | |
ganlikun | 0:13413ea9a877 | 291 | /** |
ganlikun | 0:13413ea9a877 | 292 | * @} |
ganlikun | 0:13413ea9a877 | 293 | */ |
ganlikun | 0:13413ea9a877 | 294 | |
ganlikun | 0:13413ea9a877 | 295 | /** @defgroup UTILS_EF_SYSTEM SYSTEM |
ganlikun | 0:13413ea9a877 | 296 | * @{ |
ganlikun | 0:13413ea9a877 | 297 | */ |
ganlikun | 0:13413ea9a877 | 298 | |
ganlikun | 0:13413ea9a877 | 299 | void LL_SetSystemCoreClock(uint32_t HCLKFrequency); |
ganlikun | 0:13413ea9a877 | 300 | ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, |
ganlikun | 0:13413ea9a877 | 301 | LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); |
ganlikun | 0:13413ea9a877 | 302 | ErrorStatus LL_PLL_ConfigSystemClock_HSE(uint32_t HSEFrequency, uint32_t HSEBypass, |
ganlikun | 0:13413ea9a877 | 303 | LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); |
ganlikun | 0:13413ea9a877 | 304 | |
ganlikun | 0:13413ea9a877 | 305 | /** |
ganlikun | 0:13413ea9a877 | 306 | * @} |
ganlikun | 0:13413ea9a877 | 307 | */ |
ganlikun | 0:13413ea9a877 | 308 | |
ganlikun | 0:13413ea9a877 | 309 | /** |
ganlikun | 0:13413ea9a877 | 310 | * @} |
ganlikun | 0:13413ea9a877 | 311 | */ |
ganlikun | 0:13413ea9a877 | 312 | |
ganlikun | 0:13413ea9a877 | 313 | /** |
ganlikun | 0:13413ea9a877 | 314 | * @} |
ganlikun | 0:13413ea9a877 | 315 | */ |
ganlikun | 0:13413ea9a877 | 316 | |
ganlikun | 0:13413ea9a877 | 317 | /** |
ganlikun | 0:13413ea9a877 | 318 | * @} |
ganlikun | 0:13413ea9a877 | 319 | */ |
ganlikun | 0:13413ea9a877 | 320 | |
ganlikun | 0:13413ea9a877 | 321 | #ifdef __cplusplus |
ganlikun | 0:13413ea9a877 | 322 | } |
ganlikun | 0:13413ea9a877 | 323 | #endif |
ganlikun | 0:13413ea9a877 | 324 | |
ganlikun | 0:13413ea9a877 | 325 | #endif /* __STM32F4xx_LL_UTILS_H */ |
ganlikun | 0:13413ea9a877 | 326 | |
ganlikun | 0:13413ea9a877 | 327 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
ganlikun | 0:13413ea9a877 | 328 |