你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

【经验分享】STM32 时钟相关函数和类型

[复制链接]
STMCU小助手 发布时间:2022-3-31 11:00
01. 概述
4 ~6 t. y1 {3 K' y! Z$ `在 STM32F4 标准固件库里,时钟源的选择以及时钟使能等函数都是在 RCC 相关固件库文件 stm32f4xx_rcc.h 和 stm32f4xx_rcc.c 中声明和定义的。大家打开 stm32f4xx_rcc.h 文件可以看到文件开头有很多宏定义标识符,然后是一系列时钟配置和时钟使能函数申明。这些函数大致可以归结为三类,一类是外设时钟使能函数,一类是时钟源和分频因子配置函数,还有一类是外设复位函数。当然还有几个获取时钟源配置的函数。) U3 o: l' d/ S& x( ~" [
% G6 U3 V, g; }: g' \* u' r, r
02. 相关类型! p( a( ^* ~1 K# h5 C
RCC_ClocksTypeDef: Z* O1 a6 Q7 @& @" l7 D
7 p7 w( T/ Z) L% X0 m! j
  1. /* Exported types ------------------------------------------------------------*/
    9 `6 d9 \* U$ D8 t1 a* |4 W
  2. typedef struct1 X/ z6 l  }+ Y; B  X1 A( x1 Z
  3. {5 s0 O6 a) ~  t; H
  4.   uint32_t SYSCLK_Frequency; /*!<  SYSCLK clock frequency expressed in Hz */
    7 P& I8 z2 u) M" K( ~
  5.   uint32_t HCLK_Frequency;   /*!<  HCLK clock frequency expressed in Hz   */8 o. w& b% s, \
  6.   uint32_t PCLK1_Frequency;  /*!<  PCLK1 clock frequency expressed in Hz  */
    9 H/ Z9 y5 Z. U+ i( C) @2 g
  7.   uint32_t PCLK2_Frequency;  /*!<  PCLK2 clock frequency expressed in Hz  */6 `7 I, B/ v) T3 \
  8. }RCC_ClocksTypeDef;
复制代码
1 q6 }! x" u  U+ @/ w
RCC_HSE_configuration, O/ V, B# F: O$ b& Q  a4 N
3 Z3 J: X' h. O5 A9 G" T
  1. /** @defgroup RCC_HSE_configuration
      o/ x7 y$ W2 H% `
  2.   * @{) V* S5 ?8 U1 C  ^. x: B
  3.   */
    $ E* J8 f! G2 r3 S
  4. #define RCC_HSE_OFF                      ((uint8_t)0x00); p: U0 O. @3 l# V
  5. #define RCC_HSE_ON                       ((uint8_t)0x01)
    ; g5 u0 _6 u+ `, A) f3 _
  6. #define RCC_HSE_Bypass                   ((uint8_t)0x05)2 m/ W# `: o6 D1 X
  7. #define IS_RCC_HSE(HSE) (((HSE) == RCC_HSE_OFF) || ((HSE) == RCC_HSE_ON) || \
    - w3 _5 o2 j$ q/ a! P
  8.                          ((HSE) == RCC_HSE_Bypass))
复制代码

) O( _0 H4 O+ [% g, HRCC_LSE_Dual_Mode_Selection
  K" q( `6 h0 O) R! H: S7 m  n' c6 z6 m) T. @' v+ L
  1. /** @defgroup RCC_LSE_Dual_Mode_Selection1 H- x, p/ S0 z" I5 ^/ M9 o' w
  2.   * @{( s% K4 L1 s. f0 |5 N- I% U
  3.   */, ?3 T4 j, r8 Z4 T: Q' N
  4. #define RCC_LSE_LOWPOWER_MODE           ((uint8_t)0x00)
    3 I0 r! I4 |- o, y2 H9 ~. S5 Q
  5. #define RCC_LSE_HIGHDRIVE_MODE          ((uint8_t)0x01)
    : w% u: K7 I/ h# D- K2 L( t$ A
  6. #define IS_RCC_LSE_MODE(MODE)           (((MODE) == RCC_LSE_LOWPOWER_MODE) || \! ?# h3 r/ y: A6 ]5 O& I: Y9 {, M- q/ y
  7.                                          ((MODE) == RCC_LSE_HIGHDRIVE_MODE))
复制代码

$ K/ ]9 X5 f1 |$ d3 QRCC_PLLSAIDivR_Factor* u; h' x/ o$ [& ]8 L- g1 Q6 V
9 a$ d  ^. M! c/ A9 |
  1. /** @defgroup RCC_PLLSAIDivR_Factor
    6 l9 |+ O/ W& z) {1 E
  2.   * @{
    ) |" f* r8 S% E* P. D  q
  3.   */
    / G% ]9 W! [" n
  4. #define RCC_PLLSAIDivR_Div2                ((uint32_t)0x00000000)( n! ^! w# f  m, Z8 Q6 B7 ~
  5. #define RCC_PLLSAIDivR_Div4                ((uint32_t)0x00010000)* Q- ^: L3 f0 K# `& H
  6. #define RCC_PLLSAIDivR_Div8                ((uint32_t)0x00020000)7 G, s% b1 G( j2 [/ x
  7. #define RCC_PLLSAIDivR_Div16               ((uint32_t)0x00030000)
    3 t0 ~# |. {  m: \1 e! F
  8. #define IS_RCC_PLLSAI_DIVR_VALUE(VALUE) (((VALUE) == RCC_PLLSAIDivR_Div2) ||\! T  y* n8 T+ x+ w
  9.                                         ((VALUE) == RCC_PLLSAIDivR_Div4)  ||\
    9 x: `+ Z- d1 X1 ?  |( y
  10.                                         ((VALUE) == RCC_PLLSAIDivR_Div8)  ||\
    ; }4 m7 a% h$ r9 F! p3 x7 H9 N
  11.                                         ((VALUE) == RCC_PLLSAIDivR_Div16))
复制代码
; j# l$ K" O0 u, Y& w" ~
RCC_PLL_Clock_Source9 H1 Z- B- p: V: r) d/ W

: `1 ]; K# h% Y+ @9 a' Y
  1. /** @defgroup RCC_PLL_Clock_Source
    2 O. t2 j$ t' ^- d* U  q' T4 [
  2.   * @{
    ; |, Z4 ?6 V% X) t& I3 b# e
  3.   */% v6 h1 G2 a4 C: b3 U. A/ e
  4. #define RCC_PLLSource_HSI                ((uint32_t)0x00000000)$ v1 @/ F% I8 L' W2 r' l; e- S" c
  5. #define RCC_PLLSource_HSE                ((uint32_t)0x00400000)+ m' m' J; C6 z& X# n+ K8 e- b2 k
  6. #define IS_RCC_PLL_SOURCE(SOURCE) (((SOURCE) == RCC_PLLSource_HSI) || \* B% z0 B$ x" i/ _( @; }! Q
  7.                                    ((SOURCE) == RCC_PLLSource_HSE))
    8 k; G" e$ P  A: f) a! B  I2 p
  8. #define IS_RCC_PLLM_VALUE(VALUE) ((VALUE) <= 63)
    / T( |3 l2 R8 V; n, v4 z
  9. #define IS_RCC_PLLN_VALUE(VALUE) ((50 <= (VALUE)) && ((VALUE) <= 432))9 {- \- R; p% `  @  O1 b6 `7 t
  10. #define IS_RCC_PLLP_VALUE(VALUE) (((VALUE) == 2) || ((VALUE) == 4) || 3 a6 Q! D& C% s
  11. ((VALUE) == 6) || ((VALUE) == 8))5 o6 q  J3 R3 e4 \* g4 g
  12. #define IS_RCC_PLLQ_VALUE(VALUE) ((4 <= (VALUE)) && ((VALUE) <= 15))
    ) O# Y; G0 u! C* b0 e% b
  13. #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) * k5 o, f- k' |6 _6 f7 q
  14.     || defined(STM32F446xx) || defined(STM32F469_479xx)
    . v) j0 Q$ X( [7 p1 h) O
  15. #define IS_RCC_PLLR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))# b7 z  n0 u; k4 X- w2 Q0 f
  16. #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx || STM32F446xx 4 Z  u: G# V& a
  17. || STM32F469_479xx */
    2 d* K; F4 X( Q

  18. 4 \" _2 o/ R' ]/ }
  19. #define IS_RCC_PLLI2SN_VALUE(VALUE) ((50 <= (VALUE)) && ((VALUE) <= 432))) e3 T) p! W* u6 ?; }
  20. #define IS_RCC_PLLI2SR_VALUE(VALUE) ((2 <= (VALUE))  && ((VALUE) <= 7))) i3 A' z! ^9 [4 W0 `
  21. #define IS_RCC_PLLI2SM_VALUE(VALUE) ((2 <= (VALUE))  && ((VALUE) <= 63))
    % w4 f- O9 q7 b+ q& E3 J  t, U
  22. #define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2 <= (VALUE))  && ((VALUE) <= 15))* @+ y4 H* e3 E/ H. {+ E
  23. #if defined(STM32F446xx) & A$ o: u8 S) q
  24. #define IS_RCC_PLLI2SP_VALUE(VALUE) (((VALUE) == 2) || ((VALUE) == 4)
    : b+ |- H3 a9 M; s0 s
  25.     || ((VALUE) == 6) || ((VALUE) == 8))9 m) J$ x- i5 \5 {' T
  26. #define IS_RCC_PLLSAIM_VALUE(VALUE) ((VALUE) <= 63)
    , T2 Y3 t: s+ S9 {6 i
  27. #elif  defined(STM32F412xG) || defined(STM32F413_423xx)
    ) B1 [0 y  A' W% P; [. c# c
  28. #define IS_RCC_PLLI2SP_VALUE(VALUE) (((VALUE) == 2) || ((VALUE) == 4) 5 x) j* k, O" g* x3 \
  29.     || ((VALUE) == 6) || ((VALUE) == 8))
    7 S! V; ]7 K1 m6 J  J  Z- w
  30. #else
    6 x+ S0 J% d  D* D
  31. #endif /* STM32F446xx */( Y0 O  d, g0 u& {! T" `* l
  32. #define IS_RCC_PLLSAIN_VALUE(VALUE) ((50 <= (VALUE)) && ((VALUE) <= 432))
    , t, W' F& C, J0 ~
  33. #if defined(STM32F446xx) || defined(STM32F469_479xx)
    % p( b# R$ H8 R( N! N# h. x
  34. #define IS_RCC_PLLSAIP_VALUE(VALUE) (((VALUE) == 2) || ((VALUE) == 4) % s* B0 ]( H; q
  35.     || ((VALUE) == 6) || ((VALUE) == 8)); D) s) J% \1 H
  36. #endif /* STM32F446xx || STM32F469_479xx */
    % N3 R. x& @; L! e1 ~. T
  37. #define IS_RCC_PLLSAIQ_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 15))% d: {7 P1 t% D, C
  38. #define IS_RCC_PLLSAIR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))  + F  c: Y* m) \8 c& O# Z

  39. : [3 y! v0 z0 N0 j. c' f
  40. #define IS_RCC_PLLSAI_DIVQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))' z& U1 w6 Z+ l) ^
  41. #define IS_RCC_PLLI2S_DIVQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))( X# C1 y6 q( D7 `' ]1 ~
  42. 3 K* {# d$ V' e
  43. #if defined(STM32F413_423xx)
    ' T, N1 }3 M3 f2 `5 A
  44. #define IS_RCC_PLLI2S_DIVR_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))
    . ?8 |3 X9 c- |; I0 F' `
  45. #define IS_RCC_PLL_DIVR_VALUE(VALUE)    ((1 <= (VALUE)) && ((VALUE) <= 32))- g" _; ?% A, V; T) S( N% u6 A8 ]
  46. #endif /* STM32F413_423xx */
复制代码

4 W% ~& l; f+ c* s2 lRCC_System_Clock_Source
6 p1 U6 P9 N( k3 P8 B* t6 v9 [: x6 E) t$ {) A
  1. /** @defgroup RCC_System_Clock_Source 7 Q+ Q& t. Y- r# C' E$ Y
  2.   * @{
    $ _! H2 }1 L- c6 J7 s6 ?0 x  d
  3.   */
    % u" b' j* O$ @6 K/ Y' O
  4. & g, c( Z8 L/ ]6 e  p
  5. #if  defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx)2 F- o* q! e% h5 H" G5 p
  6. #define RCC_SYSCLKSource_HSI             ((uint32_t)0x00000000)+ G3 n! i# j* O
  7. #define RCC_SYSCLKSource_HSE             ((uint32_t)0x00000001)
    / j8 {6 h! x  ]/ _3 m) B% k# G: c# u+ f
  8. #define RCC_SYSCLKSource_PLLPCLK         ((uint32_t)0x00000002)' e" f( L  c9 O# S2 ~( W7 _# l5 d
  9. #define RCC_SYSCLKSource_PLLRCLK         ((uint32_t)0x00000003)
    - v6 o* \# M! [% g- F1 U& d
  10. #define IS_RCC_SYSCLK_SOURCE(SOURCE) (((SOURCE) == RCC_SYSCLKSource_HSI) || \+ D6 h9 k: _$ S  E
  11.                                       ((SOURCE) == RCC_SYSCLKSource_HSE) || \- x7 a& s: V3 q; W3 J
  12.                                       ((SOURCE) == RCC_SYSCLKSource_PLLPCLK) || \" b/ s3 A5 e+ z6 M
  13.                                       ((SOURCE) == RCC_SYSCLKSource_PLLRCLK))
    . z2 W( S) x2 M$ p; _4 c
  14. /* Add legacy definition */
    ) C% }+ s/ F9 ^3 {* ?) ?9 O8 C+ R7 K
  15. #define  RCC_SYSCLKSource_PLLCLK    RCC_SYSCLKSource_PLLPCLK  
    ! H$ Q! P: J  E. B: m
  16. #endif /* STM32F446xx */4 B5 R* o+ o$ ]" u* r5 C
  17. ) D* a4 J  o' x3 f& x
  18. #if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F429_439xx)
    ) E. ^; [2 i) Y9 h& Q% Y
  19. || defined(STM32F401xx) || defined(STM32F410xx) || defined(STM32F411xE)
    $ s2 e2 ~* t! T4 W0 D. R% C
  20.     || defined(STM32F469_479xx)9 _  i/ h' K( _# k( N4 o$ J( ^
  21. #define RCC_SYSCLKSource_HSI             ((uint32_t)0x00000000)
    - |! F+ T6 W: S( ?
  22. #define RCC_SYSCLKSource_HSE             ((uint32_t)0x00000001)+ R3 S+ r4 }4 E3 }/ x
  23. #define RCC_SYSCLKSource_PLLCLK          ((uint32_t)0x00000002)) h1 m' o5 r5 ?' Q; ^, [5 L
  24. #define IS_RCC_SYSCLK_SOURCE(SOURCE) (((SOURCE) == RCC_SYSCLKSource_HSI) || \
    ( E7 k$ G4 ^8 n2 X7 U
  25.                                       ((SOURCE) == RCC_SYSCLKSource_HSE) || \2 `9 K% X' T( s+ O
  26.                                       ((SOURCE) == RCC_SYSCLKSource_PLLCLK))' o, D* z4 z! w
  27. #endif /* STM32F40_41xxx || STM32F427_437xx || STM32F429_439xx || STM32F401xx & b8 v0 {3 v# h' ]$ l2 @& U
  28. || STM32F410xx || STM32F411xE || STM32F469_479xx */
    " I1 X! S0 m( X% r1 ^
复制代码

4 t0 z; `# I+ _. T# K0 f7 x7 aRCC_AHB_Clock_Source
% r4 F. Z% {6 \  Z0 Q+ }9 i
* |# _- V) n! K3 T. G9 t; `
  1. /** @defgroup RCC_AHB_Clock_Source1 u8 Y0 P: Y% \) ]8 Z3 p* K  W" N0 o
  2.   * @{
    6 d5 x0 i; O0 d* v& [
  3.   */
    5 H9 S/ j. @  R2 K
  4. #define RCC_SYSCLK_Div1                  ((uint32_t)0x00000000)
    / v, s9 @  V( E4 [- M
  5. #define RCC_SYSCLK_Div2                  ((uint32_t)0x00000080)! a0 n$ {: P/ W) M8 j
  6. #define RCC_SYSCLK_Div4                  ((uint32_t)0x00000090)* B% {1 q' r# {& P6 ]
  7. #define RCC_SYSCLK_Div8                  ((uint32_t)0x000000A0)
    ! r9 a3 P3 f% K- `8 D* s
  8. #define RCC_SYSCLK_Div16                 ((uint32_t)0x000000B0)7 B3 G; A# w. S1 M) ?" U
  9. #define RCC_SYSCLK_Div64                 ((uint32_t)0x000000C0)
    1 i7 C/ Q# R4 [: x3 b% \3 E2 P
  10. #define RCC_SYSCLK_Div128                ((uint32_t)0x000000D0): ?5 J  k1 ?  \; j
  11. #define RCC_SYSCLK_Div256                ((uint32_t)0x000000E0)+ Z4 K3 R& k" A' \8 }9 V
  12. #define RCC_SYSCLK_Div512                ((uint32_t)0x000000F0)
    - e7 L6 P6 u" R; k+ ?" ^) x8 y
  13. #define IS_RCC_HCLK(HCLK) (((HCLK) == RCC_SYSCLK_Div1) || ((HCLK) == RCC_SYSCLK_Div2) || \
      [- ^6 q8 `# A9 w
  14.                            ((HCLK) == RCC_SYSCLK_Div4) || ((HCLK) == RCC_SYSCLK_Div8) || \
    / n$ O( S# I5 t! b3 B3 ^
  15.                            ((HCLK) == RCC_SYSCLK_Div16) || ((HCLK) == RCC_SYSCLK_Div64) || \
    6 t$ J5 z6 t; ~4 O" u( u6 j1 e4 E
  16.                            ((HCLK) == RCC_SYSCLK_Div128) || ((HCLK) == RCC_SYSCLK_Div256) || \0 `: [6 ]# W$ R* Q4 f, s
  17.                            ((HCLK) == RCC_SYSCLK_Div512))
复制代码

/ G3 q% n" s, t8 E# V3 `* iRCC_APB1_APB2_Clock_Source
4 g4 f# Q4 M+ U" }9 k& B& q
0 w- E0 Q; u- a& @( p; l
  1. /** @defgroup RCC_APB1_APB2_Clock_Source
    % E' K! p/ B& _3 M
  2.   * @{% _3 {$ E$ C1 D# U  z0 U; R
  3.   */$ N+ `& ]5 u6 l, [
  4. #define RCC_HCLK_Div1                    ((uint32_t)0x00000000)/ J- I1 H7 }8 u( R8 _: z: P: h
  5. #define RCC_HCLK_Div2                    ((uint32_t)0x00001000)
    , ]' T  I9 N+ f7 p
  6. #define RCC_HCLK_Div4                    ((uint32_t)0x00001400)/ ?2 b& ^$ j# R
  7. #define RCC_HCLK_Div8                    ((uint32_t)0x00001800)
    8 I6 j3 H1 K. I, h; z2 H: Y; {
  8. #define RCC_HCLK_Div16                   ((uint32_t)0x00001C00): S2 D9 R) r, \! a; ^7 D
  9. #define IS_RCC_PCLK(PCLK) (((PCLK) == RCC_HCLK_Div1) || ((PCLK) == RCC_HCLK_Div2) || \
    * g! X* k* p0 k/ \' Y
  10.                            ((PCLK) == RCC_HCLK_Div4) || ((PCLK) == RCC_HCLK_Div8) || \! g' Z2 W$ B% e( V9 Y9 P
  11.                            ((PCLK) == RCC_HCLK_Div16))* q# E8 J6 U$ ?9 f
复制代码

1 f' f8 e. \# K2 wRCC_Interrupt_Source$ T1 R- [& u* t2 y5 T

* p2 d6 I4 W) _
  1. /** @defgroup RCC_Interrupt_Source
    " N5 j1 `1 t, ^: z3 e! @
  2.   * @{( {3 |( Q5 b8 M# l3 A) ~9 k
  3.   */5 f: @& j! M( i# k; w1 f" U1 s
  4. #define RCC_IT_LSIRDY                    ((uint8_t)0x01)
    8 H/ `1 d* R8 ], z( f: G
  5. #define RCC_IT_LSERDY                    ((uint8_t)0x02)
    ' D( g8 X6 M( `, ~! C' u
  6. #define RCC_IT_HSIRDY                    ((uint8_t)0x04); m8 f; Q, |: w" A
  7. #define RCC_IT_HSERDY                    ((uint8_t)0x08)
    9 |: b  c* H) J
  8. #define RCC_IT_PLLRDY                    ((uint8_t)0x10)
    & S: }2 d4 }+ o0 D. |3 ^
  9. #define RCC_IT_PLLI2SRDY                 ((uint8_t)0x20)
    7 s2 I" C! v( G  g3 b& Y
  10. #define RCC_IT_PLLSAIRDY                 ((uint8_t)0x40)
    9 }8 D& |  e+ L
  11. #define RCC_IT_CSS                       ((uint8_t)0x80)) G6 X  {& a$ u. \4 t

  12.   L% c5 v+ l. X: [( G
  13. #define IS_RCC_IT(IT) ((((IT) & (uint8_t)0x80) == 0x00) && ((IT) != 0x00))
    ) ]; W) t( J, y7 P; v2 _0 z! D
  14. #define IS_RCC_GET_IT(IT) (((IT) == RCC_IT_LSIRDY) || ((IT) == RCC_IT_LSERDY) || \7 a+ S+ d1 y; s& T6 @. G8 k8 ?
  15.                            ((IT) == RCC_IT_HSIRDY) || ((IT) == RCC_IT_HSERDY) || \
    2 q( T* D  a" K0 a6 O9 {
  16.                            ((IT) == RCC_IT_PLLRDY) || ((IT) == RCC_IT_CSS) || \
    & B+ R2 H1 q8 x4 @
  17.                            ((IT) == RCC_IT_PLLSAIRDY) || ((IT) == RCC_IT_PLLI2SRDY))
    * E) ^0 M. O) E" d5 ^* b
  18. #define IS_RCC_CLEAR_IT(IT)((IT) != 0x00)
复制代码

& w8 n2 b' n* m1 N% s6 p! SRCC_LSE_Configuration
) `, {, j$ _* f" H2 R
1 p; ], b4 E$ M; n
  1. /** @defgroup RCC_LSE_Configuration
    8 n3 K# O4 S8 s2 ^
  2.   * @{
    - i+ T. V* w# E" }: I  j
  3.   */
    & {: L  R) \, U5 b# W
  4. #define RCC_LSE_OFF                      ((uint8_t)0x00)! f! H: X& w6 ?/ c2 i4 j
  5. #define RCC_LSE_ON                       ((uint8_t)0x01)
    9 @: q6 z9 m+ k+ a& N! f0 B
  6. #define RCC_LSE_Bypass                   ((uint8_t)0x04)4 a/ [, d4 G0 y
  7. #define IS_RCC_LSE(LSE) (((LSE) == RCC_LSE_OFF) || ((LSE) == RCC_LSE_ON) || \! n# z$ J& _$ V; S7 s2 c
  8.                          ((LSE) == RCC_LSE_Bypass))
复制代码
8 G* E) P  N4 T# i0 _5 W
RCC_RTC_Clock_Source
1 r% M* q! l; p: S3 B! @
, Q6 [/ n$ z; U/ R9 D  o
  1. /** @defgroup RCC_RTC_Clock_Source  U, a( I# b( h
  2.   * @{8 u4 c' B1 I; \9 s& F
  3.   */
    3 q; s/ Y- R  {. g, }0 ]" Z% M
  4. #define RCC_RTCCLKSource_LSE             ((uint32_t)0x00000100)
    # {6 E  |: c- Z. Y
  5. #define RCC_RTCCLKSource_LSI             ((uint32_t)0x00000200)' X; R" z8 t4 O$ b6 F9 X
  6. #define RCC_RTCCLKSource_HSE_Div2        ((uint32_t)0x00020300)) l! n4 ?* ]/ C: ]. a8 v
  7. #define RCC_RTCCLKSource_HSE_Div3        ((uint32_t)0x00030300)
    8 T$ x( L+ G. k) p
  8. #define RCC_RTCCLKSource_HSE_Div4        ((uint32_t)0x00040300)
    9 o6 \  d: p8 V
  9. #define RCC_RTCCLKSource_HSE_Div5        ((uint32_t)0x00050300)6 w7 }( Y1 e; V
  10. #define RCC_RTCCLKSource_HSE_Div6        ((uint32_t)0x00060300)
    5 o; |" V! J8 D7 ?; o4 @
  11. #define RCC_RTCCLKSource_HSE_Div7        ((uint32_t)0x00070300)7 ~" ]  e5 ~, z( D# Q4 D
  12. #define RCC_RTCCLKSource_HSE_Div8        ((uint32_t)0x00080300)( r1 t" s+ r- i- R
  13. #define RCC_RTCCLKSource_HSE_Div9        ((uint32_t)0x00090300)7 E5 t" s$ T6 ]9 v+ w& D
  14. #define RCC_RTCCLKSource_HSE_Div10       ((uint32_t)0x000A0300)) C4 d! R8 z+ \
  15. #define RCC_RTCCLKSource_HSE_Div11       ((uint32_t)0x000B0300)
    % A9 E* j2 a# B! w
  16. #define RCC_RTCCLKSource_HSE_Div12       ((uint32_t)0x000C0300)
    8 \+ |" e0 ]7 I" P  a3 f
  17. #define RCC_RTCCLKSource_HSE_Div13       ((uint32_t)0x000D0300)4 Q; k1 m& [2 i5 N* F, j7 s
  18. #define RCC_RTCCLKSource_HSE_Div14       ((uint32_t)0x000E0300)
    ! ~7 @& X' s: ?/ e! n) c
  19. #define RCC_RTCCLKSource_HSE_Div15       ((uint32_t)0x000F0300)
    : `* f- b6 |6 Y- u8 g/ F
  20. #define RCC_RTCCLKSource_HSE_Div16       ((uint32_t)0x00100300)
    1 s- V/ ?9 w5 ^/ I
  21. #define RCC_RTCCLKSource_HSE_Div17       ((uint32_t)0x00110300)
    ) T0 Z( b6 c5 v1 @6 |4 a, j) M) R; l6 q
  22. #define RCC_RTCCLKSource_HSE_Div18       ((uint32_t)0x00120300)- t& ]8 \2 O! \+ H% \+ y0 p
  23. #define RCC_RTCCLKSource_HSE_Div19       ((uint32_t)0x00130300). K9 R% B5 Q3 o0 @( O7 y
  24. #define RCC_RTCCLKSource_HSE_Div20       ((uint32_t)0x00140300)
    % h1 H3 E: N+ R! c
  25. #define RCC_RTCCLKSource_HSE_Div21       ((uint32_t)0x00150300)+ `7 i8 b' Q2 J9 Y5 n, S$ C& \- A, ^
  26. #define RCC_RTCCLKSource_HSE_Div22       ((uint32_t)0x00160300), O" A) p( z1 c
  27. #define RCC_RTCCLKSource_HSE_Div23       ((uint32_t)0x00170300)
    0 f' @9 {/ f# E2 ^  {1 H5 ~
  28. #define RCC_RTCCLKSource_HSE_Div24       ((uint32_t)0x00180300)
      |' x* @3 G0 R5 g  Y& b# a
  29. #define RCC_RTCCLKSource_HSE_Div25       ((uint32_t)0x00190300)
    + N9 t- c1 e; g$ {
  30. #define RCC_RTCCLKSource_HSE_Div26       ((uint32_t)0x001A0300)
    4 Z  g9 }& R3 @
  31. #define RCC_RTCCLKSource_HSE_Div27       ((uint32_t)0x001B0300)8 ], Z, D; y" U) u
  32. #define RCC_RTCCLKSource_HSE_Div28       ((uint32_t)0x001C0300)) H( F$ ~8 m2 e& b* ], D! b( u
  33. #define RCC_RTCCLKSource_HSE_Div29       ((uint32_t)0x001D0300)0 [% e- q+ e+ H4 `) \1 B
  34. #define RCC_RTCCLKSource_HSE_Div30       ((uint32_t)0x001E0300)
    " [, M" ^1 t- J9 B
  35. #define RCC_RTCCLKSource_HSE_Div31       ((uint32_t)0x001F0300)$ @$ e9 l8 I: M4 x  i
  36. #define IS_RCC_RTCCLK_SOURCE(SOURCE) (((SOURCE) == RCC_RTCCLKSource_LSE) || \+ \' l1 M/ w3 z- ~; o6 ?3 T
  37.                                       ((SOURCE) == RCC_RTCCLKSource_LSI) || \* Y( d+ f) h; ^7 C
  38.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div2) || \
    : i9 a1 z5 W: A8 M0 h5 a# ~
  39.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div3) || \
    & w; c9 j6 Z! d1 B9 J7 Z/ N
  40.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div4) || \
    $ j; Q& T* I" d0 b1 w" a
  41.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div5) || \6 ^) c4 U" |0 m+ u' A; [
  42.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div6) || \
    1 k; R4 X& Y, c. V
  43.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div7) || \
    " D9 Y8 B" P& B  x
  44.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div8) || \, F3 z+ w0 `9 p* _9 B, G
  45.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div9) || \
    ; @# X# o* q( |& w
  46.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div10) || \
    ! e2 {( h& d- E' t3 r
  47.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div11) || \
    ; U8 U7 x6 }/ g9 U
  48.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div12) || \+ }. x$ W3 \% `' f) L' ?  P6 X
  49.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div13) || \
    ' n: z5 D0 }: r" F
  50.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div14) || \
    7 J! {( a9 `, x% L
  51.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div15) || \
    7 f. P. Z/ h, j* n
  52.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div16) || \
    . @( X4 J7 b& W) F
  53.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div17) || \$ `0 ?' u* h: Z
  54.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div18) || \
    3 b+ @3 @& |1 v. r
  55.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div19) || \
    5 y# `( v. d0 _( Z+ b" [5 Q
  56.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div20) || \
    1 q- i7 E. T, x+ |, t& y. S
  57.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div21) || \) q4 H8 v& x7 ]' k* s( t, }
  58.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div22) || \
    $ ~) v2 S8 p0 A9 r- G
  59.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div23) || \
    9 T! l0 o5 m/ y
  60.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div24) || \
      S) y& Q6 v7 W# [) @. |9 D5 u, ]. _
  61.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div25) || \
    , E) a8 z: e& ?" s1 _( g: g
  62.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div26) || \
    ; o# A: ~$ [9 a& w
  63.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div27) || \
    0 T* o4 ]% O/ ~, }5 A7 D" p) T
  64.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div28) || \) R4 n* ]3 v" ^" A7 \; p* f" p
  65.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div29) || \6 i- h7 f" }+ S$ r8 a( V
  66.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div30) || \
    : M# L% J" L4 A8 Q) @
  67.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div31))
复制代码
- N) E7 h4 n2 U( O0 j/ V9 E& H
RCC_SAI_BlockA_Clock_Source& r3 b8 `, s" s5 x% j: ]$ j8 E

$ h+ {$ ?( H& X' J
  1. /** @defgroup RCC_SAI_BlockA_Clock_Source
    / H- \1 b* D0 _% I5 J
  2.   * @{/ x5 |8 q4 i& J
  3.   */6 N' d! h- p) U5 @! ]1 Z6 z
  4. #define RCC_SAIACLKSource_PLLSAI             ((uint32_t)0x00000000)
    % M) E, {5 a6 r8 y3 q  Q; s
  5. #define RCC_SAIACLKSource_PLLI2S             ((uint32_t)0x00100000)) @, `5 F9 H% M4 r7 w" o9 T
  6. #define RCC_SAIACLKSource_Ext                ((uint32_t)0x00200000)
    & j/ J. P8 O! v% l+ L, G8 c
  7. 4 i" ^: h( R, S( ^. r* [% E
  8. #define IS_RCC_SAIACLK_SOURCE(SOURCE) (((SOURCE) == RCC_SAIACLKSource_PLLI2S) ||\
    ) H9 y& r# z% t4 X3 ?" O' i4 C
  9.                                        ((SOURCE) == RCC_SAIACLKSource_PLLSAI) ||\  P0 a; P( Q( k, B7 k7 k: n4 ~
  10.                                        ((SOURCE) == RCC_SAIACLKSource_Ext))
复制代码

7 `' \0 O- c3 b2 x( r9 c7 V1 c# hRCC_SAI_BlockB_Clock_Source; k8 E( U' L- Z" C+ b/ A8 L9 b

2 y: F( I* L9 E9 e* W+ F6 v9 N: I1 `
  1. /** @defgroup RCC_SAI_BlockB_Clock_Source
    ! T; z7 D2 c! Z
  2.   * @{
    3 T+ Z9 Y6 l( ~# v9 Z; Q
  3.   */$ A$ I( ]5 t+ [0 G6 p' f/ B
  4. #define RCC_SAIBCLKSource_PLLSAI             ((uint32_t)0x00000000)
    7 R$ M* o8 P' z/ Y5 h3 a5 R
  5. #define RCC_SAIBCLKSource_PLLI2S             ((uint32_t)0x00400000)5 A9 v7 N# _: \! @+ ~" u
  6. #define RCC_SAIBCLKSource_Ext                ((uint32_t)0x00800000)
    * I& r% g/ k6 G& _9 q% B* g

  7. + G0 Z0 M0 L7 H5 _5 w) w7 g, q+ H
  8. #define IS_RCC_SAIBCLK_SOURCE(SOURCE) (((SOURCE) == RCC_SAIBCLKSource_PLLI2S) ||\
    ; \' s5 x+ M: b& m, u
  9.                                        ((SOURCE) == RCC_SAIBCLKSource_PLLSAI) ||\
    - Q7 H2 h$ `* p9 f- m
  10.                                        ((SOURCE) == RCC_SAIBCLKSource_Ext))
复制代码
' D" v) _) X5 O' U: a4 S
RCC_TIM_PRescaler_Selection
8 m: \3 E. g! U/ s( l, D2 U) ]! A3 L1 u6 z# |" D0 F& Z
  1. /** @defgroup RCC_TIM_PRescaler_Selection* a- ?6 c, {# }
  2.   * @{7 B3 ]3 @; _) t4 z1 V* J
  3.   */- D$ x$ ^- f% a% j# [
  4. #define RCC_TIMPrescDesactivated             ((uint8_t)0x00)& P4 w: g# n7 Q& t3 _
  5. #define RCC_TIMPrescActivated                ((uint8_t)0x01)
    2 F$ r# x8 G, Q! Z0 G9 @! x

  6. 0 C5 d- A! p' T7 H0 [  h
  7. #define IS_RCC_TIMCLK_PRESCALER(VALUE) (((VALUE) == RCC_TIMPrescDesactivated)
    0 C, q. c4 q' C
  8. || ((VALUE) == RCC_TIMPrescActivated))
复制代码
0 Q  @* Y- x) |- x/ F
RCC_AHB1_Peripherals
2 p  H: `- I6 W% Y6 K0 b  p3 n4 N. A- Z5 c& S) m" F5 e# x
  1. /** @defgroup RCC_AHB1_Peripherals
    6 R1 I9 J' S; @2 h2 b5 l/ y# y9 x
  2.   * @{
    $ ]3 |3 Y5 z8 z* |$ F8 ]
  3.   */   p  ^8 y/ P. Z1 ~& |6 s
  4. #define RCC_AHB1Periph_GPIOA             ((uint32_t)0x00000001)9 _, k1 \1 f3 c2 L& ^: s' g
  5. #define RCC_AHB1Periph_GPIOB             ((uint32_t)0x00000002)
    4 ]3 \0 P$ t" Z$ m, q% R& H
  6. #define RCC_AHB1Periph_GPIOC             ((uint32_t)0x00000004)' V* Q; c7 s* W- @5 K0 w
  7. #define RCC_AHB1Periph_GPIOD             ((uint32_t)0x00000008)! b; p$ F9 j5 ?  M1 C7 c
  8. #define RCC_AHB1Periph_GPIOE             ((uint32_t)0x00000010)* Y  R% `. J; F' }2 O
  9. #define RCC_AHB1Periph_GPIOF             ((uint32_t)0x00000020)8 A& U' f" M+ F
  10. #define RCC_AHB1Periph_GPIOG             ((uint32_t)0x00000040)( A' F( J, i* W% e
  11. #define RCC_AHB1Periph_GPIOH             ((uint32_t)0x00000080)$ R+ p7 x: r% G* k3 B( N
  12. #define RCC_AHB1Periph_GPIOI             ((uint32_t)0x00000100)
    - c! D9 G, r/ ?( q
  13. #define RCC_AHB1Periph_GPIOJ             ((uint32_t)0x00000200)1 d/ j2 H% J1 y' B/ h/ l) v
  14. #define RCC_AHB1Periph_GPIOK             ((uint32_t)0x00000400)
    9 M- `; Z& y# K  I9 u( `
  15. #define RCC_AHB1Periph_CRC               ((uint32_t)0x00001000)3 b: e' A. d) f2 X4 h
  16. #define RCC_AHB1Periph_FLITF             ((uint32_t)0x00008000)
    ; v3 B2 S8 C4 G8 v
  17. #define RCC_AHB1Periph_SRAM1             ((uint32_t)0x00010000): w; z, U; i0 Z  M8 Q
  18. #define RCC_AHB1Periph_SRAM2             ((uint32_t)0x00020000). A8 u% M3 y" p) Q' Q
  19. #define RCC_AHB1Periph_BKPSRAM           ((uint32_t)0x00040000)9 W$ v- C, x. D* [( s  G9 ^
  20. #define RCC_AHB1Periph_SRAM3             ((uint32_t)0x00080000)
    ! s$ D" H; Y  [
  21. #define RCC_AHB1Periph_CCMDATARAMEN      ((uint32_t)0x00100000)( w; D; H- |; t
  22. #define RCC_AHB1Periph_DMA1              ((uint32_t)0x00200000). ^, ^" t" L: J/ p( x$ ]
  23. #define RCC_AHB1Periph_DMA2              ((uint32_t)0x00400000)
    6 q8 [% o  }( J2 f! H& P2 K3 t. d9 k1 |
  24. #define RCC_AHB1Periph_DMA2D             ((uint32_t)0x00800000)
    9 h; U+ `: |7 g
  25. #define RCC_AHB1Periph_ETH_MAC           ((uint32_t)0x02000000)* n' \3 q' {4 t, v  j' R- S  o( e
  26. #define RCC_AHB1Periph_ETH_MAC_Tx        ((uint32_t)0x04000000)
    # W# a1 a- y! _! ^) V; X% ~
  27. #define RCC_AHB1Periph_ETH_MAC_Rx        ((uint32_t)0x08000000)
    . [5 w8 g$ H0 Q$ |1 t
  28. #define RCC_AHB1Periph_ETH_MAC_PTP       ((uint32_t)0x10000000)
    ( a2 f% e& v# P* r& c6 p
  29. #define RCC_AHB1Periph_OTG_HS            ((uint32_t)0x20000000)
    - t' R8 j4 a9 x, z/ x
  30. #define RCC_AHB1Periph_OTG_HS_ULPI       ((uint32_t)0x40000000)0 B4 _" k( Z$ u* C# j9 c
  31. % N5 @& r2 h: U0 G) ^" s( B$ P
  32. #define IS_RCC_AHB1_CLOCK_PERIPH(PERIPH) 7 b3 E7 j7 N$ e7 f) ?
  33.         ((((PERIPH) & 0x010BE800) == 0x00) && ((PERIPH) != 0x00))! ]! t1 l2 U- E* `- m
  34. #define IS_RCC_AHB1_RESET_PERIPH(PERIPH) 5 @! F# v5 J5 W3 `* \7 n& U
  35.         ((((PERIPH) & 0x51FE800) == 0x00) && ((PERIPH) != 0x00))
    $ N, c7 ~4 w: o* D
  36. #define IS_RCC_AHB1_LPMODE_PERIPH(PERIPH) ( X4 j  G3 i3 ~( s+ n5 Q" d: M
  37.         ((((PERIPH) & 0x01106800) == 0x00) && ((PERIPH) != 0x00))
    % N  `3 ~! k3 u" j. [
复制代码

% R, E" \0 K: T. ~RCC_APB1_Peripherals- _! W& k% b% @1 U) ?4 l0 B

$ D: B: N' a. l5 B; e8 b& L
  1. /** @defgroup RCC_APB1_Peripherals
    & f  b/ `/ U6 v. M6 @0 A1 {* m. d
  2.   * @{
      s6 O6 y: D* G8 b( H' e8 [
  3.   */ 3 }0 U! T- P- L. ?
  4. #define RCC_APB1Periph_TIM2              ((uint32_t)0x00000001)  L6 i6 q' b- L% s- |8 y* h
  5. #define RCC_APB1Periph_TIM3              ((uint32_t)0x00000002)
    . q9 C- j# z# q: ]% [
  6. #define RCC_APB1Periph_TIM4              ((uint32_t)0x00000004)
    7 l. w; ]+ \' F7 b# L* Y) c) f
  7. #define RCC_APB1Periph_TIM5              ((uint32_t)0x00000008)
    3 U; H; w4 U0 o3 c9 G/ ?; G# v4 t
  8. #define RCC_APB1Periph_TIM6              ((uint32_t)0x00000010)
    " N: }8 U& B8 c# E! G  t$ I0 [2 z, a
  9. #define RCC_APB1Periph_TIM7              ((uint32_t)0x00000020)4 s) A, A. \% I. J
  10. #define RCC_APB1Periph_TIM12             ((uint32_t)0x00000040)2 T( x+ _; y; h: |
  11. #define RCC_APB1Periph_TIM13             ((uint32_t)0x00000080)4 Z* p" n  B* V( I0 Z1 J$ p6 J
  12. #define RCC_APB1Periph_TIM14             ((uint32_t)0x00000100)
    : d" E4 n" C' b' j: t* Y$ d
  13. #if defined(STM32F410xx) || defined(STM32F413_423xx)
    ( A! @  `! N. l3 B. M+ w/ M2 {
  14. #define RCC_APB1Periph_LPTIM1            ((uint32_t)0x00000200)
    . Z" t% w& c; B, k6 w  ^; J# {
  15. #endif /* STM32F410xx || STM32F413_423xx *// ?1 Q* U$ t4 S; ?& J
  16. #define RCC_APB1Periph_WWDG              ((uint32_t)0x00000800)' y/ s# u/ H4 X7 \& m
  17. #define RCC_APB1Periph_SPI2              ((uint32_t)0x00004000)
    5 s2 g4 J' c. A5 v9 h% @9 L
  18. #define RCC_APB1Periph_SPI3              ((uint32_t)0x00008000)# C9 U  d. F% b$ x5 _4 E
  19. #if defined(STM32F446xx)
    $ _2 ?: b) D- W  c# o( W
  20. #define RCC_APB1Periph_SPDIFRX           ((uint32_t)0x00010000)
    $ ]: r, ~% I5 _: c  p9 T
  21. #endif /* STM32F446xx */ ( M" t3 p5 a1 n; [$ f' R
  22. #define RCC_APB1Periph_USART2            ((uint32_t)0x00020000)
    & b% H. w" m# S6 q8 f% Q1 [2 h
  23. #define RCC_APB1Periph_USART3            ((uint32_t)0x00040000)
    / U* j  A1 a4 s& F* Q0 r
  24. #define RCC_APB1Periph_UART4             ((uint32_t)0x00080000)6 I+ j. A* l) F& _
  25. #define RCC_APB1Periph_UART5             ((uint32_t)0x00100000)7 h1 v4 {9 e- ]; u( O1 @# q7 `/ c
  26. #define RCC_APB1Periph_I2C1              ((uint32_t)0x00200000)! s2 Y: h( E) v& g
  27. #define RCC_APB1Periph_I2C2              ((uint32_t)0x00400000)7 `9 e6 Y9 [, ~
  28. #define RCC_APB1Periph_I2C3              ((uint32_t)0x00800000)/ T" I& O: v! P/ D" {9 t' }0 L! _
  29. #if defined(STM32F410xx) || defined(STM32F412xG) ; ?. [- ^# o* d7 Y/ h
  30. || defined(STM32F413_423xx) || defined(STM32F446xx)
    " S0 V) z( J: _* Y. C) B
  31. #define RCC_APB1Periph_FMPI2C1           ((uint32_t)0x01000000)
    . {* k$ j+ k: W' c0 ?& g( \, b; u
  32. #endif /* STM32F410xx || STM32F446xx || STM32F413_423xx*/ 4 K% v' T6 \4 p/ k
  33. #define RCC_APB1Periph_CAN1              ((uint32_t)0x02000000)
    5 s4 k" s4 E# _! V2 \( H
  34. #define RCC_APB1Periph_CAN2              ((uint32_t)0x04000000)
    ' A; ?: x4 Y0 S+ x. g8 I& `% y
  35. #if defined(STM32F413_423xx)0 \$ l5 t3 w/ [. a4 R1 X4 l# k& \
  36. #define RCC_APB1Periph_CAN3              ((uint32_t)0x08000000)
    5 ~8 g/ n$ h1 E
  37. #endif /* STM32F413_423xx */9 x8 N) l8 E) q3 K+ C  U* S- f
  38. #if defined(STM32F446xx)
    ) O2 W" z  G$ t/ Q! ^$ E$ m
  39. #define RCC_APB1Periph_CEC               ((uint32_t)0x08000000); Q) a2 _1 K* H4 q/ A% N; u* M
  40. #endif /* STM32F446xx */
    2 y% K3 @, W) r- _" v: d$ y
  41. #define RCC_APB1Periph_PWR               ((uint32_t)0x10000000)  a0 l% O6 N& s
  42. #define RCC_APB1Periph_DAC               ((uint32_t)0x20000000)) C8 e3 o% T/ f1 k" {" h
  43. #define RCC_APB1Periph_UART7             ((uint32_t)0x40000000)- M. }8 R4 H, W5 B& q
  44. #define RCC_APB1Periph_UART8             ((uint32_t)0x80000000)2 j3 L6 P/ ^. j) p
  45. #define IS_RCC_APB1_PERIPH(PERIPH)
    / _* b( l  `2 J( I1 i
  46.     ((((PERIPH) & 0x00003600) == 0x00) && ((PERIPH) != 0x00))
复制代码
/ s( k! p& v( x* @, Y  d
RCC_APB2_Peripherals
( ^4 Y+ H, v5 c* C0 u0 q. }8 s7 _+ N  N8 v2 K% e2 x1 f2 x
  1. /** @defgroup RCC_APB2_Peripherals
    $ r( L: R, ], S) o( R4 ?
  2.   * @{7 |" j& l* d" _
  3.   */ & T6 |9 K2 U; g: V' D. \
  4. #define RCC_APB2Periph_TIM1              ((uint32_t)0x00000001)
    1 q* ?+ J8 ~+ p! `. g) L% B
  5. #define RCC_APB2Periph_TIM8              ((uint32_t)0x00000002)
    6 R4 l/ |  ^, x# [7 Y. ?
  6. #define RCC_APB2Periph_USART1            ((uint32_t)0x00000010)
    ! k5 w9 X+ }* [
  7. #define RCC_APB2Periph_USART6            ((uint32_t)0x00000020)7 S& i* b( k# f9 E; d8 T
  8. #define RCC_APB2Periph_ADC               ((uint32_t)0x00000100)
    1 g+ e7 ~  b3 T: i
  9. #define RCC_APB2Periph_ADC1              ((uint32_t)0x00000100)
    $ g3 V/ X: M+ g) \6 c3 I9 F
  10. #define RCC_APB2Periph_ADC2              ((uint32_t)0x00000200)7 q# z$ H1 E7 z1 Y: L
  11. #define RCC_APB2Periph_ADC3              ((uint32_t)0x00000400), O) Q. `* k7 g
  12. #define RCC_APB2Periph_SDIO              ((uint32_t)0x00000800)
    2 d+ n4 v* i( A& h6 h! n3 d- Z
  13. #define RCC_APB2Periph_SPI1              ((uint32_t)0x00001000)8 Z! p, H+ s! K( K2 s4 E
  14. #define RCC_APB2Periph_SPI4              ((uint32_t)0x00002000)( u! P. B, ]1 }& v* b! y
  15. #define RCC_APB2Periph_SYSCFG            ((uint32_t)0x00004000)
    7 }* |  c7 b- p* U: x+ N
  16. #define RCC_APB2Periph_EXTIT             ((uint32_t)0x00008000)1 O6 {1 t3 b- P
  17. #define RCC_APB2Periph_TIM9              ((uint32_t)0x00010000)
    % T8 T* t- t3 n9 i  o
  18. #define RCC_APB2Periph_TIM10             ((uint32_t)0x00020000)7 V# x, O  a- G
  19. #define RCC_APB2Periph_TIM11             ((uint32_t)0x00040000)
    ! I  s9 b, [" v: `2 I4 M1 Y4 R( D
  20. #define RCC_APB2Periph_SPI5              ((uint32_t)0x00100000)
    ! _, [0 I$ [" C) v! J# _) ?
  21. #define RCC_APB2Periph_SPI6              ((uint32_t)0x00200000), B  V" ^0 ~3 g6 w; E- s
  22. #define RCC_APB2Periph_SAI1              ((uint32_t)0x00400000)3 N2 M' u5 e6 L3 j
  23. #if defined(STM32F446xx) || defined(STM32F469_479xx)
    $ k/ U4 b& ~% E- e4 T
  24. #define RCC_APB2Periph_SAI2              ((uint32_t)0x00800000); q) I; {. q( h- m, Q' N/ ~* _) ^
  25. #endif /* STM32F446xx || STM32F469_479xx */* w& M2 }* Q) k: S) S" \
  26. #define RCC_APB2Periph_LTDC              ((uint32_t)0x04000000)0 e8 K7 k) ^8 x8 m7 ]! L" Y$ K
  27. #if defined(STM32F469_479xx)  t0 s5 \9 ~/ {, Q
  28. #define RCC_APB2Periph_DSI               ((uint32_t)0x08000000)
    , m2 |6 o" F. |) J2 k( Q6 N
  29. #endif /* STM32F469_479xx */% g- M9 Q  Q& x+ q  o
  30. #if defined(STM32F412xG) || defined(STM32F413_423xx)
    ' s& m! \8 L5 v) L! H
  31. #define RCC_APB2Periph_DFSDM1            ((uint32_t)0x01000000)
    2 v# i9 N; Z) J! D+ }9 G
  32. #endif /* STM32F412xG || STM32F413_423xx */& s- Z7 k( q3 t
  33. #if defined(STM32F413_423xx)
    4 N) Q: E2 C; q* x
  34. #define RCC_APB2Periph_DFSDM2            ((uint32_t)0x02000000)$ d1 V5 `0 r5 q
  35. #define RCC_APB2Periph_UART9             ((uint32_t)0x02000040)' B0 S+ T+ p7 Q7 x/ ~! l
  36. #define RCC_APB2Periph_UART10            ((uint32_t)0x00000080)% m  M% i4 I/ s0 H
  37. #endif /* STM32F413_423xx */- K' J' T% Z* A/ l# N* q
  38. 8 \- ^4 ~1 P7 p3 i' N
  39. /* Legacy Defines *// Q0 I- n$ l1 C  x' s7 Q
  40. #define RCC_APB2Periph_DFSDM              RCC_APB2Periph_DFSDM13 n/ |. k; p% X9 w- V# C( H
  41.   c  Y/ x! Y+ U( q
  42. #define IS_RCC_APB2_PERIPH(PERIPH)
    + Z$ I: b8 x- j) H7 r
  43.         ((((PERIPH) & 0xF008000C) == 0x00) && ((PERIPH) != 0x00))
    2 R4 W  \& b  n3 B) H7 m; }
  44. #define IS_RCC_APB2_RESET_PERIPH(PERIPH) ' s+ s) [9 K+ q8 J7 V
  45.         ((((PERIPH) & 0xF208860C) == 0x00) && ((PERIPH) != 0x00))
复制代码

- U, N2 f5 o% Y: Q+ G$ A1 V# I9 M* nRCC_MCO1_Clock_Source_Prescaler

# p8 E! W% ^, |& e6 X8 F1 X( y! K8 a$ Q3 h8 k" A+ V3 I9 v
  1. /** @defgroup RCC_MCO1_Clock_Source_Prescaler3 F% E. u. ?: m& I1 N! c
  2.   * @{9 {* L9 L# p4 k5 p! V/ F7 X3 Q
  3.   */* g& s" K! l$ |7 f* j: p( G, \
  4. #define RCC_MCO1Source_HSI               ((uint32_t)0x00000000)0 O( Q) H# y7 N2 Q, f
  5. #define RCC_MCO1Source_LSE               ((uint32_t)0x00200000)0 i) a; v( A) ?* }
  6. #define RCC_MCO1Source_HSE               ((uint32_t)0x00400000)
    4 e- _+ j. L; e$ y
  7. #define RCC_MCO1Source_PLLCLK            ((uint32_t)0x00600000)
    $ u# ~: D. c9 v- [4 g/ |
  8. #define RCC_MCO1Div_1                    ((uint32_t)0x00000000)
    1 z, [8 N+ r* g
  9. #define RCC_MCO1Div_2                    ((uint32_t)0x04000000)
    $ L# k0 u  o6 J' C6 c0 j
  10. #define RCC_MCO1Div_3                    ((uint32_t)0x05000000)7 u4 v& N  D! a) M+ h- D* O
  11. #define RCC_MCO1Div_4                    ((uint32_t)0x06000000)
    3 D/ U5 k2 p- g3 r' T5 [
  12. #define RCC_MCO1Div_5                    ((uint32_t)0x07000000)& C/ A2 f& k$ }: p; U. H6 Z
  13. #define IS_RCC_MCO1SOURCE(SOURCE) (((SOURCE) == RCC_MCO1Source_HSI)
    0 q6 U8 C6 R9 O) P; }7 C3 N5 O  |. [
  14. || ((SOURCE) == RCC_MCO1Source_LSE) || \
    - Y9 I5 E8 H, x' v0 m
  15. ((SOURCE) == RCC_MCO1Source_HSE) || ((SOURCE) == RCC_MCO1Source_PLLCLK))( E4 D. M0 q+ |: c& e0 q
  16.   U5 y4 F  ~( k0 W- p2 }
  17. #define IS_RCC_MCO1DIV(DIV) (((DIV) == RCC_MCO1Div_1) || ((DIV) == RCC_MCO1Div_2) || \/ g4 F. j4 j/ j4 }. F  c
  18.                              ((DIV) == RCC_MCO1Div_3) || ((DIV) == RCC_MCO1Div_4) || \
    / ~* C/ ^5 E, Z
  19.                              ((DIV) == RCC_MCO1Div_5))
复制代码
, v! l. V: z! |
RCC_MCO2_Clock_Source_Prescaler
0 K! P" c+ u0 s3 ?! I: ^  i
, N/ s) Y( j5 M, [- |
  1. /** @defgroup RCC_MCO2_Clock_Source_Prescaler5 i0 @" C8 ?0 ~! O3 A
  2.   * @{/ J% b6 l: C1 O) v  [- X
  3.   */0 v2 H1 m: M0 J8 y. h, m
  4. #define RCC_MCO2Source_SYSCLK            ((uint32_t)0x00000000)
    2 I2 q. k$ z) Y4 `: I( X- w
  5. #define RCC_MCO2Source_PLLI2SCLK         ((uint32_t)0x40000000). Y. n/ C4 O7 J( M
  6. #define RCC_MCO2Source_HSE               ((uint32_t)0x80000000)& z6 C! _9 K- w/ k) N- \
  7. #define RCC_MCO2Source_PLLCLK            ((uint32_t)0xC0000000)8 q9 [/ M( ?, d7 f
  8. #define RCC_MCO2Div_1                    ((uint32_t)0x00000000)2 X5 j7 z- v. z( @. a+ ?" g& F
  9. #define RCC_MCO2Div_2                    ((uint32_t)0x20000000), l' o; @$ q% d: l) r' h) `8 X
  10. #define RCC_MCO2Div_3                    ((uint32_t)0x28000000)
    ) ?9 m$ v4 t" T6 A5 h* O
  11. #define RCC_MCO2Div_4                    ((uint32_t)0x30000000)
    - J2 _, F( E* j6 Q$ B7 i0 Q% K
  12. #define RCC_MCO2Div_5                    ((uint32_t)0x38000000)
    9 Y$ \& F5 d- M
  13. #define IS_RCC_MCO2SOURCE(SOURCE) (((SOURCE) == RCC_MCO2Source_SYSCLK)
    + K  E* c9 L$ S
  14. || ((SOURCE) == RCC_MCO2Source_PLLI2SCLK)|| \
    ' p  r2 x/ h, n7 I1 O
  15.                                    ((SOURCE) == RCC_MCO2Source_HSE) , t/ ?; ?+ S. ^3 ~
  16.     || ((SOURCE) == RCC_MCO2Source_PLLCLK))
    ; G6 X5 Q  u! s
  17. 9 l; m* G0 r, m5 w
  18. #define IS_RCC_MCO2DIV(DIV) (((DIV) == RCC_MCO2Div_1) || ((DIV) == RCC_MCO2Div_2) || \& M& ~, }) }9 Q; ~+ z+ N# Q
  19.                              ((DIV) == RCC_MCO2Div_3) || ((DIV) == RCC_MCO2Div_4) || \% Z' @# C' T; U# b  W% O' Q
  20.                              ((DIV) == RCC_MCO2Div_5))   
复制代码
( i1 ^- k; B' @7 I
RCC_Flag/ `" w, \  d. e7 J( W4 _
0 F+ p- F- H3 t6 r
  1. /** @defgroup RCC_Flag
    % u+ C; Z% y. ~1 P' V
  2.   * @{
    ; A2 W. Q( p) }
  3.   */
    6 f( a% {0 W0 z& z; y7 E+ {, C
  4. #define RCC_FLAG_HSIRDY                  ((uint8_t)0x21)0 g" C) }, b$ \) j, I0 d7 c
  5. #define RCC_FLAG_HSERDY                  ((uint8_t)0x31)0 y2 z' B+ v4 T6 t4 I; K# \2 [
  6. #define RCC_FLAG_PLLRDY                  ((uint8_t)0x39)
    , [. {6 k9 w! ?! c
  7. #define RCC_FLAG_PLLI2SRDY               ((uint8_t)0x3B)
    6 O* u- e7 o+ E5 q4 l" ]
  8. #define RCC_FLAG_PLLSAIRDY               ((uint8_t)0x3D)
    ( q1 p1 f- {3 q- h
  9. #define RCC_FLAG_LSERDY                  ((uint8_t)0x41)
    9 q* O: ^4 Q2 S( b# s
  10. #define RCC_FLAG_LSIRDY                  ((uint8_t)0x61)* S6 m7 f8 v6 w1 V1 j
  11. #define RCC_FLAG_BORRST                  ((uint8_t)0x79)
    & s6 u) A  K7 {: Q, f# v! {8 E
  12. #define RCC_FLAG_PINRST                  ((uint8_t)0x7A)" h0 E2 J  z, P2 n" T
  13. #define RCC_FLAG_PORRST                  ((uint8_t)0x7B)* R* ~* a! k* A) F  `- W8 U) V5 U1 l
  14. #define RCC_FLAG_SFTRST                  ((uint8_t)0x7C)
    3 ?" B/ p$ K" {0 o+ ?. n
  15. #define RCC_FLAG_IWDGRST                 ((uint8_t)0x7D)
    5 P8 K. @- K; ]+ V' M3 N
  16. #define RCC_FLAG_WWDGRST                 ((uint8_t)0x7E)( L7 z6 s/ f6 D7 G0 J
  17. #define RCC_FLAG_LPWRRST                 ((uint8_t)0x7F); x, A3 r6 a7 n; Y' B6 J3 C
  18. ! q; Y( r. M6 \; W( U) V6 G( ~
  19. #define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSIRDY)   || ((FLAG) == RCC_FLAG_HSERDY) || \
    ) R' j7 S+ U7 ~4 n) l- f2 y/ o
  20.                            ((FLAG) == RCC_FLAG_PLLRDY)   || ((FLAG) == RCC_FLAG_LSERDY) || \
    1 q, r/ L0 f! N4 z) \# x2 r
  21.                            ((FLAG) == RCC_FLAG_LSIRDY)   || ((FLAG) == RCC_FLAG_BORRST) || \$ B5 i% k' b* D3 V5 U% `
  22.                            ((FLAG) == RCC_FLAG_PINRST)   || ((FLAG) == RCC_FLAG_PORRST) || \
    - t# ]' b! O- Z. T
  23.                            ((FLAG) == RCC_FLAG_SFTRST)   || ((FLAG) == RCC_FLAG_IWDGRST)|| \
    9 J% [# W9 v# u
  24.                            ((FLAG) == RCC_FLAG_WWDGRST)  || ((FLAG) == RCC_FLAG_LPWRRST)|| \2 Q5 v+ p8 K% |& F
  25.                            ((FLAG) == RCC_FLAG_PLLI2SRDY)|| ((FLAG) == RCC_FLAG_PLLSAIRDY))
    , h4 W( O  H) @3 f' p8 W5 C8 p
  26. 5 I3 g! }$ M" V: e2 `
  27. #define IS_RCC_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x1F)
复制代码
5 C5 Q3 a, M- @# {  ]- M2 o
03. 相关函数
+ U" \% _& ^6 d5 Y2 y6 Z
  1. /* Function used to set the RCC clock configuration to the default reset state */- y1 t: N4 L" Q. o/ m  g( E8 ^
  2. void        RCC_DeInit(void);
    7 X- c0 f+ }; [, E
  3. / q2 Z0 k% P- ^7 }
  4. /* Internal/external clocks, PLL, CSS and MCO configuration functions *********/
    " `( n4 c' p' ~1 \1 b) T/ p1 n
  5. void        RCC_HSEConfig(uint8_t RCC_HSE);! b5 H0 |9 E) ]% {% P$ y+ _
  6. ErrorStatus RCC_WaitForHSEStartUp(void);
    1 H3 C& n6 Y# f, G% P0 x% [% v  @
  7. void        RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue);2 ^  m# s1 |- E% y1 M. Y
  8. void        RCC_HSICmd(FunctionalState NewState);
    5 v, H+ T5 b) x* F+ `9 C$ s5 U  f
  9. void        RCC_LSEConfig(uint8_t RCC_LSE);: `. Q3 z$ W' \1 ^7 ^
  10. void        RCC_LSICmd(FunctionalState NewState);' q+ d6 T  o7 H: i: g( H
  11. * S" J( t6 X; \4 }  L2 u2 o& o- R( _
  12. void        RCC_PLLCmd(FunctionalState NewState);' ~$ p3 T- R% A3 [& X
  13. ( W$ V* U9 x; x& j. e' F# p2 ~
  14. void        RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t PLLM, uint32_t PLLN,
      `$ v* h9 h1 o( ?8 q6 m' I
  15.                           uint32_t PLLP, uint32_t PLLQ);
    ; T4 j8 J. i$ s& W- L

  16. / ^: h8 M9 g; s7 g" f
  17. void        RCC_PLLI2SCmd(FunctionalState NewState);( k9 A6 n3 o9 `5 Q3 n4 ^( _, z

  18. - Q/ l' [3 s' E8 d1 q9 l; j( r' i
  19. void        RCC_PLLI2SConfig(uint32_t PLLI2SN, uint32_t PLLI2SR);
    1 o. O, s3 r6 l7 G! a
  20. % g8 Z# L6 L- V& t5 M0 H$ U* k

  21. : t- r8 x# b  `7 t
  22. void        RCC_PLLSAICmd(FunctionalState NewState);) Z) z) n+ G0 U# o9 C# d
  23. * \! I' Y0 B, f: M# j
  24. void        RCC_PLLSAIConfig(uint32_t PLLSAIN, uint32_t PLLSAIQ, uint32_t PLLSAIR);5 y& H0 E$ d! t" \4 Q" j, e
  25. void        RCC_ClockSecuritySystemCmd(FunctionalState NewState);
      T: Q4 `( }, Q
  26. void        RCC_MCO1Config(uint32_t RCC_MCO1Source, uint32_t RCC_MCO1Div);
    5 P+ x# m' A' N) I$ d
  27. void        RCC_MCO2Config(uint32_t RCC_MCO2Source, uint32_t RCC_MCO2Div);& t* f) G  \; q# k
  28. $ X/ i& [# [, i0 T* u: b
  29. - Y* C' Y+ v; R) \. X/ a/ F
  30. /* System, AHB and APB busses clocks configuration functions ******************/& u/ V5 R2 M6 u, X9 c" ]3 X* ^; ~
  31. void        RCC_SYSCLKConfig(uint32_t RCC_SYSCLKSource);
    & y+ G  s& E' `6 f# C/ P7 n! M
  32. uint8_t     RCC_GetSYSCLKSource(void);9 P  g$ y- t. ?& F9 l
  33. void        RCC_HCLKConfig(uint32_t RCC_SYSCLK);8 Q. P2 q$ Z: G' u7 W8 I; J$ N
  34. void        RCC_PCLK1Config(uint32_t RCC_HCLK);* J2 E* b% h7 v* n/ W0 m
  35. void        RCC_PCLK2Config(uint32_t RCC_HCLK);
    ' B+ X  U5 P, v- J2 _$ ~. E
  36. void        RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks);
    2 _- e+ X) B  {: L" t

  37. , o* x* I: ^/ h1 T, n/ ?' s* y* e
  38. /* Peripheral clocks configuration functions **********************************/. i+ Q$ R1 s, ], y) B
  39. void        RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSource);
    5 I+ \( h0 F4 j( Y# ^
  40. void        RCC_RTCCLKCmd(FunctionalState NewState);9 |1 J8 @! t9 n5 a. m6 x4 W
  41. void        RCC_BackupResetCmd(FunctionalState NewState);
    4 v; s8 W/ ~  l, w0 N. Y( I& e
  42. % K" i% N9 U' @0 Q# s) g- U3 A

  43. # ^9 r$ {( }3 u+ s1 ~
  44. void        RCC_I2SCLKConfig(uint32_t RCC_I2SCLKSource);
    ' ?& [+ p# u! S' B8 _
  45. " Z* m/ I8 l! D, t  D
  46. ) ^6 M1 n% ?" O! x2 N4 k1 k6 W
  47. void        RCC_SAIBlockACLKConfig(uint32_t RCC_SAIBlockACLKSource);
    " i1 f6 D+ U  s0 S' d+ {
  48. void        RCC_SAIBlockBCLKConfig(uint32_t RCC_SAIBlockBCLKSource);
    / M; D, B0 ]7 n

  49. 9 M8 a$ |; `9 @+ @& ?5 k

  50. ( p  G1 H& S/ u
  51. void        RCC_SAIPLLI2SClkDivConfig(uint32_t RCC_PLLI2SDivQ);
    & V0 g9 Z9 s8 X9 F9 H. {1 v/ T
  52. void        RCC_SAIPLLSAIClkDivConfig(uint32_t RCC_PLLSAIDivQ);
    1 I& S8 I' r! {* ]" i+ t$ \0 T

  53. 7 I! F& `5 f! J3 M
  54. 0 F; ?2 e9 [7 f, H. q5 o& S( n
  55. void        RCC_LTDCCLKDivConfig(uint32_t RCC_PLLSAIDivR);
    . E/ r/ L' z- K
  56. void        RCC_TIMCLKPresConfig(uint32_t RCC_TIMCLKPrescaler);" n4 O. n* p( O$ b6 Q" T5 f; y
  57. : ]6 U' J1 f% R: p2 l- Y! y
  58. void        RCC_AHB1PeriphClockCmd(uint32_t RCC_AHB1Periph, FunctionalState NewState);; ?& h" Z/ C# x
  59. void        RCC_AHB2PeriphClockCmd(uint32_t RCC_AHB2Periph, FunctionalState NewState);+ ^) H# |7 ?1 G
  60. void        RCC_AHB3PeriphClockCmd(uint32_t RCC_AHB3Periph, FunctionalState NewState);
    ; _- I8 f1 ^$ S. t6 {: S
  61. void        RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
    4 ^" B) b; e7 b8 Z; a
  62. void        RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
    ) I# T& {' R1 l3 O/ {3 P) h2 {

  63. * x- t* l$ u- q* c6 K' D* K
  64. void        RCC_AHB1PeriphResetCmd(uint32_t RCC_AHB1Periph, FunctionalState NewState);
    4 }9 ~, c4 R! T0 R( i
  65. void        RCC_AHB2PeriphResetCmd(uint32_t RCC_AHB2Periph, FunctionalState NewState);
    / q: d- K8 h/ m+ X2 Z
  66. void        RCC_AHB3PeriphResetCmd(uint32_t RCC_AHB3Periph, FunctionalState NewState);
    8 Y. w% \' U9 |' r" ?' N" y
  67. void        RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
    . G. r' T: ]- S3 T- \
  68. void        RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
    3 k# t- N6 z1 r) o* m

  69. $ @$ R5 v8 t# d! D2 z; B
  70. void        RCC_AHB1PeriphClockLPModeCmd(uint32_t RCC_AHB1Periph, FunctionalState NewState);
    & z4 e0 `' c( [4 i0 {) o( g
  71. void        RCC_AHB2PeriphClockLPModeCmd(uint32_t RCC_AHB2Periph, FunctionalState NewState);4 v0 \+ H& F7 w$ B$ q- k
  72. void        RCC_AHB3PeriphClockLPModeCmd(uint32_t RCC_AHB3Periph, FunctionalState NewState);: k/ V+ s7 k/ K1 `9 |" o. H- B
  73. void        RCC_APB1PeriphClockLPModeCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
    7 E5 j" O- `" o( L) `$ |& d
  74. void        RCC_APB2PeriphClockLPModeCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);1 H# a2 ]" d2 t8 M) ^7 f
  75. / N( k$ Q( v. a4 O

  76. & x& l  R7 R0 a% M+ l1 j, [& x
  77. /* Interrupts and flags management functions **********************************/
    : `  [2 h) x9 d8 ^  i
  78. void        RCC_ITConfig(uint8_t RCC_IT, FunctionalState NewState);
    . b$ E+ t0 R' O+ n& Y) v
  79. FlagStatus  RCC_GetFlagStatus(uint8_t RCC_FLAG);6 n* a6 b7 h) B* ]1 u/ E& I
  80. void        RCC_ClearFlag(void);- M+ E  o2 i. N1 C0 F$ p0 M1 I% D( N4 {
  81. ITStatus    RCC_GetITStatus(uint8_t RCC_IT);% o9 p6 h. ?, {2 M" F
  82. void        RCC_ClearITPendingBit(uint8_t RCC_IT);
复制代码
3 ]* k2 E" Y: v6 ]+ R
04. 结构体封装
5 l# G9 b. f! H" h
  1. /** % a7 Q, k- [4 q% w/ }
  2.   * @brief Reset and Clock Control
    . @" z" `! j4 }# V: M9 Y
  3.   */) ~0 `3 l$ c2 _2 n  l
  4. / P7 B& k, W" s* X9 {
  5. typedef struct
    ( N! q. N" p: j
  6. {
    3 F5 ~/ M0 x9 }
  7.   __IO uint32_t CR;            /*!< RCC clock control register,                                  Address offset: 0x00 */
    # w6 g* D3 `9 V5 m9 g
  8.   __IO uint32_t PLLCFGR;       /*!< RCC PLL configuration register,                              Address offset: 0x04 */7 P& G5 N# R0 G; ?7 j) V( F
  9.   __IO uint32_t CFGR;          /*!< RCC clock configuration register,                            Address offset: 0x08 */# a: c/ c" D: R) C: E
  10.   __IO uint32_t CIR;           /*!< RCC clock interrupt register,                                Address offset: 0x0C */, |: H0 Z! a# D6 l
  11.   __IO uint32_t AHB1RSTR;      /*!< RCC AHB1 peripheral reset register,                          Address offset: 0x10 */; h; H$ H, z; f8 _. Z* b
  12.   __IO uint32_t AHB2RSTR;      /*!< RCC AHB2 peripheral reset register,                          Address offset: 0x14 */
    0 k: t- ~+ m# A- j; b1 R
  13.   __IO uint32_t AHB3RSTR;      /*!< RCC AHB3 peripheral reset register,                          Address offset: 0x18 */
    ; f' K: b0 M8 G, h; ]
  14.   uint32_t      RESERVED0;     /*!< Reserved, 0x1C                                                                    */
    1 z% N, E4 y7 A
  15.   __IO uint32_t APB1RSTR;      /*!< RCC APB1 peripheral reset register,                          Address offset: 0x20 */
    ; Q" y+ s" e0 F  v6 X% Y; U
  16.   __IO uint32_t APB2RSTR;      /*!< RCC APB2 peripheral reset register,                          Address offset: 0x24 */& O# K) R4 W& W
  17.   uint32_t      RESERVED1[2];  /*!< Reserved, 0x28-0x2C                                                               */
    0 e# J$ v/ X- \: j) u
  18.   __IO uint32_t AHB1ENR;       /*!< RCC AHB1 peripheral clock register,                          Address offset: 0x30 */
    6 q5 @- D' s' n) w
  19.   __IO uint32_t AHB2ENR;       /*!< RCC AHB2 peripheral clock register,                          Address offset: 0x34 */
    5 s5 J+ E6 r7 d- l4 p: x) W
  20.   __IO uint32_t AHB3ENR;       /*!< RCC AHB3 peripheral clock register,                          Address offset: 0x38 */
    6 [, M% L8 C; k# o9 ~$ J7 j
  21.   uint32_t      RESERVED2;     /*!< Reserved, 0x3C                                                                    */
    4 q' Y0 {$ P/ a; p6 B
  22.   __IO uint32_t APB1ENR;       /*!< RCC APB1 peripheral clock enable register,                   Address offset: 0x40 */
    - e- i2 H1 u3 j9 m" T9 i. `( Q
  23.   __IO uint32_t APB2ENR;       /*!< RCC APB2 peripheral clock enable register,                   Address offset: 0x44 */6 D/ t0 v7 }1 d7 X
  24.   uint32_t      RESERVED3[2];  /*!< Reserved, 0x48-0x4C                                                               */
    " z7 ~7 ~( A8 W* g$ }2 Z3 k8 O
  25.   __IO uint32_t AHB1LPENR;     /*!< RCC AHB1 peripheral clock enable in low power mode register, Address offset: 0x50 */: N  o1 L( d1 @+ a' g9 u) l# c
  26.   __IO uint32_t AHB2LPENR;     /*!< RCC AHB2 peripheral clock enable in low power mode register, Address offset: 0x54 */' T! \1 x' W6 f  g
  27.   __IO uint32_t AHB3LPENR;     /*!< RCC AHB3 peripheral clock enable in low power mode register, Address offset: 0x58 */
    5 l* i9 z4 O, L8 e/ i  X' S
  28.   uint32_t      RESERVED4;     /*!< Reserved, 0x5C                                                                    */) {7 Z& f' S/ W+ T
  29.   __IO uint32_t APB1LPENR;     /*!< RCC APB1 peripheral clock enable in low power mode register, Address offset: 0x60 */
    ) _2 |8 M. v% }4 t$ z
  30.   __IO uint32_t APB2LPENR;     /*!< RCC APB2 peripheral clock enable in low power mode register, Address offset: 0x64 */, s4 Q. f1 \* t7 o" ]
  31.   uint32_t      RESERVED5[2];  /*!< Reserved, 0x68-0x6C                                                               */) m, }# W3 A$ [6 m1 k1 \. T
  32.   __IO uint32_t BDCR;          /*!< RCC Backup domain control register,                          Address offset: 0x70 */
    3 N) g/ g. P7 J1 p$ Q3 ^
  33.   __IO uint32_t CSR;           /*!< RCC clock control & status register,                         Address offset: 0x74 */
    - c, i& A8 U% T: V* O
  34.   uint32_t      RESERVED6[2];  /*!< Reserved, 0x78-0x7C                                                               */; n: J5 S4 i8 H
  35.   __IO uint32_t SSCGR;         /*!< RCC spread spectrum clock generation register,               Address offset: 0x80 */- R- o; G; ^2 e
  36.   __IO uint32_t PLLI2SCFGR;    /*!< RCC PLLI2S configuration register,                           Address offset: 0x84 */
      B! w/ Y& M2 C2 w  v0 p
  37.   __IO uint32_t PLLSAICFGR;    /*!< RCC PLLSAI configuration register,                           Address offset: 0x88 */
    2 ?# r/ T8 k3 ]; r# I5 G3 F
  38.   __IO uint32_t DCKCFGR;       /*!< RCC Dedicated Clocks configuration register,                 Address offset: 0x8C */  B' ]7 _6 p! g
  39.   __IO uint32_t CKGATENR;      /*!< RCC Clocks Gated Enable Register,                            Address offset: 0x90 */ /* Only for STM32F412xG, STM32413_423xx and STM32F446xx devices */
    * F$ I# @: ?# P! i* f. r  m0 F) Q
  40.   __IO uint32_t DCKCFGR2;      /*!< RCC Dedicated Clocks configuration register 2,               Address offset: 0x94 */ /* Only for STM32F410xx, STM32F412xG, STM32413_423xx and STM32F446xx devices */
    ) O: V  A* e- h- Z7 D- U/ e- o  l6 F

  41. / G- }$ O$ l2 N- d9 Z4 f1 g. n5 U
  42. } RCC_TypeDef;3 w6 I9 B, U# C% I! ]* [
复制代码
9 g5 F( q8 R4 Q9 R0 k+ c
05. 其它- C, n# w/ t# e+ H
  1. /******************************************************************************/
    ; f& r7 i; _; W7 j" S6 ]+ |
  2. /*                                                                            */
    5 w( C: O3 J3 o% J$ r" H& N
  3. /*                         Reset and Clock Control                            */5 A: s' w7 t8 m+ q
  4. /*                                                                            */& S8 s/ D; x; q) e8 }
  5. /******************************************************************************/
    . c1 M) K) o# Q  c& ]9 T  ]1 L
  6. /********************  Bit definition for RCC_CR register  ********************/- t3 ^2 \5 v1 O
  7. #define  RCC_CR_HSION                        ((uint32_t)0x00000001)
    . L. i+ C- K& H+ r/ Y
  8. #define  RCC_CR_HSIRDY                       ((uint32_t)0x00000002)* h# q! Z  E$ o3 R$ t% H

  9. + i" B' W8 Z( W) ]# [% _7 X
  10. #define  RCC_CR_HSITRIM                      ((uint32_t)0x000000F8)- Z* o" d1 r3 M. S/ d1 b
  11. #define  RCC_CR_HSITRIM_0                    ((uint32_t)0x00000008)/*!<Bit 0 */
    ; z5 w8 H& W% {% [
  12. #define  RCC_CR_HSITRIM_1                    ((uint32_t)0x00000010)/*!<Bit 1 */
    # G$ g5 ~  e# B- }' {
  13. #define  RCC_CR_HSITRIM_2                    ((uint32_t)0x00000020)/*!<Bit 2 *// ]! V7 r5 x% K- j
  14. #define  RCC_CR_HSITRIM_3                    ((uint32_t)0x00000040)/*!<Bit 3 */
    ! H- m, c7 K- b4 j& L
  15. #define  RCC_CR_HSITRIM_4                    ((uint32_t)0x00000080)/*!<Bit 4 */
      Q/ c9 G/ I* C; |4 E

  16. $ w3 M/ _0 m' I2 k/ U9 L% E
  17. #define  RCC_CR_HSICAL                       ((uint32_t)0x0000FF00)
    : g1 x& m+ N6 g' _2 s. j: T
  18. #define  RCC_CR_HSICAL_0                     ((uint32_t)0x00000100)/*!<Bit 0 */
    6 c+ h+ V+ S3 J* _
  19. #define  RCC_CR_HSICAL_1                     ((uint32_t)0x00000200)/*!<Bit 1 */" S3 N/ T" F+ H+ M" Y
  20. #define  RCC_CR_HSICAL_2                     ((uint32_t)0x00000400)/*!<Bit 2 */
    8 U* k, I. O: ~6 ]: `4 Q
  21. #define  RCC_CR_HSICAL_3                     ((uint32_t)0x00000800)/*!<Bit 3 */
    " c& U& ]& g! O) V9 u+ h2 l, \& }
  22. #define  RCC_CR_HSICAL_4                     ((uint32_t)0x00001000)/*!<Bit 4 */- n- W0 F* f; a: ~
  23. #define  RCC_CR_HSICAL_5                     ((uint32_t)0x00002000)/*!<Bit 5 */
    2 Z0 F" w* }) k0 y
  24. #define  RCC_CR_HSICAL_6                     ((uint32_t)0x00004000)/*!<Bit 6 */
    6 ?, A9 _3 ?# N+ t  d+ F( A
  25. #define  RCC_CR_HSICAL_7                     ((uint32_t)0x00008000)/*!<Bit 7 */
    0 U" a" [6 o2 I1 ]/ S7 Y7 m- m$ G/ a; z
  26. ' f  b: Q2 L" m" d
  27. #define  RCC_CR_HSEON                        ((uint32_t)0x00010000)
    ' y- y* ^0 x9 O2 S% M% |, K2 L# F' E
  28. #define  RCC_CR_HSERDY                       ((uint32_t)0x00020000)( Q$ K$ k+ g# ^6 i3 i
  29. #define  RCC_CR_HSEBYP                       ((uint32_t)0x00040000)8 q( Z% Q: n, H# f& Q( K
  30. #define  RCC_CR_CSSON                        ((uint32_t)0x00080000)
    1 e$ \6 g8 v4 D$ W) b- w: T. O% z. x
  31. #define  RCC_CR_PLLON                        ((uint32_t)0x01000000)+ L* w" s4 a- d2 ~$ I) r1 t
  32. #define  RCC_CR_PLLRDY                       ((uint32_t)0x02000000)! G2 m* w5 M* V9 }$ s7 O4 e
  33. #define  RCC_CR_PLLI2SON                     ((uint32_t)0x04000000)
    4 ~! F* U' ]; y- T
  34. #define  RCC_CR_PLLI2SRDY                    ((uint32_t)0x08000000)
    0 o7 ?" ?& X+ V
  35. #define  RCC_CR_PLLSAION                     ((uint32_t)0x10000000). z& K! f; D/ h9 F
  36. #define  RCC_CR_PLLSAIRDY                    ((uint32_t)0x20000000)' V+ ^  V* y# C8 Z
  37. 1 q7 R2 h! m2 r
  38. /********************  Bit definition for RCC_PLLCFGR register  ***************/- q# D% r, H0 x+ }
  39. #define  RCC_PLLCFGR_PLLM                    ((uint32_t)0x0000003F)
    & c# a/ Y7 ]( {& v
  40. #define  RCC_PLLCFGR_PLLM_0                  ((uint32_t)0x00000001)4 R8 x5 g( e' n1 R+ H8 H
  41. #define  RCC_PLLCFGR_PLLM_1                  ((uint32_t)0x00000002)! s& Z# L2 P; C/ f6 h1 `! X0 }6 x
  42. #define  RCC_PLLCFGR_PLLM_2                  ((uint32_t)0x00000004)) d4 [! B- f! }
  43. #define  RCC_PLLCFGR_PLLM_3                  ((uint32_t)0x00000008)
    ! t. r* B4 O+ m. ]2 G
  44. #define  RCC_PLLCFGR_PLLM_4                  ((uint32_t)0x00000010)8 ?4 [1 m. ^  f3 R! o
  45. #define  RCC_PLLCFGR_PLLM_5                  ((uint32_t)0x00000020)
    6 g; J1 t' \+ ?$ N6 Q3 g: i
  46. , D7 S4 ?6 y+ Q0 Q. n
  47. #define  RCC_PLLCFGR_PLLN                     ((uint32_t)0x00007FC0)
    * v' Q" m2 Z6 \# y+ h3 K- _1 Y! a
  48. #define  RCC_PLLCFGR_PLLN_0                   ((uint32_t)0x00000040)
    $ z$ a& ?! q2 \9 R) D$ X
  49. #define  RCC_PLLCFGR_PLLN_1                   ((uint32_t)0x00000080)
    / v/ t  M7 L. c- l9 s, ?
  50. #define  RCC_PLLCFGR_PLLN_2                   ((uint32_t)0x00000100)" H4 I1 v0 D- F/ H, V
  51. #define  RCC_PLLCFGR_PLLN_3                   ((uint32_t)0x00000200)
    0 R9 }* e& L( n" V8 e
  52. #define  RCC_PLLCFGR_PLLN_4                   ((uint32_t)0x00000400)
    ( Q$ h7 S" o$ I2 d+ c' A
  53. #define  RCC_PLLCFGR_PLLN_5                   ((uint32_t)0x00000800)  S4 ^, Y+ G9 @, @' f+ N6 l6 Q
  54. #define  RCC_PLLCFGR_PLLN_6                   ((uint32_t)0x00001000)
    3 J0 g1 n( l  U: H. o3 p7 J# C0 ~
  55. #define  RCC_PLLCFGR_PLLN_7                   ((uint32_t)0x00002000)
    9 z  D6 B; o8 F3 f: X9 a) h0 c
  56. #define  RCC_PLLCFGR_PLLN_8                   ((uint32_t)0x00004000)
    : F- r$ n% c/ r

  57. # E' U# T, R! w$ f
  58. #define  RCC_PLLCFGR_PLLP                    ((uint32_t)0x00030000)1 ^- G6 ?. u- T$ O( z
  59. #define  RCC_PLLCFGR_PLLP_0                  ((uint32_t)0x00010000)8 ^: W$ j: l7 |( O# u- S: y- o
  60. #define  RCC_PLLCFGR_PLLP_1                  ((uint32_t)0x00020000)  m& Z8 {- g2 @0 C
  61. 8 m. c* D) J& R/ X% \( A$ p' \
  62. #define  RCC_PLLCFGR_PLLSRC                  ((uint32_t)0x00400000): Z# s1 M: H. L' g8 L% C
  63. #define  RCC_PLLCFGR_PLLSRC_HSE              ((uint32_t)0x00400000)9 X# V" W* }  Z* Q) I
  64. #define  RCC_PLLCFGR_PLLSRC_HSI              ((uint32_t)0x00000000)8 @/ z7 l: G: N5 p) ~2 v

  65. 7 H8 L+ X5 l) ]- d- g9 H# A9 ]& Q
  66. #define  RCC_PLLCFGR_PLLQ                    ((uint32_t)0x0F000000)
    ' L* _) c7 |# s
  67. #define  RCC_PLLCFGR_PLLQ_0                  ((uint32_t)0x01000000)+ D) a5 ?6 {2 U1 S! f
  68. #define  RCC_PLLCFGR_PLLQ_1                  ((uint32_t)0x02000000)
    5 Z0 F- ^8 W3 c4 h; z0 x
  69. #define  RCC_PLLCFGR_PLLQ_2                  ((uint32_t)0x04000000)6 x" R+ `: V6 N' T' A/ {: t
  70. #define  RCC_PLLCFGR_PLLQ_3                  ((uint32_t)0x08000000)) y5 o( |/ z1 s2 D

  71. 1 }9 z) f1 D% l8 L5 y4 d
  72. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx)
    9 H+ ~/ x+ D; W0 [; G0 T
  73. #define  RCC_PLLCFGR_PLLR                    ((uint32_t)0x70000000)& {; J0 x: A( Z- |# l* t
  74. #define  RCC_PLLCFGR_PLLR_0                  ((uint32_t)0x10000000)
    : u# o& j: l9 e4 o6 x, a7 O: l9 U
  75. #define  RCC_PLLCFGR_PLLR_1                  ((uint32_t)0x20000000)9 r% H2 J. H  m) u& Q
  76. #define  RCC_PLLCFGR_PLLR_2                  ((uint32_t)0x40000000)) ^8 V: t0 g8 U0 m" S, O
  77. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */
    7 I3 I6 b6 v3 d7 J* G

  78.   a# p  J7 P1 O3 V( i
  79. /********************  Bit definition for RCC_CFGR register  ******************/* _4 ~9 o, R0 p" G; F3 k
  80. /*!< SW configuration */7 R( u" K4 K3 @
  81. #define  RCC_CFGR_SW                         ((uint32_t)0x00000003)        /*!< SW[1:0] bits (System clock Switch) */
    5 T* T) W5 f6 k
  82. #define  RCC_CFGR_SW_0                       ((uint32_t)0x00000001)        /*!< Bit 0 */
    & g/ s, |1 c% H0 U% l
  83. #define  RCC_CFGR_SW_1                       ((uint32_t)0x00000002)        /*!< Bit 1 */9 j$ z! G7 @6 e

  84. # L9 H* r: d2 {# s. Z3 Q
  85. #define  RCC_CFGR_SW_HSI                     ((uint32_t)0x00000000)        /*!< HSI selected as system clock */- I2 D& B3 ~  C: V6 S
  86. #define  RCC_CFGR_SW_HSE                     ((uint32_t)0x00000001)        /*!< HSE selected as system clock */0 `! ~# P- c3 O; W$ s- F
  87. #define  RCC_CFGR_SW_PLL                     ((uint32_t)0x00000002)        /*!< PLL/PLLP selected as system clock */
    / e) \8 L2 W# g" o4 A$ @9 t
  88. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx)7 c4 s  E6 y4 p8 Q3 C; o1 {
  89. #define  RCC_CFGR_SW_PLLR                    ((uint32_t)0x00000003)        /*!< PLL/PLLR selected as system clock */2 s1 S; z" F/ K% C, h
  90. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */# I$ _: r: Z) A* g1 q6 O) j, e

  91.   d- P8 }6 ^3 |. e+ q
  92. /*!< SWS configuration */
    3 T" ?, w% Q1 ]9 A* u/ J+ f( k. K
  93. #define  RCC_CFGR_SWS                        ((uint32_t)0x0000000C)        /*!< SWS[1:0] bits (System Clock Switch Status) */
    " H" [0 K) R1 {, E% C6 E9 g
  94. #define  RCC_CFGR_SWS_0                      ((uint32_t)0x00000004)        /*!< Bit 0 */5 _: y# t5 A8 Z* [! f/ l" Z
  95. #define  RCC_CFGR_SWS_1                      ((uint32_t)0x00000008)        /*!< Bit 1 */- @  W+ M7 [$ f: ^" G) T8 K

  96. ( B9 y7 \5 G6 d: R. F
  97. #define  RCC_CFGR_SWS_HSI                    ((uint32_t)0x00000000)        /*!< HSI oscillator used as system clock */+ b" _& L2 x/ g8 w
  98. #define  RCC_CFGR_SWS_HSE                    ((uint32_t)0x00000004)        /*!< HSE oscillator used as system clock */  o/ K9 }. ~& b3 C' d% @
  99. #define  RCC_CFGR_SWS_PLL                    ((uint32_t)0x00000008)        /*!< PLL/PLLP used as system clock       */
    4 ]6 s+ v/ Q& Q  R) d; _4 V
  100. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F469_479xx) || defined(STM32F446xx)
    5 f! n% o3 L) ^
  101. #define  RCC_CFGR_SWS_PLLR                   ((uint32_t)0x0000000C)        /*!< PLL/PLLR used as system clock       */
    6 x! |% F7 s6 ]$ X6 s+ g- j, ?" |
  102. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */% R; X$ D7 {) V# |3 h3 h

  103. 5 H% Y* ^" \! N  [, z: q$ U
  104. /*!< HPRE configuration */8 N; S( M' C9 g7 ]2 N" U8 n
  105. #define  RCC_CFGR_HPRE                       ((uint32_t)0x000000F0)        /*!< HPRE[3:0] bits (AHB prescaler) */
    ' ~7 G9 s/ C6 R! P
  106. #define  RCC_CFGR_HPRE_0                     ((uint32_t)0x00000010)        /*!< Bit 0 */
    $ |  v7 A+ p# y; Z
  107. #define  RCC_CFGR_HPRE_1                     ((uint32_t)0x00000020)        /*!< Bit 1 */
    $ I; u) `, |5 B8 b( |9 A
  108. #define  RCC_CFGR_HPRE_2                     ((uint32_t)0x00000040)        /*!< Bit 2 */
    % A9 n; @& S! Q: L! S/ I
  109. #define  RCC_CFGR_HPRE_3                     ((uint32_t)0x00000080)        /*!< Bit 3 */
    % B- o3 o9 |2 R/ T, Y3 M
  110. ) Y0 @* D. `9 `" h2 X
  111. #define  RCC_CFGR_HPRE_DIV1                  ((uint32_t)0x00000000)        /*!< SYSCLK not divided */
    5 g% Y' b5 V( z# c, X5 Q0 o8 g
  112. #define  RCC_CFGR_HPRE_DIV2                  ((uint32_t)0x00000080)        /*!< SYSCLK divided by 2 */5 ]# r. M  _' T/ L. c( P# M/ I( m2 T
  113. #define  RCC_CFGR_HPRE_DIV4                  ((uint32_t)0x00000090)        /*!< SYSCLK divided by 4 */8 f4 d8 i( t. r& F8 M9 l
  114. #define  RCC_CFGR_HPRE_DIV8                  ((uint32_t)0x000000A0)        /*!< SYSCLK divided by 8 */
    9 M+ d4 e! n7 Z+ y" O% S+ I" p
  115. #define  RCC_CFGR_HPRE_DIV16                 ((uint32_t)0x000000B0)        /*!< SYSCLK divided by 16 */
    7 r8 Q  S. r  l" w* k; G2 N  z
  116. #define  RCC_CFGR_HPRE_DIV64                 ((uint32_t)0x000000C0)        /*!< SYSCLK divided by 64 */
    / j$ l, p$ ?0 ?4 u4 U* A
  117. #define  RCC_CFGR_HPRE_DIV128                ((uint32_t)0x000000D0)        /*!< SYSCLK divided by 128 */  s- h5 V  v! j
  118. #define  RCC_CFGR_HPRE_DIV256                ((uint32_t)0x000000E0)        /*!< SYSCLK divided by 256 */0 c, K& y6 Z( X/ s- j, E0 R1 @
  119. #define  RCC_CFGR_HPRE_DIV512                ((uint32_t)0x000000F0)        /*!< SYSCLK divided by 512 */
    # \; A# f' ]3 i. R
  120. % k* u6 x$ d2 E# j
  121. #if defined(STM32F410xx)
    ( ^# N9 o, h/ C$ d. c
  122. /*!< MCO1EN configuration *// H7 g1 ^  ~7 M4 T4 M; {3 t4 T
  123. #define  RCC_CFGR_MCO1EN                     ((uint32_t)0x00000100)        /*!< MCO1EN bit */
    $ A% d& Q+ n% m3 ?6 u
  124. /*!< MCO1EN configuration */' |, h1 ]# p+ p% R' s% S0 U3 G
  125. #define  RCC_CFGR_MCO2EN                     ((uint32_t)0x00000200)        /*!< MCO2EN bit */
    $ v; \5 I, _  e/ _7 Y5 i3 [1 s
  126. #endif /* STM32F410xx */9 I$ r3 ~$ X$ h
  127. /*!< PPRE1 configuration */
    8 W- |3 h* e6 Z) h  Q) X
  128. #define  RCC_CFGR_PPRE1                      ((uint32_t)0x00001C00)        /*!< PRE1[2:0] bits (APB1 prescaler) */# r. _6 n9 o9 y
  129. #define  RCC_CFGR_PPRE1_0                    ((uint32_t)0x00000400)        /*!< Bit 0 */" ~6 u. a/ H8 A
  130. #define  RCC_CFGR_PPRE1_1                    ((uint32_t)0x00000800)        /*!< Bit 1 */
    * `0 l1 p1 s  J7 t
  131. #define  RCC_CFGR_PPRE1_2                    ((uint32_t)0x00001000)        /*!< Bit 2 */
    3 f1 r. l, @+ R5 d! ?# c) P

  132. ( b. I7 \# z; a1 H. T* D
  133. #define  RCC_CFGR_PPRE1_DIV1                 ((uint32_t)0x00000000)        /*!< HCLK not divided */' r* W; V2 e- K
  134. #define  RCC_CFGR_PPRE1_DIV2                 ((uint32_t)0x00001000)        /*!< HCLK divided by 2 */' o+ U0 O4 K) }  ~5 Q! y7 a# S
  135. #define  RCC_CFGR_PPRE1_DIV4                 ((uint32_t)0x00001400)        /*!< HCLK divided by 4 */9 Y5 y) t8 B5 w& \0 l) e6 f/ B
  136. #define  RCC_CFGR_PPRE1_DIV8                 ((uint32_t)0x00001800)        /*!< HCLK divided by 8 */4 f4 E! x* I5 i" G! ?: {
  137. #define  RCC_CFGR_PPRE1_DIV16                ((uint32_t)0x00001C00)        /*!< HCLK divided by 16 */
    4 x; A9 B3 c( a* ]$ U: Z5 a7 @

  138. , Z- A# Z2 d! E
  139. /*!< PPRE2 configuration */6 ~. a/ q5 U! r8 ]
  140. #define  RCC_CFGR_PPRE2                      ((uint32_t)0x0000E000)        /*!< PRE2[2:0] bits (APB2 prescaler) */
    " z) A1 e( J  G
  141. #define  RCC_CFGR_PPRE2_0                    ((uint32_t)0x00002000)        /*!< Bit 0 */. W8 i- ]6 i* W1 j# V0 n6 Z
  142. #define  RCC_CFGR_PPRE2_1                    ((uint32_t)0x00004000)        /*!< Bit 1 */
    8 o9 P4 D% N& D0 e. R7 I
  143. #define  RCC_CFGR_PPRE2_2                    ((uint32_t)0x00008000)        /*!< Bit 2 */
    - c1 X' m: a4 u7 \( Y1 ^/ N7 Q

  144. 2 m: {+ e* {# j3 \) \5 D
  145. #define  RCC_CFGR_PPRE2_DIV1                 ((uint32_t)0x00000000)        /*!< HCLK not divided */
    ( ^# H3 H" p3 A1 ?0 a
  146. #define  RCC_CFGR_PPRE2_DIV2                 ((uint32_t)0x00008000)        /*!< HCLK divided by 2 */! I+ P* T# F3 b* g8 B% u( z1 o
  147. #define  RCC_CFGR_PPRE2_DIV4                 ((uint32_t)0x0000A000)        /*!< HCLK divided by 4 */9 j$ ^/ k* e$ \5 P
  148. #define  RCC_CFGR_PPRE2_DIV8                 ((uint32_t)0x0000C000)        /*!< HCLK divided by 8 */
    + c) |) K, D, F$ t* W
  149. #define  RCC_CFGR_PPRE2_DIV16                ((uint32_t)0x0000E000)        /*!< HCLK divided by 16 */+ d# t0 p! a2 R4 N5 [

  150. 3 Z  c) a8 Y. s3 c: z5 F$ T
  151. /*!< RTCPRE configuration */
    9 u) y6 J5 S- j
  152. #define  RCC_CFGR_RTCPRE                     ((uint32_t)0x001F0000)
    3 J% s. W$ z  E
  153. #define  RCC_CFGR_RTCPRE_0                   ((uint32_t)0x00010000); L1 O% G: w& q7 N$ \$ b( I! g
  154. #define  RCC_CFGR_RTCPRE_1                   ((uint32_t)0x00020000)) \) h9 b. \/ o: o) ^0 E& e
  155. #define  RCC_CFGR_RTCPRE_2                   ((uint32_t)0x00040000)$ |  d% d3 h8 B2 P4 |
  156. #define  RCC_CFGR_RTCPRE_3                   ((uint32_t)0x00080000)
    + H: H  _! F# ^  r
  157. #define  RCC_CFGR_RTCPRE_4                   ((uint32_t)0x00100000)5 v& H6 u0 d# p1 M% K9 o- C
  158. / ]! S' J4 S, g( ^( s
  159. /*!< MCO1 configuration */  F0 Z4 _# v1 \! f8 [  N4 ?2 B
  160. #define  RCC_CFGR_MCO1                       ((uint32_t)0x00600000)( r, Z1 {$ v/ r1 t4 C7 J
  161. #define  RCC_CFGR_MCO1_0                     ((uint32_t)0x00200000)5 b5 o1 E& x: |+ D2 u  n
  162. #define  RCC_CFGR_MCO1_1                     ((uint32_t)0x00400000)) p% D7 V# [) d) [

  163. ( S* p1 d( @' X; ?6 Y
  164. #define  RCC_CFGR_I2SSRC                     ((uint32_t)0x00800000)
    5 u8 w! y/ M( v- {

  165. ) ~( Q3 q. C. K# X6 K8 x* a: t
  166. #define  RCC_CFGR_MCO1PRE                    ((uint32_t)0x07000000)& |/ P8 }. L( u. i; Y% x( q
  167. #define  RCC_CFGR_MCO1PRE_0                  ((uint32_t)0x01000000)
    / {& z# Q! {8 d  q
  168. #define  RCC_CFGR_MCO1PRE_1                  ((uint32_t)0x02000000)6 C& u. ^8 M9 i1 I5 {" m! J% }
  169. #define  RCC_CFGR_MCO1PRE_2                  ((uint32_t)0x04000000), M% [0 T6 L. G
  170. 5 e9 T+ u. c" Z7 v% n) u& J
  171. #define  RCC_CFGR_MCO2PRE                    ((uint32_t)0x38000000): Q' d# ~" k0 f* a* N# B
  172. #define  RCC_CFGR_MCO2PRE_0                  ((uint32_t)0x08000000)5 c2 f2 ?0 u8 I1 R* E
  173. #define  RCC_CFGR_MCO2PRE_1                  ((uint32_t)0x10000000)
    ( i8 J( T( d8 ^9 l( {. _( |
  174. #define  RCC_CFGR_MCO2PRE_2                  ((uint32_t)0x20000000); z- w. z, Q4 n  l5 E2 o( I4 w! P6 l% n
  175. 4 E; T0 A) A' r8 X8 |
  176. #define  RCC_CFGR_MCO2                       ((uint32_t)0xC0000000)7 l; z" J7 d, _0 e! _4 Q
  177. #define  RCC_CFGR_MCO2_0                     ((uint32_t)0x40000000)
    ( `. O* |" s5 K9 Z- Y: F7 ~) Z
  178. #define  RCC_CFGR_MCO2_1                     ((uint32_t)0x80000000)
    7 L+ {$ [2 y9 O1 p. y2 V
  179. / X1 T& `6 V. f- Q4 j
  180. /********************  Bit definition for RCC_CIR register  *******************/( R$ t/ Y2 J% m. \3 A" h' q7 j
  181. #define  RCC_CIR_LSIRDYF                     ((uint32_t)0x00000001)/ U: A0 v( {! @2 d; |1 P  v
  182. #define  RCC_CIR_LSERDYF                     ((uint32_t)0x00000002)6 F' H+ t8 U( w" x
  183. #define  RCC_CIR_HSIRDYF                     ((uint32_t)0x00000004)
    - C# Q/ [, ^" ?. w
  184. #define  RCC_CIR_HSERDYF                     ((uint32_t)0x00000008)
    " @6 U6 q6 ]* h8 U1 z8 B! t
  185. #define  RCC_CIR_PLLRDYF                     ((uint32_t)0x00000010)
    1 b3 S7 [" ?: t9 D% U* ]* h
  186. #define  RCC_CIR_PLLI2SRDYF                  ((uint32_t)0x00000020)
    * E2 l+ Y! ^' B' r) }/ o. n! }
  187. #define  RCC_CIR_PLLSAIRDYF                  ((uint32_t)0x00000040)4 |5 }4 J1 U$ ^* p1 W% a
  188. #define  RCC_CIR_CSSF                        ((uint32_t)0x00000080)
    , N, G' m# S. u# r# \
  189. #define  RCC_CIR_LSIRDYIE                    ((uint32_t)0x00000100)$ u, J$ I; h& @( |
  190. #define  RCC_CIR_LSERDYIE                    ((uint32_t)0x00000200)
      A) i, A2 c, F1 `8 g9 h6 u
  191. #define  RCC_CIR_HSIRDYIE                    ((uint32_t)0x00000400): @7 n# g* z& E5 |
  192. #define  RCC_CIR_HSERDYIE                    ((uint32_t)0x00000800)" N: \) I- e9 }% @! g- B
  193. #define  RCC_CIR_PLLRDYIE                    ((uint32_t)0x00001000)# ~# Z0 `; t) Q9 A( o5 Q" O. k
  194. #define  RCC_CIR_PLLI2SRDYIE                 ((uint32_t)0x00002000)$ Z: _1 L) U' Y/ ]) N0 z" A5 H& r
  195. #define  RCC_CIR_PLLSAIRDYIE                 ((uint32_t)0x00004000)- t6 `, l8 f2 H$ K
  196. #define  RCC_CIR_LSIRDYC                     ((uint32_t)0x00010000)+ o% T9 Y4 V" R) s; z3 ^
  197. #define  RCC_CIR_LSERDYC                     ((uint32_t)0x00020000)
    0 l8 Q# S* ?- e& R; l- r8 I
  198. #define  RCC_CIR_HSIRDYC                     ((uint32_t)0x00040000)
    ; c1 P0 L( E- y
  199. #define  RCC_CIR_HSERDYC                     ((uint32_t)0x00080000), t0 S, n: |- \' k9 l% m# |! o3 C
  200. #define  RCC_CIR_PLLRDYC                     ((uint32_t)0x00100000), }% H( D' Y2 \0 s
  201. #define  RCC_CIR_PLLI2SRDYC                  ((uint32_t)0x00200000)8 x' w, W3 G; H1 u* q
  202. #define  RCC_CIR_PLLSAIRDYC                  ((uint32_t)0x00400000)
    8 z+ U: M  X$ H) u! A7 j
  203. #define  RCC_CIR_CSSC                        ((uint32_t)0x00800000)" c3 P! W7 P7 j1 C9 ^

  204. 6 K+ C2 A7 P" p5 I  L2 O
  205. /********************  Bit definition for RCC_AHB1RSTR register  **************/+ k! J+ j# S, Q7 ?. \$ S
  206. #define  RCC_AHB1RSTR_GPIOARST               ((uint32_t)0x00000001)" [5 W# y- q2 z. g$ U
  207. #define  RCC_AHB1RSTR_GPIOBRST               ((uint32_t)0x00000002)
    ; {4 R, W. ^7 }/ R1 u) _
  208. #define  RCC_AHB1RSTR_GPIOCRST               ((uint32_t)0x00000004)
    5 _6 ^  U- e; ~1 K' c2 \1 i& K5 p
  209. #define  RCC_AHB1RSTR_GPIODRST               ((uint32_t)0x00000008)
    / R: [! |, e5 c+ u( W, ~
  210. #define  RCC_AHB1RSTR_GPIOERST               ((uint32_t)0x00000010)
    : W/ N* ^  `* y; U
  211. #define  RCC_AHB1RSTR_GPIOFRST               ((uint32_t)0x00000020)
    * K8 T8 s2 D; |2 [* ~
  212. #define  RCC_AHB1RSTR_GPIOGRST               ((uint32_t)0x00000040)# b" d0 i: N# |0 f
  213. #define  RCC_AHB1RSTR_GPIOHRST               ((uint32_t)0x00000080)
    " z# t3 x6 c1 u/ Q/ m" S0 t
  214. #define  RCC_AHB1RSTR_GPIOIRST               ((uint32_t)0x00000100)
      u) u/ D2 ~, {
  215. #define  RCC_AHB1RSTR_GPIOJRST               ((uint32_t)0x00000200)
    & y0 V$ g* M- t" M8 t( k0 h; e
  216. #define  RCC_AHB1RSTR_GPIOKRST               ((uint32_t)0x00000400)0 x% @7 Y( F2 E4 Q6 a' A
  217. #define  RCC_AHB1RSTR_CRCRST                 ((uint32_t)0x00001000)6 v3 \2 ?, E5 Z, }; j( ]; J, M. `* X! P
  218. #define  RCC_AHB1RSTR_DMA1RST                ((uint32_t)0x00200000)$ h0 `* W+ S* N8 K1 V3 x
  219. #define  RCC_AHB1RSTR_DMA2RST                ((uint32_t)0x00400000)
    1 Z5 h6 L7 ^; N" C
  220. #define  RCC_AHB1RSTR_DMA2DRST               ((uint32_t)0x00800000)
    ; d/ K$ u& x8 T- o9 V- G
  221. #define  RCC_AHB1RSTR_ETHMACRST              ((uint32_t)0x02000000)
    ) A' r: e# N1 m8 h3 H6 [8 C! {
  222. #define  RCC_AHB1RSTR_OTGHRST                ((uint32_t)0x10000000)" [7 H: z7 F* x7 W3 t* j. K
  223. , J" P4 N( v) N3 S% T% m
  224. /********************  Bit definition for RCC_AHB2RSTR register  **************/
    : U8 B( t* @# l# L2 z
  225. #define  RCC_AHB2RSTR_DCMIRST                ((uint32_t)0x00000001)
    0 G  E* d4 U' x5 E- E' D
  226. #define  RCC_AHB2RSTR_CRYPRST                ((uint32_t)0x00000010)
    2 l2 L9 R/ c6 ~5 N' `
  227. #define  RCC_AHB2RSTR_HASHRST                ((uint32_t)0x00000020)1 t  ~1 m- w6 k8 @/ k
  228. /* maintained for legacy purpose */' h) O3 i; U& J
  229. #define  RCC_AHB2RSTR_HSAHRST                RCC_AHB2RSTR_HASHRST) Z8 f3 j( h5 ^9 E! k. n  [
  230. #define  RCC_AHB2RSTR_RNGRST                 ((uint32_t)0x00000040)
    - n$ d' y& \% ~4 v+ u
  231. #define  RCC_AHB2RSTR_OTGFSRST               ((uint32_t)0x00000080)
    5 J+ T: U9 d( W1 z* b) f  T  r: C1 V

  232. $ n3 U1 v7 P* f3 ?
  233. /********************  Bit definition for RCC_AHB3RSTR register  **************/
    , `! w0 y* i9 F, x; d
  234. #if defined(STM32F40_41xxx) || defined(STM32F412xG) || defined(STM32F413_423xx); E2 A3 M. Y. O$ y
  235. #define  RCC_AHB3RSTR_FSMCRST                ((uint32_t)0x00000001). B4 q% A# R: A% m
  236. #endif /* STM32F40_41xxx || STM32F412xG || STM32F413_423xx */
    5 K8 O# }+ L8 `2 T9 v! h

  237. + ?9 S1 T) Y4 |( l7 Q; g
  238. #if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx)/ h2 B* J; E9 D# |( c+ B9 N8 Q6 \
  239. #define  RCC_AHB3RSTR_FMCRST                ((uint32_t)0x00000001)
    . W9 s" }9 j0 g; P+ [
  240. #endif /* STM32F427_437xx ||  STM32F429_439xx || STM32F446xx || STM32F469_479xx */
    ; s* U  D2 v0 P) {. _3 S+ R
  241. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx)6 J4 i# @. E1 Y% e$ |6 g
  242. #define  RCC_AHB3RSTR_QSPIRST               ((uint32_t)0x00000002)
    3 a5 l) v) p: c) L0 Q2 o9 c1 C& t
  243. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */- U4 U9 L0 p- H$ ?/ H9 S6 ^: P; X

  244. ' i4 O1 X2 K' _4 s
  245. /********************  Bit definition for RCC_APB1RSTR register  **************/: P1 z$ V. u, O
  246. #define  RCC_APB1RSTR_TIM2RST                ((uint32_t)0x00000001)
    # Z& O. ]; c' z$ s. L
  247. #define  RCC_APB1RSTR_TIM3RST                ((uint32_t)0x00000002)
    : R7 M% v9 f# N
  248. #define  RCC_APB1RSTR_TIM4RST                ((uint32_t)0x00000004)0 E- f& |6 K5 L& t! \) M
  249. #define  RCC_APB1RSTR_TIM5RST                ((uint32_t)0x00000008)  A% m$ K( [4 w3 z
  250. #define  RCC_APB1RSTR_TIM6RST                ((uint32_t)0x00000010)
    8 b% l8 u# W( I! I' r
  251. #define  RCC_APB1RSTR_TIM7RST                ((uint32_t)0x00000020)
    $ X1 M3 M4 n9 w& m6 V
  252. #define  RCC_APB1RSTR_TIM12RST               ((uint32_t)0x00000040)
    # q/ K; K0 h8 b5 c) i8 Y7 Y
  253. #define  RCC_APB1RSTR_TIM13RST               ((uint32_t)0x00000080)6 k3 u8 f" a* |& A
  254. #define  RCC_APB1RSTR_TIM14RST               ((uint32_t)0x00000100)- P$ o/ X  F4 h* d! r/ k) J
  255. #if defined(STM32F410xx) || defined(STM32F413_423xx)& `8 Q1 u/ u0 M: E$ z$ ^7 ]
  256. #define  RCC_APB1RSTR_LPTIM1RST              ((uint32_t)0x00000200)
    ' ~9 |2 j5 d/ A5 b' E. i7 @  d
  257. #endif /* STM32F410xx || STM32F413_423xx */4 W  n. u9 [$ x3 q, t
  258. #define  RCC_APB1RSTR_WWDGRST                ((uint32_t)0x00000800)
    : k5 B; C3 Q) h$ N" a5 [
  259. #define  RCC_APB1RSTR_SPI2RST                ((uint32_t)0x00004000)7 s" j2 ?+ Q! j
  260. #define  RCC_APB1RSTR_SPI3RST                ((uint32_t)0x00008000)9 i) G9 U* R7 `% a! @/ ?5 w
  261. #if defined(STM32F446xx)& \; ]4 Y" O# C: i- M5 j
  262. #define  RCC_APB1RSTR_SPDIFRXRST             ((uint32_t)0x00010000)
    2 G& s2 T2 K' c
  263. #endif /* STM32F446xx */
    3 d* L6 w3 C$ \* {
  264. #define  RCC_APB1RSTR_USART2RST              ((uint32_t)0x00020000)
    9 N# G( _6 e( m) p$ \, Y
  265. #define  RCC_APB1RSTR_USART3RST              ((uint32_t)0x00040000)* W, G! B$ y( z( W& `4 j
  266. #define  RCC_APB1RSTR_UART4RST               ((uint32_t)0x00080000)
    6 n1 E; f3 _( P9 q# S  p
  267. #define  RCC_APB1RSTR_UART5RST               ((uint32_t)0x00100000)
    ) `6 o( \+ D3 S+ `+ L) [1 a
  268. #define  RCC_APB1RSTR_I2C1RST                ((uint32_t)0x00200000). u) Q1 g" e1 t$ P, G, q$ g
  269. #define  RCC_APB1RSTR_I2C2RST                ((uint32_t)0x00400000)
    5 X* b. A# n& H; ^# _
  270. #define  RCC_APB1RSTR_I2C3RST                ((uint32_t)0x00800000)0 M: J% m! c6 \+ K
  271. #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx)
    / n/ z2 ]  z6 |3 Z/ x
  272. #define  RCC_APB1RSTR_FMPI2C1RST             ((uint32_t)0x01000000)% o8 K+ F+ t- F5 Q/ `" B1 J
  273. #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx || STM32F446xx */
    , |3 L& D+ L; i6 }
  274. #define  RCC_APB1RSTR_CAN1RST                ((uint32_t)0x02000000)
    : S% e" M  }2 p, R/ ]! d7 N8 ^
  275. #define  RCC_APB1RSTR_CAN2RST                ((uint32_t)0x04000000)( s1 v* K0 h. S2 ~2 Z2 s
  276. #if defined(STM32F446xx)
    ; i) t1 |9 g1 H/ r+ k0 ?
  277. #define  RCC_APB1RSTR_CECRST                 ((uint32_t)0x08000000)
    5 `1 S% v+ r  D
  278. #endif /* STM32F446xx */
    # r! N/ S$ f+ b- _$ B( J
  279. #define  RCC_APB1RSTR_PWRRST                 ((uint32_t)0x10000000)
    ; N% ?0 T- D3 D2 K& ?# U
  280. #define  RCC_APB1RSTR_DACRST                 ((uint32_t)0x20000000)
    . i3 O( G2 z$ F- P9 B, }
  281. #define  RCC_APB1RSTR_UART7RST               ((uint32_t)0x40000000)
    " O. j3 [" o" n( Z! B
  282. #define  RCC_APB1RSTR_UART8RST               ((uint32_t)0x80000000): O) y$ W$ o* Y/ V8 s
  283. 7 ^( C6 v8 r  k3 e
  284. /********************  Bit definition for RCC_APB2RSTR register  **************/
    8 c9 U5 C, `# K, ~% m  N
  285. #define  RCC_APB2RSTR_TIM1RST                ((uint32_t)0x00000001)2 d, A! i9 j* w# @8 Q5 r% l
  286. #define  RCC_APB2RSTR_TIM8RST                ((uint32_t)0x00000002)4 @- J' ~6 S) L5 r3 b- J$ J
  287. #define  RCC_APB2RSTR_USART1RST              ((uint32_t)0x00000010)
    0 J5 i( N: o/ p' F! ^& B6 A
  288. #define  RCC_APB2RSTR_USART6RST              ((uint32_t)0x00000020)
      C# r2 F" ]1 _9 y! @9 L# _% W
  289. #define  RCC_APB2RSTR_UART9RST               ((uint32_t)0x00000040); T9 P% E8 r* u# H
  290. #define  RCC_APB2RSTR_UART10RST              ((uint32_t)0x00000080)0 s& D, g8 N; Y" I$ P( x0 w
  291. #define  RCC_APB2RSTR_ADCRST                 ((uint32_t)0x00000100)
    8 y- k. x8 u1 B: Q6 \
  292. #define  RCC_APB2RSTR_SDIORST                ((uint32_t)0x00000800). R/ ]$ x; C* s  T; |. Z
  293. #define  RCC_APB2RSTR_SPI1RST                ((uint32_t)0x00001000)
    " {9 Y  c& i! e' K- ~
  294. #define  RCC_APB2RSTR_SPI4RST                ((uint32_t)0x00002000)7 ]* D6 R% W+ P' Z+ U  g% e( N
  295. #define  RCC_APB2RSTR_SYSCFGRST              ((uint32_t)0x00004000)
    + U2 l( a9 E: e+ e6 u
  296. #define  RCC_APB2RSTR_TIM9RST                ((uint32_t)0x00010000)
    3 [, O/ `( M2 w4 h. c9 W/ ?
  297. #define  RCC_APB2RSTR_TIM10RST               ((uint32_t)0x00020000)
    8 L5 g: b8 G1 u5 z" F/ [
  298. #define  RCC_APB2RSTR_TIM11RST               ((uint32_t)0x00040000)
    # U0 Q9 x# _$ }# a
  299. #define  RCC_APB2RSTR_SPI5RST                ((uint32_t)0x00100000)5 U7 q( }' k* [4 t5 {/ j
  300. #define  RCC_APB2RSTR_SPI6RST                ((uint32_t)0x00200000)
    7 u( x1 g" s4 P, E
  301. #define  RCC_APB2RSTR_SAI1RST                ((uint32_t)0x00400000)$ ~+ j5 W/ W8 ^$ \' z. v: p+ R- v$ ^$ l
  302. #if defined(STM32F446xx)$ H* g  r0 t8 j( p) h& ]
  303. #define  RCC_APB2RSTR_SAI2RST                ((uint32_t)0x00800000)  |4 q, H. A  N( a/ r4 }% R3 b
  304. #endif /* STM32F446xx */0 W, o0 w' G+ h1 t" `
  305. #define  RCC_APB2RSTR_LTDCRST                ((uint32_t)0x04000000)
    - A* O! B' y% \" U  z" W% ~- B# _9 W
  306. #if defined(STM32F469_479xx)
    + y" X% u8 v0 T- F1 ^
  307. #define  RCC_APB2RSTR_DSIRST                 ((uint32_t)0x08000000), |) |# v( C2 I% A2 X% d* t
  308. #endif /* STM32F469_479xx */
    ) @5 C$ V' Z1 d% z  h8 y
  309. #if defined(STM32F412xG) || defined(STM32F413_423xx)
    6 V) U/ O8 B8 H2 s$ p
  310. #define  RCC_APB2RSTR_DFSDM1RST              ((uint32_t)0x01000000)
    2 Q: b, d5 z; v2 k. I0 q9 n
  311. #endif /* STM32F412xG || STM32F413_423xx */. R; h' V; g0 Y' |1 F7 G0 M
  312. 6 t" {! }& [0 s; u6 r( |
  313. #if defined(STM32F413_423xx)4 I3 F. W: [& w% I# B7 C
  314. #define  RCC_APB2RSTR_DFSDM2RST              ((uint32_t)0x02000000)& k% e% m9 `  I: f" r  l8 B9 P% |9 J
  315. #endif /* STM32F413_423xx */9 I3 e# `3 M8 K% l( z' R  ^2 S
  316. /* Old definitions, maintained for legacy purpose */2 ]0 z- Q9 N, [( C0 N) d
  317. #define  RCC_APB2RSTR_SPI1                   RCC_APB2RSTR_SPI1RST
    # {/ m* e0 z( V
  318. #define  RCC_APB2RSTR_DFSDMRST               RCC_APB2RSTR_DFSDM1RST
    6 {$ a4 j8 ]; p4 t
  319. : j/ b3 \6 [  O5 k
  320. /********************  Bit definition for RCC_AHB1ENR register  ***************/
    ! g$ ?0 w3 F* K! \+ D2 }" D
  321. #define  RCC_AHB1ENR_GPIOAEN                 ((uint32_t)0x00000001)
    8 E. r  A  S7 I1 a1 C( a% A/ m
  322. #define  RCC_AHB1ENR_GPIOBEN                 ((uint32_t)0x00000002)
    4 p6 a$ J0 p3 F% n) f
  323. #define  RCC_AHB1ENR_GPIOCEN                 ((uint32_t)0x00000004)
    0 Y# W( b+ I, _* T( ^
  324. #define  RCC_AHB1ENR_GPIODEN                 ((uint32_t)0x00000008); b1 U) X0 O/ v9 h
  325. #define  RCC_AHB1ENR_GPIOEEN                 ((uint32_t)0x00000010)
    $ J5 a  `. B5 I) M
  326. #define  RCC_AHB1ENR_GPIOFEN                 ((uint32_t)0x00000020)1 T- {' j  ]" z/ v1 [+ E* {
  327. #define  RCC_AHB1ENR_GPIOGEN                 ((uint32_t)0x00000040)
    6 j- U. V# E: \2 J( ]6 a
  328. #define  RCC_AHB1ENR_GPIOHEN                 ((uint32_t)0x00000080): b' g  g; [2 o$ w8 V
  329. #define  RCC_AHB1ENR_GPIOIEN                 ((uint32_t)0x00000100)
    5 A) k: n( f' o# Y$ U: s
  330. #define  RCC_AHB1ENR_GPIOJEN                 ((uint32_t)0x00000200)
    ' Z  O% p% b+ y4 S  n: Y
  331. #define  RCC_AHB1ENR_GPIOKEN                 ((uint32_t)0x00000400)
    . K  R- t; e- D, Z# p% G
  332. #define  RCC_AHB1ENR_CRCEN                   ((uint32_t)0x00001000)' d' H. q3 u6 ^/ D( f6 R! I- K
  333. #define  RCC_AHB1ENR_BKPSRAMEN               ((uint32_t)0x00040000)9 O7 H9 p, [' q6 v1 c
  334. #define  RCC_AHB1ENR_CCMDATARAMEN            ((uint32_t)0x00100000)
      K; V" q  Z# b2 `9 g
  335. #define  RCC_AHB1ENR_DMA1EN                  ((uint32_t)0x00200000)
    ( G: D8 N( M/ M+ {/ c
  336. #define  RCC_AHB1ENR_DMA2EN                  ((uint32_t)0x00400000)/ e9 l# {% M& S& o# \3 Q
  337. #define  RCC_AHB1ENR_DMA2DEN                 ((uint32_t)0x00800000)! r6 x. p. a  K/ J% D% ?) \! b5 M
  338. #define  RCC_AHB1ENR_ETHMACEN                ((uint32_t)0x02000000)
    7 M$ l2 c8 n, M" N5 ]' I
  339. #define  RCC_AHB1ENR_ETHMACTXEN              ((uint32_t)0x04000000)
    3 d* a1 q+ u: }2 [
  340. #define  RCC_AHB1ENR_ETHMACRXEN              ((uint32_t)0x08000000)
    9 T& @/ o' T2 R9 k% d6 u/ p
  341. #define  RCC_AHB1ENR_ETHMACPTPEN             ((uint32_t)0x10000000)
    4 j6 G0 J  i) a
  342. #define  RCC_AHB1ENR_OTGHSEN                 ((uint32_t)0x20000000)
    6 t- k2 ]  }) P7 O, \1 y  {
  343. #define  RCC_AHB1ENR_OTGHSULPIEN             ((uint32_t)0x40000000)
    " Y/ s8 e' M) d2 G3 Y0 B$ B
  344.   n# _6 ~/ N7 n) W% j
  345. /********************  Bit definition for RCC_AHB2ENR register  ***************/
    2 \) `8 [. A) z  _' e& m" R1 P
  346. #define  RCC_AHB2ENR_DCMIEN                  ((uint32_t)0x00000001)
    6 B+ _' n) M/ ]; S- |
  347. #define  RCC_AHB2ENR_CRYPEN                  ((uint32_t)0x00000010)
    7 m; m1 j( K7 j% P1 U2 a- W
  348. #define  RCC_AHB2ENR_HASHEN                  ((uint32_t)0x00000020)
    1 m8 R& Y3 [7 ?$ L& u2 i6 L
  349. #define  RCC_AHB2ENR_RNGEN                   ((uint32_t)0x00000040). S* C" Y! c6 H. M2 p; ~  V/ S
  350. #define  RCC_AHB2ENR_OTGFSEN                 ((uint32_t)0x00000080)
    / S; l, x' R% B7 `. N1 \
  351. 1 k" O+ s3 b8 u2 V# O- `
  352. /********************  Bit definition for RCC_AHB3ENR register  ***************/3 V' H9 f& {* c1 R8 I* i- O1 G
  353. ; K0 Y+ d/ f# h
  354. #if defined(STM32F40_41xxx) || defined(STM32F412xG) || defined(STM32F413_423xx)
    - f" y4 C: W" s' s2 k
  355. #define  RCC_AHB3ENR_FSMCEN                  ((uint32_t)0x00000001)1 i5 m7 J4 J" S, R
  356. #endif /* STM32F40_41xxx || STM32F412xG || STM32F413_423xx */
    + R) r1 d1 W! [0 E- @
  357. 0 h9 r: P% h3 u4 ~& `& ?
  358. #if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx)2 g# x5 O4 W: N$ ]7 B, [2 d0 E
  359. #define  RCC_AHB3ENR_FMCEN                  ((uint32_t)0x00000001)
    : W. m( m2 y3 |! H: Z
  360. #endif /* STM32F427_437xx ||  STM32F429_439xx || STM32F446xx || STM32F469_479xx */
    6 Z+ e/ q  r+ G* a, K0 q1 F! l
  361. % m- y3 ^+ q- |0 H
  362. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx)
    6 @" w( w( y" o$ E- I0 y
  363. #define  RCC_AHB3ENR_QSPIEN                 ((uint32_t)0x00000002)
    1 H2 f# l( i5 n3 ~2 K
  364. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */
    ! V# O& |- m' U' y) W+ X
  365. 6 x% Z) B1 I7 o- H, e
  366. /********************  Bit definition for RCC_APB1ENR register  ***************/3 R$ A6 s( R  |( R$ R+ Z$ N3 k/ e
  367. #define  RCC_APB1ENR_TIM2EN                  ((uint32_t)0x00000001)
    1 M. ^8 {# q8 \5 l+ K
  368. #define  RCC_APB1ENR_TIM3EN                  ((uint32_t)0x00000002)7 a6 C1 G: w- o6 l' h
  369. #define  RCC_APB1ENR_TIM4EN                  ((uint32_t)0x00000004); E  }& u  X2 B" N& B; @* ]7 z
  370. #define  RCC_APB1ENR_TIM5EN                  ((uint32_t)0x00000008)
      |0 s1 R- S/ p9 d7 ]
  371. #define  RCC_APB1ENR_TIM6EN                  ((uint32_t)0x00000010)  T7 }! O3 V& d% H/ B
  372. #define  RCC_APB1ENR_TIM7EN                  ((uint32_t)0x00000020)2 q( E9 L; }' u* ]3 ~) N$ s
  373. #define  RCC_APB1ENR_TIM12EN                 ((uint32_t)0x00000040)( ^7 l/ r) R7 M2 n
  374. #define  RCC_APB1ENR_TIM13EN                 ((uint32_t)0x00000080): e; V3 L. u8 k! @% h9 t$ X; Q8 C
  375. #define  RCC_APB1ENR_TIM14EN                 ((uint32_t)0x00000100)5 s7 Y* x6 R+ f4 q
  376. #if defined(STM32F410xx) || defined(STM32F413_423xx)
    " v7 Y' P1 o& W) U% l
  377. #define  RCC_APB1ENR_LPTIM1EN                ((uint32_t)0x00000200)
    , h. P; ]4 N' D' X6 s* ~
  378. #endif /* STM32F410xx || STM32F413_423xx */. L" o1 R/ s: X( ?' e/ b
  379. #define  RCC_APB1ENR_WWDGEN                  ((uint32_t)0x00000800)
    " E0 }! |0 c! r5 O1 ]- ?, Z
  380. #define  RCC_APB1ENR_SPI2EN                  ((uint32_t)0x00004000)
    , a7 a1 [+ `5 b
  381. #define  RCC_APB1ENR_SPI3EN                  ((uint32_t)0x00008000)- W) T: n1 p$ k+ a
  382. #if defined(STM32F446xx)
    4 v" A$ M2 N3 R: G
  383. #define  RCC_APB1ENR_SPDIFRXEN               ((uint32_t)0x00010000)6 I, O6 E2 I$ N( l- J( L
  384. #endif /* STM32F446xx */4 X" A( H) ]3 ~4 ~5 w1 W, [3 w& C: w
  385. #define  RCC_APB1ENR_USART2EN                ((uint32_t)0x00020000)
    * I& a/ \, S0 A' S
  386. #define  RCC_APB1ENR_USART3EN                ((uint32_t)0x00040000)
    ! m) ~4 i/ d+ U. _- b
  387. #define  RCC_APB1ENR_UART4EN                 ((uint32_t)0x00080000)  P! g! z2 B( t) A$ p- S& D3 d
  388. #define  RCC_APB1ENR_UART5EN                 ((uint32_t)0x00100000)& s9 q& U# X  [
  389. #define  RCC_APB1ENR_I2C1EN                  ((uint32_t)0x00200000)! n. c: @& p: z
  390. #define  RCC_APB1ENR_I2C2EN                  ((uint32_t)0x00400000)
      @, x% Z- g. x( d
  391. #define  RCC_APB1ENR_I2C3EN                  ((uint32_t)0x00800000)7 X  v# F; _; R( t4 f* p
  392. #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx)
    6 t/ M+ Q5 ~0 I+ G
  393. #define  RCC_APB1ENR_FMPI2C1EN               ((uint32_t)0x01000000)0 k9 u$ q& c1 `) B) l5 @9 ?* A( p
  394. #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx || STM32F446xx */
    " ^& B/ f9 |$ i) m& D% Z7 r* ?/ |! o
  395. #define  RCC_APB1ENR_CAN1EN                  ((uint32_t)0x02000000)
    3 m) z/ V& z- e, A7 e' t
  396. #define  RCC_APB1ENR_CAN2EN                  ((uint32_t)0x04000000)- W7 f; u) I4 d5 R! D3 h' j
  397. #if defined(STM32F446xx)
    . Q" L) _, X: e' D9 ]) O% g
  398. #define  RCC_APB1ENR_CECEN                   ((uint32_t)0x08000000)
    4 g' }! A: S& I) i8 X
  399. #endif /* STM32F446xx */% I( ?6 S8 \! D
  400. #define  RCC_APB1ENR_PWREN                   ((uint32_t)0x10000000)$ J. z4 t5 G6 g: |7 H
  401. #define  RCC_APB1ENR_DACEN                   ((uint32_t)0x20000000)
    4 Y% C) D7 ]# F
  402. #define  RCC_APB1ENR_UART7EN                 ((uint32_t)0x40000000): J! s, n3 y; D" E, |8 G' p
  403. #define  RCC_APB1ENR_UART8EN                 ((uint32_t)0x80000000)
    / T9 g8 i4 h. Z' p. ]. `" ^/ ], j
  404. & z$ B( s* f: F
  405. /********************  Bit definition for RCC_APB2ENR register  ***************/7 z' R2 L$ B9 a4 S. ^: o8 C4 l
  406. #define  RCC_APB2ENR_TIM1EN                  ((uint32_t)0x00000001)# o0 |9 [5 R, O: D- H, q
  407. #define  RCC_APB2ENR_TIM8EN                  ((uint32_t)0x00000002)
    6 b* x  O. Y/ s, U; U
  408. #define  RCC_APB2ENR_USART1EN                ((uint32_t)0x00000010)
    ( X. _! z, ~' I, g1 l5 F+ q
  409. #define  RCC_APB2ENR_USART6EN                ((uint32_t)0x00000020)( m6 k/ k* y/ G# \) Y$ u
  410. #define  RCC_APB2ENR_UART9EN                 ((uint32_t)0x00000040)
    / H9 e, I1 R- j- ]/ u& f
  411. #define  RCC_APB2ENR_UART10EN                ((uint32_t)0x00000080)% z) W! F' q+ w( g1 }# T+ u( G6 C$ Y( M
  412. #define  RCC_APB2ENR_ADC1EN                  ((uint32_t)0x00000100)# W6 \& z* o1 R9 |
  413. #define  RCC_APB2ENR_ADC2EN                  ((uint32_t)0x00000200)" J9 d1 {; S$ j
  414. #define  RCC_APB2ENR_ADC3EN                  ((uint32_t)0x00000400)
    & [" g; k- {, x! `, W" W
  415. #define  RCC_APB2ENR_SDIOEN                  ((uint32_t)0x00000800)- D% L/ @! }) }! v$ ^# X9 _
  416. #define  RCC_APB2ENR_SPI1EN                  ((uint32_t)0x00001000): l* Q. o' f. O
  417. #define  RCC_APB2ENR_SPI4EN                  ((uint32_t)0x00002000)
    1 J0 v- ]0 R. R) U; Q
  418. #define  RCC_APB2ENR_SYSCFGEN                ((uint32_t)0x00004000)
    5 F+ g. _& K! l& D: `* z
  419. #define  RCC_APB2ENR_EXTIEN                  ((uint32_t)0x00008000)
    # Z, g+ v! {2 F
  420. #define  RCC_APB2ENR_TIM9EN                  ((uint32_t)0x00010000)
    ! b7 t# P0 d: k3 g, o& U7 Y
  421. #define  RCC_APB2ENR_TIM10EN                 ((uint32_t)0x00020000)
    ( r2 [8 u* k; j8 J: [
  422. #define  RCC_APB2ENR_TIM11EN                 ((uint32_t)0x00040000)
    ; ^" ~, z+ y6 P% h/ Q0 X) Y1 M
  423. #define  RCC_APB2ENR_SPI5EN                  ((uint32_t)0x00100000)
    - ?' R) R2 g7 m, ?
  424. #define  RCC_APB2ENR_SPI6EN                  ((uint32_t)0x00200000)' R" ]3 v: F* h8 Y
  425. #define  RCC_APB2ENR_SAI1EN                  ((uint32_t)0x00400000)6 c! D4 A0 [( W' |
  426. #if defined(STM32F446xx)' _9 G- |2 T! f3 c$ E1 n" u
  427. #define  RCC_APB2ENR_SAI2EN                  ((uint32_t)0x00800000)
    7 V0 {  s4 n6 z" v' O; ]3 K
  428. #endif /* STM32F446xx */. H0 B6 B0 P0 i$ u+ N# X
  429. #define  RCC_APB2ENR_LTDCEN                  ((uint32_t)0x04000000)
    ! n# A! L; Z# B* ?: I" ?, i4 j9 c
  430. #if defined(STM32F469_479xx)
    ( ]3 i( m) O3 n0 r
  431. #define  RCC_APB2ENR_DSIEN                   ((uint32_t)0x08000000)
    + Q- U; e1 w/ R; i, B% M
  432. #endif /* STM32F469_479xx */2 q: P- H0 j# {1 Z7 A' h4 D( Z
  433. #if defined(STM32F412xG) || defined(STM32F413_423xx)
    & G) {$ W( q2 M) b: B4 i$ i
  434. #define  RCC_APB2ENR_DFSDM1EN                ((uint32_t)0x01000000)
    + p. x1 }# [. p) N; {+ @6 B' G5 V
  435. #endif /* STM32F412xG || STM32F413_423xx */
    0 N5 W3 r. q% p7 @
  436. #if defined(STM32F413_423xx)
    1 L( ~# X1 y" \
  437. #define  RCC_APB2ENR_DFSDM2EN                ((uint32_t)0x02000000)  K' O) m- P  n
  438. #endif /* STM32F413_423xx */
    : V2 L( o8 ~3 V+ r% I0 a; @
  439. /********************  Bit definition for RCC_AHB1LPENR register  *************/
    , E5 W. q3 V' m9 i" {! j  a% t  D
  440. #define  RCC_AHB1LPENR_GPIOALPEN             ((uint32_t)0x00000001)
    - {* c* j8 A' A: o7 G& J
  441. #define  RCC_AHB1LPENR_GPIOBLPEN             ((uint32_t)0x00000002); ~; A4 k( e5 ?# G  A/ S. I
  442. #define  RCC_AHB1LPENR_GPIOCLPEN             ((uint32_t)0x00000004)) O$ ]4 e0 a$ C# Q! R7 i% c
  443. #define  RCC_AHB1LPENR_GPIODLPEN             ((uint32_t)0x00000008)# P6 v) Y: p- e7 \( f1 {" C2 N) Y9 G
  444. #define  RCC_AHB1LPENR_GPIOELPEN             ((uint32_t)0x00000010)' y/ v, s7 e, ?
  445. #define  RCC_AHB1LPENR_GPIOFLPEN             ((uint32_t)0x00000020)8 z# A. x9 G) T- S8 H
  446. #define  RCC_AHB1LPENR_GPIOGLPEN             ((uint32_t)0x00000040). g  ^. @0 K9 O2 a9 b  _
  447. #define  RCC_AHB1LPENR_GPIOHLPEN             ((uint32_t)0x00000080)
    ; l# o4 M5 ~8 i$ j) S# ~* i. e
  448. #define  RCC_AHB1LPENR_GPIOILPEN             ((uint32_t)0x00000100)" v8 I) b3 u3 m& |. r6 g* F
  449. #define  RCC_AHB1LPENR_GPIOJLPEN             ((uint32_t)0x00000200)
    4 Q" F( Z/ c: D. p/ F
  450. #define  RCC_AHB1LPENR_GPIOKLPEN             ((uint32_t)0x00000400)/ X5 s& B" K1 u2 T( F
  451. #define  RCC_AHB1LPENR_CRCLPEN               ((uint32_t)0x00001000)' \7 e; b1 J  f7 w) ~
  452. #define  RCC_AHB1LPENR_FLITFLPEN             ((uint32_t)0x00008000)6 d* D% G2 Z9 |$ w
  453. #define  RCC_AHB1LPENR_SRAM1LPEN             ((uint32_t)0x00010000)% `0 k& U+ K1 p$ ^
  454. #define  RCC_AHB1LPENR_SRAM2LPEN             ((uint32_t)0x00020000)
    6 n; c; O$ Q! `, D
  455. #define  RCC_AHB1LPENR_BKPSRAMLPEN           ((uint32_t)0x00040000)8 \! S* _- u$ B* ]  B: A" m: a8 Z
  456. #define  RCC_AHB1LPENR_SRAM3LPEN             ((uint32_t)0x00080000)
    ) }3 V5 I5 }1 `5 K1 o6 J1 r
  457. #define  RCC_AHB1LPENR_DMA1LPEN              ((uint32_t)0x00200000)
    1 d) T* R. n# Z
  458. #define  RCC_AHB1LPENR_DMA2LPEN              ((uint32_t)0x00400000)
    * F( G/ s) i3 Y. I) n$ I; J
  459. #define  RCC_AHB1LPENR_DMA2DLPEN             ((uint32_t)0x00800000)! A+ o1 i+ Y! x6 u( }6 |; s
  460. #define  RCC_AHB1LPENR_ETHMACLPEN            ((uint32_t)0x02000000)
    7 D1 Z) X; a% v  p) y
  461. #define  RCC_AHB1LPENR_ETHMACTXLPEN          ((uint32_t)0x04000000)
    4 K$ W6 e/ c% T5 U6 A; ]
  462. #define  RCC_AHB1LPENR_ETHMACRXLPEN          ((uint32_t)0x08000000)1 W6 y! K% Z: y- [
  463. #define  RCC_AHB1LPENR_ETHMACPTPLPEN         ((uint32_t)0x10000000)* D( V+ j0 t8 s0 a! z
  464. #define  RCC_AHB1LPENR_OTGHSLPEN             ((uint32_t)0x20000000). {: H; \$ L& [
  465. #define  RCC_AHB1LPENR_OTGHSULPILPEN         ((uint32_t)0x40000000)
    # z9 v+ R7 [2 d" k6 k# d
  466. # W# ~1 h: Y% f. A! h
  467. /********************  Bit definition for RCC_AHB2LPENR register  *************/% l* k# x0 H1 q9 o9 ^
  468. #define  RCC_AHB2LPENR_DCMILPEN              ((uint32_t)0x00000001). l' j. n# I0 O$ `5 X1 P4 B
  469. #define  RCC_AHB2LPENR_CRYPLPEN              ((uint32_t)0x00000010)
    . S4 t6 B( b$ K, N0 W
  470. #define  RCC_AHB2LPENR_HASHLPEN              ((uint32_t)0x00000020)
    9 c4 k& b5 I, v+ `# Y: h( Q
  471. #define  RCC_AHB2LPENR_RNGLPEN               ((uint32_t)0x00000040)
    ( K3 t4 m0 l, e7 U. K
  472. #define  RCC_AHB2LPENR_OTGFSLPEN             ((uint32_t)0x00000080)
      I; v& C0 w' [9 S
  473. 4 w' i! p0 M* @! j6 f
  474. /********************  Bit definition for RCC_AHB3LPENR register  *************/) K- f0 P1 a& _2 R. q
  475. #if defined(STM32F40_41xxx) || defined(STM32F412xG) || defined(STM32F413_423xx)2 d3 k9 f  |4 Q0 f# S* p  O
  476. #define  RCC_AHB3LPENR_FSMCLPEN              ((uint32_t)0x00000001)
    1 @6 t7 z' d0 P  N3 w6 A
  477. #endif /* STM32F40_41xxx || STM32F412xG || STM32F413_423xx */
    ; _( F% V5 A+ |$ p

  478. 5 h2 t- `0 g; [' L
  479. #if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx): [9 N. |% }0 g# l  s. k) z
  480. #define  RCC_AHB3LPENR_FMCLPEN              ((uint32_t)0x00000001)9 r# w' H" R) m3 o
  481. #endif /* STM32F427_437xx ||  STM32F429_439xx  || STM32F446xx || STM32F469_479xx */3 s+ P- o8 K! ~& T3 F0 C, K& o% u
  482. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx)$ H* m# Q! P4 M, P: g+ X* {
  483. #define  RCC_AHB3LPENR_QSPILPEN             ((uint32_t)0x00000002)
      g0 W) u4 I  o5 Y% c5 Z4 [
  484. #endif /* STM32F412xG || STM32F413_423xx || STM32F469_479xx || STM32F446xx */
      t/ w) l6 L9 c) f

  485. 1 I5 S) T0 W* }% G" @  T0 {
  486. /********************  Bit definition for RCC_APB1LPENR register  *************/' G/ ^: j! M: |' s# y! K& W
  487. #define  RCC_APB1LPENR_TIM2LPEN              ((uint32_t)0x00000001)$ I1 e/ `/ |" p: j! u" h9 V
  488. #define  RCC_APB1LPENR_TIM3LPEN              ((uint32_t)0x00000002)" n) I" ]4 V9 E4 a
  489. #define  RCC_APB1LPENR_TIM4LPEN              ((uint32_t)0x00000004)- L1 M' h! t" f6 C; N+ S" r
  490. #define  RCC_APB1LPENR_TIM5LPEN              ((uint32_t)0x00000008)
    4 z) x7 t- B. F! y! C) V' }( b
  491. #define  RCC_APB1LPENR_TIM6LPEN              ((uint32_t)0x00000010)+ B& |! P8 s5 K2 E+ g% k2 Y5 @7 I
  492. #define  RCC_APB1LPENR_TIM7LPEN              ((uint32_t)0x00000020)
    : _5 G1 p% R. O2 d
  493. #define  RCC_APB1LPENR_TIM12LPEN             ((uint32_t)0x00000040)8 D, K4 C, s: S
  494. #define  RCC_APB1LPENR_TIM13LPEN             ((uint32_t)0x00000080)
    * `! g! G: V0 p! i# v; K. |
  495. #define  RCC_APB1LPENR_TIM14LPEN             ((uint32_t)0x00000100), @. m- W; u3 ~' t. P$ \
  496. #if defined(STM32F410xx) || defined(STM32F413_423xx)% ~) f$ P' Y5 t5 I5 w/ q
  497. #define  RCC_APB1LPENR_LPTIM1LPEN            ((uint32_t)0x00000200)8 u, D6 `, n  v! B8 X7 T
  498. #endif /* STM32F410xx || STM32F413_423xx */
    4 G( Z& s# w+ \! Y" P6 r9 Y
  499. #define  RCC_APB1LPENR_WWDGLPEN              ((uint32_t)0x00000800)0 I8 ~' o( f* M! S
  500. #define  RCC_APB1LPENR_SPI2LPEN              ((uint32_t)0x00004000)
    8 p, F) Z+ u) S8 _; ~0 h
  501. #define  RCC_APB1LPENR_SPI3LPEN              ((uint32_t)0x00008000)
    + y( H# m: h! i" ^& W7 W
  502. #if defined(STM32F446xx)
    5 m: i' e) h$ a
  503. #define  RCC_APB1LPENR_SPDIFRXLPEN           ((uint32_t)0x00010000)+ U9 k/ Y+ F+ D! e, a: ]* L. i
  504. #endif /* STM32F446xx */  J; ^' `  K: F5 L: z" x7 R
  505. #define  RCC_APB1LPENR_USART2LPEN            ((uint32_t)0x00020000)4 {5 {' c/ n+ |# Y( h6 g
  506. #define  RCC_APB1LPENR_USART3LPEN            ((uint32_t)0x00040000)! j1 s# p2 W6 l" h9 E
  507. #define  RCC_APB1LPENR_UART4LPEN             ((uint32_t)0x00080000)2 e1 r6 F) X) C0 b
  508. #define  RCC_APB1LPENR_UART5LPEN             ((uint32_t)0x00100000)5 W1 Y: ?/ K; P3 @0 o$ _  x9 t
  509. #define  RCC_APB1LPENR_I2C1LPEN              ((uint32_t)0x00200000)% Q# A6 X8 T3 _
  510. #define  RCC_APB1LPENR_I2C2LPEN              ((uint32_t)0x00400000)
    ! e. ^  `: m% C4 j3 n' _; I& u
  511. #define  RCC_APB1LPENR_I2C3LPEN              ((uint32_t)0x00800000)
    & c' ]0 s& C+ ^2 [2 Q' b) F
  512. #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx)
    ) I- e" m1 c2 q5 Z5 i
  513. #define  RCC_APB1LPENR_FMPI2C1LPEN           ((uint32_t)0x01000000)
    ' `# y! _7 o& y
  514. #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx || STM32F446xx *// r# `, a/ U8 i) V, Y
  515. #define  RCC_APB1LPENR_CAN1LPEN              ((uint32_t)0x02000000)& F1 {. N% ~" k; J7 O3 j
  516. #define  RCC_APB1LPENR_CAN2LPEN              ((uint32_t)0x04000000)" B9 m8 {( x3 A+ }( L' {5 d
  517. #if defined(STM32F446xx)5 d7 ?. S1 ^3 K# ^% M
  518. #define  RCC_APB1LPENR_CECLPEN               ((uint32_t)0x08000000)
    6 T; |+ P+ x! q5 u* M2 r
  519. #endif /* STM32F446xx */$ j- W& ?% k' C
  520. #define  RCC_APB1LPENR_PWRLPEN               ((uint32_t)0x10000000). S$ V! c7 O. g& ^, O- y
  521. #define  RCC_APB1LPENR_DACLPEN               ((uint32_t)0x20000000)
    : @' h; u* ]0 H5 M8 a( G
  522. #define  RCC_APB1LPENR_UART7LPEN             ((uint32_t)0x40000000): H5 D/ A! M0 a8 Q
  523. #define  RCC_APB1LPENR_UART8LPEN             ((uint32_t)0x80000000)  b( q2 y4 ^6 o' X, g8 V

  524. / Z! d2 ?2 f2 a0 }; g
  525. /********************  Bit definition for RCC_APB2LPENR register  *************/
    - l; q5 }1 B- c% j3 r  L5 f7 S. F
  526. #define  RCC_APB2LPENR_TIM1LPEN              ((uint32_t)0x00000001)
    ! R7 Z! N( {7 @4 G' |. ?
  527. #define  RCC_APB2LPENR_TIM8LPEN              ((uint32_t)0x00000002)
    7 }8 v# n$ q6 l. G+ V
  528. #define  RCC_APB2LPENR_USART1LPEN            ((uint32_t)0x00000010)2 X/ I2 V2 Y$ a  X
  529. #define  RCC_APB2LPENR_USART6LPEN            ((uint32_t)0x00000020)) I( p( m; n. y/ Z6 H
  530. #define  RCC_APB2LPENR_UART9LPEN             ((uint32_t)0x00000040)' u# V7 I1 T& G/ M. m: r
  531. #define  RCC_APB2LPENR_UART10LPEN            ((uint32_t)0x00000080), ~8 j, b; G/ C+ y# E5 _. s
  532. #define  RCC_APB2LPENR_ADC1LPEN              ((uint32_t)0x00000100)
    9 ?2 @( G& ]- v
  533. #define  RCC_APB2LPENR_ADC2PEN               ((uint32_t)0x00000200)( a7 t' p$ f: g  B6 l6 x
  534. #define  RCC_APB2LPENR_ADC3LPEN              ((uint32_t)0x00000400)
    4 c. v0 G8 b$ l( {# @! o0 q. ~
  535. #define  RCC_APB2LPENR_SDIOLPEN              ((uint32_t)0x00000800)9 W2 C7 c0 o- o/ z% z+ j! Q8 {
  536. #define  RCC_APB2LPENR_SPI1LPEN              ((uint32_t)0x00001000)
    # ]! D( X: @& p% |# `, z
  537. #define  RCC_APB2LPENR_SPI4LPEN              ((uint32_t)0x00002000)9 @$ h1 ?9 c3 H  t" J1 e2 ?
  538. #define  RCC_APB2LPENR_SYSCFGLPEN            ((uint32_t)0x00004000): `1 Z7 C' K( w2 b8 O' ^% j
  539. #define  RCC_APB2LPENR_TIM9LPEN              ((uint32_t)0x00010000)& N. [" o8 F5 a- Q8 ^6 X* o0 F
  540. #define  RCC_APB2LPENR_TIM10LPEN             ((uint32_t)0x00020000)
    3 f# z6 A) ?# q, r, j6 _2 c
  541. #define  RCC_APB2LPENR_TIM11LPEN             ((uint32_t)0x00040000)
    ) F& x8 U$ R. x
  542. #define  RCC_APB2LPENR_SPI5LPEN              ((uint32_t)0x00100000)
    # ~) u8 W% R6 ?' a
  543. #define  RCC_APB2LPENR_SPI6LPEN              ((uint32_t)0x00200000)
    ; `5 Y8 s' F+ V$ R
  544. #define  RCC_APB2LPENR_SAI1LPEN              ((uint32_t)0x00400000)/ H: e# ?  d4 M' P% }% `
  545. #if defined(STM32F446xx)# u2 F: h0 P: n  t% E
  546. #define  RCC_APB2LPENR_SAI2LPEN              ((uint32_t)0x00800000)3 n. v0 f6 Q7 K- R6 X, ^4 h% ^6 b
  547. #endif /* STM32F446xx */
    : g0 j9 y1 v0 A" q0 `
  548. #define  RCC_APB2LPENR_LTDCLPEN              ((uint32_t)0x04000000)
    . v/ j9 N1 j3 W9 s/ n
  549. #if defined(STM32F469_479xx)* u# r, u: Y- \+ I" Z0 x
  550. #define  RCC_APB2LPENR_DSILPEN               ((uint32_t)0x08000000)/ w/ {4 Q* }6 J. v5 \8 q. e  m
  551. #endif /* STM32F469_479xx */
    + ^) }9 z4 c1 \% u, e9 [
  552. #if defined(STM32F412xG) || defined(STM32F413_423xx)# o& t' o8 |* j+ x* G% @9 Q9 D9 A
  553. #define  RCC_APB2LPENR_DFSDM1LPEN            ((uint32_t)0x01000000)- K3 c7 v5 O& T8 h. Q6 u; `
  554. #endif /* STM32F412xG || STM32F413_423xx */
    0 j9 |( c" o( k" r( F2 r  n
  555. #if defined(STM32F413_423xx)
    + F% e' h( ~( R) i( Z
  556. #define  RCC_APB2LPENR_DFSDM2LPEN            ((uint32_t)0x02000000)
    ' i' R) N  `* w6 O
  557. #endif /* STM32F413_423xx */
      G5 c# f  h9 w$ A9 G) ^$ A2 I
  558. & B! X3 d& {2 B/ s
  559. /********************  Bit definition for RCC_BDCR register  ******************/
    5 T# a6 P, ]/ X! y( X( N9 Q
  560. #define  RCC_BDCR_LSEON                      ((uint32_t)0x00000001)0 y) T* |$ X* A8 m9 q! j
  561. #define  RCC_BDCR_LSERDY                     ((uint32_t)0x00000002)
    ( A% e9 i% N; y
  562. #define  RCC_BDCR_LSEBYP                     ((uint32_t)0x00000004)- w# W+ s' B9 M( F5 Y, e; g
  563. #define  RCC_BDCR_LSEMOD                     ((uint32_t)0x00000008)
      H0 w( O/ r" s6 w; K
  564. $ m' q* k, G& `; Y) t
  565. #define  RCC_BDCR_RTCSEL                    ((uint32_t)0x00000300)
    . q- I. h; M6 L" g% h/ T
  566. #define  RCC_BDCR_RTCSEL_0                  ((uint32_t)0x00000100)
    4 S* b, @6 f0 a# P7 I* ^
  567. #define  RCC_BDCR_RTCSEL_1                  ((uint32_t)0x00000200)9 h5 k5 o2 w$ H" {

  568. 4 F& [8 G# W5 s$ z3 D1 N4 w
  569. #define  RCC_BDCR_RTCEN                      ((uint32_t)0x00008000)" G1 n& ~. f4 z7 s* l
  570. #define  RCC_BDCR_BDRST                      ((uint32_t)0x00010000)( W, \5 s  l( U4 K8 i

  571. 4 a1 o6 q7 I& H( Q6 F5 C$ _
  572. /********************  Bit definition for RCC_CSR register  *******************/2 o$ D  v$ J# o' B) s( }
  573. #define  RCC_CSR_LSION                       ((uint32_t)0x00000001), f7 M4 k2 |# `& N8 x) R! Z
  574. #define  RCC_CSR_LSIRDY                      ((uint32_t)0x00000002)* X8 B1 V: L. b, `
  575. #define  RCC_CSR_RMVF                        ((uint32_t)0x01000000)6 }9 J, M5 |! T3 x% D" n, Q) l
  576. #define  RCC_CSR_BORRSTF                     ((uint32_t)0x02000000)
    ' E9 O1 M* n. F7 w- H% C6 i+ r
  577. #define  RCC_CSR_PADRSTF                     ((uint32_t)0x04000000)) a) L+ [" V8 Y0 s  L$ C
  578. #define  RCC_CSR_PORRSTF                     ((uint32_t)0x08000000)
    - ^+ W6 {* {. _: W8 l: V6 S
  579. #define  RCC_CSR_SFTRSTF                     ((uint32_t)0x10000000)
      r8 k2 W, i  N3 {- i) X
  580. #define  RCC_CSR_WDGRSTF                     ((uint32_t)0x20000000)
    " V- F- d) e* F! E
  581. #define  RCC_CSR_WWDGRSTF                    ((uint32_t)0x40000000). C- I/ L, z% b' ~# A" h
  582. #define  RCC_CSR_LPWRRSTF                    ((uint32_t)0x80000000)
    , d/ B% B3 z5 N7 `  t8 J& C
  583. 8 j4 ]( X6 z$ J2 n- R4 y6 R- W; u
  584. /********************  Bit definition for RCC_SSCGR register  *****************/* @, o0 O+ Q& y+ x' |
  585. #define  RCC_SSCGR_MODPER                    ((uint32_t)0x00001FFF)
    5 @6 L  k* M/ Z) Z& q9 i! p( ^4 B
  586. #define  RCC_SSCGR_INCSTEP                   ((uint32_t)0x0FFFE000)
    1 _9 o* ?4 n) ]: @& t
  587. #define  RCC_SSCGR_SPREADSEL                 ((uint32_t)0x40000000)# b3 @1 r$ c/ C
  588. #define  RCC_SSCGR_SSCGEN                    ((uint32_t)0x80000000)
    . [  m' q: [+ L

  589. " j/ J8 K- P8 V
  590. /********************  Bit definition for RCC_PLLI2SCFGR register  ************/
    * M- s# l2 |7 Y8 O' N+ Q
  591. #define  RCC_PLLI2SCFGR_PLLI2SM              ((uint32_t)0x0000003F), N* o- n8 f5 U" r
  592. #define  RCC_PLLI2SCFGR_PLLI2SM_0            ((uint32_t)0x00000001)
    % z! a' S1 K) A- z& u
  593. #define  RCC_PLLI2SCFGR_PLLI2SM_1            ((uint32_t)0x00000002)
    ' E6 G+ q, ^% m) Y$ Y3 w
  594. #define  RCC_PLLI2SCFGR_PLLI2SM_2            ((uint32_t)0x00000004)  ~) v. D4 ~: h( b: I0 P3 t' U2 K
  595. #define  RCC_PLLI2SCFGR_PLLI2SM_3            ((uint32_t)0x00000008)3 L( R: Q3 o$ m$ b4 \3 k" c
  596. #define  RCC_PLLI2SCFGR_PLLI2SM_4            ((uint32_t)0x00000010)- S% {% J8 {1 J3 J0 K+ U& E
  597. #define  RCC_PLLI2SCFGR_PLLI2SM_5            ((uint32_t)0x00000020)
    0 `" @* S1 h6 X8 a+ [

  598. * v+ k  i5 m1 M" s, L
  599. #define  RCC_PLLI2SCFGR_PLLI2SN              ((uint32_t)0x00007FC0)2 S1 L  T9 d8 N7 i4 i* _. o! M
  600. #define  RCC_PLLI2SCFGR_PLLI2SN_0            ((uint32_t)0x00000040)
    " G) a' Y# Q9 `) i  A3 r
  601. #define  RCC_PLLI2SCFGR_PLLI2SN_1            ((uint32_t)0x00000080)* j: j& p& l& }$ U3 @) Q4 H
  602. #define  RCC_PLLI2SCFGR_PLLI2SN_2            ((uint32_t)0x00000100)' V: c  b+ D4 w& M, y
  603. #define  RCC_PLLI2SCFGR_PLLI2SN_3            ((uint32_t)0x00000200)- B+ Y0 ~2 v, N7 ]) w
  604. #define  RCC_PLLI2SCFGR_PLLI2SN_4            ((uint32_t)0x00000400)
    " I0 t3 X4 @) b# K- E
  605. #define  RCC_PLLI2SCFGR_PLLI2SN_5            ((uint32_t)0x00000800)# e0 ~& _3 M5 t3 t2 M' r, a
  606. #define  RCC_PLLI2SCFGR_PLLI2SN_6            ((uint32_t)0x00001000)3 X9 w5 [' h( t% x. F
  607. #define  RCC_PLLI2SCFGR_PLLI2SN_7            ((uint32_t)0x00002000)8 O# v4 B$ u/ E  |. t* v
  608. #define  RCC_PLLI2SCFGR_PLLI2SN_8            ((uint32_t)0x00004000)2 w0 t# v8 \  R0 `5 O+ m

  609. % \. ^  I  {- K9 o4 x8 S5 j& E
  610. #if defined(STM32F412xG) || defined(STM32F413_423xx)
    ! v; x+ n1 ~$ ^% H  _+ P+ v
  611. #define  RCC_PLLI2SCFGR_PLLI2SSRC            ((uint32_t)0x00400000)
    " i; N' k' `6 e  |' i/ ^
  612. #endif /* STM32F412xG || STM32F413_423xx */
    5 P' m% w' u7 C- S5 Q3 F' E, W

  613. ( i+ t, z9 O6 c
  614. #if defined(STM32F446xx)$ O9 Z. j; r" e7 Q3 g
  615. #define  RCC_PLLI2SCFGR_PLLI2SP              ((uint32_t)0x00030000)
    / N$ ?3 A( J" J% v; Q7 n
  616. #define  RCC_PLLI2SCFGR_PLLI2SP_0            ((uint32_t)0x00010000). l! @8 a: }1 @( R% \
  617. #define  RCC_PLLI2SCFGR_PLLI2SP_1            ((uint32_t)0x00020000)2 T/ T% T5 D0 x" I8 [# B% i7 r2 W
  618. #endif /* STM32F446xx */9 q- ^; y5 U$ C7 b$ e. J

  619. 0 `3 Q9 b/ A+ a
  620. #define  RCC_PLLI2SCFGR_PLLI2SQ              ((uint32_t)0x0F000000)
    " L7 t& d6 @+ E5 D
  621. #define  RCC_PLLI2SCFGR_PLLI2SQ_0            ((uint32_t)0x01000000)
    " a2 x4 u" G5 ?" @% s
  622. #define  RCC_PLLI2SCFGR_PLLI2SQ_1            ((uint32_t)0x02000000)6 p( @9 f0 g1 L$ c+ y
  623. #define  RCC_PLLI2SCFGR_PLLI2SQ_2            ((uint32_t)0x04000000)
    4 Y" O* I4 D2 {0 f
  624. #define  RCC_PLLI2SCFGR_PLLI2SQ_3            ((uint32_t)0x08000000)
    1 x; M' L  U1 h# d
  625. 7 V; j: i( \6 b. r1 M
  626. #define  RCC_PLLI2SCFGR_PLLI2SR              ((uint32_t)0x70000000)
    2 S3 V& n3 |$ i; o0 U4 s
  627. #define  RCC_PLLI2SCFGR_PLLI2SR_0            ((uint32_t)0x10000000)
    ' C( T* S9 m( A: y7 e
  628. #define  RCC_PLLI2SCFGR_PLLI2SR_1            ((uint32_t)0x20000000)5 ~9 y0 ~# z4 n9 F+ G
  629. #define  RCC_PLLI2SCFGR_PLLI2SR_2            ((uint32_t)0x40000000)% {( q: ]. x3 m. J: w. Y
  630. . P0 D1 u: I; {5 u( }8 f
  631. /********************  Bit definition for RCC_PLLSAICFGR register  ************/. [* r( ?) ~- W' i7 u2 i
  632. #if defined(STM32F446xx)
    8 w: d6 b8 ]4 n9 s) j+ ~7 K; K) O6 z8 a
  633. #define  RCC_PLLSAICFGR_PLLSAIM              ((uint32_t)0x0000003F)3 J' s' N2 G5 x, N2 I
  634. #define  RCC_PLLSAICFGR_PLLSAIM_0            ((uint32_t)0x00000001)
    6 Y- H4 f/ k2 `7 K7 p0 F- L
  635. #define  RCC_PLLSAICFGR_PLLSAIM_1            ((uint32_t)0x00000002)0 O3 h: p5 Z( q1 W2 z# i
  636. #define  RCC_PLLSAICFGR_PLLSAIM_2            ((uint32_t)0x00000004)" ?5 F  g3 m0 T" [0 b- u" {
  637. #define  RCC_PLLSAICFGR_PLLSAIM_3            ((uint32_t)0x00000008)' v% H0 o  ?- G1 ]2 |0 b* {5 r
  638. #define  RCC_PLLSAICFGR_PLLSAIM_4            ((uint32_t)0x00000010)
    , {3 b4 }* R; n* Z) h6 j  _- e
  639. #define  RCC_PLLSAICFGR_PLLSAIM_5            ((uint32_t)0x00000020)
    : O$ }+ b- Y9 J- u1 Q9 t, r
  640. #endif /* STM32F446xx */
    5 }% d2 O2 c7 {5 t
  641. ) c9 l1 m; t0 ^9 C6 o. H
  642. #define  RCC_PLLSAICFGR_PLLSAIN              ((uint32_t)0x00007FC0)
    8 x9 N" N4 X) C6 g# a4 N
  643. #define  RCC_PLLSAICFGR_PLLSAIN_0            ((uint32_t)0x00000040)
    3 w+ ?# v- ~5 M! y% V" I& {
  644. #define  RCC_PLLSAICFGR_PLLSAIN_1            ((uint32_t)0x00000080)( n$ L- o* l# f8 t
  645. #define  RCC_PLLSAICFGR_PLLSAIN_2            ((uint32_t)0x00000100)2 i( W+ H$ V7 y. n9 p
  646. #define  RCC_PLLSAICFGR_PLLSAIN_3            ((uint32_t)0x00000200)- U; Q9 t$ R( P0 B% [( U7 Q$ e9 i
  647. #define  RCC_PLLSAICFGR_PLLSAIN_4            ((uint32_t)0x00000400)
    6 M0 K  \3 g$ K6 d7 [) t
  648. #define  RCC_PLLSAICFGR_PLLSAIN_5            ((uint32_t)0x00000800)' e6 g9 U( p4 M1 k. S( [
  649. #define  RCC_PLLSAICFGR_PLLSAIN_6            ((uint32_t)0x00001000)
    . ?8 q5 ^5 ~. V( s, {7 [8 L
  650. #define  RCC_PLLSAICFGR_PLLSAIN_7            ((uint32_t)0x00002000)
    4 n! c7 \' v1 F/ q! }- O  W
  651. #define  RCC_PLLSAICFGR_PLLSAIN_8            ((uint32_t)0x00004000)/ v, C9 P9 m  K
  652. 9 g4 K. L4 F( W, J9 P
  653. #if defined(STM32F446xx) || defined(STM32F469_479xx)  1 p5 E' ]' X; v1 S
  654. #define  RCC_PLLSAICFGR_PLLSAIP              ((uint32_t)0x00030000)# L7 B% Q% C# q
  655. #define  RCC_PLLSAICFGR_PLLSAIP_0            ((uint32_t)0x00010000)/ S3 k% R8 Z( ]) e- E) h9 |4 ?
  656. #define  RCC_PLLSAICFGR_PLLSAIP_1            ((uint32_t)0x00020000)
    8 Y0 Y8 \" \  J# V
  657. #endif /* STM32F446xx || STM32F469_479xx */- Q; \5 }, N& d

  658. % _7 L" ?( F" o# j: q
  659. #define  RCC_PLLSAICFGR_PLLSAIQ              ((uint32_t)0x0F000000)5 [) S" P: \7 s( [7 t
  660. #define  RCC_PLLSAICFGR_PLLSAIQ_0            ((uint32_t)0x01000000)% f' y( L3 {  ^/ v; W
  661. #define  RCC_PLLSAICFGR_PLLSAIQ_1            ((uint32_t)0x02000000)9 W! ?7 w1 f' s* G
  662. #define  RCC_PLLSAICFGR_PLLSAIQ_2            ((uint32_t)0x04000000). `3 v# i4 E% W% i0 H
  663. #define  RCC_PLLSAICFGR_PLLSAIQ_3            ((uint32_t)0x08000000)4 o7 m3 U. X4 a- ?! e( c% z

  664. 7 S: T8 t* f( M8 i. J/ h2 |
  665. #define  RCC_PLLSAICFGR_PLLSAIR              ((uint32_t)0x70000000)4 G4 O7 V8 c) `2 F
  666. #define  RCC_PLLSAICFGR_PLLSAIR_0            ((uint32_t)0x10000000)) _, h$ \/ I, h( c8 N1 {. Z
  667. #define  RCC_PLLSAICFGR_PLLSAIR_1            ((uint32_t)0x20000000)" E3 g& q; O% W* e
  668. #define  RCC_PLLSAICFGR_PLLSAIR_2            ((uint32_t)0x40000000)  H% H; s4 P: V0 u" l! }
  669.   X. K, s# m, \* U) x/ H! f
  670. /********************  Bit definition for RCC_DCKCFGR register  ***************/+ v4 W* \% v+ U+ f9 a- a0 N( R
  671. #define  RCC_DCKCFGR_PLLI2SDIVQ              ((uint32_t)0x0000001F)
      x! {6 K* u! ]) t: h0 {
  672. #define  RCC_DCKCFGR_PLLSAIDIVQ              ((uint32_t)0x00001F00)
    ) D3 X. }$ b/ o/ k
  673. #define  RCC_DCKCFGR_PLLSAIDIVR              ((uint32_t)0x00030000)" V! p+ Q, d8 j: U# ~2 P3 V

  674. 9 F3 H3 B) O# U, B4 Z+ X/ m
  675. #if defined(STM32F412xG) || defined(STM32F413_423xx)$ W; j: X9 m8 o+ V- `9 q2 p+ G
  676. #define  RCC_DCKCFGR_CKDFSDM1SEL             ((uint32_t)0x80000000)
    8 Q. M3 s! |6 I
  677. #define  RCC_DCKCFGR_CKDFSDM1ASEL            ((uint32_t)0x00008000): B1 [; [: P* {
  678. #endif /* STM32F412xG || STM32F413_423xx */# M1 F( f* [( h- r' ?6 z' ~5 X( O

  679. 4 T$ c! h3 S. n  O/ }) ]
  680. #if defined(STM32F413_423xx)
    6 ^: s3 w6 ~; ~" W( }
  681. #define  RCC_DCKCFGR_PLLI2SDIVR              ((uint32_t)0x0000001F)
    : @; A' v: b4 }1 m9 O* g& Z
  682. #define  RCC_DCKCFGR_PLLI2SDIVR_0            ((uint32_t)0x00000001)* [( ]  U) d' a
  683. #define  RCC_DCKCFGR_PLLI2SDIVR_1            ((uint32_t)0x00000002)
    * `  M, {7 Q2 j; [
  684. #define  RCC_DCKCFGR_PLLI2SDIVR_2            ((uint32_t)0x00000004)/ D" ?/ D: V; k6 d$ N+ N3 o0 t
  685. #define  RCC_DCKCFGR_PLLI2SDIVR_3            ((uint32_t)0x00000008)- ]' I! T4 i$ @  l
  686. #define  RCC_DCKCFGR_PLLI2SDIVR_4            ((uint32_t)0x00000010). q. _( h5 R8 a

  687. - b- ]% T# I+ n+ c8 |2 k% @+ E
  688. #define  RCC_DCKCFGR_PLLDIVR                 ((uint32_t)0x00001F00)3 \# N8 v" g$ t. j  s" x
  689. #define  RCC_DCKCFGR_PLLDIVR_0               ((uint32_t)0x00000100)
    ! _, p6 q* g$ Q% D, H0 _+ f
  690. #define  RCC_DCKCFGR_PLLDIVR_1               ((uint32_t)0x00000200)- R* K( H# [. c- I6 B# i( z# ?7 s
  691. #define  RCC_DCKCFGR_PLLDIVR_2               ((uint32_t)0x00000400)3 D4 g. i$ J  q! M; ^; J* F2 O
  692. #define  RCC_DCKCFGR_PLLDIVR_3               ((uint32_t)0x00000800)
    9 z% C# H; d; G% f7 Y% ?
  693. #define  RCC_DCKCFGR_PLLDIVR_4               ((uint32_t)0x00001000)
    " c; _: E: S, {, U! r
  694. #define  RCC_DCKCFGR_CKDFSDM2ASEL            ((uint32_t)0x00004000)* z: y. Z1 K1 d! H1 W
  695. #endif /* STM32F413_423xx */
    $ n( r0 b2 N( m* S& I  i
  696. . Y- P8 W' c/ `! v% K; d+ l! u0 l
  697. #define  RCC_DCKCFGR_SAI1ASRC                ((uint32_t)0x00300000)0 ~& x( _0 l5 g7 D: W* d
  698. #define  RCC_DCKCFGR_SAI1ASRC_0              ((uint32_t)0x00100000)5 p# m5 |3 |! R' ^. s
  699. #define  RCC_DCKCFGR_SAI1ASRC_1              ((uint32_t)0x00200000)- e  u" B3 [0 j. C& |2 c
  700. #if defined(STM32F446xx)" q1 w% O5 Q& x% [0 \
  701. #define  RCC_DCKCFGR_SAI1SRC                 ((uint32_t)0x00300000)1 n. l  D5 `' l6 D
  702. #define  RCC_DCKCFGR_SAI1SRC_0               ((uint32_t)0x00100000)
    ) W' T/ K: Y4 N0 P
  703. #define  RCC_DCKCFGR_SAI1SRC_1               ((uint32_t)0x00200000)+ R4 V& t: W$ _# K+ @. ?
  704. #endif /* STM32F446xx */; ?+ C* D5 ^' W# S7 u* |: J
  705. / U! U+ O" i& w
  706. #define  RCC_DCKCFGR_SAI1BSRC                ((uint32_t)0x00C00000)9 h- ^) x, b9 E+ ^3 q9 a4 l% L
  707. #define  RCC_DCKCFGR_SAI1BSRC_0              ((uint32_t)0x00400000)/ b6 r5 u$ q) s
  708. #define  RCC_DCKCFGR_SAI1BSRC_1              ((uint32_t)0x00800000)! b3 A* i5 J4 Q6 X! r- i: f! ^6 @. U
  709. #if defined(STM32F446xx)% k6 m( A! M: S! R$ Y4 q
  710. #define  RCC_DCKCFGR_SAI2SRC                 ((uint32_t)0x00C00000)
    , q$ `! J9 \6 Y$ ]; c. r/ P& u
  711. #define  RCC_DCKCFGR_SAI2SRC_0               ((uint32_t)0x00400000)
    / \$ ?5 i0 Q0 I3 T: u5 c' a. S
  712. #define  RCC_DCKCFGR_SAI2SRC_1               ((uint32_t)0x00800000)
    - S3 N# C  D2 m3 i( S' w
  713. #endif /* STM32F446xx */- R$ R0 u$ I, S* |' O1 Q, e
  714. ( \4 n! X2 m' m* G+ \
  715. #define  RCC_DCKCFGR_TIMPRE                  ((uint32_t)0x01000000)/ {7 E0 I% R% k( {
  716. #if defined(STM32F469_479xx)
    3 W0 Y( W  v4 E! e9 _+ c
  717. #define  RCC_DCKCFGR_CK48MSEL                ((uint32_t)0x08000000)
    # t0 F0 N& ?" C+ h9 D: G, f. i
  718. #define  RCC_DCKCFGR_SDIOSEL                 ((uint32_t)0x10000000); r' A3 j3 ]+ [) \# T0 A
  719. #define  RCC_DCKCFGR_DSISEL                  ((uint32_t)0x20000000)
    ( }$ W6 a) g3 M6 u
  720. #endif /* STM32F469_479xx */
    ( s" `' V# P& Q. F
  721. & J' ~) B' g/ i% ~
  722. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx)
    ' N" R+ c9 i9 ^+ X5 k, Q' b# F
  723. #define  RCC_DCKCFGR_I2S1SRC                 ((uint32_t)0x06000000)
    : \5 ~; S5 Q2 R0 V5 Q* I9 P- x3 O
  724. #define  RCC_DCKCFGR_I2S1SRC_0               ((uint32_t)0x02000000)
    6 R# m, W2 E2 _; q  I9 I  O  S& S
  725. #define  RCC_DCKCFGR_I2S1SRC_1               ((uint32_t)0x04000000)) ]! J3 E1 w  N# U8 U, _
  726. #define  RCC_DCKCFGR_I2S2SRC                 ((uint32_t)0x18000000)
    " `3 ^# ]0 P) f# s
  727. #define  RCC_DCKCFGR_I2S2SRC_0               ((uint32_t)0x08000000)) Q2 J9 A! e( V. F, c3 ]
  728. #define  RCC_DCKCFGR_I2S2SRC_1               ((uint32_t)0x10000000)
    # \) l- p, V8 _# h% b) j8 `

  729. 8 B/ i- S+ h/ K) ~+ g9 X9 j
  730. /********************  Bit definition for RCC_CKGATENR register  ***************/6 W. P/ p9 r4 L9 Q6 _' |
  731. #define  RCC_CKGATENR_AHB2APB1_CKEN          ((uint32_t)0x00000001)
    0 M0 H" [7 X& ~, m
  732. #define  RCC_CKGATENR_AHB2APB2_CKEN          ((uint32_t)0x00000002)
    ; f9 d' S* E3 z! B. O. O. e
  733. #define  RCC_CKGATENR_CM4DBG_CKEN            ((uint32_t)0x00000004)9 I. Q, U" i7 |  p
  734. #define  RCC_CKGATENR_SPARE_CKEN             ((uint32_t)0x00000008)
    . I3 Z0 k0 c% m# V; ~9 \+ W
  735. #define  RCC_CKGATENR_SRAM_CKEN              ((uint32_t)0x00000010)& R" h+ }: D1 Q. Y
  736. #define  RCC_CKGATENR_FLITF_CKEN             ((uint32_t)0x00000020); F( ^- x# [( a+ D8 F( q6 Z  q6 K
  737. #define  RCC_CKGATENR_RCC_CKEN               ((uint32_t)0x00000040)# n$ O6 E. h( H
  738. #if defined(STM32F412xG) || defined(STM32F413_423xx)
    : v$ L" i  r, A) U$ ^. I0 F
  739. #define  RCC_CKGATENR_RCC_EVTCTL             ((uint32_t)0x00000080)
    ( S- h3 ^2 F; Z9 }; X! Z8 s$ k
  740. #endif /* STM32F412xG || STM32F413_423xx */
    ( m* J! H7 X. L. D

  741. 1 O0 y2 p" X- k, @* H/ `# q
  742. /********************  Bit definition for RCC_DCKCFGR2 register  ***************/$ a# h: g) S5 {
  743. #define  RCC_DCKCFGR2_FMPI2C1SEL             ((uint32_t)0x00C00000)2 L, }" @$ n" @. @  `- s
  744. #define  RCC_DCKCFGR2_FMPI2C1SEL_0           ((uint32_t)0x00400000)1 Y5 u& V0 l: ^" t
  745. #define  RCC_DCKCFGR2_FMPI2C1SEL_1           ((uint32_t)0x00800000)
    ) h- ]& L- g5 T' a3 X
  746. #define  RCC_DCKCFGR2_CECSEL                 ((uint32_t)0x04000000)
    + F  o/ |: m" o4 K6 {% k! s
  747. #define  RCC_DCKCFGR2_CK48MSEL               ((uint32_t)0x08000000): a5 ]+ T4 z6 r) [* J
  748. #define  RCC_DCKCFGR2_SDIOSEL                ((uint32_t)0x10000000)
    # z( \4 ], e- V3 v# }
  749. #if defined(STM32F446xx)
      o: l: N1 o9 u  a
  750. #define  RCC_DCKCFGR2_SPDIFRXSEL             ((uint32_t)0x20000000)
    * O% U) q: K  Q4 s6 t5 }8 v
  751. #endif /* STM32F446xx */: X& \5 V* X8 a' y* x( @
  752. #if defined(STM32F413_423xx)- f, S  f4 y( |  V2 f- p) ?
  753. #define  RCC_DCKCFGR2_LPTIM1SEL              ((uint32_t)0xC0000000)
    * C; R- H8 l) i9 j1 T5 r2 Q
  754. #define  RCC_DCKCFGR2_LPTIM1SEL_0            ((uint32_t)0x40000000)& j8 E0 r9 M1 {( X/ C" y
  755. #define  RCC_DCKCFGR2_LPTIM1SEL_1            ((uint32_t)0x80000000)
    ( R: [8 C9 p$ j. @: O
  756. #endif /* STM32F413_423xx */
    % k, {7 y8 m# @5 U( T. s3 s
  757. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx */* B: c+ ?0 {# b7 N( I/ V! k3 i$ B

  758. 0 ~8 l0 Q7 d/ ]/ [5 y8 w8 O
  759. #if defined(STM32F410xx)- y  E  t) f6 D; U" k; p  h
  760. #define  RCC_DCKCFGR_I2SSRC                  ((uint32_t)0x06000000)
    / q* p# ?  c# P  o8 ?7 O- N' G1 r7 G2 L
  761. #define  RCC_DCKCFGR_I2SSRC_0                ((uint32_t)0x02000000)
    $ p, a/ r; X  [% ]* d
  762. #define  RCC_DCKCFGR_I2SSRC_1                ((uint32_t)0x04000000)7 a+ k8 w  e2 _- p! O7 A+ x) V
  763. #endif /* STM32F410xx */: f3 }, M' M$ n0 L
  764. : Z+ g6 p. w7 B- S6 y* A
  765. #if defined(STM32F410xx)
    $ z# l: H# ^+ i0 q9 Z) x1 D6 x
  766. /********************  Bit definition for RCC_DCKCFGR2 register  **************/
    " m! J" p! S0 ?8 ]+ v: d# H
  767. #define  RCC_DCKCFGR2_FMPI2C1SEL             ((uint32_t)0x00C00000)0 E6 C' P4 s( w& c! c9 G3 |2 `
  768. #define  RCC_DCKCFGR2_FMPI2C1SEL_0           ((uint32_t)0x00400000)
    / {  s4 a" J+ {. O9 G& p( P& t
  769. #define  RCC_DCKCFGR2_FMPI2C1SEL_1           ((uint32_t)0x00800000)
    5 x+ l: I+ D) J
  770. #define  RCC_DCKCFGR2_LPTIM1SEL              ((uint32_t)0xC0000000)
    ! b. M/ }: w3 I9 v/ f1 O4 D* X3 G
  771. #define  RCC_DCKCFGR2_LPTIM1SEL_0            ((uint32_t)0x40000000)" u) E% S0 e2 z0 @/ c2 z. x
  772. #define  RCC_DCKCFGR2_LPTIM1SEL_1            ((uint32_t)0x80000000)
    3 j% M0 J' P8 N
  773. #endif /* STM32F410xx */4 \3 e/ x4 A! d- ~
复制代码
. Q5 R. Z# C/ m% W# w0 d
赞 收藏 评论0 发布时间:2022-3-31 11:00

举报

0个回答

所属标签

相似技术帖

官网相关资源

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版