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