Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /** |
2 | ****************************************************************************** |
||
3 | * @file stm32f1xx_hal_rcc_ex.h |
||
4 | * @author MCD Application Team |
||
5 | * @brief Header file of RCC HAL Extension module. |
||
6 | ****************************************************************************** |
||
7 | * @attention |
||
8 | * |
||
9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
||
10 | * |
||
11 | * Redistribution and use in source and binary forms, with or without modification, |
||
12 | * are permitted provided that the following conditions are met: |
||
13 | * 1. Redistributions of source code must retain the above copyright notice, |
||
14 | * this list of conditions and the following disclaimer. |
||
15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
||
16 | * this list of conditions and the following disclaimer in the documentation |
||
17 | * and/or other materials provided with the distribution. |
||
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
||
19 | * may be used to endorse or promote products derived from this software |
||
20 | * without specific prior written permission. |
||
21 | * |
||
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
||
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
32 | * |
||
33 | ****************************************************************************** |
||
34 | */ |
||
35 | |||
36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
||
37 | #ifndef __STM32F1xx_HAL_RCC_EX_H |
||
38 | #define __STM32F1xx_HAL_RCC_EX_H |
||
39 | |||
40 | #ifdef __cplusplus |
||
41 | extern "C" { |
||
42 | #endif |
||
43 | |||
44 | /* Includes ------------------------------------------------------------------*/ |
||
45 | #include "stm32f1xx_hal_def.h" |
||
46 | |||
47 | /** @addtogroup STM32F1xx_HAL_Driver |
||
48 | * @{ |
||
49 | */ |
||
50 | |||
51 | /** @addtogroup RCCEx |
||
52 | * @{ |
||
53 | */ |
||
54 | |||
55 | /** @addtogroup RCCEx_Private_Constants |
||
56 | * @{ |
||
57 | */ |
||
58 | |||
59 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
60 | |||
61 | /* Alias word address of PLLI2SON bit */ |
||
62 | #define PLLI2SON_BITNUMBER RCC_CR_PLL3ON_Pos |
||
63 | #define RCC_CR_PLLI2SON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (PLLI2SON_BITNUMBER * 4U))) |
||
64 | /* Alias word address of PLL2ON bit */ |
||
65 | #define PLL2ON_BITNUMBER RCC_CR_PLL2ON_Pos |
||
66 | #define RCC_CR_PLL2ON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (PLL2ON_BITNUMBER * 4U))) |
||
67 | |||
68 | #define PLLI2S_TIMEOUT_VALUE 100U /* 100 ms */ |
||
69 | #define PLL2_TIMEOUT_VALUE 100U /* 100 ms */ |
||
70 | |||
71 | #endif /* STM32F105xC || STM32F107xC */ |
||
72 | |||
73 | |||
74 | #define CR_REG_INDEX ((uint8_t)1) |
||
75 | |||
76 | /** |
||
77 | * @} |
||
78 | */ |
||
79 | |||
80 | /** @addtogroup RCCEx_Private_Macros |
||
81 | * @{ |
||
82 | */ |
||
83 | |||
84 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
85 | #define IS_RCC_PREDIV1_SOURCE(__SOURCE__) (((__SOURCE__) == RCC_PREDIV1_SOURCE_HSE) || \ |
||
86 | ((__SOURCE__) == RCC_PREDIV1_SOURCE_PLL2)) |
||
87 | #endif /* STM32F105xC || STM32F107xC */ |
||
88 | |||
89 | #if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\ |
||
90 | || defined(STM32F100xE) |
||
91 | #define IS_RCC_HSE_PREDIV(__DIV__) (((__DIV__) == RCC_HSE_PREDIV_DIV1) || ((__DIV__) == RCC_HSE_PREDIV_DIV2) || \ |
||
92 | ((__DIV__) == RCC_HSE_PREDIV_DIV3) || ((__DIV__) == RCC_HSE_PREDIV_DIV4) || \ |
||
93 | ((__DIV__) == RCC_HSE_PREDIV_DIV5) || ((__DIV__) == RCC_HSE_PREDIV_DIV6) || \ |
||
94 | ((__DIV__) == RCC_HSE_PREDIV_DIV7) || ((__DIV__) == RCC_HSE_PREDIV_DIV8) || \ |
||
95 | ((__DIV__) == RCC_HSE_PREDIV_DIV9) || ((__DIV__) == RCC_HSE_PREDIV_DIV10) || \ |
||
96 | ((__DIV__) == RCC_HSE_PREDIV_DIV11) || ((__DIV__) == RCC_HSE_PREDIV_DIV12) || \ |
||
97 | ((__DIV__) == RCC_HSE_PREDIV_DIV13) || ((__DIV__) == RCC_HSE_PREDIV_DIV14) || \ |
||
98 | ((__DIV__) == RCC_HSE_PREDIV_DIV15) || ((__DIV__) == RCC_HSE_PREDIV_DIV16)) |
||
99 | |||
100 | #else |
||
101 | #define IS_RCC_HSE_PREDIV(__DIV__) (((__DIV__) == RCC_HSE_PREDIV_DIV1) || ((__DIV__) == RCC_HSE_PREDIV_DIV2)) |
||
102 | #endif /* STM32F105xC || STM32F107xC || STM32F100xB || STM32F100xE */ |
||
103 | |||
104 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
105 | #define IS_RCC_PLL_MUL(__MUL__) (((__MUL__) == RCC_PLL_MUL4) || ((__MUL__) == RCC_PLL_MUL5) || \ |
||
106 | ((__MUL__) == RCC_PLL_MUL6) || ((__MUL__) == RCC_PLL_MUL7) || \ |
||
107 | ((__MUL__) == RCC_PLL_MUL8) || ((__MUL__) == RCC_PLL_MUL9) || \ |
||
108 | ((__MUL__) == RCC_PLL_MUL6_5)) |
||
109 | |||
110 | #define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || ((__SOURCE__) == RCC_MCO1SOURCE_HSI) \ |
||
111 | || ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) \ |
||
112 | || ((__SOURCE__) == RCC_MCO1SOURCE_PLL2CLK) || ((__SOURCE__) == RCC_MCO1SOURCE_PLL3CLK) \ |
||
113 | || ((__SOURCE__) == RCC_MCO1SOURCE_PLL3CLK_DIV2) || ((__SOURCE__) == RCC_MCO1SOURCE_EXT_HSE) \ |
||
114 | || ((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK)) |
||
115 | |||
116 | #else |
||
117 | #define IS_RCC_PLL_MUL(__MUL__) (((__MUL__) == RCC_PLL_MUL2) || ((__MUL__) == RCC_PLL_MUL3) || \ |
||
118 | ((__MUL__) == RCC_PLL_MUL4) || ((__MUL__) == RCC_PLL_MUL5) || \ |
||
119 | ((__MUL__) == RCC_PLL_MUL6) || ((__MUL__) == RCC_PLL_MUL7) || \ |
||
120 | ((__MUL__) == RCC_PLL_MUL8) || ((__MUL__) == RCC_PLL_MUL9) || \ |
||
121 | ((__MUL__) == RCC_PLL_MUL10) || ((__MUL__) == RCC_PLL_MUL11) || \ |
||
122 | ((__MUL__) == RCC_PLL_MUL12) || ((__MUL__) == RCC_PLL_MUL13) || \ |
||
123 | ((__MUL__) == RCC_PLL_MUL14) || ((__MUL__) == RCC_PLL_MUL15) || \ |
||
124 | ((__MUL__) == RCC_PLL_MUL16)) |
||
125 | |||
126 | #define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || ((__SOURCE__) == RCC_MCO1SOURCE_HSI) \ |
||
127 | || ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) \ |
||
128 | || ((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK)) |
||
129 | |||
130 | #endif /* STM32F105xC || STM32F107xC*/ |
||
131 | |||
132 | #define IS_RCC_ADCPLLCLK_DIV(__ADCCLK__) (((__ADCCLK__) == RCC_ADCPCLK2_DIV2) || ((__ADCCLK__) == RCC_ADCPCLK2_DIV4) || \ |
||
133 | ((__ADCCLK__) == RCC_ADCPCLK2_DIV6) || ((__ADCCLK__) == RCC_ADCPCLK2_DIV8)) |
||
134 | |||
135 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
136 | #define IS_RCC_I2S2CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_I2S2CLKSOURCE_SYSCLK) || ((__SOURCE__) == RCC_I2S2CLKSOURCE_PLLI2S_VCO)) |
||
137 | |||
138 | #define IS_RCC_I2S3CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_I2S3CLKSOURCE_SYSCLK) || ((__SOURCE__) == RCC_I2S3CLKSOURCE_PLLI2S_VCO)) |
||
139 | |||
140 | #define IS_RCC_USBPLLCLK_DIV(__USBCLK__) (((__USBCLK__) == RCC_USBCLKSOURCE_PLL_DIV2) || ((__USBCLK__) == RCC_USBCLKSOURCE_PLL_DIV3)) |
||
141 | |||
142 | #define IS_RCC_PLLI2S_MUL(__MUL__) (((__MUL__) == RCC_PLLI2S_MUL8) || ((__MUL__) == RCC_PLLI2S_MUL9) || \ |
||
143 | ((__MUL__) == RCC_PLLI2S_MUL10) || ((__MUL__) == RCC_PLLI2S_MUL11) || \ |
||
144 | ((__MUL__) == RCC_PLLI2S_MUL12) || ((__MUL__) == RCC_PLLI2S_MUL13) || \ |
||
145 | ((__MUL__) == RCC_PLLI2S_MUL14) || ((__MUL__) == RCC_PLLI2S_MUL16) || \ |
||
146 | ((__MUL__) == RCC_PLLI2S_MUL20)) |
||
147 | |||
148 | #define IS_RCC_HSE_PREDIV2(__DIV__) (((__DIV__) == RCC_HSE_PREDIV2_DIV1) || ((__DIV__) == RCC_HSE_PREDIV2_DIV2) || \ |
||
149 | ((__DIV__) == RCC_HSE_PREDIV2_DIV3) || ((__DIV__) == RCC_HSE_PREDIV2_DIV4) || \ |
||
150 | ((__DIV__) == RCC_HSE_PREDIV2_DIV5) || ((__DIV__) == RCC_HSE_PREDIV2_DIV6) || \ |
||
151 | ((__DIV__) == RCC_HSE_PREDIV2_DIV7) || ((__DIV__) == RCC_HSE_PREDIV2_DIV8) || \ |
||
152 | ((__DIV__) == RCC_HSE_PREDIV2_DIV9) || ((__DIV__) == RCC_HSE_PREDIV2_DIV10) || \ |
||
153 | ((__DIV__) == RCC_HSE_PREDIV2_DIV11) || ((__DIV__) == RCC_HSE_PREDIV2_DIV12) || \ |
||
154 | ((__DIV__) == RCC_HSE_PREDIV2_DIV13) || ((__DIV__) == RCC_HSE_PREDIV2_DIV14) || \ |
||
155 | ((__DIV__) == RCC_HSE_PREDIV2_DIV15) || ((__DIV__) == RCC_HSE_PREDIV2_DIV16)) |
||
156 | |||
157 | #define IS_RCC_PLL2(__PLL__) (((__PLL__) == RCC_PLL2_NONE) || ((__PLL__) == RCC_PLL2_OFF) || \ |
||
158 | ((__PLL__) == RCC_PLL2_ON)) |
||
159 | |||
160 | #define IS_RCC_PLL2_MUL(__MUL__) (((__MUL__) == RCC_PLL2_MUL8) || ((__MUL__) == RCC_PLL2_MUL9) || \ |
||
161 | ((__MUL__) == RCC_PLL2_MUL10) || ((__MUL__) == RCC_PLL2_MUL11) || \ |
||
162 | ((__MUL__) == RCC_PLL2_MUL12) || ((__MUL__) == RCC_PLL2_MUL13) || \ |
||
163 | ((__MUL__) == RCC_PLL2_MUL14) || ((__MUL__) == RCC_PLL2_MUL16) || \ |
||
164 | ((__MUL__) == RCC_PLL2_MUL20)) |
||
165 | |||
166 | #define IS_RCC_PERIPHCLOCK(__SELECTION__) \ |
||
167 | ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ |
||
168 | (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ |
||
169 | (((__SELECTION__) & RCC_PERIPHCLK_I2S2) == RCC_PERIPHCLK_I2S2) || \ |
||
170 | (((__SELECTION__) & RCC_PERIPHCLK_I2S3) == RCC_PERIPHCLK_I2S3) || \ |
||
171 | (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB)) |
||
172 | |||
173 | #elif defined(STM32F103xE) || defined(STM32F103xG) |
||
174 | |||
175 | #define IS_RCC_I2S2CLKSOURCE(__SOURCE__) ((__SOURCE__) == RCC_I2S2CLKSOURCE_SYSCLK) |
||
176 | |||
177 | #define IS_RCC_I2S3CLKSOURCE(__SOURCE__) ((__SOURCE__) == RCC_I2S3CLKSOURCE_SYSCLK) |
||
178 | |||
179 | #define IS_RCC_PERIPHCLOCK(__SELECTION__) \ |
||
180 | ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ |
||
181 | (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ |
||
182 | (((__SELECTION__) & RCC_PERIPHCLK_I2S2) == RCC_PERIPHCLK_I2S2) || \ |
||
183 | (((__SELECTION__) & RCC_PERIPHCLK_I2S3) == RCC_PERIPHCLK_I2S3) || \ |
||
184 | (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB)) |
||
185 | |||
186 | |||
187 | #elif defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ |
||
188 | || defined(STM32F103xB) |
||
189 | |||
190 | #define IS_RCC_PERIPHCLOCK(__SELECTION__) \ |
||
191 | ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ |
||
192 | (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ |
||
193 | (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB)) |
||
194 | |||
195 | #else |
||
196 | |||
197 | #define IS_RCC_PERIPHCLOCK(__SELECTION__) \ |
||
198 | ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ |
||
199 | (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC)) |
||
200 | |||
201 | #endif /* STM32F105xC || STM32F107xC */ |
||
202 | |||
203 | #if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ |
||
204 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) |
||
205 | |||
206 | #define IS_RCC_USBPLLCLK_DIV(__USBCLK__) (((__USBCLK__) == RCC_USBCLKSOURCE_PLL) || ((__USBCLK__) == RCC_USBCLKSOURCE_PLL_DIV1_5)) |
||
207 | |||
208 | #endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ |
||
209 | |||
210 | /** |
||
211 | * @} |
||
212 | */ |
||
213 | |||
214 | /* Exported types ------------------------------------------------------------*/ |
||
215 | |||
216 | /** @defgroup RCCEx_Exported_Types RCCEx Exported Types |
||
217 | * @{ |
||
218 | */ |
||
219 | |||
220 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
221 | /** |
||
222 | * @brief RCC PLL2 configuration structure definition |
||
223 | */ |
||
224 | typedef struct |
||
225 | { |
||
226 | uint32_t PLL2State; /*!< The new state of the PLL2. |
||
227 | This parameter can be a value of @ref RCCEx_PLL2_Config */ |
||
228 | |||
229 | uint32_t PLL2MUL; /*!< PLL2MUL: Multiplication factor for PLL2 VCO input clock |
||
230 | This parameter must be a value of @ref RCCEx_PLL2_Multiplication_Factor*/ |
||
231 | |||
232 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
233 | uint32_t HSEPrediv2Value; /*!< The Prediv2 factor value. |
||
234 | This parameter can be a value of @ref RCCEx_Prediv2_Factor */ |
||
235 | |||
236 | #endif /* STM32F105xC || STM32F107xC */ |
||
237 | } RCC_PLL2InitTypeDef; |
||
238 | |||
239 | #endif /* STM32F105xC || STM32F107xC */ |
||
240 | |||
241 | /** |
||
242 | * @brief RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition |
||
243 | */ |
||
244 | typedef struct |
||
245 | { |
||
246 | uint32_t OscillatorType; /*!< The oscillators to be configured. |
||
247 | This parameter can be a value of @ref RCC_Oscillator_Type */ |
||
248 | |||
249 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
250 | uint32_t Prediv1Source; /*!< The Prediv1 source value. |
||
251 | This parameter can be a value of @ref RCCEx_Prediv1_Source */ |
||
252 | #endif /* STM32F105xC || STM32F107xC */ |
||
253 | |||
254 | uint32_t HSEState; /*!< The new state of the HSE. |
||
255 | This parameter can be a value of @ref RCC_HSE_Config */ |
||
256 | |||
257 | uint32_t HSEPredivValue; /*!< The Prediv1 factor value (named PREDIV1 or PLLXTPRE in RM) |
||
258 | This parameter can be a value of @ref RCCEx_Prediv1_Factor */ |
||
259 | |||
260 | uint32_t LSEState; /*!< The new state of the LSE. |
||
261 | This parameter can be a value of @ref RCC_LSE_Config */ |
||
262 | |||
263 | uint32_t HSIState; /*!< The new state of the HSI. |
||
264 | This parameter can be a value of @ref RCC_HSI_Config */ |
||
265 | |||
266 | uint32_t HSICalibrationValue; /*!< The HSI calibration trimming value (default is RCC_HSICALIBRATION_DEFAULT). |
||
267 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */ |
||
268 | |||
269 | uint32_t LSIState; /*!< The new state of the LSI. |
||
270 | This parameter can be a value of @ref RCC_LSI_Config */ |
||
271 | |||
272 | RCC_PLLInitTypeDef PLL; /*!< PLL structure parameters */ |
||
273 | |||
274 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
275 | RCC_PLL2InitTypeDef PLL2; /*!< PLL2 structure parameters */ |
||
276 | #endif /* STM32F105xC || STM32F107xC */ |
||
277 | } RCC_OscInitTypeDef; |
||
278 | |||
279 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
280 | /** |
||
281 | * @brief RCC PLLI2S configuration structure definition |
||
282 | */ |
||
283 | typedef struct |
||
284 | { |
||
285 | uint32_t PLLI2SMUL; /*!< PLLI2SMUL: Multiplication factor for PLLI2S VCO input clock |
||
286 | This parameter must be a value of @ref RCCEx_PLLI2S_Multiplication_Factor*/ |
||
287 | |||
288 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
289 | uint32_t HSEPrediv2Value; /*!< The Prediv2 factor value. |
||
290 | This parameter can be a value of @ref RCCEx_Prediv2_Factor */ |
||
291 | |||
292 | #endif /* STM32F105xC || STM32F107xC */ |
||
293 | } RCC_PLLI2SInitTypeDef; |
||
294 | #endif /* STM32F105xC || STM32F107xC */ |
||
295 | |||
296 | /** |
||
297 | * @brief RCC extended clocks structure definition |
||
298 | */ |
||
299 | typedef struct |
||
300 | { |
||
301 | uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured. |
||
302 | This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */ |
||
303 | |||
304 | uint32_t RTCClockSelection; /*!< specifies the RTC clock source. |
||
305 | This parameter can be a value of @ref RCC_RTC_Clock_Source */ |
||
306 | |||
307 | uint32_t AdcClockSelection; /*!< ADC clock source |
||
308 | This parameter can be a value of @ref RCCEx_ADC_Prescaler */ |
||
309 | |||
310 | #if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ |
||
311 | || defined(STM32F107xC) |
||
312 | uint32_t I2s2ClockSelection; /*!< I2S2 clock source |
||
313 | This parameter can be a value of @ref RCCEx_I2S2_Clock_Source */ |
||
314 | |||
315 | uint32_t I2s3ClockSelection; /*!< I2S3 clock source |
||
316 | This parameter can be a value of @ref RCCEx_I2S3_Clock_Source */ |
||
317 | |||
318 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
319 | RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters |
||
320 | This parameter will be used only when PLLI2S is selected as Clock Source I2S2 or I2S3 */ |
||
321 | |||
322 | #endif /* STM32F105xC || STM32F107xC */ |
||
323 | #endif /* STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ |
||
324 | |||
325 | #if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ |
||
326 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ |
||
327 | || defined(STM32F105xC) || defined(STM32F107xC) |
||
328 | uint32_t UsbClockSelection; /*!< USB clock source |
||
329 | This parameter can be a value of @ref RCCEx_USB_Prescaler */ |
||
330 | |||
331 | #endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ |
||
332 | } RCC_PeriphCLKInitTypeDef; |
||
333 | |||
334 | /** |
||
335 | * @} |
||
336 | */ |
||
337 | |||
338 | /* Exported constants --------------------------------------------------------*/ |
||
339 | |||
340 | /** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants |
||
341 | * @{ |
||
342 | */ |
||
343 | |||
344 | /** @defgroup RCCEx_Periph_Clock_Selection Periph Clock Selection |
||
345 | * @{ |
||
346 | */ |
||
347 | #define RCC_PERIPHCLK_RTC 0x00000001U |
||
348 | #define RCC_PERIPHCLK_ADC 0x00000002U |
||
349 | #if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ |
||
350 | || defined(STM32F107xC) |
||
351 | #define RCC_PERIPHCLK_I2S2 0x00000004U |
||
352 | #define RCC_PERIPHCLK_I2S3 0x00000008U |
||
353 | #endif /* STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ |
||
354 | #if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ |
||
355 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ |
||
356 | || defined(STM32F105xC) || defined(STM32F107xC) |
||
357 | #define RCC_PERIPHCLK_USB 0x00000010U |
||
358 | #endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ |
||
359 | |||
360 | /** |
||
361 | * @} |
||
362 | */ |
||
363 | |||
364 | /** @defgroup RCCEx_ADC_Prescaler ADC Prescaler |
||
365 | * @{ |
||
366 | */ |
||
367 | #define RCC_ADCPCLK2_DIV2 RCC_CFGR_ADCPRE_DIV2 |
||
368 | #define RCC_ADCPCLK2_DIV4 RCC_CFGR_ADCPRE_DIV4 |
||
369 | #define RCC_ADCPCLK2_DIV6 RCC_CFGR_ADCPRE_DIV6 |
||
370 | #define RCC_ADCPCLK2_DIV8 RCC_CFGR_ADCPRE_DIV8 |
||
371 | |||
372 | /** |
||
373 | * @} |
||
374 | */ |
||
375 | |||
376 | #if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ |
||
377 | || defined(STM32F107xC) |
||
378 | /** @defgroup RCCEx_I2S2_Clock_Source I2S2 Clock Source |
||
379 | * @{ |
||
380 | */ |
||
381 | #define RCC_I2S2CLKSOURCE_SYSCLK 0x00000000U |
||
382 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
383 | #define RCC_I2S2CLKSOURCE_PLLI2S_VCO RCC_CFGR2_I2S2SRC |
||
384 | #endif /* STM32F105xC || STM32F107xC */ |
||
385 | |||
386 | /** |
||
387 | * @} |
||
388 | */ |
||
389 | |||
390 | /** @defgroup RCCEx_I2S3_Clock_Source I2S3 Clock Source |
||
391 | * @{ |
||
392 | */ |
||
393 | #define RCC_I2S3CLKSOURCE_SYSCLK 0x00000000U |
||
394 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
395 | #define RCC_I2S3CLKSOURCE_PLLI2S_VCO RCC_CFGR2_I2S3SRC |
||
396 | #endif /* STM32F105xC || STM32F107xC */ |
||
397 | |||
398 | /** |
||
399 | * @} |
||
400 | */ |
||
401 | |||
402 | #endif /* STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ |
||
403 | |||
404 | #if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ |
||
405 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) |
||
406 | |||
407 | /** @defgroup RCCEx_USB_Prescaler USB Prescaler |
||
408 | * @{ |
||
409 | */ |
||
410 | #define RCC_USBCLKSOURCE_PLL RCC_CFGR_USBPRE |
||
411 | #define RCC_USBCLKSOURCE_PLL_DIV1_5 0x00000000U |
||
412 | |||
413 | /** |
||
414 | * @} |
||
415 | */ |
||
416 | |||
417 | #endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ |
||
418 | |||
419 | |||
420 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
421 | /** @defgroup RCCEx_USB_Prescaler USB Prescaler |
||
422 | * @{ |
||
423 | */ |
||
424 | #define RCC_USBCLKSOURCE_PLL_DIV2 RCC_CFGR_OTGFSPRE |
||
425 | #define RCC_USBCLKSOURCE_PLL_DIV3 0x00000000U |
||
426 | |||
427 | /** |
||
428 | * @} |
||
429 | */ |
||
430 | |||
431 | /** @defgroup RCCEx_PLLI2S_Multiplication_Factor PLLI2S Multiplication Factor |
||
432 | * @{ |
||
433 | */ |
||
434 | |||
435 | #define RCC_PLLI2S_MUL8 RCC_CFGR2_PLL3MUL8 /*!< PLLI2S input clock * 8 */ |
||
436 | #define RCC_PLLI2S_MUL9 RCC_CFGR2_PLL3MUL9 /*!< PLLI2S input clock * 9 */ |
||
437 | #define RCC_PLLI2S_MUL10 RCC_CFGR2_PLL3MUL10 /*!< PLLI2S input clock * 10 */ |
||
438 | #define RCC_PLLI2S_MUL11 RCC_CFGR2_PLL3MUL11 /*!< PLLI2S input clock * 11 */ |
||
439 | #define RCC_PLLI2S_MUL12 RCC_CFGR2_PLL3MUL12 /*!< PLLI2S input clock * 12 */ |
||
440 | #define RCC_PLLI2S_MUL13 RCC_CFGR2_PLL3MUL13 /*!< PLLI2S input clock * 13 */ |
||
441 | #define RCC_PLLI2S_MUL14 RCC_CFGR2_PLL3MUL14 /*!< PLLI2S input clock * 14 */ |
||
442 | #define RCC_PLLI2S_MUL16 RCC_CFGR2_PLL3MUL16 /*!< PLLI2S input clock * 16 */ |
||
443 | #define RCC_PLLI2S_MUL20 RCC_CFGR2_PLL3MUL20 /*!< PLLI2S input clock * 20 */ |
||
444 | |||
445 | /** |
||
446 | * @} |
||
447 | */ |
||
448 | #endif /* STM32F105xC || STM32F107xC */ |
||
449 | |||
450 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
451 | /** @defgroup RCCEx_Prediv1_Source Prediv1 Source |
||
452 | * @{ |
||
453 | */ |
||
454 | |||
455 | #define RCC_PREDIV1_SOURCE_HSE RCC_CFGR2_PREDIV1SRC_HSE |
||
456 | #define RCC_PREDIV1_SOURCE_PLL2 RCC_CFGR2_PREDIV1SRC_PLL2 |
||
457 | |||
458 | /** |
||
459 | * @} |
||
460 | */ |
||
461 | #endif /* STM32F105xC || STM32F107xC */ |
||
462 | |||
463 | /** @defgroup RCCEx_Prediv1_Factor HSE Prediv1 Factor |
||
464 | * @{ |
||
465 | */ |
||
466 | |||
467 | #define RCC_HSE_PREDIV_DIV1 0x00000000U |
||
468 | |||
469 | #if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\ |
||
470 | || defined(STM32F100xE) |
||
471 | #define RCC_HSE_PREDIV_DIV2 RCC_CFGR2_PREDIV1_DIV2 |
||
472 | #define RCC_HSE_PREDIV_DIV3 RCC_CFGR2_PREDIV1_DIV3 |
||
473 | #define RCC_HSE_PREDIV_DIV4 RCC_CFGR2_PREDIV1_DIV4 |
||
474 | #define RCC_HSE_PREDIV_DIV5 RCC_CFGR2_PREDIV1_DIV5 |
||
475 | #define RCC_HSE_PREDIV_DIV6 RCC_CFGR2_PREDIV1_DIV6 |
||
476 | #define RCC_HSE_PREDIV_DIV7 RCC_CFGR2_PREDIV1_DIV7 |
||
477 | #define RCC_HSE_PREDIV_DIV8 RCC_CFGR2_PREDIV1_DIV8 |
||
478 | #define RCC_HSE_PREDIV_DIV9 RCC_CFGR2_PREDIV1_DIV9 |
||
479 | #define RCC_HSE_PREDIV_DIV10 RCC_CFGR2_PREDIV1_DIV10 |
||
480 | #define RCC_HSE_PREDIV_DIV11 RCC_CFGR2_PREDIV1_DIV11 |
||
481 | #define RCC_HSE_PREDIV_DIV12 RCC_CFGR2_PREDIV1_DIV12 |
||
482 | #define RCC_HSE_PREDIV_DIV13 RCC_CFGR2_PREDIV1_DIV13 |
||
483 | #define RCC_HSE_PREDIV_DIV14 RCC_CFGR2_PREDIV1_DIV14 |
||
484 | #define RCC_HSE_PREDIV_DIV15 RCC_CFGR2_PREDIV1_DIV15 |
||
485 | #define RCC_HSE_PREDIV_DIV16 RCC_CFGR2_PREDIV1_DIV16 |
||
486 | #else |
||
487 | #define RCC_HSE_PREDIV_DIV2 RCC_CFGR_PLLXTPRE |
||
488 | #endif /* STM32F105xC || STM32F107xC || STM32F100xB || STM32F100xE */ |
||
489 | |||
490 | /** |
||
491 | * @} |
||
492 | */ |
||
493 | |||
494 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
495 | /** @defgroup RCCEx_Prediv2_Factor HSE Prediv2 Factor |
||
496 | * @{ |
||
497 | */ |
||
498 | |||
499 | #define RCC_HSE_PREDIV2_DIV1 RCC_CFGR2_PREDIV2_DIV1 /*!< PREDIV2 input clock not divided */ |
||
500 | #define RCC_HSE_PREDIV2_DIV2 RCC_CFGR2_PREDIV2_DIV2 /*!< PREDIV2 input clock divided by 2 */ |
||
501 | #define RCC_HSE_PREDIV2_DIV3 RCC_CFGR2_PREDIV2_DIV3 /*!< PREDIV2 input clock divided by 3 */ |
||
502 | #define RCC_HSE_PREDIV2_DIV4 RCC_CFGR2_PREDIV2_DIV4 /*!< PREDIV2 input clock divided by 4 */ |
||
503 | #define RCC_HSE_PREDIV2_DIV5 RCC_CFGR2_PREDIV2_DIV5 /*!< PREDIV2 input clock divided by 5 */ |
||
504 | #define RCC_HSE_PREDIV2_DIV6 RCC_CFGR2_PREDIV2_DIV6 /*!< PREDIV2 input clock divided by 6 */ |
||
505 | #define RCC_HSE_PREDIV2_DIV7 RCC_CFGR2_PREDIV2_DIV7 /*!< PREDIV2 input clock divided by 7 */ |
||
506 | #define RCC_HSE_PREDIV2_DIV8 RCC_CFGR2_PREDIV2_DIV8 /*!< PREDIV2 input clock divided by 8 */ |
||
507 | #define RCC_HSE_PREDIV2_DIV9 RCC_CFGR2_PREDIV2_DIV9 /*!< PREDIV2 input clock divided by 9 */ |
||
508 | #define RCC_HSE_PREDIV2_DIV10 RCC_CFGR2_PREDIV2_DIV10 /*!< PREDIV2 input clock divided by 10 */ |
||
509 | #define RCC_HSE_PREDIV2_DIV11 RCC_CFGR2_PREDIV2_DIV11 /*!< PREDIV2 input clock divided by 11 */ |
||
510 | #define RCC_HSE_PREDIV2_DIV12 RCC_CFGR2_PREDIV2_DIV12 /*!< PREDIV2 input clock divided by 12 */ |
||
511 | #define RCC_HSE_PREDIV2_DIV13 RCC_CFGR2_PREDIV2_DIV13 /*!< PREDIV2 input clock divided by 13 */ |
||
512 | #define RCC_HSE_PREDIV2_DIV14 RCC_CFGR2_PREDIV2_DIV14 /*!< PREDIV2 input clock divided by 14 */ |
||
513 | #define RCC_HSE_PREDIV2_DIV15 RCC_CFGR2_PREDIV2_DIV15 /*!< PREDIV2 input clock divided by 15 */ |
||
514 | #define RCC_HSE_PREDIV2_DIV16 RCC_CFGR2_PREDIV2_DIV16 /*!< PREDIV2 input clock divided by 16 */ |
||
515 | |||
516 | /** |
||
517 | * @} |
||
518 | */ |
||
519 | |||
520 | /** @defgroup RCCEx_PLL2_Config PLL Config |
||
521 | * @{ |
||
522 | */ |
||
523 | #define RCC_PLL2_NONE 0x00000000U |
||
524 | #define RCC_PLL2_OFF 0x00000001U |
||
525 | #define RCC_PLL2_ON 0x00000002U |
||
526 | |||
527 | /** |
||
528 | * @} |
||
529 | */ |
||
530 | |||
531 | /** @defgroup RCCEx_PLL2_Multiplication_Factor PLL2 Multiplication Factor |
||
532 | * @{ |
||
533 | */ |
||
534 | |||
535 | #define RCC_PLL2_MUL8 RCC_CFGR2_PLL2MUL8 /*!< PLL2 input clock * 8 */ |
||
536 | #define RCC_PLL2_MUL9 RCC_CFGR2_PLL2MUL9 /*!< PLL2 input clock * 9 */ |
||
537 | #define RCC_PLL2_MUL10 RCC_CFGR2_PLL2MUL10 /*!< PLL2 input clock * 10 */ |
||
538 | #define RCC_PLL2_MUL11 RCC_CFGR2_PLL2MUL11 /*!< PLL2 input clock * 11 */ |
||
539 | #define RCC_PLL2_MUL12 RCC_CFGR2_PLL2MUL12 /*!< PLL2 input clock * 12 */ |
||
540 | #define RCC_PLL2_MUL13 RCC_CFGR2_PLL2MUL13 /*!< PLL2 input clock * 13 */ |
||
541 | #define RCC_PLL2_MUL14 RCC_CFGR2_PLL2MUL14 /*!< PLL2 input clock * 14 */ |
||
542 | #define RCC_PLL2_MUL16 RCC_CFGR2_PLL2MUL16 /*!< PLL2 input clock * 16 */ |
||
543 | #define RCC_PLL2_MUL20 RCC_CFGR2_PLL2MUL20 /*!< PLL2 input clock * 20 */ |
||
544 | |||
545 | /** |
||
546 | * @} |
||
547 | */ |
||
548 | |||
549 | #endif /* STM32F105xC || STM32F107xC */ |
||
550 | |||
551 | /** @defgroup RCCEx_PLL_Multiplication_Factor PLL Multiplication Factor |
||
552 | * @{ |
||
553 | */ |
||
554 | |||
555 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
556 | #else |
||
557 | #define RCC_PLL_MUL2 RCC_CFGR_PLLMULL2 |
||
558 | #define RCC_PLL_MUL3 RCC_CFGR_PLLMULL3 |
||
559 | #endif /* STM32F105xC || STM32F107xC */ |
||
560 | #define RCC_PLL_MUL4 RCC_CFGR_PLLMULL4 |
||
561 | #define RCC_PLL_MUL5 RCC_CFGR_PLLMULL5 |
||
562 | #define RCC_PLL_MUL6 RCC_CFGR_PLLMULL6 |
||
563 | #define RCC_PLL_MUL7 RCC_CFGR_PLLMULL7 |
||
564 | #define RCC_PLL_MUL8 RCC_CFGR_PLLMULL8 |
||
565 | #define RCC_PLL_MUL9 RCC_CFGR_PLLMULL9 |
||
566 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
567 | #define RCC_PLL_MUL6_5 RCC_CFGR_PLLMULL6_5 |
||
568 | #else |
||
569 | #define RCC_PLL_MUL10 RCC_CFGR_PLLMULL10 |
||
570 | #define RCC_PLL_MUL11 RCC_CFGR_PLLMULL11 |
||
571 | #define RCC_PLL_MUL12 RCC_CFGR_PLLMULL12 |
||
572 | #define RCC_PLL_MUL13 RCC_CFGR_PLLMULL13 |
||
573 | #define RCC_PLL_MUL14 RCC_CFGR_PLLMULL14 |
||
574 | #define RCC_PLL_MUL15 RCC_CFGR_PLLMULL15 |
||
575 | #define RCC_PLL_MUL16 RCC_CFGR_PLLMULL16 |
||
576 | #endif /* STM32F105xC || STM32F107xC */ |
||
577 | |||
578 | /** |
||
579 | * @} |
||
580 | */ |
||
581 | |||
582 | /** @defgroup RCCEx_MCO1_Clock_Source MCO1 Clock Source |
||
583 | * @{ |
||
584 | */ |
||
585 | #define RCC_MCO1SOURCE_NOCLOCK ((uint32_t)RCC_CFGR_MCO_NOCLOCK) |
||
586 | #define RCC_MCO1SOURCE_SYSCLK ((uint32_t)RCC_CFGR_MCO_SYSCLK) |
||
587 | #define RCC_MCO1SOURCE_HSI ((uint32_t)RCC_CFGR_MCO_HSI) |
||
588 | #define RCC_MCO1SOURCE_HSE ((uint32_t)RCC_CFGR_MCO_HSE) |
||
589 | #define RCC_MCO1SOURCE_PLLCLK ((uint32_t)RCC_CFGR_MCO_PLLCLK_DIV2) |
||
590 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
591 | #define RCC_MCO1SOURCE_PLL2CLK ((uint32_t)RCC_CFGR_MCO_PLL2CLK) |
||
592 | #define RCC_MCO1SOURCE_PLL3CLK_DIV2 ((uint32_t)RCC_CFGR_MCO_PLL3CLK_DIV2) |
||
593 | #define RCC_MCO1SOURCE_EXT_HSE ((uint32_t)RCC_CFGR_MCO_EXT_HSE) |
||
594 | #define RCC_MCO1SOURCE_PLL3CLK ((uint32_t)RCC_CFGR_MCO_PLL3CLK) |
||
595 | #endif /* STM32F105xC || STM32F107xC*/ |
||
596 | /** |
||
597 | * @} |
||
598 | */ |
||
599 | |||
600 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
601 | /** @defgroup RCCEx_Interrupt RCCEx Interrupt |
||
602 | * @{ |
||
603 | */ |
||
604 | #define RCC_IT_PLL2RDY ((uint8_t)RCC_CIR_PLL2RDYF) |
||
605 | #define RCC_IT_PLLI2SRDY ((uint8_t)RCC_CIR_PLL3RDYF) |
||
606 | /** |
||
607 | * @} |
||
608 | */ |
||
609 | |||
610 | /** @defgroup RCCEx_Flag RCCEx Flag |
||
611 | * Elements values convention: 0XXYYYYYb |
||
612 | * - YYYYY : Flag position in the register |
||
613 | * - XX : Register index |
||
614 | * - 01: CR register |
||
615 | * @{ |
||
616 | */ |
||
617 | /* Flags in the CR register */ |
||
618 | #define RCC_FLAG_PLL2RDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLL2RDY_Pos)) |
||
619 | #define RCC_FLAG_PLLI2SRDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLL3RDY_Pos)) |
||
620 | /** |
||
621 | * @} |
||
622 | */ |
||
623 | #endif /* STM32F105xC || STM32F107xC*/ |
||
624 | |||
625 | /** |
||
626 | * @} |
||
627 | */ |
||
628 | |||
629 | /* Exported macro ------------------------------------------------------------*/ |
||
630 | /** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros |
||
631 | * @{ |
||
632 | */ |
||
633 | |||
634 | /** @defgroup RCCEx_Peripheral_Clock_Enable_Disable Peripheral Clock Enable Disable |
||
635 | * @brief Enable or disable the AHB1 peripheral clock. |
||
636 | * @note After reset, the peripheral clock (used for registers read/write access) |
||
637 | * is disabled and the application software has to enable this clock before |
||
638 | * using it. |
||
639 | * @{ |
||
640 | */ |
||
641 | |||
642 | #if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ |
||
643 | || defined(STM32F103xG) || defined(STM32F105xC) || defined (STM32F107xC)\ |
||
644 | || defined (STM32F100xE) |
||
645 | #define __HAL_RCC_DMA2_CLK_ENABLE() do { \ |
||
646 | __IO uint32_t tmpreg; \ |
||
647 | SET_BIT(RCC->AHBENR, RCC_AHBENR_DMA2EN);\ |
||
648 | /* Delay after an RCC peripheral clock enabling */ \ |
||
649 | tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_DMA2EN);\ |
||
650 | UNUSED(tmpreg); \ |
||
651 | } while(0U) |
||
652 | |||
653 | #define __HAL_RCC_DMA2_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_DMA2EN)) |
||
654 | #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG || STM32F105xC || STM32F107xC || STM32F100xE */ |
||
655 | |||
656 | #if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ |
||
657 | || defined(STM32F103xG) || defined (STM32F100xE) |
||
658 | #define __HAL_RCC_FSMC_CLK_ENABLE() do { \ |
||
659 | __IO uint32_t tmpreg; \ |
||
660 | SET_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN);\ |
||
661 | /* Delay after an RCC peripheral clock enabling */ \ |
||
662 | tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN);\ |
||
663 | UNUSED(tmpreg); \ |
||
664 | } while(0U) |
||
665 | |||
666 | #define __HAL_RCC_FSMC_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_FSMCEN)) |
||
667 | #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG || STM32F100xE */ |
||
668 | |||
669 | #if defined(STM32F103xE) || defined(STM32F103xG) |
||
670 | #define __HAL_RCC_SDIO_CLK_ENABLE() do { \ |
||
671 | __IO uint32_t tmpreg; \ |
||
672 | SET_BIT(RCC->AHBENR, RCC_AHBENR_SDIOEN);\ |
||
673 | /* Delay after an RCC peripheral clock enabling */ \ |
||
674 | tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_SDIOEN);\ |
||
675 | UNUSED(tmpreg); \ |
||
676 | } while(0U) |
||
677 | |||
678 | |||
679 | #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_SDIOEN)) |
||
680 | #endif /* STM32F103xE || STM32F103xG */ |
||
681 | |||
682 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
683 | #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do { \ |
||
684 | __IO uint32_t tmpreg; \ |
||
685 | SET_BIT(RCC->AHBENR, RCC_AHBENR_OTGFSEN);\ |
||
686 | /* Delay after an RCC peripheral clock enabling */ \ |
||
687 | tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_OTGFSEN);\ |
||
688 | UNUSED(tmpreg); \ |
||
689 | } while(0U) |
||
690 | |||
691 | |||
692 | #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_OTGFSEN)) |
||
693 | #endif /* STM32F105xC || STM32F107xC*/ |
||
694 | |||
695 | #if defined(STM32F107xC) |
||
696 | #define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \ |
||
697 | __IO uint32_t tmpreg; \ |
||
698 | SET_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACEN);\ |
||
699 | /* Delay after an RCC peripheral clock enabling */ \ |
||
700 | tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACEN);\ |
||
701 | UNUSED(tmpreg); \ |
||
702 | } while(0U) |
||
703 | |||
704 | #define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \ |
||
705 | __IO uint32_t tmpreg; \ |
||
706 | SET_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACTXEN);\ |
||
707 | /* Delay after an RCC peripheral clock enabling */ \ |
||
708 | tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACTXEN);\ |
||
709 | UNUSED(tmpreg); \ |
||
710 | } while(0U) |
||
711 | |||
712 | #define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \ |
||
713 | __IO uint32_t tmpreg; \ |
||
714 | SET_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACRXEN);\ |
||
715 | /* Delay after an RCC peripheral clock enabling */ \ |
||
716 | tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACRXEN);\ |
||
717 | UNUSED(tmpreg); \ |
||
718 | } while(0U) |
||
719 | |||
720 | #define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_ETHMACEN)) |
||
721 | #define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_ETHMACTXEN)) |
||
722 | #define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_ETHMACRXEN)) |
||
723 | |||
724 | /** |
||
725 | * @brief Enable ETHERNET clock. |
||
726 | */ |
||
727 | #define __HAL_RCC_ETH_CLK_ENABLE() do { \ |
||
728 | __HAL_RCC_ETHMAC_CLK_ENABLE(); \ |
||
729 | __HAL_RCC_ETHMACTX_CLK_ENABLE(); \ |
||
730 | __HAL_RCC_ETHMACRX_CLK_ENABLE(); \ |
||
731 | } while(0U) |
||
732 | /** |
||
733 | * @brief Disable ETHERNET clock. |
||
734 | */ |
||
735 | #define __HAL_RCC_ETH_CLK_DISABLE() do { \ |
||
736 | __HAL_RCC_ETHMACTX_CLK_DISABLE(); \ |
||
737 | __HAL_RCC_ETHMACRX_CLK_DISABLE(); \ |
||
738 | __HAL_RCC_ETHMAC_CLK_DISABLE(); \ |
||
739 | } while(0U) |
||
740 | |||
741 | #endif /* STM32F107xC*/ |
||
742 | |||
743 | /** |
||
744 | * @} |
||
745 | */ |
||
746 | |||
747 | /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status |
||
748 | * @brief Get the enable or disable status of the AHB1 peripheral clock. |
||
749 | * @note After reset, the peripheral clock (used for registers read/write access) |
||
750 | * is disabled and the application software has to enable this clock before |
||
751 | * using it. |
||
752 | * @{ |
||
753 | */ |
||
754 | |||
755 | #if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ |
||
756 | || defined(STM32F103xG) || defined(STM32F105xC) || defined (STM32F107xC)\ |
||
757 | || defined (STM32F100xE) |
||
758 | #define __HAL_RCC_DMA2_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA2EN)) != RESET) |
||
759 | #define __HAL_RCC_DMA2_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA2EN)) == RESET) |
||
760 | #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG || STM32F105xC || STM32F107xC || STM32F100xE */ |
||
761 | #if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ |
||
762 | || defined(STM32F103xG) || defined (STM32F100xE) |
||
763 | #define __HAL_RCC_FSMC_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_FSMCEN)) != RESET) |
||
764 | #define __HAL_RCC_FSMC_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_FSMCEN)) == RESET) |
||
765 | #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG || STM32F100xE */ |
||
766 | #if defined(STM32F103xE) || defined(STM32F103xG) |
||
767 | #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_SDIOEN)) != RESET) |
||
768 | #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_SDIOEN)) == RESET) |
||
769 | #endif /* STM32F103xE || STM32F103xG */ |
||
770 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
771 | #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_OTGFSEN)) != RESET) |
||
772 | #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_OTGFSEN)) == RESET) |
||
773 | #endif /* STM32F105xC || STM32F107xC*/ |
||
774 | #if defined(STM32F107xC) |
||
775 | #define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACEN)) != RESET) |
||
776 | #define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACEN)) == RESET) |
||
777 | #define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACTXEN)) != RESET) |
||
778 | #define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACTXEN)) == RESET) |
||
779 | #define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACRXEN)) != RESET) |
||
780 | #define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACRXEN)) == RESET) |
||
781 | #endif /* STM32F107xC*/ |
||
782 | |||
783 | /** |
||
784 | * @} |
||
785 | */ |
||
786 | |||
787 | /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Clock Enable Disable |
||
788 | * @brief Enable or disable the Low Speed APB (APB1) peripheral clock. |
||
789 | * @note After reset, the peripheral clock (used for registers read/write access) |
||
790 | * is disabled and the application software has to enable this clock before |
||
791 | * using it. |
||
792 | * @{ |
||
793 | */ |
||
794 | |||
795 | #if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\ |
||
796 | || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC) |
||
797 | #define __HAL_RCC_CAN1_CLK_ENABLE() do { \ |
||
798 | __IO uint32_t tmpreg; \ |
||
799 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ |
||
800 | /* Delay after an RCC peripheral clock enabling */ \ |
||
801 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\ |
||
802 | UNUSED(tmpreg); \ |
||
803 | } while(0U) |
||
804 | |||
805 | #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN)) |
||
806 | #endif /* STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ |
||
807 | |||
808 | #if defined(STM32F100xB) || defined(STM32F100xE) || defined(STM32F101xB)\ |
||
809 | || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F102xB)\ |
||
810 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ |
||
811 | || defined(STM32F105xC) || defined(STM32F107xC) |
||
812 | #define __HAL_RCC_TIM4_CLK_ENABLE() do { \ |
||
813 | __IO uint32_t tmpreg; \ |
||
814 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ |
||
815 | /* Delay after an RCC peripheral clock enabling */ \ |
||
816 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\ |
||
817 | UNUSED(tmpreg); \ |
||
818 | } while(0U) |
||
819 | |||
820 | #define __HAL_RCC_SPI2_CLK_ENABLE() do { \ |
||
821 | __IO uint32_t tmpreg; \ |
||
822 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\ |
||
823 | /* Delay after an RCC peripheral clock enabling */ \ |
||
824 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\ |
||
825 | UNUSED(tmpreg); \ |
||
826 | } while(0U) |
||
827 | |||
828 | #define __HAL_RCC_USART3_CLK_ENABLE() do { \ |
||
829 | __IO uint32_t tmpreg; \ |
||
830 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ |
||
831 | /* Delay after an RCC peripheral clock enabling */ \ |
||
832 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\ |
||
833 | UNUSED(tmpreg); \ |
||
834 | } while(0U) |
||
835 | |||
836 | #define __HAL_RCC_I2C2_CLK_ENABLE() do { \ |
||
837 | __IO uint32_t tmpreg; \ |
||
838 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\ |
||
839 | /* Delay after an RCC peripheral clock enabling */ \ |
||
840 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\ |
||
841 | UNUSED(tmpreg); \ |
||
842 | } while(0U) |
||
843 | |||
844 | #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN)) |
||
845 | #define __HAL_RCC_SPI2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI2EN)) |
||
846 | #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN)) |
||
847 | #define __HAL_RCC_I2C2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C2EN)) |
||
848 | #endif /* STM32F100xB || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ |
||
849 | |||
850 | #if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ |
||
851 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) |
||
852 | #define __HAL_RCC_USB_CLK_ENABLE() do { \ |
||
853 | __IO uint32_t tmpreg; \ |
||
854 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USBEN);\ |
||
855 | /* Delay after an RCC peripheral clock enabling */ \ |
||
856 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USBEN);\ |
||
857 | UNUSED(tmpreg); \ |
||
858 | } while(0U) |
||
859 | |||
860 | #define __HAL_RCC_USB_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USBEN)) |
||
861 | #endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ |
||
862 | |||
863 | #if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ |
||
864 | || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC) |
||
865 | #define __HAL_RCC_TIM5_CLK_ENABLE() do { \ |
||
866 | __IO uint32_t tmpreg; \ |
||
867 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\ |
||
868 | /* Delay after an RCC peripheral clock enabling */ \ |
||
869 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\ |
||
870 | UNUSED(tmpreg); \ |
||
871 | } while(0U) |
||
872 | |||
873 | #define __HAL_RCC_TIM6_CLK_ENABLE() do { \ |
||
874 | __IO uint32_t tmpreg; \ |
||
875 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ |
||
876 | /* Delay after an RCC peripheral clock enabling */ \ |
||
877 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ |
||
878 | UNUSED(tmpreg); \ |
||
879 | } while(0U) |
||
880 | |||
881 | #define __HAL_RCC_TIM7_CLK_ENABLE() do { \ |
||
882 | __IO uint32_t tmpreg; \ |
||
883 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ |
||
884 | /* Delay after an RCC peripheral clock enabling */ \ |
||
885 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ |
||
886 | UNUSED(tmpreg); \ |
||
887 | } while(0U) |
||
888 | |||
889 | #define __HAL_RCC_SPI3_CLK_ENABLE() do { \ |
||
890 | __IO uint32_t tmpreg; \ |
||
891 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ |
||
892 | /* Delay after an RCC peripheral clock enabling */ \ |
||
893 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ |
||
894 | UNUSED(tmpreg); \ |
||
895 | } while(0U) |
||
896 | |||
897 | #define __HAL_RCC_UART4_CLK_ENABLE() do { \ |
||
898 | __IO uint32_t tmpreg; \ |
||
899 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ |
||
900 | /* Delay after an RCC peripheral clock enabling */ \ |
||
901 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ |
||
902 | UNUSED(tmpreg); \ |
||
903 | } while(0U) |
||
904 | |||
905 | #define __HAL_RCC_UART5_CLK_ENABLE() do { \ |
||
906 | __IO uint32_t tmpreg; \ |
||
907 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ |
||
908 | /* Delay after an RCC peripheral clock enabling */ \ |
||
909 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ |
||
910 | UNUSED(tmpreg); \ |
||
911 | } while(0U) |
||
912 | |||
913 | #define __HAL_RCC_DAC_CLK_ENABLE() do { \ |
||
914 | __IO uint32_t tmpreg; \ |
||
915 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ |
||
916 | /* Delay after an RCC peripheral clock enabling */ \ |
||
917 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ |
||
918 | UNUSED(tmpreg); \ |
||
919 | } while(0U) |
||
920 | |||
921 | #define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM5EN)) |
||
922 | #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN)) |
||
923 | #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN)) |
||
924 | #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN)) |
||
925 | #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN)) |
||
926 | #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN)) |
||
927 | #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN)) |
||
928 | #endif /* STM32F101xE || STM32F103xE || STM32F101xG || (...) || STM32F105xC || STM32F107xC */ |
||
929 | |||
930 | #if defined(STM32F100xB) || defined (STM32F100xE) |
||
931 | #define __HAL_RCC_TIM6_CLK_ENABLE() do { \ |
||
932 | __IO uint32_t tmpreg; \ |
||
933 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ |
||
934 | /* Delay after an RCC peripheral clock enabling */ \ |
||
935 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\ |
||
936 | UNUSED(tmpreg); \ |
||
937 | } while(0U) |
||
938 | |||
939 | #define __HAL_RCC_TIM7_CLK_ENABLE() do { \ |
||
940 | __IO uint32_t tmpreg; \ |
||
941 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ |
||
942 | /* Delay after an RCC peripheral clock enabling */ \ |
||
943 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\ |
||
944 | UNUSED(tmpreg); \ |
||
945 | } while(0U) |
||
946 | |||
947 | #define __HAL_RCC_DAC_CLK_ENABLE() do { \ |
||
948 | __IO uint32_t tmpreg; \ |
||
949 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ |
||
950 | /* Delay after an RCC peripheral clock enabling */ \ |
||
951 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\ |
||
952 | UNUSED(tmpreg); \ |
||
953 | } while(0U) |
||
954 | |||
955 | #define __HAL_RCC_CEC_CLK_ENABLE() do { \ |
||
956 | __IO uint32_t tmpreg; \ |
||
957 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\ |
||
958 | /* Delay after an RCC peripheral clock enabling */ \ |
||
959 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\ |
||
960 | UNUSED(tmpreg); \ |
||
961 | } while(0U) |
||
962 | |||
963 | #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN)) |
||
964 | #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN)) |
||
965 | #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN)) |
||
966 | #define __HAL_RCC_CEC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CECEN)) |
||
967 | #endif /* STM32F100xB || STM32F100xE */ |
||
968 | |||
969 | #ifdef STM32F100xE |
||
970 | #define __HAL_RCC_TIM5_CLK_ENABLE() do { \ |
||
971 | __IO uint32_t tmpreg; \ |
||
972 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\ |
||
973 | /* Delay after an RCC peripheral clock enabling */ \ |
||
974 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\ |
||
975 | UNUSED(tmpreg); \ |
||
976 | } while(0U) |
||
977 | |||
978 | #define __HAL_RCC_TIM12_CLK_ENABLE() do { \ |
||
979 | __IO uint32_t tmpreg; \ |
||
980 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ |
||
981 | /* Delay after an RCC peripheral clock enabling */ \ |
||
982 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ |
||
983 | UNUSED(tmpreg); \ |
||
984 | } while(0U) |
||
985 | |||
986 | #define __HAL_RCC_TIM13_CLK_ENABLE() do { \ |
||
987 | __IO uint32_t tmpreg; \ |
||
988 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ |
||
989 | /* Delay after an RCC peripheral clock enabling */ \ |
||
990 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ |
||
991 | UNUSED(tmpreg); \ |
||
992 | } while(0U) |
||
993 | |||
994 | #define __HAL_RCC_TIM14_CLK_ENABLE() do { \ |
||
995 | __IO uint32_t tmpreg; \ |
||
996 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ |
||
997 | /* Delay after an RCC peripheral clock enabling */ \ |
||
998 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ |
||
999 | UNUSED(tmpreg); \ |
||
1000 | } while(0U) |
||
1001 | |||
1002 | #define __HAL_RCC_SPI3_CLK_ENABLE() do { \ |
||
1003 | __IO uint32_t tmpreg; \ |
||
1004 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ |
||
1005 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1006 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\ |
||
1007 | UNUSED(tmpreg); \ |
||
1008 | } while(0U) |
||
1009 | |||
1010 | #define __HAL_RCC_UART4_CLK_ENABLE() do { \ |
||
1011 | __IO uint32_t tmpreg; \ |
||
1012 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ |
||
1013 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1014 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\ |
||
1015 | UNUSED(tmpreg); \ |
||
1016 | } while(0U) |
||
1017 | |||
1018 | #define __HAL_RCC_UART5_CLK_ENABLE() do { \ |
||
1019 | __IO uint32_t tmpreg; \ |
||
1020 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ |
||
1021 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1022 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\ |
||
1023 | UNUSED(tmpreg); \ |
||
1024 | } while(0U) |
||
1025 | |||
1026 | #define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM5EN)) |
||
1027 | #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN)) |
||
1028 | #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN)) |
||
1029 | #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN)) |
||
1030 | #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN)) |
||
1031 | #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN)) |
||
1032 | #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN)) |
||
1033 | #endif /* STM32F100xE */ |
||
1034 | |||
1035 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
1036 | #define __HAL_RCC_CAN2_CLK_ENABLE() do { \ |
||
1037 | __IO uint32_t tmpreg; \ |
||
1038 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ |
||
1039 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1040 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\ |
||
1041 | UNUSED(tmpreg); \ |
||
1042 | } while(0U) |
||
1043 | |||
1044 | #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN)) |
||
1045 | #endif /* STM32F105xC || STM32F107xC */ |
||
1046 | |||
1047 | #if defined(STM32F101xG) || defined(STM32F103xG) |
||
1048 | #define __HAL_RCC_TIM12_CLK_ENABLE() do { \ |
||
1049 | __IO uint32_t tmpreg; \ |
||
1050 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ |
||
1051 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1052 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\ |
||
1053 | UNUSED(tmpreg); \ |
||
1054 | } while(0U) |
||
1055 | |||
1056 | #define __HAL_RCC_TIM13_CLK_ENABLE() do { \ |
||
1057 | __IO uint32_t tmpreg; \ |
||
1058 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ |
||
1059 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1060 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\ |
||
1061 | UNUSED(tmpreg); \ |
||
1062 | } while(0U) |
||
1063 | |||
1064 | #define __HAL_RCC_TIM14_CLK_ENABLE() do { \ |
||
1065 | __IO uint32_t tmpreg; \ |
||
1066 | SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ |
||
1067 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1068 | tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\ |
||
1069 | UNUSED(tmpreg); \ |
||
1070 | } while(0U) |
||
1071 | |||
1072 | #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN)) |
||
1073 | #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN)) |
||
1074 | #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN)) |
||
1075 | #endif /* STM32F101xG || STM32F103xG*/ |
||
1076 | |||
1077 | /** |
||
1078 | * @} |
||
1079 | */ |
||
1080 | |||
1081 | /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status |
||
1082 | * @brief Get the enable or disable status of the APB1 peripheral clock. |
||
1083 | * @note After reset, the peripheral clock (used for registers read/write access) |
||
1084 | * is disabled and the application software has to enable this clock before |
||
1085 | * using it. |
||
1086 | * @{ |
||
1087 | */ |
||
1088 | |||
1089 | #if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\ |
||
1090 | || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC) |
||
1091 | #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET) |
||
1092 | #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET) |
||
1093 | #endif /* STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ |
||
1094 | #if defined(STM32F100xB) || defined(STM32F100xE) || defined(STM32F101xB)\ |
||
1095 | || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F102xB)\ |
||
1096 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ |
||
1097 | || defined(STM32F105xC) || defined(STM32F107xC) |
||
1098 | #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET) |
||
1099 | #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET) |
||
1100 | #define __HAL_RCC_SPI2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) != RESET) |
||
1101 | #define __HAL_RCC_SPI2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) == RESET) |
||
1102 | #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET) |
||
1103 | #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET) |
||
1104 | #define __HAL_RCC_I2C2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) != RESET) |
||
1105 | #define __HAL_RCC_I2C2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) == RESET) |
||
1106 | #endif /* STM32F100xB || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ |
||
1107 | #if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ |
||
1108 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) |
||
1109 | #define __HAL_RCC_USB_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USBEN)) != RESET) |
||
1110 | #define __HAL_RCC_USB_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USBEN)) == RESET) |
||
1111 | #endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ |
||
1112 | #if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ |
||
1113 | || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC) |
||
1114 | #define __HAL_RCC_TIM5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) != RESET) |
||
1115 | #define __HAL_RCC_TIM5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) == RESET) |
||
1116 | #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET) |
||
1117 | #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET) |
||
1118 | #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET) |
||
1119 | #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET) |
||
1120 | #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET) |
||
1121 | #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET) |
||
1122 | #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET) |
||
1123 | #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET) |
||
1124 | #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET) |
||
1125 | #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET) |
||
1126 | #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET) |
||
1127 | #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET) |
||
1128 | #endif /* STM32F101xE || STM32F103xE || STM32F101xG || (...) || STM32F105xC || STM32F107xC */ |
||
1129 | #if defined(STM32F100xB) || defined (STM32F100xE) |
||
1130 | #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET) |
||
1131 | #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET) |
||
1132 | #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET) |
||
1133 | #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET) |
||
1134 | #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET) |
||
1135 | #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET) |
||
1136 | #define __HAL_RCC_CEC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) != RESET) |
||
1137 | #define __HAL_RCC_CEC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) == RESET) |
||
1138 | #endif /* STM32F100xB || STM32F100xE */ |
||
1139 | #ifdef STM32F100xE |
||
1140 | #define __HAL_RCC_TIM5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) != RESET) |
||
1141 | #define __HAL_RCC_TIM5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) == RESET) |
||
1142 | #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET) |
||
1143 | #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET) |
||
1144 | #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET) |
||
1145 | #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET) |
||
1146 | #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET) |
||
1147 | #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET) |
||
1148 | #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET) |
||
1149 | #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET) |
||
1150 | #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET) |
||
1151 | #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET) |
||
1152 | #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET) |
||
1153 | #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET) |
||
1154 | #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET) |
||
1155 | #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET) |
||
1156 | #endif /* STM32F100xE */ |
||
1157 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
1158 | #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET) |
||
1159 | #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET) |
||
1160 | #endif /* STM32F105xC || STM32F107xC */ |
||
1161 | #if defined(STM32F101xG) || defined(STM32F103xG) |
||
1162 | #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET) |
||
1163 | #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET) |
||
1164 | #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET) |
||
1165 | #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET) |
||
1166 | #endif /* STM32F101xG || STM32F103xG*/ |
||
1167 | |||
1168 | /** |
||
1169 | * @} |
||
1170 | */ |
||
1171 | |||
1172 | /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Clock Enable Disable |
||
1173 | * @brief Enable or disable the High Speed APB (APB2) peripheral clock. |
||
1174 | * @note After reset, the peripheral clock (used for registers read/write access) |
||
1175 | * is disabled and the application software has to enable this clock before |
||
1176 | * using it. |
||
1177 | * @{ |
||
1178 | */ |
||
1179 | |||
1180 | #if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\ |
||
1181 | || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\ |
||
1182 | || defined(STM32F103xG) |
||
1183 | #define __HAL_RCC_ADC2_CLK_ENABLE() do { \ |
||
1184 | __IO uint32_t tmpreg; \ |
||
1185 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\ |
||
1186 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1187 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\ |
||
1188 | UNUSED(tmpreg); \ |
||
1189 | } while(0U) |
||
1190 | |||
1191 | #define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN)) |
||
1192 | #endif /* STM32F101xG || STM32F103x6 || STM32F103xB || STM32F105xC || STM32F107xC || STM32F103xE || STM32F103xG */ |
||
1193 | |||
1194 | #if defined(STM32F100xB) || defined(STM32F100xE) |
||
1195 | #define __HAL_RCC_TIM15_CLK_ENABLE() do { \ |
||
1196 | __IO uint32_t tmpreg; \ |
||
1197 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN);\ |
||
1198 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1199 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN);\ |
||
1200 | UNUSED(tmpreg); \ |
||
1201 | } while(0U) |
||
1202 | |||
1203 | #define __HAL_RCC_TIM16_CLK_ENABLE() do { \ |
||
1204 | __IO uint32_t tmpreg; \ |
||
1205 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN);\ |
||
1206 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1207 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN);\ |
||
1208 | UNUSED(tmpreg); \ |
||
1209 | } while(0U) |
||
1210 | |||
1211 | #define __HAL_RCC_TIM17_CLK_ENABLE() do { \ |
||
1212 | __IO uint32_t tmpreg; \ |
||
1213 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN);\ |
||
1214 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1215 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN);\ |
||
1216 | UNUSED(tmpreg); \ |
||
1217 | } while(0U) |
||
1218 | |||
1219 | #define __HAL_RCC_TIM15_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM15EN)) |
||
1220 | #define __HAL_RCC_TIM16_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM16EN)) |
||
1221 | #define __HAL_RCC_TIM17_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM17EN)) |
||
1222 | #endif /* STM32F100xB || STM32F100xE */ |
||
1223 | |||
1224 | #if defined(STM32F100xE) || defined(STM32F101xB) || defined(STM32F101xE)\ |
||
1225 | || defined(STM32F101xG) || defined(STM32F100xB) || defined(STM32F103xB)\ |
||
1226 | || defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ |
||
1227 | || defined(STM32F107xC) |
||
1228 | #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \ |
||
1229 | __IO uint32_t tmpreg; \ |
||
1230 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPEEN);\ |
||
1231 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1232 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPEEN);\ |
||
1233 | UNUSED(tmpreg); \ |
||
1234 | } while(0U) |
||
1235 | |||
1236 | #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPEEN)) |
||
1237 | #endif /* STM32F101x6 || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ |
||
1238 | |||
1239 | #if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ |
||
1240 | || defined(STM32F103xG) |
||
1241 | #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \ |
||
1242 | __IO uint32_t tmpreg; \ |
||
1243 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\ |
||
1244 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1245 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\ |
||
1246 | UNUSED(tmpreg); \ |
||
1247 | } while(0U) |
||
1248 | |||
1249 | #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \ |
||
1250 | __IO uint32_t tmpreg; \ |
||
1251 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\ |
||
1252 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1253 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\ |
||
1254 | UNUSED(tmpreg); \ |
||
1255 | } while(0U) |
||
1256 | |||
1257 | #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPFEN)) |
||
1258 | #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPGEN)) |
||
1259 | #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG*/ |
||
1260 | |||
1261 | #if defined(STM32F103xE) || defined(STM32F103xG) |
||
1262 | #define __HAL_RCC_TIM8_CLK_ENABLE() do { \ |
||
1263 | __IO uint32_t tmpreg; \ |
||
1264 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ |
||
1265 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1266 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\ |
||
1267 | UNUSED(tmpreg); \ |
||
1268 | } while(0U) |
||
1269 | |||
1270 | #define __HAL_RCC_ADC3_CLK_ENABLE() do { \ |
||
1271 | __IO uint32_t tmpreg; \ |
||
1272 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\ |
||
1273 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1274 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\ |
||
1275 | UNUSED(tmpreg); \ |
||
1276 | } while(0U) |
||
1277 | |||
1278 | #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN)) |
||
1279 | #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN)) |
||
1280 | #endif /* STM32F103xE || STM32F103xG */ |
||
1281 | |||
1282 | #if defined(STM32F100xE) |
||
1283 | #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \ |
||
1284 | __IO uint32_t tmpreg; \ |
||
1285 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\ |
||
1286 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1287 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\ |
||
1288 | UNUSED(tmpreg); \ |
||
1289 | } while(0U) |
||
1290 | |||
1291 | #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \ |
||
1292 | __IO uint32_t tmpreg; \ |
||
1293 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\ |
||
1294 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1295 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\ |
||
1296 | UNUSED(tmpreg); \ |
||
1297 | } while(0U) |
||
1298 | |||
1299 | #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPFEN)) |
||
1300 | #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPGEN)) |
||
1301 | #endif /* STM32F100xE */ |
||
1302 | |||
1303 | #if defined(STM32F101xG) || defined(STM32F103xG) |
||
1304 | #define __HAL_RCC_TIM9_CLK_ENABLE() do { \ |
||
1305 | __IO uint32_t tmpreg; \ |
||
1306 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\ |
||
1307 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1308 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\ |
||
1309 | UNUSED(tmpreg); \ |
||
1310 | } while(0U) |
||
1311 | |||
1312 | #define __HAL_RCC_TIM10_CLK_ENABLE() do { \ |
||
1313 | __IO uint32_t tmpreg; \ |
||
1314 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ |
||
1315 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1316 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\ |
||
1317 | UNUSED(tmpreg); \ |
||
1318 | } while(0U) |
||
1319 | |||
1320 | #define __HAL_RCC_TIM11_CLK_ENABLE() do { \ |
||
1321 | __IO uint32_t tmpreg; \ |
||
1322 | SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\ |
||
1323 | /* Delay after an RCC peripheral clock enabling */ \ |
||
1324 | tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\ |
||
1325 | UNUSED(tmpreg); \ |
||
1326 | } while(0U) |
||
1327 | |||
1328 | #define __HAL_RCC_TIM9_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM9EN)) |
||
1329 | #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN)) |
||
1330 | #define __HAL_RCC_TIM11_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM11EN)) |
||
1331 | #endif /* STM32F101xG || STM32F103xG */ |
||
1332 | |||
1333 | /** |
||
1334 | * @} |
||
1335 | */ |
||
1336 | |||
1337 | /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status |
||
1338 | * @brief Get the enable or disable status of the APB2 peripheral clock. |
||
1339 | * @note After reset, the peripheral clock (used for registers read/write access) |
||
1340 | * is disabled and the application software has to enable this clock before |
||
1341 | * using it. |
||
1342 | * @{ |
||
1343 | */ |
||
1344 | |||
1345 | #if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\ |
||
1346 | || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\ |
||
1347 | || defined(STM32F103xG) |
||
1348 | #define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET) |
||
1349 | #define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET) |
||
1350 | #endif /* STM32F101xG || STM32F103x6 || STM32F103xB || STM32F105xC || STM32F107xC || STM32F103xE || STM32F103xG */ |
||
1351 | #if defined(STM32F100xB) || defined(STM32F100xE) |
||
1352 | #define __HAL_RCC_TIM15_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM15EN)) != RESET) |
||
1353 | #define __HAL_RCC_TIM15_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM15EN)) == RESET) |
||
1354 | #define __HAL_RCC_TIM16_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM16EN)) != RESET) |
||
1355 | #define __HAL_RCC_TIM16_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM16EN)) == RESET) |
||
1356 | #define __HAL_RCC_TIM17_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM17EN)) != RESET) |
||
1357 | #define __HAL_RCC_TIM17_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM17EN)) == RESET) |
||
1358 | #endif /* STM32F100xB || STM32F100xE */ |
||
1359 | #if defined(STM32F100xE) || defined(STM32F101xB) || defined(STM32F101xE)\ |
||
1360 | || defined(STM32F101xG) || defined(STM32F100xB) || defined(STM32F103xB)\ |
||
1361 | || defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ |
||
1362 | || defined(STM32F107xC) |
||
1363 | #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPEEN)) != RESET) |
||
1364 | #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPEEN)) == RESET) |
||
1365 | #endif /* STM32F101x6 || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ |
||
1366 | #if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ |
||
1367 | || defined(STM32F103xG) |
||
1368 | #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) != RESET) |
||
1369 | #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) == RESET) |
||
1370 | #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) != RESET) |
||
1371 | #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) == RESET) |
||
1372 | #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG*/ |
||
1373 | #if defined(STM32F103xE) || defined(STM32F103xG) |
||
1374 | #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET) |
||
1375 | #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET) |
||
1376 | #define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET) |
||
1377 | #define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET) |
||
1378 | #endif /* STM32F103xE || STM32F103xG */ |
||
1379 | #if defined(STM32F100xE) |
||
1380 | #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) != RESET) |
||
1381 | #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) == RESET) |
||
1382 | #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) != RESET) |
||
1383 | #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) == RESET) |
||
1384 | #endif /* STM32F100xE */ |
||
1385 | #if defined(STM32F101xG) || defined(STM32F103xG) |
||
1386 | #define __HAL_RCC_TIM9_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) != RESET) |
||
1387 | #define __HAL_RCC_TIM9_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) == RESET) |
||
1388 | #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET) |
||
1389 | #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET) |
||
1390 | #define __HAL_RCC_TIM11_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) != RESET) |
||
1391 | #define __HAL_RCC_TIM11_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) == RESET) |
||
1392 | #endif /* STM32F101xG || STM32F103xG */ |
||
1393 | |||
1394 | /** |
||
1395 | * @} |
||
1396 | */ |
||
1397 | |||
1398 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
1399 | /** @defgroup RCCEx_Peripheral_Clock_Force_Release Peripheral Clock Force Release |
||
1400 | * @brief Force or release AHB peripheral reset. |
||
1401 | * @{ |
||
1402 | */ |
||
1403 | #define __HAL_RCC_AHB_FORCE_RESET() (RCC->AHBRSTR = 0xFFFFFFFFU) |
||
1404 | #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_OTGFSRST)) |
||
1405 | #if defined(STM32F107xC) |
||
1406 | #define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_ETHMACRST)) |
||
1407 | #endif /* STM32F107xC */ |
||
1408 | |||
1409 | #define __HAL_RCC_AHB_RELEASE_RESET() (RCC->AHBRSTR = 0x00) |
||
1410 | #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_OTGFSRST)) |
||
1411 | #if defined(STM32F107xC) |
||
1412 | #define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_ETHMACRST)) |
||
1413 | #endif /* STM32F107xC */ |
||
1414 | |||
1415 | /** |
||
1416 | * @} |
||
1417 | */ |
||
1418 | #endif /* STM32F105xC || STM32F107xC */ |
||
1419 | |||
1420 | /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset |
||
1421 | * @brief Force or release APB1 peripheral reset. |
||
1422 | * @{ |
||
1423 | */ |
||
1424 | |||
1425 | #if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\ |
||
1426 | || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC) |
||
1427 | #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST)) |
||
1428 | |||
1429 | #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST)) |
||
1430 | #endif /* STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */ |
||
1431 | |||
1432 | #if defined(STM32F100xB) || defined(STM32F100xE) || defined(STM32F101xB)\ |
||
1433 | || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F102xB)\ |
||
1434 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\ |
||
1435 | || defined(STM32F105xC) || defined(STM32F107xC) |
||
1436 | #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST)) |
||
1437 | #define __HAL_RCC_SPI2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI2RST)) |
||
1438 | #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST)) |
||
1439 | #define __HAL_RCC_I2C2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C2RST)) |
||
1440 | |||
1441 | #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST)) |
||
1442 | #define __HAL_RCC_SPI2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI2RST)) |
||
1443 | #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST)) |
||
1444 | #define __HAL_RCC_I2C2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C2RST)) |
||
1445 | #endif /* STM32F100xB || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ |
||
1446 | |||
1447 | #if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ |
||
1448 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) |
||
1449 | #define __HAL_RCC_USB_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USBRST)) |
||
1450 | #define __HAL_RCC_USB_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USBRST)) |
||
1451 | #endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ |
||
1452 | |||
1453 | #if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ |
||
1454 | || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC) |
||
1455 | #define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM5RST)) |
||
1456 | #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST)) |
||
1457 | #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST)) |
||
1458 | #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST)) |
||
1459 | #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST)) |
||
1460 | #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST)) |
||
1461 | #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST)) |
||
1462 | |||
1463 | #define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM5RST)) |
||
1464 | #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST)) |
||
1465 | #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST)) |
||
1466 | #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST)) |
||
1467 | #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST)) |
||
1468 | #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST)) |
||
1469 | #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST)) |
||
1470 | #endif /* STM32F101xE || STM32F103xE || STM32F101xG || (...) || STM32F105xC || STM32F107xC */ |
||
1471 | |||
1472 | #if defined(STM32F100xB) || defined (STM32F100xE) |
||
1473 | #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST)) |
||
1474 | #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST)) |
||
1475 | #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST)) |
||
1476 | #define __HAL_RCC_CEC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CECRST)) |
||
1477 | |||
1478 | #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST)) |
||
1479 | #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST)) |
||
1480 | #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST)) |
||
1481 | #define __HAL_RCC_CEC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CECRST)) |
||
1482 | #endif /* STM32F100xB || STM32F100xE */ |
||
1483 | |||
1484 | #if defined (STM32F100xE) |
||
1485 | #define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM5RST)) |
||
1486 | #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST)) |
||
1487 | #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST)) |
||
1488 | #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST)) |
||
1489 | #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST)) |
||
1490 | #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST)) |
||
1491 | #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST)) |
||
1492 | |||
1493 | #define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM5RST)) |
||
1494 | #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST)) |
||
1495 | #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST)) |
||
1496 | #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST)) |
||
1497 | #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST)) |
||
1498 | #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST)) |
||
1499 | #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST)) |
||
1500 | #endif /* STM32F100xE */ |
||
1501 | |||
1502 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
1503 | #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST)) |
||
1504 | |||
1505 | #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST)) |
||
1506 | #endif /* STM32F105xC || STM32F107xC */ |
||
1507 | |||
1508 | #if defined(STM32F101xG) || defined(STM32F103xG) |
||
1509 | #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST)) |
||
1510 | #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST)) |
||
1511 | #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST)) |
||
1512 | |||
1513 | #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST)) |
||
1514 | #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST)) |
||
1515 | #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST)) |
||
1516 | #endif /* STM32F101xG || STM32F103xG */ |
||
1517 | |||
1518 | /** |
||
1519 | * @} |
||
1520 | */ |
||
1521 | |||
1522 | /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset |
||
1523 | * @brief Force or release APB2 peripheral reset. |
||
1524 | * @{ |
||
1525 | */ |
||
1526 | |||
1527 | #if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\ |
||
1528 | || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\ |
||
1529 | || defined(STM32F103xG) |
||
1530 | #define __HAL_RCC_ADC2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC2RST)) |
||
1531 | |||
1532 | #define __HAL_RCC_ADC2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADC2RST)) |
||
1533 | #endif /* STM32F101xG || STM32F103x6 || STM32F103xB || STM32F105xC || STM32F107xC || STM32F103xE || STM32F103xG */ |
||
1534 | |||
1535 | #if defined(STM32F100xB) || defined(STM32F100xE) |
||
1536 | #define __HAL_RCC_TIM15_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM15RST)) |
||
1537 | #define __HAL_RCC_TIM16_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM16RST)) |
||
1538 | #define __HAL_RCC_TIM17_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM17RST)) |
||
1539 | |||
1540 | #define __HAL_RCC_TIM15_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM15RST)) |
||
1541 | #define __HAL_RCC_TIM16_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM16RST)) |
||
1542 | #define __HAL_RCC_TIM17_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM17RST)) |
||
1543 | #endif /* STM32F100xB || STM32F100xE */ |
||
1544 | |||
1545 | #if defined(STM32F100xE) || defined(STM32F101xB) || defined(STM32F101xE)\ |
||
1546 | || defined(STM32F101xG) || defined(STM32F100xB) || defined(STM32F103xB)\ |
||
1547 | || defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\ |
||
1548 | || defined(STM32F107xC) |
||
1549 | #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPERST)) |
||
1550 | |||
1551 | #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPERST)) |
||
1552 | #endif /* STM32F101x6 || STM32F101xB || STM32F101xE || (...) || STM32F105xC || STM32F107xC */ |
||
1553 | |||
1554 | #if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\ |
||
1555 | || defined(STM32F103xG) |
||
1556 | #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPFRST)) |
||
1557 | #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPGRST)) |
||
1558 | |||
1559 | #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPFRST)) |
||
1560 | #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPGRST)) |
||
1561 | #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG*/ |
||
1562 | |||
1563 | #if defined(STM32F103xE) || defined(STM32F103xG) |
||
1564 | #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST)) |
||
1565 | #define __HAL_RCC_ADC3_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC3RST)) |
||
1566 | |||
1567 | #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST)) |
||
1568 | #define __HAL_RCC_ADC3_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADC3RST)) |
||
1569 | #endif /* STM32F103xE || STM32F103xG */ |
||
1570 | |||
1571 | #if defined(STM32F100xE) |
||
1572 | #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPFRST)) |
||
1573 | #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPGRST)) |
||
1574 | |||
1575 | #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPFRST)) |
||
1576 | #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPGRST)) |
||
1577 | #endif /* STM32F100xE */ |
||
1578 | |||
1579 | #if defined(STM32F101xG) || defined(STM32F103xG) |
||
1580 | #define __HAL_RCC_TIM9_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM9RST)) |
||
1581 | #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST)) |
||
1582 | #define __HAL_RCC_TIM11_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM11RST)) |
||
1583 | |||
1584 | #define __HAL_RCC_TIM9_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM9RST)) |
||
1585 | #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST)) |
||
1586 | #define __HAL_RCC_TIM11_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM11RST)) |
||
1587 | #endif /* STM32F101xG || STM32F103xG*/ |
||
1588 | |||
1589 | /** |
||
1590 | * @} |
||
1591 | */ |
||
1592 | |||
1593 | /** @defgroup RCCEx_HSE_Configuration HSE Configuration |
||
1594 | * @{ |
||
1595 | */ |
||
1596 | |||
1597 | #if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\ |
||
1598 | || defined(STM32F100xE) |
||
1599 | /** |
||
1600 | * @brief Macro to configure the External High Speed oscillator (HSE) Predivision factor for PLL. |
||
1601 | * @note Predivision factor can not be changed if PLL is used as system clock |
||
1602 | * In this case, you have to select another source of the system clock, disable the PLL and |
||
1603 | * then change the HSE predivision factor. |
||
1604 | * @param __HSE_PREDIV_VALUE__ specifies the division value applied to HSE. |
||
1605 | * This parameter must be a number between RCC_HSE_PREDIV_DIV1 and RCC_HSE_PREDIV_DIV16. |
||
1606 | */ |
||
1607 | #define __HAL_RCC_HSE_PREDIV_CONFIG(__HSE_PREDIV_VALUE__) MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV1, (uint32_t)(__HSE_PREDIV_VALUE__)) |
||
1608 | #else |
||
1609 | /** |
||
1610 | * @brief Macro to configure the External High Speed oscillator (HSE) Predivision factor for PLL. |
||
1611 | * @note Predivision factor can not be changed if PLL is used as system clock |
||
1612 | * In this case, you have to select another source of the system clock, disable the PLL and |
||
1613 | * then change the HSE predivision factor. |
||
1614 | * @param __HSE_PREDIV_VALUE__ specifies the division value applied to HSE. |
||
1615 | * This parameter must be a number between RCC_HSE_PREDIV_DIV1 and RCC_HSE_PREDIV_DIV2. |
||
1616 | */ |
||
1617 | #define __HAL_RCC_HSE_PREDIV_CONFIG(__HSE_PREDIV_VALUE__) \ |
||
1618 | MODIFY_REG(RCC->CFGR,RCC_CFGR_PLLXTPRE, (uint32_t)(__HSE_PREDIV_VALUE__)) |
||
1619 | |||
1620 | #endif /* STM32F105xC || STM32F107xC */ |
||
1621 | |||
1622 | #if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\ |
||
1623 | || defined(STM32F100xE) |
||
1624 | /** |
||
1625 | * @brief Macro to get prediv1 factor for PLL. |
||
1626 | */ |
||
1627 | #define __HAL_RCC_HSE_GET_PREDIV() READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1) |
||
1628 | |||
1629 | #else |
||
1630 | /** |
||
1631 | * @brief Macro to get prediv1 factor for PLL. |
||
1632 | */ |
||
1633 | #define __HAL_RCC_HSE_GET_PREDIV() READ_BIT(RCC->CFGR, RCC_CFGR_PLLXTPRE) |
||
1634 | |||
1635 | #endif /* STM32F105xC || STM32F107xC || STM32F100xB || STM32F100xE */ |
||
1636 | |||
1637 | /** |
||
1638 | * @} |
||
1639 | */ |
||
1640 | |||
1641 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
1642 | /** @defgroup RCCEx_PLLI2S_Configuration PLLI2S Configuration |
||
1643 | * @{ |
||
1644 | */ |
||
1645 | |||
1646 | /** @brief Macros to enable the main PLLI2S. |
||
1647 | * @note After enabling the main PLLI2S, the application software should wait on |
||
1648 | * PLLI2SRDY flag to be set indicating that PLLI2S clock is stable and can |
||
1649 | * be used as system clock source. |
||
1650 | * @note The main PLLI2S is disabled by hardware when entering STOP and STANDBY modes. |
||
1651 | */ |
||
1652 | #define __HAL_RCC_PLLI2S_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = ENABLE) |
||
1653 | |||
1654 | /** @brief Macros to disable the main PLLI2S. |
||
1655 | * @note The main PLLI2S is disabled by hardware when entering STOP and STANDBY modes. |
||
1656 | */ |
||
1657 | #define __HAL_RCC_PLLI2S_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = DISABLE) |
||
1658 | |||
1659 | /** @brief macros to configure the main PLLI2S multiplication factor. |
||
1660 | * @note This function must be used only when the main PLLI2S is disabled. |
||
1661 | * |
||
1662 | * @param __PLLI2SMUL__ specifies the multiplication factor for PLLI2S VCO output clock |
||
1663 | * This parameter can be one of the following values: |
||
1664 | * @arg @ref RCC_PLLI2S_MUL8 PLLI2SVCO = PLLI2S clock entry x 8 |
||
1665 | * @arg @ref RCC_PLLI2S_MUL9 PLLI2SVCO = PLLI2S clock entry x 9 |
||
1666 | * @arg @ref RCC_PLLI2S_MUL10 PLLI2SVCO = PLLI2S clock entry x 10 |
||
1667 | * @arg @ref RCC_PLLI2S_MUL11 PLLI2SVCO = PLLI2S clock entry x 11 |
||
1668 | * @arg @ref RCC_PLLI2S_MUL12 PLLI2SVCO = PLLI2S clock entry x 12 |
||
1669 | * @arg @ref RCC_PLLI2S_MUL13 PLLI2SVCO = PLLI2S clock entry x 13 |
||
1670 | * @arg @ref RCC_PLLI2S_MUL14 PLLI2SVCO = PLLI2S clock entry x 14 |
||
1671 | * @arg @ref RCC_PLLI2S_MUL16 PLLI2SVCO = PLLI2S clock entry x 16 |
||
1672 | * @arg @ref RCC_PLLI2S_MUL20 PLLI2SVCO = PLLI2S clock entry x 20 |
||
1673 | * |
||
1674 | */ |
||
1675 | #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SMUL__)\ |
||
1676 | MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PLL3MUL,(__PLLI2SMUL__)) |
||
1677 | |||
1678 | /** |
||
1679 | * @} |
||
1680 | */ |
||
1681 | |||
1682 | #endif /* STM32F105xC || STM32F107xC */ |
||
1683 | |||
1684 | /** @defgroup RCCEx_Peripheral_Configuration Peripheral Configuration |
||
1685 | * @brief Macros to configure clock source of different peripherals. |
||
1686 | * @{ |
||
1687 | */ |
||
1688 | |||
1689 | #if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\ |
||
1690 | || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) |
||
1691 | /** @brief Macro to configure the USB clock. |
||
1692 | * @param __USBCLKSOURCE__ specifies the USB clock source. |
||
1693 | * This parameter can be one of the following values: |
||
1694 | * @arg @ref RCC_USBCLKSOURCE_PLL PLL clock divided by 1 selected as USB clock |
||
1695 | * @arg @ref RCC_USBCLKSOURCE_PLL_DIV1_5 PLL clock divided by 1.5 selected as USB clock |
||
1696 | */ |
||
1697 | #define __HAL_RCC_USB_CONFIG(__USBCLKSOURCE__) \ |
||
1698 | MODIFY_REG(RCC->CFGR, RCC_CFGR_USBPRE, (uint32_t)(__USBCLKSOURCE__)) |
||
1699 | |||
1700 | /** @brief Macro to get the USB clock (USBCLK). |
||
1701 | * @retval The clock source can be one of the following values: |
||
1702 | * @arg @ref RCC_USBCLKSOURCE_PLL PLL clock divided by 1 selected as USB clock |
||
1703 | * @arg @ref RCC_USBCLKSOURCE_PLL_DIV1_5 PLL clock divided by 1.5 selected as USB clock |
||
1704 | */ |
||
1705 | #define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_USBPRE))) |
||
1706 | |||
1707 | #endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG */ |
||
1708 | |||
1709 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
1710 | |||
1711 | /** @brief Macro to configure the USB OTSclock. |
||
1712 | * @param __USBCLKSOURCE__ specifies the USB clock source. |
||
1713 | * This parameter can be one of the following values: |
||
1714 | * @arg @ref RCC_USBCLKSOURCE_PLL_DIV2 PLL clock divided by 2 selected as USB OTG FS clock |
||
1715 | * @arg @ref RCC_USBCLKSOURCE_PLL_DIV3 PLL clock divided by 3 selected as USB OTG FS clock |
||
1716 | */ |
||
1717 | #define __HAL_RCC_USB_CONFIG(__USBCLKSOURCE__) \ |
||
1718 | MODIFY_REG(RCC->CFGR, RCC_CFGR_OTGFSPRE, (uint32_t)(__USBCLKSOURCE__)) |
||
1719 | |||
1720 | /** @brief Macro to get the USB clock (USBCLK). |
||
1721 | * @retval The clock source can be one of the following values: |
||
1722 | * @arg @ref RCC_USBCLKSOURCE_PLL_DIV2 PLL clock divided by 2 selected as USB OTG FS clock |
||
1723 | * @arg @ref RCC_USBCLKSOURCE_PLL_DIV3 PLL clock divided by 3 selected as USB OTG FS clock |
||
1724 | */ |
||
1725 | #define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_OTGFSPRE))) |
||
1726 | |||
1727 | #endif /* STM32F105xC || STM32F107xC */ |
||
1728 | |||
1729 | /** @brief Macro to configure the ADCx clock (x=1 to 3 depending on devices). |
||
1730 | * @param __ADCCLKSOURCE__ specifies the ADC clock source. |
||
1731 | * This parameter can be one of the following values: |
||
1732 | * @arg @ref RCC_ADCPCLK2_DIV2 PCLK2 clock divided by 2 selected as ADC clock |
||
1733 | * @arg @ref RCC_ADCPCLK2_DIV4 PCLK2 clock divided by 4 selected as ADC clock |
||
1734 | * @arg @ref RCC_ADCPCLK2_DIV6 PCLK2 clock divided by 6 selected as ADC clock |
||
1735 | * @arg @ref RCC_ADCPCLK2_DIV8 PCLK2 clock divided by 8 selected as ADC clock |
||
1736 | */ |
||
1737 | #define __HAL_RCC_ADC_CONFIG(__ADCCLKSOURCE__) \ |
||
1738 | MODIFY_REG(RCC->CFGR, RCC_CFGR_ADCPRE, (uint32_t)(__ADCCLKSOURCE__)) |
||
1739 | |||
1740 | /** @brief Macro to get the ADC clock (ADCxCLK, x=1 to 3 depending on devices). |
||
1741 | * @retval The clock source can be one of the following values: |
||
1742 | * @arg @ref RCC_ADCPCLK2_DIV2 PCLK2 clock divided by 2 selected as ADC clock |
||
1743 | * @arg @ref RCC_ADCPCLK2_DIV4 PCLK2 clock divided by 4 selected as ADC clock |
||
1744 | * @arg @ref RCC_ADCPCLK2_DIV6 PCLK2 clock divided by 6 selected as ADC clock |
||
1745 | * @arg @ref RCC_ADCPCLK2_DIV8 PCLK2 clock divided by 8 selected as ADC clock |
||
1746 | */ |
||
1747 | #define __HAL_RCC_GET_ADC_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_ADCPRE))) |
||
1748 | |||
1749 | /** |
||
1750 | * @} |
||
1751 | */ |
||
1752 | |||
1753 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
1754 | |||
1755 | /** @addtogroup RCCEx_HSE_Configuration |
||
1756 | * @{ |
||
1757 | */ |
||
1758 | |||
1759 | /** |
||
1760 | * @brief Macro to configure the PLL2 & PLLI2S Predivision factor. |
||
1761 | * @note Predivision factor can not be changed if PLL2 is used indirectly as system clock |
||
1762 | * In this case, you have to select another source of the system clock, disable the PLL2 and PLLI2S and |
||
1763 | * then change the PREDIV2 factor. |
||
1764 | * @param __HSE_PREDIV2_VALUE__ specifies the PREDIV2 value applied to PLL2 & PLLI2S. |
||
1765 | * This parameter must be a number between RCC_HSE_PREDIV2_DIV1 and RCC_HSE_PREDIV2_DIV16. |
||
1766 | */ |
||
1767 | #define __HAL_RCC_HSE_PREDIV2_CONFIG(__HSE_PREDIV2_VALUE__) \ |
||
1768 | MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV2, (uint32_t)(__HSE_PREDIV2_VALUE__)) |
||
1769 | |||
1770 | /** |
||
1771 | * @brief Macro to get prediv2 factor for PLL2 & PLL3. |
||
1772 | */ |
||
1773 | #define __HAL_RCC_HSE_GET_PREDIV2() READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV2) |
||
1774 | |||
1775 | /** |
||
1776 | * @} |
||
1777 | */ |
||
1778 | |||
1779 | /** @addtogroup RCCEx_PLLI2S_Configuration |
||
1780 | * @{ |
||
1781 | */ |
||
1782 | |||
1783 | /** @brief Macros to enable the main PLL2. |
||
1784 | * @note After enabling the main PLL2, the application software should wait on |
||
1785 | * PLL2RDY flag to be set indicating that PLL2 clock is stable and can |
||
1786 | * be used as system clock source. |
||
1787 | * @note The main PLL2 is disabled by hardware when entering STOP and STANDBY modes. |
||
1788 | */ |
||
1789 | #define __HAL_RCC_PLL2_ENABLE() (*(__IO uint32_t *) RCC_CR_PLL2ON_BB = ENABLE) |
||
1790 | |||
1791 | /** @brief Macros to disable the main PLL2. |
||
1792 | * @note The main PLL2 can not be disabled if it is used indirectly as system clock source |
||
1793 | * @note The main PLL2 is disabled by hardware when entering STOP and STANDBY modes. |
||
1794 | */ |
||
1795 | #define __HAL_RCC_PLL2_DISABLE() (*(__IO uint32_t *) RCC_CR_PLL2ON_BB = DISABLE) |
||
1796 | |||
1797 | /** @brief macros to configure the main PLL2 multiplication factor. |
||
1798 | * @note This function must be used only when the main PLL2 is disabled. |
||
1799 | * |
||
1800 | * @param __PLL2MUL__ specifies the multiplication factor for PLL2 VCO output clock |
||
1801 | * This parameter can be one of the following values: |
||
1802 | * @arg @ref RCC_PLL2_MUL8 PLL2VCO = PLL2 clock entry x 8 |
||
1803 | * @arg @ref RCC_PLL2_MUL9 PLL2VCO = PLL2 clock entry x 9 |
||
1804 | * @arg @ref RCC_PLL2_MUL10 PLL2VCO = PLL2 clock entry x 10 |
||
1805 | * @arg @ref RCC_PLL2_MUL11 PLL2VCO = PLL2 clock entry x 11 |
||
1806 | * @arg @ref RCC_PLL2_MUL12 PLL2VCO = PLL2 clock entry x 12 |
||
1807 | * @arg @ref RCC_PLL2_MUL13 PLL2VCO = PLL2 clock entry x 13 |
||
1808 | * @arg @ref RCC_PLL2_MUL14 PLL2VCO = PLL2 clock entry x 14 |
||
1809 | * @arg @ref RCC_PLL2_MUL16 PLL2VCO = PLL2 clock entry x 16 |
||
1810 | * @arg @ref RCC_PLL2_MUL20 PLL2VCO = PLL2 clock entry x 20 |
||
1811 | * |
||
1812 | */ |
||
1813 | #define __HAL_RCC_PLL2_CONFIG(__PLL2MUL__)\ |
||
1814 | MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PLL2MUL,(__PLL2MUL__)) |
||
1815 | |||
1816 | /** |
||
1817 | * @} |
||
1818 | */ |
||
1819 | |||
1820 | /** @defgroup RCCEx_I2S_Configuration I2S Configuration |
||
1821 | * @brief Macros to configure clock source of I2S peripherals. |
||
1822 | * @{ |
||
1823 | */ |
||
1824 | |||
1825 | /** @brief Macro to configure the I2S2 clock. |
||
1826 | * @param __I2S2CLKSOURCE__ specifies the I2S2 clock source. |
||
1827 | * This parameter can be one of the following values: |
||
1828 | * @arg @ref RCC_I2S2CLKSOURCE_SYSCLK system clock selected as I2S3 clock entry |
||
1829 | * @arg @ref RCC_I2S2CLKSOURCE_PLLI2S_VCO PLLI2S VCO clock selected as I2S3 clock entry |
||
1830 | */ |
||
1831 | #define __HAL_RCC_I2S2_CONFIG(__I2S2CLKSOURCE__) \ |
||
1832 | MODIFY_REG(RCC->CFGR2, RCC_CFGR2_I2S2SRC, (uint32_t)(__I2S2CLKSOURCE__)) |
||
1833 | |||
1834 | /** @brief Macro to get the I2S2 clock (I2S2CLK). |
||
1835 | * @retval The clock source can be one of the following values: |
||
1836 | * @arg @ref RCC_I2S2CLKSOURCE_SYSCLK system clock selected as I2S3 clock entry |
||
1837 | * @arg @ref RCC_I2S2CLKSOURCE_PLLI2S_VCO PLLI2S VCO clock selected as I2S3 clock entry |
||
1838 | */ |
||
1839 | #define __HAL_RCC_GET_I2S2_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_I2S2SRC))) |
||
1840 | |||
1841 | /** @brief Macro to configure the I2S3 clock. |
||
1842 | * @param __I2S2CLKSOURCE__ specifies the I2S3 clock source. |
||
1843 | * This parameter can be one of the following values: |
||
1844 | * @arg @ref RCC_I2S3CLKSOURCE_SYSCLK system clock selected as I2S3 clock entry |
||
1845 | * @arg @ref RCC_I2S3CLKSOURCE_PLLI2S_VCO PLLI2S VCO clock selected as I2S3 clock entry |
||
1846 | */ |
||
1847 | #define __HAL_RCC_I2S3_CONFIG(__I2S2CLKSOURCE__) \ |
||
1848 | MODIFY_REG(RCC->CFGR2, RCC_CFGR2_I2S3SRC, (uint32_t)(__I2S2CLKSOURCE__)) |
||
1849 | |||
1850 | /** @brief Macro to get the I2S3 clock (I2S3CLK). |
||
1851 | * @retval The clock source can be one of the following values: |
||
1852 | * @arg @ref RCC_I2S3CLKSOURCE_SYSCLK system clock selected as I2S3 clock entry |
||
1853 | * @arg @ref RCC_I2S3CLKSOURCE_PLLI2S_VCO PLLI2S VCO clock selected as I2S3 clock entry |
||
1854 | */ |
||
1855 | #define __HAL_RCC_GET_I2S3_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_I2S3SRC))) |
||
1856 | |||
1857 | /** |
||
1858 | * @} |
||
1859 | */ |
||
1860 | |||
1861 | #endif /* STM32F105xC || STM32F107xC */ |
||
1862 | /** |
||
1863 | * @} |
||
1864 | */ |
||
1865 | |||
1866 | /* Exported functions --------------------------------------------------------*/ |
||
1867 | /** @addtogroup RCCEx_Exported_Functions |
||
1868 | * @{ |
||
1869 | */ |
||
1870 | |||
1871 | /** @addtogroup RCCEx_Exported_Functions_Group1 |
||
1872 | * @{ |
||
1873 | */ |
||
1874 | |||
1875 | HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit); |
||
1876 | void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit); |
||
1877 | uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk); |
||
1878 | |||
1879 | /** |
||
1880 | * @} |
||
1881 | */ |
||
1882 | |||
1883 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
1884 | /** @addtogroup RCCEx_Exported_Functions_Group2 |
||
1885 | * @{ |
||
1886 | */ |
||
1887 | HAL_StatusTypeDef HAL_RCCEx_EnablePLLI2S(RCC_PLLI2SInitTypeDef *PLLI2SInit); |
||
1888 | HAL_StatusTypeDef HAL_RCCEx_DisablePLLI2S(void); |
||
1889 | |||
1890 | /** |
||
1891 | * @} |
||
1892 | */ |
||
1893 | |||
1894 | /** @addtogroup RCCEx_Exported_Functions_Group3 |
||
1895 | * @{ |
||
1896 | */ |
||
1897 | HAL_StatusTypeDef HAL_RCCEx_EnablePLL2(RCC_PLL2InitTypeDef *PLL2Init); |
||
1898 | HAL_StatusTypeDef HAL_RCCEx_DisablePLL2(void); |
||
1899 | |||
1900 | /** |
||
1901 | * @} |
||
1902 | */ |
||
1903 | #endif /* STM32F105xC || STM32F107xC */ |
||
1904 | |||
1905 | /** |
||
1906 | * @} |
||
1907 | */ |
||
1908 | |||
1909 | /** |
||
1910 | * @} |
||
1911 | */ |
||
1912 | |||
1913 | /** |
||
1914 | * @} |
||
1915 | */ |
||
1916 | |||
1917 | #ifdef __cplusplus |
||
1918 | } |
||
1919 | #endif |
||
1920 | |||
1921 | #endif /* __STM32F1xx_HAL_RCC_EX_H */ |
||
1922 | |||
1923 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
||
1924 |