21#ifndef __STM32F1xx_HAL_RCC_EX_H
22#define __STM32F1xx_HAL_RCC_EX_H
43#if defined(STM32F105xC) || defined(STM32F107xC)
46#define PLLI2SON_BITNUMBER RCC_CR_PLL3ON_Pos
47#define RCC_CR_PLLI2SON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (PLLI2SON_BITNUMBER * 4U)))
49#define PLL2ON_BITNUMBER RCC_CR_PLL2ON_Pos
50#define RCC_CR_PLL2ON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (PLL2ON_BITNUMBER * 4U)))
52#define PLLI2S_TIMEOUT_VALUE 100U
53#define PLL2_TIMEOUT_VALUE 100U
58#define CR_REG_INDEX ((uint8_t)1)
68#if defined(STM32F105xC) || defined(STM32F107xC)
69#define IS_RCC_PREDIV1_SOURCE(__SOURCE__) (((__SOURCE__) == RCC_PREDIV1_SOURCE_HSE) || \
70 ((__SOURCE__) == RCC_PREDIV1_SOURCE_PLL2))
73#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\
74 || defined(STM32F100xE)
75#define IS_RCC_HSE_PREDIV(__DIV__) (((__DIV__) == RCC_HSE_PREDIV_DIV1) || ((__DIV__) == RCC_HSE_PREDIV_DIV2) || \
76 ((__DIV__) == RCC_HSE_PREDIV_DIV3) || ((__DIV__) == RCC_HSE_PREDIV_DIV4) || \
77 ((__DIV__) == RCC_HSE_PREDIV_DIV5) || ((__DIV__) == RCC_HSE_PREDIV_DIV6) || \
78 ((__DIV__) == RCC_HSE_PREDIV_DIV7) || ((__DIV__) == RCC_HSE_PREDIV_DIV8) || \
79 ((__DIV__) == RCC_HSE_PREDIV_DIV9) || ((__DIV__) == RCC_HSE_PREDIV_DIV10) || \
80 ((__DIV__) == RCC_HSE_PREDIV_DIV11) || ((__DIV__) == RCC_HSE_PREDIV_DIV12) || \
81 ((__DIV__) == RCC_HSE_PREDIV_DIV13) || ((__DIV__) == RCC_HSE_PREDIV_DIV14) || \
82 ((__DIV__) == RCC_HSE_PREDIV_DIV15) || ((__DIV__) == RCC_HSE_PREDIV_DIV16))
85#define IS_RCC_HSE_PREDIV(__DIV__) (((__DIV__) == RCC_HSE_PREDIV_DIV1) || ((__DIV__) == RCC_HSE_PREDIV_DIV2))
88#if defined(STM32F105xC) || defined(STM32F107xC)
89#define IS_RCC_PLL_MUL(__MUL__) (((__MUL__) == RCC_PLL_MUL4) || ((__MUL__) == RCC_PLL_MUL5) || \
90 ((__MUL__) == RCC_PLL_MUL6) || ((__MUL__) == RCC_PLL_MUL7) || \
91 ((__MUL__) == RCC_PLL_MUL8) || ((__MUL__) == RCC_PLL_MUL9) || \
92 ((__MUL__) == RCC_PLL_MUL6_5))
94#define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || ((__SOURCE__) == RCC_MCO1SOURCE_HSI) \
95 || ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) \
96 || ((__SOURCE__) == RCC_MCO1SOURCE_PLL2CLK) || ((__SOURCE__) == RCC_MCO1SOURCE_PLL3CLK) \
97 || ((__SOURCE__) == RCC_MCO1SOURCE_PLL3CLK_DIV2) || ((__SOURCE__) == RCC_MCO1SOURCE_EXT_HSE) \
98 || ((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK))
101#define IS_RCC_PLL_MUL(__MUL__) (((__MUL__) == RCC_PLL_MUL2) || ((__MUL__) == RCC_PLL_MUL3) || \
102 ((__MUL__) == RCC_PLL_MUL4) || ((__MUL__) == RCC_PLL_MUL5) || \
103 ((__MUL__) == RCC_PLL_MUL6) || ((__MUL__) == RCC_PLL_MUL7) || \
104 ((__MUL__) == RCC_PLL_MUL8) || ((__MUL__) == RCC_PLL_MUL9) || \
105 ((__MUL__) == RCC_PLL_MUL10) || ((__MUL__) == RCC_PLL_MUL11) || \
106 ((__MUL__) == RCC_PLL_MUL12) || ((__MUL__) == RCC_PLL_MUL13) || \
107 ((__MUL__) == RCC_PLL_MUL14) || ((__MUL__) == RCC_PLL_MUL15) || \
108 ((__MUL__) == RCC_PLL_MUL16))
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_NOCLOCK))
116#define IS_RCC_ADCPLLCLK_DIV(__ADCCLK__) (((__ADCCLK__) == RCC_ADCPCLK2_DIV2) || ((__ADCCLK__) == RCC_ADCPCLK2_DIV4) || \
117 ((__ADCCLK__) == RCC_ADCPCLK2_DIV6) || ((__ADCCLK__) == RCC_ADCPCLK2_DIV8))
119#if defined(STM32F105xC) || defined(STM32F107xC)
120#define IS_RCC_I2S2CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_I2S2CLKSOURCE_SYSCLK) || ((__SOURCE__) == RCC_I2S2CLKSOURCE_PLLI2S_VCO))
122#define IS_RCC_I2S3CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_I2S3CLKSOURCE_SYSCLK) || ((__SOURCE__) == RCC_I2S3CLKSOURCE_PLLI2S_VCO))
124#define IS_RCC_USBPLLCLK_DIV(__USBCLK__) (((__USBCLK__) == RCC_USBCLKSOURCE_PLL_DIV2) || ((__USBCLK__) == RCC_USBCLKSOURCE_PLL_DIV3))
126#define IS_RCC_PLLI2S_MUL(__MUL__) (((__MUL__) == RCC_PLLI2S_MUL8) || ((__MUL__) == RCC_PLLI2S_MUL9) || \
127 ((__MUL__) == RCC_PLLI2S_MUL10) || ((__MUL__) == RCC_PLLI2S_MUL11) || \
128 ((__MUL__) == RCC_PLLI2S_MUL12) || ((__MUL__) == RCC_PLLI2S_MUL13) || \
129 ((__MUL__) == RCC_PLLI2S_MUL14) || ((__MUL__) == RCC_PLLI2S_MUL16) || \
130 ((__MUL__) == RCC_PLLI2S_MUL20))
132#define IS_RCC_HSE_PREDIV2(__DIV__) (((__DIV__) == RCC_HSE_PREDIV2_DIV1) || ((__DIV__) == RCC_HSE_PREDIV2_DIV2) || \
133 ((__DIV__) == RCC_HSE_PREDIV2_DIV3) || ((__DIV__) == RCC_HSE_PREDIV2_DIV4) || \
134 ((__DIV__) == RCC_HSE_PREDIV2_DIV5) || ((__DIV__) == RCC_HSE_PREDIV2_DIV6) || \
135 ((__DIV__) == RCC_HSE_PREDIV2_DIV7) || ((__DIV__) == RCC_HSE_PREDIV2_DIV8) || \
136 ((__DIV__) == RCC_HSE_PREDIV2_DIV9) || ((__DIV__) == RCC_HSE_PREDIV2_DIV10) || \
137 ((__DIV__) == RCC_HSE_PREDIV2_DIV11) || ((__DIV__) == RCC_HSE_PREDIV2_DIV12) || \
138 ((__DIV__) == RCC_HSE_PREDIV2_DIV13) || ((__DIV__) == RCC_HSE_PREDIV2_DIV14) || \
139 ((__DIV__) == RCC_HSE_PREDIV2_DIV15) || ((__DIV__) == RCC_HSE_PREDIV2_DIV16))
141#define IS_RCC_PLL2(__PLL__) (((__PLL__) == RCC_PLL2_NONE) || ((__PLL__) == RCC_PLL2_OFF) || \
142 ((__PLL__) == RCC_PLL2_ON))
144#define IS_RCC_PLL2_MUL(__MUL__) (((__MUL__) == RCC_PLL2_MUL8) || ((__MUL__) == RCC_PLL2_MUL9) || \
145 ((__MUL__) == RCC_PLL2_MUL10) || ((__MUL__) == RCC_PLL2_MUL11) || \
146 ((__MUL__) == RCC_PLL2_MUL12) || ((__MUL__) == RCC_PLL2_MUL13) || \
147 ((__MUL__) == RCC_PLL2_MUL14) || ((__MUL__) == RCC_PLL2_MUL16) || \
148 ((__MUL__) == RCC_PLL2_MUL20))
150#define IS_RCC_PERIPHCLOCK(__SELECTION__) \
151 ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \
152 (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \
153 (((__SELECTION__) & RCC_PERIPHCLK_I2S2) == RCC_PERIPHCLK_I2S2) || \
154 (((__SELECTION__) & RCC_PERIPHCLK_I2S3) == RCC_PERIPHCLK_I2S3) || \
155 (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB))
157#elif defined(STM32F103xE) || defined(STM32F103xG)
159#define IS_RCC_I2S2CLKSOURCE(__SOURCE__) ((__SOURCE__) == RCC_I2S2CLKSOURCE_SYSCLK)
161#define IS_RCC_I2S3CLKSOURCE(__SOURCE__) ((__SOURCE__) == RCC_I2S3CLKSOURCE_SYSCLK)
163#define IS_RCC_PERIPHCLOCK(__SELECTION__) \
164 ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \
165 (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \
166 (((__SELECTION__) & RCC_PERIPHCLK_I2S2) == RCC_PERIPHCLK_I2S2) || \
167 (((__SELECTION__) & RCC_PERIPHCLK_I2S3) == RCC_PERIPHCLK_I2S3) || \
168 (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB))
171#elif defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
172 || defined(STM32F103xB)
174#define IS_RCC_PERIPHCLOCK(__SELECTION__) \
175 ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \
176 (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \
177 (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB))
181#define IS_RCC_PERIPHCLOCK(__SELECTION__) \
182 ((((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \
183 (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC))
187#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
188 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)
190#define IS_RCC_USBPLLCLK_DIV(__USBCLK__) (((__USBCLK__) == RCC_USBCLKSOURCE_PLL) || ((__USBCLK__) == RCC_USBCLKSOURCE_PLL_DIV1_5))
204#if defined(STM32F105xC) || defined(STM32F107xC)
216#if defined(STM32F105xC) || defined(STM32F107xC)
217 uint32_t HSEPrediv2Value;
233#if defined(STM32F105xC) || defined(STM32F107xC)
234 uint32_t Prediv1Source;
258#if defined(STM32F105xC) || defined(STM32F107xC)
263#if defined(STM32F105xC) || defined(STM32F107xC)
272#if defined(STM32F105xC) || defined(STM32F107xC)
273 uint32_t HSEPrediv2Value;
294#if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\
295 || defined(STM32F107xC)
296 uint32_t I2s2ClockSelection;
299 uint32_t I2s3ClockSelection;
302#if defined(STM32F105xC) || defined(STM32F107xC)
309#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
310 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\
311 || defined(STM32F105xC) || defined(STM32F107xC)
312 uint32_t UsbClockSelection;
331#define RCC_PERIPHCLK_RTC 0x00000001U
332#define RCC_PERIPHCLK_ADC 0x00000002U
333#if defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE)\
334 || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC)
335#define RCC_PERIPHCLK_I2S2 0x00000004U
336#define RCC_PERIPHCLK_I2S3 0x00000008U
338#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
339 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\
340 || defined(STM32F105xC) || defined(STM32F107xC)
341#define RCC_PERIPHCLK_USB 0x00000010U
351#define RCC_ADCPCLK2_DIV2 RCC_CFGR_ADCPRE_DIV2
352#define RCC_ADCPCLK2_DIV4 RCC_CFGR_ADCPRE_DIV4
353#define RCC_ADCPCLK2_DIV6 RCC_CFGR_ADCPRE_DIV6
354#define RCC_ADCPCLK2_DIV8 RCC_CFGR_ADCPRE_DIV8
360#if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\
361 || defined(STM32F107xC)
365#define RCC_I2S2CLKSOURCE_SYSCLK 0x00000000U
366#if defined(STM32F105xC) || defined(STM32F107xC)
367#define RCC_I2S2CLKSOURCE_PLLI2S_VCO RCC_CFGR2_I2S2SRC
377#define RCC_I2S3CLKSOURCE_SYSCLK 0x00000000U
378#if defined(STM32F105xC) || defined(STM32F107xC)
379#define RCC_I2S3CLKSOURCE_PLLI2S_VCO RCC_CFGR2_I2S3SRC
388#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
389 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)
394#define RCC_USBCLKSOURCE_PLL RCC_CFGR_USBPRE
395#define RCC_USBCLKSOURCE_PLL_DIV1_5 0x00000000U
404#if defined(STM32F105xC) || defined(STM32F107xC)
408#define RCC_USBCLKSOURCE_PLL_DIV2 RCC_CFGR_OTGFSPRE
409#define RCC_USBCLKSOURCE_PLL_DIV3 0x00000000U
419#define RCC_PLLI2S_MUL8 RCC_CFGR2_PLL3MUL8
420#define RCC_PLLI2S_MUL9 RCC_CFGR2_PLL3MUL9
421#define RCC_PLLI2S_MUL10 RCC_CFGR2_PLL3MUL10
422#define RCC_PLLI2S_MUL11 RCC_CFGR2_PLL3MUL11
423#define RCC_PLLI2S_MUL12 RCC_CFGR2_PLL3MUL12
424#define RCC_PLLI2S_MUL13 RCC_CFGR2_PLL3MUL13
425#define RCC_PLLI2S_MUL14 RCC_CFGR2_PLL3MUL14
426#define RCC_PLLI2S_MUL16 RCC_CFGR2_PLL3MUL16
427#define RCC_PLLI2S_MUL20 RCC_CFGR2_PLL3MUL20
434#if defined(STM32F105xC) || defined(STM32F107xC)
439#define RCC_PREDIV1_SOURCE_HSE RCC_CFGR2_PREDIV1SRC_HSE
440#define RCC_PREDIV1_SOURCE_PLL2 RCC_CFGR2_PREDIV1SRC_PLL2
451#define RCC_HSE_PREDIV_DIV1 0x00000000U
453#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\
454 || defined(STM32F100xE)
455#define RCC_HSE_PREDIV_DIV2 RCC_CFGR2_PREDIV1_DIV2
456#define RCC_HSE_PREDIV_DIV3 RCC_CFGR2_PREDIV1_DIV3
457#define RCC_HSE_PREDIV_DIV4 RCC_CFGR2_PREDIV1_DIV4
458#define RCC_HSE_PREDIV_DIV5 RCC_CFGR2_PREDIV1_DIV5
459#define RCC_HSE_PREDIV_DIV6 RCC_CFGR2_PREDIV1_DIV6
460#define RCC_HSE_PREDIV_DIV7 RCC_CFGR2_PREDIV1_DIV7
461#define RCC_HSE_PREDIV_DIV8 RCC_CFGR2_PREDIV1_DIV8
462#define RCC_HSE_PREDIV_DIV9 RCC_CFGR2_PREDIV1_DIV9
463#define RCC_HSE_PREDIV_DIV10 RCC_CFGR2_PREDIV1_DIV10
464#define RCC_HSE_PREDIV_DIV11 RCC_CFGR2_PREDIV1_DIV11
465#define RCC_HSE_PREDIV_DIV12 RCC_CFGR2_PREDIV1_DIV12
466#define RCC_HSE_PREDIV_DIV13 RCC_CFGR2_PREDIV1_DIV13
467#define RCC_HSE_PREDIV_DIV14 RCC_CFGR2_PREDIV1_DIV14
468#define RCC_HSE_PREDIV_DIV15 RCC_CFGR2_PREDIV1_DIV15
469#define RCC_HSE_PREDIV_DIV16 RCC_CFGR2_PREDIV1_DIV16
471#define RCC_HSE_PREDIV_DIV2 RCC_CFGR_PLLXTPRE
478#if defined(STM32F105xC) || defined(STM32F107xC)
483#define RCC_HSE_PREDIV2_DIV1 RCC_CFGR2_PREDIV2_DIV1
484#define RCC_HSE_PREDIV2_DIV2 RCC_CFGR2_PREDIV2_DIV2
485#define RCC_HSE_PREDIV2_DIV3 RCC_CFGR2_PREDIV2_DIV3
486#define RCC_HSE_PREDIV2_DIV4 RCC_CFGR2_PREDIV2_DIV4
487#define RCC_HSE_PREDIV2_DIV5 RCC_CFGR2_PREDIV2_DIV5
488#define RCC_HSE_PREDIV2_DIV6 RCC_CFGR2_PREDIV2_DIV6
489#define RCC_HSE_PREDIV2_DIV7 RCC_CFGR2_PREDIV2_DIV7
490#define RCC_HSE_PREDIV2_DIV8 RCC_CFGR2_PREDIV2_DIV8
491#define RCC_HSE_PREDIV2_DIV9 RCC_CFGR2_PREDIV2_DIV9
492#define RCC_HSE_PREDIV2_DIV10 RCC_CFGR2_PREDIV2_DIV10
493#define RCC_HSE_PREDIV2_DIV11 RCC_CFGR2_PREDIV2_DIV11
494#define RCC_HSE_PREDIV2_DIV12 RCC_CFGR2_PREDIV2_DIV12
495#define RCC_HSE_PREDIV2_DIV13 RCC_CFGR2_PREDIV2_DIV13
496#define RCC_HSE_PREDIV2_DIV14 RCC_CFGR2_PREDIV2_DIV14
497#define RCC_HSE_PREDIV2_DIV15 RCC_CFGR2_PREDIV2_DIV15
498#define RCC_HSE_PREDIV2_DIV16 RCC_CFGR2_PREDIV2_DIV16
507#define RCC_PLL2_NONE 0x00000000U
508#define RCC_PLL2_OFF 0x00000001U
509#define RCC_PLL2_ON 0x00000002U
519#define RCC_PLL2_MUL8 RCC_CFGR2_PLL2MUL8
520#define RCC_PLL2_MUL9 RCC_CFGR2_PLL2MUL9
521#define RCC_PLL2_MUL10 RCC_CFGR2_PLL2MUL10
522#define RCC_PLL2_MUL11 RCC_CFGR2_PLL2MUL11
523#define RCC_PLL2_MUL12 RCC_CFGR2_PLL2MUL12
524#define RCC_PLL2_MUL13 RCC_CFGR2_PLL2MUL13
525#define RCC_PLL2_MUL14 RCC_CFGR2_PLL2MUL14
526#define RCC_PLL2_MUL16 RCC_CFGR2_PLL2MUL16
527#define RCC_PLL2_MUL20 RCC_CFGR2_PLL2MUL20
539#if defined(STM32F105xC) || defined(STM32F107xC)
541#define RCC_PLL_MUL2 RCC_CFGR_PLLMULL2
542#define RCC_PLL_MUL3 RCC_CFGR_PLLMULL3
544#define RCC_PLL_MUL4 RCC_CFGR_PLLMULL4
545#define RCC_PLL_MUL5 RCC_CFGR_PLLMULL5
546#define RCC_PLL_MUL6 RCC_CFGR_PLLMULL6
547#define RCC_PLL_MUL7 RCC_CFGR_PLLMULL7
548#define RCC_PLL_MUL8 RCC_CFGR_PLLMULL8
549#define RCC_PLL_MUL9 RCC_CFGR_PLLMULL9
550#if defined(STM32F105xC) || defined(STM32F107xC)
551#define RCC_PLL_MUL6_5 RCC_CFGR_PLLMULL6_5
553#define RCC_PLL_MUL10 RCC_CFGR_PLLMULL10
554#define RCC_PLL_MUL11 RCC_CFGR_PLLMULL11
555#define RCC_PLL_MUL12 RCC_CFGR_PLLMULL12
556#define RCC_PLL_MUL13 RCC_CFGR_PLLMULL13
557#define RCC_PLL_MUL14 RCC_CFGR_PLLMULL14
558#define RCC_PLL_MUL15 RCC_CFGR_PLLMULL15
559#define RCC_PLL_MUL16 RCC_CFGR_PLLMULL16
569#define RCC_MCO1SOURCE_NOCLOCK ((uint32_t)RCC_CFGR_MCO_NOCLOCK)
570#define RCC_MCO1SOURCE_SYSCLK ((uint32_t)RCC_CFGR_MCO_SYSCLK)
571#define RCC_MCO1SOURCE_HSI ((uint32_t)RCC_CFGR_MCO_HSI)
572#define RCC_MCO1SOURCE_HSE ((uint32_t)RCC_CFGR_MCO_HSE)
573#define RCC_MCO1SOURCE_PLLCLK ((uint32_t)RCC_CFGR_MCO_PLLCLK_DIV2)
574#if defined(STM32F105xC) || defined(STM32F107xC)
575#define RCC_MCO1SOURCE_PLL2CLK ((uint32_t)RCC_CFGR_MCO_PLL2CLK)
576#define RCC_MCO1SOURCE_PLL3CLK_DIV2 ((uint32_t)RCC_CFGR_MCO_PLL3CLK_DIV2)
577#define RCC_MCO1SOURCE_EXT_HSE ((uint32_t)RCC_CFGR_MCO_EXT_HSE)
578#define RCC_MCO1SOURCE_PLL3CLK ((uint32_t)RCC_CFGR_MCO_PLL3CLK)
584#if defined(STM32F105xC) || defined(STM32F107xC)
588#define RCC_IT_PLL2RDY ((uint8_t)RCC_CIR_PLL2RDYF)
589#define RCC_IT_PLLI2SRDY ((uint8_t)RCC_CIR_PLL3RDYF)
602#define RCC_FLAG_PLL2RDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLL2RDY_Pos))
603#define RCC_FLAG_PLLI2SRDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLL3RDY_Pos))
626#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
627 || defined(STM32F103xG) || defined(STM32F105xC) || defined (STM32F107xC)\
628 || defined (STM32F100xE)
629#define __HAL_RCC_DMA2_CLK_ENABLE() do { \
630 __IO uint32_t tmpreg; \
631 SET_BIT(RCC->AHBENR, RCC_AHBENR_DMA2EN);\
633 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_DMA2EN);\
637#define __HAL_RCC_DMA2_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_DMA2EN))
640#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
641 || defined(STM32F103xG) || defined (STM32F100xE)
642#define __HAL_RCC_FSMC_CLK_ENABLE() do { \
643 __IO uint32_t tmpreg; \
644 SET_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN);\
646 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN);\
650#define __HAL_RCC_FSMC_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_FSMCEN))
653#if defined(STM32F103xE) || defined(STM32F103xG)
654#define __HAL_RCC_SDIO_CLK_ENABLE() do { \
655 __IO uint32_t tmpreg; \
656 SET_BIT(RCC->AHBENR, RCC_AHBENR_SDIOEN);\
658 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_SDIOEN);\
663#define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_SDIOEN))
666#if defined(STM32F105xC) || defined(STM32F107xC)
667#define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do { \
668 __IO uint32_t tmpreg; \
669 SET_BIT(RCC->AHBENR, RCC_AHBENR_OTGFSEN);\
671 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_OTGFSEN);\
676#define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_OTGFSEN))
679#if defined(STM32F107xC)
680#define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \
681 __IO uint32_t tmpreg; \
682 SET_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACEN);\
684 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACEN);\
688#define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \
689 __IO uint32_t tmpreg; \
690 SET_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACTXEN);\
692 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACTXEN);\
696#define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \
697 __IO uint32_t tmpreg; \
698 SET_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACRXEN);\
700 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_ETHMACRXEN);\
704#define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_ETHMACEN))
705#define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_ETHMACTXEN))
706#define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_ETHMACRXEN))
711#define __HAL_RCC_ETH_CLK_ENABLE() do { \
712 __HAL_RCC_ETHMAC_CLK_ENABLE(); \
713 __HAL_RCC_ETHMACTX_CLK_ENABLE(); \
714 __HAL_RCC_ETHMACRX_CLK_ENABLE(); \
719#define __HAL_RCC_ETH_CLK_DISABLE() do { \
720 __HAL_RCC_ETHMACTX_CLK_DISABLE(); \
721 __HAL_RCC_ETHMACRX_CLK_DISABLE(); \
722 __HAL_RCC_ETHMAC_CLK_DISABLE(); \
739#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
740 || defined(STM32F103xG) || defined(STM32F105xC) || defined (STM32F107xC)\
741 || defined (STM32F100xE)
742#define __HAL_RCC_DMA2_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA2EN)) != RESET)
743#define __HAL_RCC_DMA2_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA2EN)) == RESET)
745#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
746 || defined(STM32F103xG) || defined (STM32F100xE)
747#define __HAL_RCC_FSMC_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_FSMCEN)) != RESET)
748#define __HAL_RCC_FSMC_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_FSMCEN)) == RESET)
750#if defined(STM32F103xE) || defined(STM32F103xG)
751#define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_SDIOEN)) != RESET)
752#define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_SDIOEN)) == RESET)
754#if defined(STM32F105xC) || defined(STM32F107xC)
755#define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_OTGFSEN)) != RESET)
756#define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_OTGFSEN)) == RESET)
758#if defined(STM32F107xC)
759#define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACEN)) != RESET)
760#define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACEN)) == RESET)
761#define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACTXEN)) != RESET)
762#define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACTXEN)) == RESET)
763#define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACRXEN)) != RESET)
764#define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_ETHMACRXEN)) == RESET)
779#if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\
780 || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC)
781#define __HAL_RCC_CAN1_CLK_ENABLE() do { \
782 __IO uint32_t tmpreg; \
783 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
785 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
789#define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
792#if defined(STM32F100xB) || defined(STM32F100xE) || defined(STM32F101xB)\
793 || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F102xB)\
794 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\
795 || defined(STM32F105xC) || defined(STM32F107xC)
796#define __HAL_RCC_TIM4_CLK_ENABLE() do { \
797 __IO uint32_t tmpreg; \
798 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
800 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
804#define __HAL_RCC_SPI2_CLK_ENABLE() do { \
805 __IO uint32_t tmpreg; \
806 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
808 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
812#define __HAL_RCC_USART3_CLK_ENABLE() do { \
813 __IO uint32_t tmpreg; \
814 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
816 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
820#define __HAL_RCC_I2C2_CLK_ENABLE() do { \
821 __IO uint32_t tmpreg; \
822 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
824 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
828#define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
829#define __HAL_RCC_SPI2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI2EN))
830#define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
831#define __HAL_RCC_I2C2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C2EN))
834#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
835 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)
836#define __HAL_RCC_USB_CLK_ENABLE() do { \
837 __IO uint32_t tmpreg; \
838 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USBEN);\
840 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USBEN);\
844#define __HAL_RCC_USB_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USBEN))
847#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
848 || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC)
849#define __HAL_RCC_TIM5_CLK_ENABLE() do { \
850 __IO uint32_t tmpreg; \
851 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\
853 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\
857#define __HAL_RCC_TIM6_CLK_ENABLE() do { \
858 __IO uint32_t tmpreg; \
859 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
861 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
865#define __HAL_RCC_TIM7_CLK_ENABLE() do { \
866 __IO uint32_t tmpreg; \
867 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
869 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
873#define __HAL_RCC_SPI3_CLK_ENABLE() do { \
874 __IO uint32_t tmpreg; \
875 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
877 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
881#define __HAL_RCC_UART4_CLK_ENABLE() do { \
882 __IO uint32_t tmpreg; \
883 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
885 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
889#define __HAL_RCC_UART5_CLK_ENABLE() do { \
890 __IO uint32_t tmpreg; \
891 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
893 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
897#define __HAL_RCC_DAC_CLK_ENABLE() do { \
898 __IO uint32_t tmpreg; \
899 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
901 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
905#define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM5EN))
906#define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
907#define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
908#define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
909#define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
910#define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
911#define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
914#if defined(STM32F100xB) || defined (STM32F100xE)
915#define __HAL_RCC_TIM6_CLK_ENABLE() do { \
916 __IO uint32_t tmpreg; \
917 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
919 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
923#define __HAL_RCC_TIM7_CLK_ENABLE() do { \
924 __IO uint32_t tmpreg; \
925 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
927 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
931#define __HAL_RCC_DAC_CLK_ENABLE() do { \
932 __IO uint32_t tmpreg; \
933 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
935 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
939#define __HAL_RCC_CEC_CLK_ENABLE() do { \
940 __IO uint32_t tmpreg; \
941 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
943 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
947#define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
948#define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
949#define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
950#define __HAL_RCC_CEC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CECEN))
954#define __HAL_RCC_TIM5_CLK_ENABLE() do { \
955 __IO uint32_t tmpreg; \
956 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\
958 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\
962#define __HAL_RCC_TIM12_CLK_ENABLE() do { \
963 __IO uint32_t tmpreg; \
964 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
966 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
970#define __HAL_RCC_TIM13_CLK_ENABLE() do { \
971 __IO uint32_t tmpreg; \
972 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
974 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
978#define __HAL_RCC_TIM14_CLK_ENABLE() do { \
979 __IO uint32_t tmpreg; \
980 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
982 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
986#define __HAL_RCC_SPI3_CLK_ENABLE() do { \
987 __IO uint32_t tmpreg; \
988 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
990 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
994#define __HAL_RCC_UART4_CLK_ENABLE() do { \
995 __IO uint32_t tmpreg; \
996 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
998 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
1002#define __HAL_RCC_UART5_CLK_ENABLE() do { \
1003 __IO uint32_t tmpreg; \
1004 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
1006 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
1010#define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM5EN))
1011#define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
1012#define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
1013#define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
1014#define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
1015#define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
1016#define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
1019#if defined(STM32F105xC) || defined(STM32F107xC)
1020#define __HAL_RCC_CAN2_CLK_ENABLE() do { \
1021 __IO uint32_t tmpreg; \
1022 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
1024 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
1028#define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
1031#if defined(STM32F101xG) || defined(STM32F103xG)
1032#define __HAL_RCC_TIM12_CLK_ENABLE() do { \
1033 __IO uint32_t tmpreg; \
1034 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
1036 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
1040#define __HAL_RCC_TIM13_CLK_ENABLE() do { \
1041 __IO uint32_t tmpreg; \
1042 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
1044 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
1048#define __HAL_RCC_TIM14_CLK_ENABLE() do { \
1049 __IO uint32_t tmpreg; \
1050 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
1052 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
1056#define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
1057#define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
1058#define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
1073#if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\
1074 || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC)
1075#define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET)
1076#define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
1078#if defined(STM32F100xB) || defined(STM32F100xE) || defined(STM32F101xB)\
1079 || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F102xB)\
1080 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\
1081 || defined(STM32F105xC) || defined(STM32F107xC)
1082#define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
1083#define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
1084#define __HAL_RCC_SPI2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) != RESET)
1085#define __HAL_RCC_SPI2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) == RESET)
1086#define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
1087#define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
1088#define __HAL_RCC_I2C2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) != RESET)
1089#define __HAL_RCC_I2C2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) == RESET)
1091#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
1092 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)
1093#define __HAL_RCC_USB_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USBEN)) != RESET)
1094#define __HAL_RCC_USB_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USBEN)) == RESET)
1096#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
1097 || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC)
1098#define __HAL_RCC_TIM5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) != RESET)
1099#define __HAL_RCC_TIM5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) == RESET)
1100#define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
1101#define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
1102#define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
1103#define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
1104#define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
1105#define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
1106#define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
1107#define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
1108#define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
1109#define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
1110#define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
1111#define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
1113#if defined(STM32F100xB) || defined (STM32F100xE)
1114#define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
1115#define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
1116#define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
1117#define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
1118#define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
1119#define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
1120#define __HAL_RCC_CEC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) != RESET)
1121#define __HAL_RCC_CEC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) == RESET)
1124#define __HAL_RCC_TIM5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) != RESET)
1125#define __HAL_RCC_TIM5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) == RESET)
1126#define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
1127#define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
1128#define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
1129#define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
1130#define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
1131#define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
1132#define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
1133#define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
1134#define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
1135#define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
1136#define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
1137#define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
1138#define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
1139#define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
1141#if defined(STM32F105xC) || defined(STM32F107xC)
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)
1145#if defined(STM32F101xG) || defined(STM32F103xG)
1146#define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
1147#define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
1148#define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
1149#define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
1164#if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\
1165 || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\
1166 || defined(STM32F103xG)
1167#define __HAL_RCC_ADC2_CLK_ENABLE() do { \
1168 __IO uint32_t tmpreg; \
1169 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
1171 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
1175#define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN))
1178#if defined(STM32F100xB) || defined(STM32F100xE)
1179#define __HAL_RCC_TIM15_CLK_ENABLE() do { \
1180 __IO uint32_t tmpreg; \
1181 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN);\
1183 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN);\
1187#define __HAL_RCC_TIM16_CLK_ENABLE() do { \
1188 __IO uint32_t tmpreg; \
1189 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN);\
1191 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN);\
1195#define __HAL_RCC_TIM17_CLK_ENABLE() do { \
1196 __IO uint32_t tmpreg; \
1197 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN);\
1199 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN);\
1203#define __HAL_RCC_TIM15_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM15EN))
1204#define __HAL_RCC_TIM16_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM16EN))
1205#define __HAL_RCC_TIM17_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM17EN))
1208#if defined(STM32F100xE) || defined(STM32F101xB) || defined(STM32F101xE)\
1209 || defined(STM32F101xG) || defined(STM32F100xB) || defined(STM32F103xB)\
1210 || defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\
1211 || defined(STM32F107xC)
1212#define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
1213 __IO uint32_t tmpreg; \
1214 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPEEN);\
1216 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPEEN);\
1220#define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPEEN))
1223#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
1224 || defined(STM32F103xG)
1225#define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
1226 __IO uint32_t tmpreg; \
1227 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\
1229 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\
1233#define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
1234 __IO uint32_t tmpreg; \
1235 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\
1237 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\
1241#define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPFEN))
1242#define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPGEN))
1245#if defined(STM32F103xE) || defined(STM32F103xG)
1246#define __HAL_RCC_TIM8_CLK_ENABLE() do { \
1247 __IO uint32_t tmpreg; \
1248 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
1250 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
1254#define __HAL_RCC_ADC3_CLK_ENABLE() do { \
1255 __IO uint32_t tmpreg; \
1256 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
1258 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
1262#define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
1263#define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN))
1266#if defined(STM32F100xE)
1267#define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
1268 __IO uint32_t tmpreg; \
1269 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\
1271 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPFEN);\
1275#define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
1276 __IO uint32_t tmpreg; \
1277 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\
1279 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPGEN);\
1283#define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPFEN))
1284#define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPGEN))
1287#if defined(STM32F101xG) || defined(STM32F103xG)
1288#define __HAL_RCC_TIM9_CLK_ENABLE() do { \
1289 __IO uint32_t tmpreg; \
1290 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
1292 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
1296#define __HAL_RCC_TIM10_CLK_ENABLE() do { \
1297 __IO uint32_t tmpreg; \
1298 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
1300 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
1304#define __HAL_RCC_TIM11_CLK_ENABLE() do { \
1305 __IO uint32_t tmpreg; \
1306 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
1308 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
1312#define __HAL_RCC_TIM9_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM9EN))
1313#define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
1314#define __HAL_RCC_TIM11_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM11EN))
1329#if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\
1330 || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\
1331 || defined(STM32F103xG)
1332#define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET)
1333#define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET)
1335#if defined(STM32F100xB) || defined(STM32F100xE)
1336#define __HAL_RCC_TIM15_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM15EN)) != RESET)
1337#define __HAL_RCC_TIM15_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM15EN)) == RESET)
1338#define __HAL_RCC_TIM16_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM16EN)) != RESET)
1339#define __HAL_RCC_TIM16_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM16EN)) == RESET)
1340#define __HAL_RCC_TIM17_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM17EN)) != RESET)
1341#define __HAL_RCC_TIM17_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM17EN)) == RESET)
1343#if defined(STM32F100xE) || defined(STM32F101xB) || defined(STM32F101xE)\
1344 || defined(STM32F101xG) || defined(STM32F100xB) || defined(STM32F103xB)\
1345 || defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\
1346 || defined(STM32F107xC)
1347#define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPEEN)) != RESET)
1348#define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPEEN)) == RESET)
1350#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
1351 || defined(STM32F103xG)
1352#define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) != RESET)
1353#define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) == RESET)
1354#define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) != RESET)
1355#define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) == RESET)
1357#if defined(STM32F103xE) || defined(STM32F103xG)
1358#define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
1359#define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
1360#define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET)
1361#define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET)
1363#if defined(STM32F100xE)
1364#define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) != RESET)
1365#define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPFEN)) == RESET)
1366#define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) != RESET)
1367#define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPGEN)) == RESET)
1369#if defined(STM32F101xG) || defined(STM32F103xG)
1370#define __HAL_RCC_TIM9_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) != RESET)
1371#define __HAL_RCC_TIM9_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) == RESET)
1372#define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
1373#define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
1374#define __HAL_RCC_TIM11_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) != RESET)
1375#define __HAL_RCC_TIM11_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) == RESET)
1382#if defined(STM32F105xC) || defined(STM32F107xC)
1387#define __HAL_RCC_AHB_FORCE_RESET() (RCC->AHBRSTR = 0xFFFFFFFFU)
1388#define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_OTGFSRST))
1389#if defined(STM32F107xC)
1390#define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_ETHMACRST))
1393#define __HAL_RCC_AHB_RELEASE_RESET() (RCC->AHBRSTR = 0x00)
1394#define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_OTGFSRST))
1395#if defined(STM32F107xC)
1396#define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_ETHMACRST))
1409#if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\
1410 || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC)
1411#define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
1413#define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
1416#if defined(STM32F100xB) || defined(STM32F100xE) || defined(STM32F101xB)\
1417 || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F102xB)\
1418 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\
1419 || defined(STM32F105xC) || defined(STM32F107xC)
1420#define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
1421#define __HAL_RCC_SPI2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI2RST))
1422#define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
1423#define __HAL_RCC_I2C2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C2RST))
1425#define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
1426#define __HAL_RCC_SPI2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI2RST))
1427#define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
1428#define __HAL_RCC_I2C2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C2RST))
1431#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
1432 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)
1433#define __HAL_RCC_USB_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USBRST))
1434#define __HAL_RCC_USB_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USBRST))
1437#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
1438 || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC)
1439#define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM5RST))
1440#define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
1441#define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
1442#define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
1443#define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
1444#define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
1445#define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
1447#define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM5RST))
1448#define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
1449#define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
1450#define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
1451#define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
1452#define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
1453#define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
1456#if defined(STM32F100xB) || defined (STM32F100xE)
1457#define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
1458#define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
1459#define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
1460#define __HAL_RCC_CEC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CECRST))
1462#define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
1463#define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
1464#define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
1465#define __HAL_RCC_CEC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CECRST))
1468#if defined (STM32F100xE)
1469#define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM5RST))
1470#define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
1471#define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
1472#define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
1473#define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
1474#define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
1475#define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
1477#define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM5RST))
1478#define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
1479#define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
1480#define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
1481#define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
1482#define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
1483#define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
1486#if defined(STM32F105xC) || defined(STM32F107xC)
1487#define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
1489#define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
1492#if defined(STM32F101xG) || defined(STM32F103xG)
1493#define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
1494#define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
1495#define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
1497#define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
1498#define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
1499#define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
1511#if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\
1512 || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\
1513 || defined(STM32F103xG)
1514#define __HAL_RCC_ADC2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC2RST))
1516#define __HAL_RCC_ADC2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADC2RST))
1519#if defined(STM32F100xB) || defined(STM32F100xE)
1520#define __HAL_RCC_TIM15_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM15RST))
1521#define __HAL_RCC_TIM16_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM16RST))
1522#define __HAL_RCC_TIM17_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM17RST))
1524#define __HAL_RCC_TIM15_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM15RST))
1525#define __HAL_RCC_TIM16_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM16RST))
1526#define __HAL_RCC_TIM17_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM17RST))
1529#if defined(STM32F100xE) || defined(STM32F101xB) || defined(STM32F101xE)\
1530 || defined(STM32F101xG) || defined(STM32F100xB) || defined(STM32F103xB)\
1531 || defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\
1532 || defined(STM32F107xC)
1533#define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPERST))
1535#define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPERST))
1538#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
1539 || defined(STM32F103xG)
1540#define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPFRST))
1541#define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPGRST))
1543#define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPFRST))
1544#define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPGRST))
1547#if defined(STM32F103xE) || defined(STM32F103xG)
1548#define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
1549#define __HAL_RCC_ADC3_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC3RST))
1551#define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
1552#define __HAL_RCC_ADC3_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADC3RST))
1555#if defined(STM32F100xE)
1556#define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPFRST))
1557#define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPGRST))
1559#define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPFRST))
1560#define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPGRST))
1563#if defined(STM32F101xG) || defined(STM32F103xG)
1564#define __HAL_RCC_TIM9_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM9RST))
1565#define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
1566#define __HAL_RCC_TIM11_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM11RST))
1568#define __HAL_RCC_TIM9_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM9RST))
1569#define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
1570#define __HAL_RCC_TIM11_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM11RST))
1581#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\
1582 || defined(STM32F100xE)
1591#define __HAL_RCC_HSE_PREDIV_CONFIG(__HSE_PREDIV_VALUE__) MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV1, (uint32_t)(__HSE_PREDIV_VALUE__))
1601#define __HAL_RCC_HSE_PREDIV_CONFIG(__HSE_PREDIV_VALUE__) \
1602 MODIFY_REG(RCC->CFGR,RCC_CFGR_PLLXTPRE, (uint32_t)(__HSE_PREDIV_VALUE__))
1606#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\
1607 || defined(STM32F100xE)
1611#define __HAL_RCC_HSE_GET_PREDIV() READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV1)
1617#define __HAL_RCC_HSE_GET_PREDIV() READ_BIT(RCC->CFGR, RCC_CFGR_PLLXTPRE)
1625#if defined(STM32F105xC) || defined(STM32F107xC)
1636#define __HAL_RCC_PLLI2S_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = ENABLE)
1641#define __HAL_RCC_PLLI2S_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = DISABLE)
1659#define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SMUL__)\
1660 MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PLL3MUL,(__PLLI2SMUL__))
1673#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
1674 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)
1681#define __HAL_RCC_USB_CONFIG(__USBCLKSOURCE__) \
1682 MODIFY_REG(RCC->CFGR, RCC_CFGR_USBPRE, (uint32_t)(__USBCLKSOURCE__))
1689#define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_USBPRE)))
1693#if defined(STM32F105xC) || defined(STM32F107xC)
1701#define __HAL_RCC_USB_CONFIG(__USBCLKSOURCE__) \
1702 MODIFY_REG(RCC->CFGR, RCC_CFGR_OTGFSPRE, (uint32_t)(__USBCLKSOURCE__))
1709#define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_OTGFSPRE)))
1721#define __HAL_RCC_ADC_CONFIG(__ADCCLKSOURCE__) \
1722 MODIFY_REG(RCC->CFGR, RCC_CFGR_ADCPRE, (uint32_t)(__ADCCLKSOURCE__))
1731#define __HAL_RCC_GET_ADC_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_ADCPRE)))
1737#if defined(STM32F105xC) || defined(STM32F107xC)
1751#define __HAL_RCC_HSE_PREDIV2_CONFIG(__HSE_PREDIV2_VALUE__) \
1752 MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV2, (uint32_t)(__HSE_PREDIV2_VALUE__))
1757#define __HAL_RCC_HSE_GET_PREDIV2() READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV2)
1773#define __HAL_RCC_PLL2_ENABLE() (*(__IO uint32_t *) RCC_CR_PLL2ON_BB = ENABLE)
1779#define __HAL_RCC_PLL2_DISABLE() (*(__IO uint32_t *) RCC_CR_PLL2ON_BB = DISABLE)
1797#define __HAL_RCC_PLL2_CONFIG(__PLL2MUL__)\
1798 MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PLL2MUL,(__PLL2MUL__))
1815#define __HAL_RCC_I2S2_CONFIG(__I2S2CLKSOURCE__) \
1816 MODIFY_REG(RCC->CFGR2, RCC_CFGR2_I2S2SRC, (uint32_t)(__I2S2CLKSOURCE__))
1823#define __HAL_RCC_GET_I2S2_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_I2S2SRC)))
1831#define __HAL_RCC_I2S3_CONFIG(__I2S2CLKSOURCE__) \
1832 MODIFY_REG(RCC->CFGR2, RCC_CFGR2_I2S3SRC, (uint32_t)(__I2S2CLKSOURCE__))
1839#define __HAL_RCC_GET_I2S3_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_I2S3SRC)))
1861uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk);
1867#if defined(STM32F105xC) || defined(STM32F107xC)
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition stm32f1xx_hal_def.h:40
RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition.
Definition stm32f1xx_hal_rcc_ex.h:229
uint32_t HSIState
Definition stm32f1xx_hal_rcc_ex.h:247
uint32_t HSEPredivValue
Definition stm32f1xx_hal_rcc_ex.h:241
uint32_t LSEState
Definition stm32f1xx_hal_rcc_ex.h:244
uint32_t HSEState
Definition stm32f1xx_hal_rcc_ex.h:238
uint32_t LSIState
Definition stm32f1xx_hal_rcc_ex.h:253
uint32_t HSICalibrationValue
Definition stm32f1xx_hal_rcc_ex.h:250
RCC_PLLInitTypeDef PLL
Definition stm32f1xx_hal_rcc_ex.h:256
uint32_t OscillatorType
Definition stm32f1xx_hal_rcc_ex.h:230
PLL2 Clock structure definition.
Definition stm32h7xx_hal_rcc_ex.h:48
PLLI2S Clock structure definition
Definition stm32f2xx_hal_rcc_ex.h:47
RCC PLL configuration structure definition.
Definition stm32f1xx_hal_rcc.h:50
RCC extended clocks structure definition.
Definition stm32f1xx_hal_rcc_ex.h:284
uint32_t PeriphClockSelection
Definition stm32f1xx_hal_rcc_ex.h:285
uint32_t AdcClockSelection
Definition stm32f1xx_hal_rcc_ex.h:291
uint32_t RTCClockSelection
Definition stm32f1xx_hal_rcc_ex.h:288