Subversion Repositories LedShow

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 9
Line 4... Line 4...
4
  * @author  MCD Application Team
4
  * @author  MCD Application Team
5
  * @brief   Header file of RCC HAL Extension module.
5
  * @brief   Header file of RCC HAL Extension module.
6
  ******************************************************************************
6
  ******************************************************************************
7
  * @attention
7
  * @attention
8
  *
8
  *
9
  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
9
  * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
-
 
10
  * All rights reserved.</center></h2>
10
  *
11
  *
11
  * Redistribution and use in source and binary forms, with or without modification,
12
  * This software component is licensed by ST under BSD 3-Clause license,
12
  * are permitted provided that the following conditions are met:
13
  * the "License"; You may not use this file except in compliance with the
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.
14
  * License. You may obtain a copy of the License at:
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
15
  *                        opensource.org/licenses/BSD-3-Clause
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
  *
16
  *
33
  ******************************************************************************
17
  ******************************************************************************
34
  */
18
  */
35
 
19
 
36
/* Define to prevent recursive inclusion -------------------------------------*/
20
/* Define to prevent recursive inclusion -------------------------------------*/
37
#ifndef __STM32F1xx_HAL_RCC_EX_H
21
#ifndef __STM32F1xx_HAL_RCC_EX_H
38
#define __STM32F1xx_HAL_RCC_EX_H
22
#define __STM32F1xx_HAL_RCC_EX_H
39
 
23
 
40
#ifdef __cplusplus
24
#ifdef __cplusplus
41
 extern "C" {
25
extern "C" {
42
#endif
26
#endif
43
 
27
 
44
/* Includes ------------------------------------------------------------------*/
28
/* Includes ------------------------------------------------------------------*/
45
#include "stm32f1xx_hal_def.h"
29
#include "stm32f1xx_hal_def.h"
46
 
30
 
Line 48... Line 32...
48
  * @{
32
  * @{
49
  */
33
  */
50
 
34
 
51
/** @addtogroup RCCEx
35
/** @addtogroup RCCEx
52
  * @{
36
  * @{
53
  */
37
  */
54
 
38
 
55
/** @addtogroup RCCEx_Private_Constants
39
/** @addtogroup RCCEx_Private_Constants
56
 * @{
40
 * @{
57
 */
41
 */
58
 
42
 
Line 69... Line 53...
69
#define PLL2_TIMEOUT_VALUE           100U  /* 100 ms */
53
#define PLL2_TIMEOUT_VALUE           100U  /* 100 ms */
70
 
54
 
71
#endif /* STM32F105xC || STM32F107xC */
55
#endif /* STM32F105xC || STM32F107xC */
72
 
56
 
73
 
57
 
74
#define CR_REG_INDEX                 ((uint8_t)1)    
58
#define CR_REG_INDEX                 ((uint8_t)1)
75
 
59
 
76
/**
60
/**
77
  * @}
61
  * @}
78
  */
62
  */
79
 
63
 
Line 209... Line 193...
209
 
193
 
210
/**
194
/**
211
  * @}
195
  * @}
212
  */
196
  */
213
 
197
 
214
/* Exported types ------------------------------------------------------------*/
198
/* Exported types ------------------------------------------------------------*/
215
 
199
 
216
/** @defgroup RCCEx_Exported_Types RCCEx Exported Types
200
/** @defgroup RCCEx_Exported_Types RCCEx Exported Types
217
  * @{
201
  * @{
218
  */
202
  */
219
 
203
 
220
#if defined(STM32F105xC) || defined(STM32F107xC)
204
#if defined(STM32F105xC) || defined(STM32F107xC)
221
/**
205
/**
222
  * @brief  RCC PLL2 configuration structure definition  
206
  * @brief  RCC PLL2 configuration structure definition
223
  */
207
  */
224
typedef struct
208
typedef struct
225
{
209
{
226
  uint32_t PLL2State;     /*!< The new state of the PLL2.
210
  uint32_t PLL2State;     /*!< The new state of the PLL2.
227
                              This parameter can be a value of @ref RCCEx_PLL2_Config */
211
                              This parameter can be a value of @ref RCCEx_PLL2_Config */
228
 
212
 
229
  uint32_t PLL2MUL;         /*!< PLL2MUL: Multiplication factor for PLL2 VCO input clock
213
  uint32_t PLL2MUL;         /*!< PLL2MUL: Multiplication factor for PLL2 VCO input clock
230
                              This parameter must be a value of @ref RCCEx_PLL2_Multiplication_Factor*/        
214
                              This parameter must be a value of @ref RCCEx_PLL2_Multiplication_Factor*/
231
 
215
 
232
#if defined(STM32F105xC) || defined(STM32F107xC)
216
#if defined(STM32F105xC) || defined(STM32F107xC)
233
  uint32_t HSEPrediv2Value;       /*!<  The Prediv2 factor value.
217
  uint32_t HSEPrediv2Value;       /*!<  The Prediv2 factor value.
234
                                       This parameter can be a value of @ref RCCEx_Prediv2_Factor */
218
                                       This parameter can be a value of @ref RCCEx_Prediv2_Factor */
235
 
219
 
236
#endif /* STM32F105xC || STM32F107xC */
220
#endif /* STM32F105xC || STM32F107xC */
237
} RCC_PLL2InitTypeDef;
221
} RCC_PLL2InitTypeDef;
238
 
222
 
239
#endif /* STM32F105xC || STM32F107xC */
223
#endif /* STM32F105xC || STM32F107xC */
240
 
224
 
241
/**
225
/**
242
  * @brief  RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition  
226
  * @brief  RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition
243
  */
227
  */
244
typedef struct
228
typedef struct
245
{
229
{
246
  uint32_t OscillatorType;       /*!< The oscillators to be configured.
230
  uint32_t OscillatorType;       /*!< The oscillators to be configured.
247
                                       This parameter can be a value of @ref RCC_Oscillator_Type */
231
                                       This parameter can be a value of @ref RCC_Oscillator_Type */
Line 251... Line 235...
251
                                       This parameter can be a value of @ref RCCEx_Prediv1_Source */
235
                                       This parameter can be a value of @ref RCCEx_Prediv1_Source */
252
#endif /* STM32F105xC || STM32F107xC */
236
#endif /* STM32F105xC || STM32F107xC */
253
 
237
 
254
  uint32_t HSEState;              /*!< The new state of the HSE.
238
  uint32_t HSEState;              /*!< The new state of the HSE.
255
                                       This parameter can be a value of @ref RCC_HSE_Config */
239
                                       This parameter can be a value of @ref RCC_HSE_Config */
256
                         
-
 
-
 
240
 
257
  uint32_t HSEPredivValue;       /*!<  The Prediv1 factor value (named PREDIV1 or PLLXTPRE in RM)
241
  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 */
242
                                       This parameter can be a value of @ref RCCEx_Prediv1_Factor */
259
 
243
 
260
  uint32_t LSEState;              /*!<  The new state of the LSE.
244
  uint32_t LSEState;              /*!<  The new state of the LSE.
261
                                        This parameter can be a value of @ref RCC_LSE_Config */
245
                                        This parameter can be a value of @ref RCC_LSE_Config */
262
                                         
-
 
-
 
246
 
263
  uint32_t HSIState;              /*!< The new state of the HSI.
247
  uint32_t HSIState;              /*!< The new state of the HSI.
264
                                       This parameter can be a value of @ref RCC_HSI_Config */
248
                                       This parameter can be a value of @ref RCC_HSI_Config */
265
 
249
 
266
  uint32_t HSICalibrationValue;   /*!< The HSI calibration trimming value (default is RCC_HSICALIBRATION_DEFAULT).
250
  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 */
251
                                       This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */
268
                               
-
 
-
 
252
 
269
  uint32_t LSIState;              /*!<  The new state of the LSI.
253
  uint32_t LSIState;              /*!<  The new state of the LSI.
270
                                        This parameter can be a value of @ref RCC_LSI_Config */
254
                                        This parameter can be a value of @ref RCC_LSI_Config */
271
 
255
 
272
  RCC_PLLInitTypeDef PLL;         /*!< PLL structure parameters */      
256
  RCC_PLLInitTypeDef PLL;         /*!< PLL structure parameters */
273
 
257
 
274
#if defined(STM32F105xC) || defined(STM32F107xC)
258
#if defined(STM32F105xC) || defined(STM32F107xC)
275
  RCC_PLL2InitTypeDef PLL2;         /*!< PLL2 structure parameters */      
259
  RCC_PLL2InitTypeDef PLL2;         /*!< PLL2 structure parameters */
276
#endif /* STM32F105xC || STM32F107xC */
260
#endif /* STM32F105xC || STM32F107xC */
277
} RCC_OscInitTypeDef;
261
} RCC_OscInitTypeDef;
278
 
262
 
279
#if defined(STM32F105xC) || defined(STM32F107xC)
263
#if defined(STM32F105xC) || defined(STM32F107xC)
280
/**
264
/**
281
  * @brief  RCC PLLI2S configuration structure definition  
265
  * @brief  RCC PLLI2S configuration structure definition
282
  */
266
  */
283
typedef struct
267
typedef struct
284
{
268
{
285
  uint32_t PLLI2SMUL;         /*!< PLLI2SMUL: Multiplication factor for PLLI2S VCO input clock
269
  uint32_t PLLI2SMUL;         /*!< PLLI2SMUL: Multiplication factor for PLLI2S VCO input clock
286
                              This parameter must be a value of @ref RCCEx_PLLI2S_Multiplication_Factor*/        
270
                              This parameter must be a value of @ref RCCEx_PLLI2S_Multiplication_Factor*/
287
 
271
 
288
#if defined(STM32F105xC) || defined(STM32F107xC)
272
#if defined(STM32F105xC) || defined(STM32F107xC)
289
  uint32_t HSEPrediv2Value;       /*!<  The Prediv2 factor value.
273
  uint32_t HSEPrediv2Value;       /*!<  The Prediv2 factor value.
290
                                       This parameter can be a value of @ref RCCEx_Prediv2_Factor */
274
                                       This parameter can be a value of @ref RCCEx_Prediv2_Factor */
291
 
275
 
292
#endif /* STM32F105xC || STM32F107xC */
276
#endif /* STM32F105xC || STM32F107xC */
293
} RCC_PLLI2SInitTypeDef;
277
} RCC_PLLI2SInitTypeDef;
294
#endif /* STM32F105xC || STM32F107xC */
278
#endif /* STM32F105xC || STM32F107xC */
295
 
279
 
296
/**
280
/**
297
  * @brief  RCC extended clocks structure definition  
281
  * @brief  RCC extended clocks structure definition
298
  */
282
  */
299
typedef struct
283
typedef struct
300
{
284
{
301
  uint32_t PeriphClockSelection;      /*!< The Extended Clock to be configured.
285
  uint32_t PeriphClockSelection;      /*!< The Extended Clock to be configured.
302
                                       This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
286
                                       This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
303
 
287
 
304
  uint32_t RTCClockSelection;         /*!< specifies the RTC clock source.
288
  uint32_t RTCClockSelection;         /*!< specifies the RTC clock source.
305
                                       This parameter can be a value of @ref RCC_RTC_Clock_Source */
289
                                       This parameter can be a value of @ref RCC_RTC_Clock_Source */
306
 
290
 
307
  uint32_t AdcClockSelection;         /*!< ADC clock source      
291
  uint32_t AdcClockSelection;         /*!< ADC clock source
308
                                       This parameter can be a value of @ref RCCEx_ADC_Prescaler */
292
                                       This parameter can be a value of @ref RCCEx_ADC_Prescaler */
309
 
293
 
310
#if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\
294
#if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\
311
 || defined(STM32F107xC)
295
 || defined(STM32F107xC)
312
  uint32_t I2s2ClockSelection;         /*!< I2S2 clock source
296
  uint32_t I2s2ClockSelection;         /*!< I2S2 clock source
313
                                       This parameter can be a value of @ref RCCEx_I2S2_Clock_Source */
297
                                       This parameter can be a value of @ref RCCEx_I2S2_Clock_Source */
314
 
298
 
315
  uint32_t I2s3ClockSelection;         /*!< I2S3 clock source
299
  uint32_t I2s3ClockSelection;         /*!< I2S3 clock source
316
                                       This parameter can be a value of @ref RCCEx_I2S3_Clock_Source */
300
                                       This parameter can be a value of @ref RCCEx_I2S3_Clock_Source */
317
 
301
 
318
#if defined(STM32F105xC) || defined(STM32F107xC)
302
#if defined(STM32F105xC) || defined(STM32F107xC)
319
  RCC_PLLI2SInitTypeDef PLLI2S;  /*!< PLL I2S structure parameters
303
  RCC_PLLI2SInitTypeDef PLLI2S;  /*!< PLL I2S structure parameters
320
                                      This parameter will be used only when PLLI2S is selected as Clock Source I2S2 or I2S3 */
304
                                      This parameter will be used only when PLLI2S is selected as Clock Source I2S2 or I2S3 */
321
 
305
 
322
#endif /* STM32F105xC || STM32F107xC */
306
#endif /* STM32F105xC || STM32F107xC */
323
#endif /* STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
307
#endif /* STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
324
 
308
 
325
#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
309
#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
326
 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\
310
 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\
327
 || defined(STM32F105xC) || defined(STM32F107xC)
311
 || defined(STM32F105xC) || defined(STM32F107xC)
328
  uint32_t UsbClockSelection;         /*!< USB clock source      
312
  uint32_t UsbClockSelection;         /*!< USB clock source
329
                                       This parameter can be a value of @ref RCCEx_USB_Prescaler */
313
                                       This parameter can be a value of @ref RCCEx_USB_Prescaler */
330
 
314
 
331
#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
315
#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
332
} RCC_PeriphCLKInitTypeDef;
316
} RCC_PeriphCLKInitTypeDef;
333
 
317
 
Line 344... Line 328...
344
/** @defgroup RCCEx_Periph_Clock_Selection Periph Clock Selection
328
/** @defgroup RCCEx_Periph_Clock_Selection Periph Clock Selection
345
  * @{
329
  * @{
346
  */
330
  */
347
#define RCC_PERIPHCLK_RTC           0x00000001U
331
#define RCC_PERIPHCLK_RTC           0x00000001U
348
#define RCC_PERIPHCLK_ADC           0x00000002U
332
#define RCC_PERIPHCLK_ADC           0x00000002U
349
#if defined(STM32F103xE) || defined(STM32F103xG) || defined(STM32F105xC)\
333
#if defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE)\
350
 || defined(STM32F107xC)
334
 || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC)
351
#define RCC_PERIPHCLK_I2S2          0x00000004U
335
#define RCC_PERIPHCLK_I2S2          0x00000004U
352
#define RCC_PERIPHCLK_I2S3          0x00000008U
336
#define RCC_PERIPHCLK_I2S3          0x00000008U
353
#endif /* STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
337
#endif /* STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
354
#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
338
#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
355
 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\
339
 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)\
356
 || defined(STM32F105xC) || defined(STM32F107xC)
340
 || defined(STM32F105xC) || defined(STM32F107xC)
357
#define RCC_PERIPHCLK_USB          0x00000010U
341
#define RCC_PERIPHCLK_USB          0x00000010U
358
#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
342
#endif /* STM32F102x6 || STM32F102xB || STM32F103x6 || STM32F103xB || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
Line 603... Line 587...
603
  */
587
  */
604
#define RCC_IT_PLL2RDY                   ((uint8_t)RCC_CIR_PLL2RDYF)
588
#define RCC_IT_PLL2RDY                   ((uint8_t)RCC_CIR_PLL2RDYF)
605
#define RCC_IT_PLLI2SRDY                 ((uint8_t)RCC_CIR_PLL3RDYF)
589
#define RCC_IT_PLLI2SRDY                 ((uint8_t)RCC_CIR_PLL3RDYF)
606
/**
590
/**
607
  * @}
591
  * @}
608
  */  
592
  */
609
 
593
 
610
/** @defgroup RCCEx_Flag RCCEx Flag
594
/** @defgroup RCCEx_Flag RCCEx Flag
611
  *        Elements values convention: 0XXYYYYYb
595
  *        Elements values convention: 0XXYYYYYb
612
  *           - YYYYY  : Flag position in the register
596
  *           - YYYYY  : Flag position in the register
613
  *           - XX  : Register index
597
  *           - XX  : Register index
Line 617... Line 601...
617
/* Flags in the CR register */
601
/* Flags in the CR register */
618
#define RCC_FLAG_PLL2RDY                  ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLL2RDY_Pos))
602
#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))
603
#define RCC_FLAG_PLLI2SRDY                ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLL3RDY_Pos))
620
/**
604
/**
621
  * @}
605
  * @}
622
  */
606
  */
623
#endif /* STM32F105xC || STM32F107xC*/
607
#endif /* STM32F105xC || STM32F107xC*/
624
 
608
 
625
/**
609
/**
626
  * @}
610
  * @}
627
  */
611
  */
Line 632... Line 616...
632
 */
616
 */
633
 
617
 
634
/** @defgroup RCCEx_Peripheral_Clock_Enable_Disable Peripheral Clock Enable Disable
618
/** @defgroup RCCEx_Peripheral_Clock_Enable_Disable Peripheral Clock Enable Disable
635
  * @brief  Enable or disable the AHB1 peripheral clock.
619
  * @brief  Enable or disable the AHB1 peripheral clock.
636
  * @note   After reset, the peripheral clock (used for registers read/write access)
620
  * @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
621
  *         is disabled and the application software has to enable this clock before
638
  *         using it.  
622
  *         using it.
639
  * @{
623
  * @{
640
  */
624
  */
641
 
625
 
642
#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
626
#if defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG)\
643
 || defined(STM32F103xG) || defined(STM32F105xC) || defined  (STM32F107xC)\
627
 || defined(STM32F103xG) || defined(STM32F105xC) || defined  (STM32F107xC)\
Line 735... Line 719...
735
#define __HAL_RCC_ETH_CLK_DISABLE()  do {                                      \
719
#define __HAL_RCC_ETH_CLK_DISABLE()  do {                                      \
736
                                          __HAL_RCC_ETHMACTX_CLK_DISABLE();    \
720
                                          __HAL_RCC_ETHMACTX_CLK_DISABLE();    \
737
                                          __HAL_RCC_ETHMACRX_CLK_DISABLE();    \
721
                                          __HAL_RCC_ETHMACRX_CLK_DISABLE();    \
738
                                          __HAL_RCC_ETHMAC_CLK_DISABLE();      \
722
                                          __HAL_RCC_ETHMAC_CLK_DISABLE();      \
739
                                        } while(0U)
723
                                        } while(0U)
740
                                     
-
 
-
 
724
 
741
#endif /* STM32F107xC*/
725
#endif /* STM32F107xC*/
742
 
726
 
743
/**
727
/**
744
  * @}
728
  * @}
745
  */
729
  */
Line 785... Line 769...
785
  */
769
  */
786
 
770
 
787
/** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Clock Enable Disable
771
/** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Clock Enable Disable
788
  * @brief  Enable or disable the Low Speed APB (APB1) peripheral clock.
772
  * @brief  Enable or disable the Low Speed APB (APB1) peripheral clock.
789
  * @note   After reset, the peripheral clock (used for registers read/write access)
773
  * @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
774
  *         is disabled and the application software has to enable this clock before
791
  *         using it.
775
  *         using it.
792
  * @{  
776
  * @{
793
  */
777
  */
794
 
778
 
795
#if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\
779
#if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\
796
 || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC)
780
 || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC)
797
#define __HAL_RCC_CAN1_CLK_ENABLE()   do { \
781
#define __HAL_RCC_CAN1_CLK_ENABLE()   do { \
Line 1170... Line 1154...
1170
  */
1154
  */
1171
 
1155
 
1172
/** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Clock Enable Disable
1156
/** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Clock Enable Disable
1173
  * @brief  Enable or disable the High Speed APB (APB2) peripheral clock.
1157
  * @brief  Enable or disable the High Speed APB (APB2) peripheral clock.
1174
  * @note   After reset, the peripheral clock (used for registers read/write access)
1158
  * @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
1159
  *         is disabled and the application software has to enable this clock before
1176
  *         using it.
1160
  *         using it.
1177
  * @{  
1161
  * @{
1178
  */
1162
  */
1179
 
1163
 
1180
#if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\
1164
#if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\
1181
 || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\
1165
 || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\
1182
 || defined(STM32F103xG)
1166
 || defined(STM32F103xG)
Line 1397... Line 1381...
1397
 
1381
 
1398
#if defined(STM32F105xC) || defined(STM32F107xC)
1382
#if defined(STM32F105xC) || defined(STM32F107xC)
1399
/** @defgroup RCCEx_Peripheral_Clock_Force_Release Peripheral Clock Force Release
1383
/** @defgroup RCCEx_Peripheral_Clock_Force_Release Peripheral Clock Force Release
1400
  * @brief  Force or release AHB peripheral reset.
1384
  * @brief  Force or release AHB peripheral reset.
1401
  * @{
1385
  * @{
1402
  */  
1386
  */
1403
#define __HAL_RCC_AHB_FORCE_RESET()         (RCC->AHBRSTR = 0xFFFFFFFFU)
1387
#define __HAL_RCC_AHB_FORCE_RESET()         (RCC->AHBRSTR = 0xFFFFFFFFU)
1404
#define __HAL_RCC_USB_OTG_FS_FORCE_RESET()       (RCC->AHBRSTR |= (RCC_AHBRSTR_OTGFSRST))
1388
#define __HAL_RCC_USB_OTG_FS_FORCE_RESET()       (RCC->AHBRSTR |= (RCC_AHBRSTR_OTGFSRST))
1405
#if defined(STM32F107xC)
1389
#if defined(STM32F107xC)
1406
#define __HAL_RCC_ETHMAC_FORCE_RESET()      (RCC->AHBRSTR |= (RCC_AHBRSTR_ETHMACRST))
1390
#define __HAL_RCC_ETHMAC_FORCE_RESET()      (RCC->AHBRSTR |= (RCC_AHBRSTR_ETHMACRST))
1407
#endif /* STM32F107xC */
1391
#endif /* STM32F107xC */
Line 1417... Line 1401...
1417
  */
1401
  */
1418
#endif /* STM32F105xC || STM32F107xC */
1402
#endif /* STM32F105xC || STM32F107xC */
1419
 
1403
 
1420
/** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
1404
/** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
1421
  * @brief  Force or release APB1 peripheral reset.
1405
  * @brief  Force or release APB1 peripheral reset.
1422
  * @{  
1406
  * @{
1423
  */
1407
  */
1424
 
1408
 
1425
#if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\
1409
#if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE)\
1426
 || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC)
1410
 || defined(STM32F103xG) || defined(STM32F105xC) ||defined(STM32F107xC)
1427
#define __HAL_RCC_CAN1_FORCE_RESET()        (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
1411
#define __HAL_RCC_CAN1_FORCE_RESET()        (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
Line 1519... Line 1503...
1519
  * @}
1503
  * @}
1520
  */
1504
  */
1521
 
1505
 
1522
/** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
1506
/** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
1523
  * @brief  Force or release APB2 peripheral reset.
1507
  * @brief  Force or release APB2 peripheral reset.
1524
  * @{  
1508
  * @{
1525
  */
1509
  */
1526
 
1510
 
1527
#if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\
1511
#if defined(STM32F101xG) || defined(STM32F103x6) || defined(STM32F103xB)\
1528
 || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\
1512
 || defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F103xE)\
1529
 || defined(STM32F103xG)
1513
 || defined(STM32F103xG)
Line 1589... Line 1573...
1589
/**
1573
/**
1590
  * @}
1574
  * @}
1591
  */
1575
  */
1592
 
1576
 
1593
/** @defgroup RCCEx_HSE_Configuration HSE Configuration
1577
/** @defgroup RCCEx_HSE_Configuration HSE Configuration
1594
  * @{  
1578
  * @{
1595
  */
1579
  */
1596
 
1580
 
1597
#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\
1581
#if defined(STM32F105xC) || defined(STM32F107xC) || defined(STM32F100xB)\
1598
 || defined(STM32F100xE)
1582
 || defined(STM32F100xE)
1599
/**
1583
/**
1600
  * @brief  Macro to configure the External High Speed oscillator (HSE) Predivision factor for PLL.
1584
  * @brief  Macro to configure the External High Speed oscillator (HSE) Predivision factor for PLL.
Line 1638... Line 1622...
1638
  * @}
1622
  * @}
1639
  */
1623
  */
1640
 
1624
 
1641
#if defined(STM32F105xC) || defined(STM32F107xC)
1625
#if defined(STM32F105xC) || defined(STM32F107xC)
1642
/** @defgroup RCCEx_PLLI2S_Configuration PLLI2S Configuration
1626
/** @defgroup RCCEx_PLLI2S_Configuration PLLI2S Configuration
1643
  * @{  
1627
  * @{
1644
  */
1628
  */
1645
 
1629
 
1646
/** @brief Macros to enable the main PLLI2S.
1630
/** @brief Macros to enable the main PLLI2S.
1647
  * @note   After enabling the main PLLI2S, the application software should wait on
1631
  * @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
1632
  *         PLLI2SRDY flag to be set indicating that PLLI2S clock is stable and can
1649
  *         be used as system clock source.
1633
  *         be used as system clock source.
1650
  * @note   The main PLLI2S is disabled by hardware when entering STOP and STANDBY modes.
1634
  * @note   The main PLLI2S is disabled by hardware when entering STOP and STANDBY modes.
1651
  */
1635
  */
1652
#define __HAL_RCC_PLLI2S_ENABLE()          (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = ENABLE)
1636
#define __HAL_RCC_PLLI2S_ENABLE()          (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = ENABLE)
Line 1656... Line 1640...
1656
  */
1640
  */
1657
#define __HAL_RCC_PLLI2S_DISABLE()         (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = DISABLE)
1641
#define __HAL_RCC_PLLI2S_DISABLE()         (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = DISABLE)
1658
 
1642
 
1659
/** @brief macros to configure the main PLLI2S multiplication factor.
1643
/** @brief macros to configure the main PLLI2S multiplication factor.
1660
  * @note   This function must be used only when the main PLLI2S is disabled.
1644
  * @note   This function must be used only when the main PLLI2S is disabled.
1661
  *  
1645
  *
1662
  * @param  __PLLI2SMUL__ specifies the multiplication factor for PLLI2S VCO output clock
1646
  * @param  __PLLI2SMUL__ specifies the multiplication factor for PLLI2S VCO output clock
1663
  *          This parameter can be one of the following values:
1647
  *          This parameter can be one of the following values:
1664
  *             @arg @ref RCC_PLLI2S_MUL8 PLLI2SVCO = PLLI2S clock entry x 8
1648
  *             @arg @ref RCC_PLLI2S_MUL8 PLLI2SVCO = PLLI2S clock entry x 8
1665
  *             @arg @ref RCC_PLLI2S_MUL9 PLLI2SVCO = PLLI2S clock entry x 9
1649
  *             @arg @ref RCC_PLLI2S_MUL9 PLLI2SVCO = PLLI2S clock entry x 9
1666
  *             @arg @ref RCC_PLLI2S_MUL10 PLLI2SVCO = PLLI2S clock entry x 10
1650
  *             @arg @ref RCC_PLLI2S_MUL10 PLLI2SVCO = PLLI2S clock entry x 10
Line 1668... Line 1652...
1668
  *             @arg @ref RCC_PLLI2S_MUL12 PLLI2SVCO = PLLI2S clock entry x 12
1652
  *             @arg @ref RCC_PLLI2S_MUL12 PLLI2SVCO = PLLI2S clock entry x 12
1669
  *             @arg @ref RCC_PLLI2S_MUL13 PLLI2SVCO = PLLI2S clock entry x 13
1653
  *             @arg @ref RCC_PLLI2S_MUL13 PLLI2SVCO = PLLI2S clock entry x 13
1670
  *             @arg @ref RCC_PLLI2S_MUL14 PLLI2SVCO = PLLI2S clock entry x 14
1654
  *             @arg @ref RCC_PLLI2S_MUL14 PLLI2SVCO = PLLI2S clock entry x 14
1671
  *             @arg @ref RCC_PLLI2S_MUL16 PLLI2SVCO = PLLI2S clock entry x 16
1655
  *             @arg @ref RCC_PLLI2S_MUL16 PLLI2SVCO = PLLI2S clock entry x 16
1672
  *             @arg @ref RCC_PLLI2S_MUL20 PLLI2SVCO = PLLI2S clock entry x 20
1656
  *             @arg @ref RCC_PLLI2S_MUL20 PLLI2SVCO = PLLI2S clock entry x 20
1673
  *  
1657
  *
1674
  */
1658
  */
1675
#define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SMUL__)\
1659
#define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SMUL__)\
1676
          MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PLL3MUL,(__PLLI2SMUL__))
1660
          MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PLL3MUL,(__PLLI2SMUL__))
1677
 
1661
 
1678
/**
1662
/**
Line 1682... Line 1666...
1682
#endif /* STM32F105xC || STM32F107xC */
1666
#endif /* STM32F105xC || STM32F107xC */
1683
 
1667
 
1684
/** @defgroup RCCEx_Peripheral_Configuration Peripheral Configuration
1668
/** @defgroup RCCEx_Peripheral_Configuration Peripheral Configuration
1685
  * @brief  Macros to configure clock source of different peripherals.
1669
  * @brief  Macros to configure clock source of different peripherals.
1686
  * @{
1670
  * @{
1687
  */  
1671
  */
1688
 
1672
 
1689
#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
1673
#if defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)\
1690
 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)
1674
 || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG)
1691
/** @brief  Macro to configure the USB clock.
1675
/** @brief  Macro to configure the USB clock.
1692
  * @param  __USBCLKSOURCE__ specifies the USB clock source.
1676
  * @param  __USBCLKSOURCE__ specifies the USB clock source.
Line 1751... Line 1735...
1751
  */
1735
  */
1752
 
1736
 
1753
#if defined(STM32F105xC) || defined(STM32F107xC)
1737
#if defined(STM32F105xC) || defined(STM32F107xC)
1754
 
1738
 
1755
/** @addtogroup RCCEx_HSE_Configuration
1739
/** @addtogroup RCCEx_HSE_Configuration
1756
  * @{  
1740
  * @{
1757
  */
1741
  */
1758
 
1742
 
1759
/**
1743
/**
1760
  * @brief  Macro to configure the PLL2 & PLLI2S Predivision factor.
1744
  * @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
1745
  * @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
1746
  *         In this case, you have to select another source of the system clock, disable the PLL2 and PLLI2S and
Line 1764... Line 1748...
1764
  * @param  __HSE_PREDIV2_VALUE__ specifies the PREDIV2 value applied to PLL2 & PLLI2S.
1748
  * @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.
1749
  *         This parameter must be a number between RCC_HSE_PREDIV2_DIV1 and RCC_HSE_PREDIV2_DIV16.
1766
  */
1750
  */
1767
#define __HAL_RCC_HSE_PREDIV2_CONFIG(__HSE_PREDIV2_VALUE__) \
1751
#define __HAL_RCC_HSE_PREDIV2_CONFIG(__HSE_PREDIV2_VALUE__) \
1768
                  MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV2, (uint32_t)(__HSE_PREDIV2_VALUE__))
1752
                  MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV2, (uint32_t)(__HSE_PREDIV2_VALUE__))
1769
                 
-
 
-
 
1753
 
1770
/**
1754
/**
1771
  * @brief  Macro to get prediv2 factor for PLL2 & PLL3.
1755
  * @brief  Macro to get prediv2 factor for PLL2 & PLL3.
1772
  */
1756
  */
1773
#define __HAL_RCC_HSE_GET_PREDIV2() READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV2)
1757
#define __HAL_RCC_HSE_GET_PREDIV2() READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV2)
1774
 
1758
 
1775
/**
1759
/**
1776
  * @}
1760
  * @}
1777
  */
1761
  */
1778
 
1762
 
1779
/** @addtogroup RCCEx_PLLI2S_Configuration
1763
/** @addtogroup RCCEx_PLLI2S_Configuration
1780
  * @{  
1764
  * @{
1781
  */
1765
  */
1782
 
1766
 
1783
/** @brief Macros to enable the main PLL2.
1767
/** @brief Macros to enable the main PLL2.
1784
  * @note   After enabling the main PLL2, the application software should wait on
1768
  * @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
1769
  *         PLL2RDY flag to be set indicating that PLL2 clock is stable and can
1786
  *         be used as system clock source.
1770
  *         be used as system clock source.
1787
  * @note   The main PLL2 is disabled by hardware when entering STOP and STANDBY modes.
1771
  * @note   The main PLL2 is disabled by hardware when entering STOP and STANDBY modes.
1788
  */
1772
  */
1789
#define __HAL_RCC_PLL2_ENABLE()          (*(__IO uint32_t *) RCC_CR_PLL2ON_BB = ENABLE)
1773
#define __HAL_RCC_PLL2_ENABLE()          (*(__IO uint32_t *) RCC_CR_PLL2ON_BB = ENABLE)
Line 1794... Line 1778...
1794
  */
1778
  */
1795
#define __HAL_RCC_PLL2_DISABLE()         (*(__IO uint32_t *) RCC_CR_PLL2ON_BB = DISABLE)
1779
#define __HAL_RCC_PLL2_DISABLE()         (*(__IO uint32_t *) RCC_CR_PLL2ON_BB = DISABLE)
1796
 
1780
 
1797
/** @brief macros to configure the main PLL2 multiplication factor.
1781
/** @brief macros to configure the main PLL2 multiplication factor.
1798
  * @note   This function must be used only when the main PLL2 is disabled.
1782
  * @note   This function must be used only when the main PLL2 is disabled.
1799
  *  
1783
  *
1800
  * @param  __PLL2MUL__ specifies the multiplication factor for PLL2 VCO output clock
1784
  * @param  __PLL2MUL__ specifies the multiplication factor for PLL2 VCO output clock
1801
  *          This parameter can be one of the following values:
1785
  *          This parameter can be one of the following values:
1802
  *             @arg @ref RCC_PLL2_MUL8 PLL2VCO = PLL2 clock entry x 8
1786
  *             @arg @ref RCC_PLL2_MUL8 PLL2VCO = PLL2 clock entry x 8
1803
  *             @arg @ref RCC_PLL2_MUL9 PLL2VCO = PLL2 clock entry x 9
1787
  *             @arg @ref RCC_PLL2_MUL9 PLL2VCO = PLL2 clock entry x 9
1804
  *             @arg @ref RCC_PLL2_MUL10 PLL2VCO = PLL2 clock entry x 10
1788
  *             @arg @ref RCC_PLL2_MUL10 PLL2VCO = PLL2 clock entry x 10
Line 1806... Line 1790...
1806
  *             @arg @ref RCC_PLL2_MUL12 PLL2VCO = PLL2 clock entry x 12
1790
  *             @arg @ref RCC_PLL2_MUL12 PLL2VCO = PLL2 clock entry x 12
1807
  *             @arg @ref RCC_PLL2_MUL13 PLL2VCO = PLL2 clock entry x 13
1791
  *             @arg @ref RCC_PLL2_MUL13 PLL2VCO = PLL2 clock entry x 13
1808
  *             @arg @ref RCC_PLL2_MUL14 PLL2VCO = PLL2 clock entry x 14
1792
  *             @arg @ref RCC_PLL2_MUL14 PLL2VCO = PLL2 clock entry x 14
1809
  *             @arg @ref RCC_PLL2_MUL16 PLL2VCO = PLL2 clock entry x 16
1793
  *             @arg @ref RCC_PLL2_MUL16 PLL2VCO = PLL2 clock entry x 16
1810
  *             @arg @ref RCC_PLL2_MUL20 PLL2VCO = PLL2 clock entry x 20
1794
  *             @arg @ref RCC_PLL2_MUL20 PLL2VCO = PLL2 clock entry x 20
1811
  *  
1795
  *
1812
  */
1796
  */
1813
#define __HAL_RCC_PLL2_CONFIG(__PLL2MUL__)\
1797
#define __HAL_RCC_PLL2_CONFIG(__PLL2MUL__)\
1814
          MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PLL2MUL,(__PLL2MUL__))
1798
          MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PLL2MUL,(__PLL2MUL__))
1815
 
1799
 
1816
/**
1800
/**
Line 1818... Line 1802...
1818
  */
1802
  */
1819
 
1803
 
1820
/** @defgroup RCCEx_I2S_Configuration I2S Configuration
1804
/** @defgroup RCCEx_I2S_Configuration I2S Configuration
1821
  * @brief  Macros to configure clock source of I2S peripherals.
1805
  * @brief  Macros to configure clock source of I2S peripherals.
1822
  * @{
1806
  * @{
1823
  */  
1807
  */
1824
 
1808
 
1825
/** @brief  Macro to configure the I2S2 clock.
1809
/** @brief  Macro to configure the I2S2 clock.
1826
  * @param  __I2S2CLKSOURCE__ specifies the I2S2 clock source.
1810
  * @param  __I2S2CLKSOURCE__ specifies the I2S2 clock source.
1827
  *          This parameter can be one of the following values:
1811
  *          This parameter can be one of the following values:
1828
  *            @arg @ref RCC_I2S2CLKSOURCE_SYSCLK system clock selected as I2S3 clock entry
1812
  *            @arg @ref RCC_I2S2CLKSOURCE_SYSCLK system clock selected as I2S3 clock entry
Line 1907... Line 1891...
1907
  */
1891
  */
1908
 
1892
 
1909
/**
1893
/**
1910
  * @}
1894
  * @}
1911
  */
1895
  */
1912
 
1896
 
1913
/**
1897
/**
1914
  * @}
1898
  * @}
1915
  */
1899
  */
1916
 
1900
 
1917
#ifdef __cplusplus
1901
#ifdef __cplusplus
1918
}
1902
}
1919
#endif
1903
#endif
1920
 
1904
 
1921
#endif /* __STM32F1xx_HAL_RCC_EX_H */
1905
#endif /* __STM32F1xx_HAL_RCC_EX_H */