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

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

[复制链接]
STMCU小助手 发布时间:2022-3-31 11:00
01. 概述6 S4 p, Q: Q7 ?) M9 K! Y' \
在 STM32F4 标准固件库里,时钟源的选择以及时钟使能等函数都是在 RCC 相关固件库文件 stm32f4xx_rcc.h 和 stm32f4xx_rcc.c 中声明和定义的。大家打开 stm32f4xx_rcc.h 文件可以看到文件开头有很多宏定义标识符,然后是一系列时钟配置和时钟使能函数申明。这些函数大致可以归结为三类,一类是外设时钟使能函数,一类是时钟源和分频因子配置函数,还有一类是外设复位函数。当然还有几个获取时钟源配置的函数。* M5 v4 Y0 Q/ C  U# {8 e- g$ {3 U  C

  M9 S0 i0 g# s1 w' r. c( e9 [- b02. 相关类型
! @, B0 `! E# v- i( pRCC_ClocksTypeDef1 o" ^4 o8 f7 J* y, q

9 s  f1 Z# ?/ V& s% P' U; c
  1. /* Exported types ------------------------------------------------------------*/
    ; w+ L) Y) c" ]) g$ h* k
  2. typedef struct, l0 E, W: s! U% `
  3. {
    + s0 t+ u* d6 F7 @
  4.   uint32_t SYSCLK_Frequency; /*!<  SYSCLK clock frequency expressed in Hz */" B6 c9 g+ y: G, N+ k  G' p
  5.   uint32_t HCLK_Frequency;   /*!<  HCLK clock frequency expressed in Hz   */
    7 d5 P0 X2 U' q8 v* _
  6.   uint32_t PCLK1_Frequency;  /*!<  PCLK1 clock frequency expressed in Hz  */, k- ^7 R2 k* \
  7.   uint32_t PCLK2_Frequency;  /*!<  PCLK2 clock frequency expressed in Hz  */
    4 a6 y2 j3 M, i3 o0 ?$ L0 m
  8. }RCC_ClocksTypeDef;
复制代码
/ q, i, K( u$ |0 T: \5 e
RCC_HSE_configuration* z# l% a% e( b1 `7 d- C! f

2 h* r) h- u3 }$ J: q9 ^/ B7 b
  1. /** @defgroup RCC_HSE_configuration
    " s1 H5 P6 Z  P0 B5 w
  2.   * @{
    5 N7 E( g& [; @) y! @* m% X- A6 \. l
  3.   */# l3 {2 y+ {6 d6 z% r1 \
  4. #define RCC_HSE_OFF                      ((uint8_t)0x00)
    % t: t+ _1 I1 C  Z; Q- N
  5. #define RCC_HSE_ON                       ((uint8_t)0x01)
    + V7 k6 f; \# D1 A+ Z" K
  6. #define RCC_HSE_Bypass                   ((uint8_t)0x05)2 P" J9 ~, b' |$ U+ m' D9 D
  7. #define IS_RCC_HSE(HSE) (((HSE) == RCC_HSE_OFF) || ((HSE) == RCC_HSE_ON) || \1 ^# M  w* W+ \* p+ ]/ o: b
  8.                          ((HSE) == RCC_HSE_Bypass))
复制代码
6 v0 @( S; ^9 w5 z
RCC_LSE_Dual_Mode_Selection; Q0 S, z( ~2 y

2 l9 F+ p3 x; X
  1. /** @defgroup RCC_LSE_Dual_Mode_Selection# Z7 u9 D+ C8 t, \3 w# o
  2.   * @{
    ; T/ u2 e, E9 j$ Q" }) x
  3.   */
    - V; ]5 V" B- A5 k
  4. #define RCC_LSE_LOWPOWER_MODE           ((uint8_t)0x00): R* S8 F( M* Z7 |6 h: L8 ]1 N7 D
  5. #define RCC_LSE_HIGHDRIVE_MODE          ((uint8_t)0x01)
    ; ?2 G+ b( D/ _- A
  6. #define IS_RCC_LSE_MODE(MODE)           (((MODE) == RCC_LSE_LOWPOWER_MODE) || \. P4 Y7 d% L* w$ w
  7.                                          ((MODE) == RCC_LSE_HIGHDRIVE_MODE))
复制代码

1 P( x* o' l7 @( V5 o9 c) fRCC_PLLSAIDivR_Factor
& b, K9 y8 [& x4 \1 y& p( j4 C* m5 x$ O  k4 F2 l
  1. /** @defgroup RCC_PLLSAIDivR_Factor
      C7 s, n6 z4 J6 s. @1 s
  2.   * @{
    ) L" L/ B' [( Z# N
  3.   */4 ^2 |. g& ^( v+ J! p) I) u
  4. #define RCC_PLLSAIDivR_Div2                ((uint32_t)0x00000000)  _0 K6 {8 `, H. o
  5. #define RCC_PLLSAIDivR_Div4                ((uint32_t)0x00010000)3 y# z+ t6 D8 r, f0 a/ ?0 w4 l
  6. #define RCC_PLLSAIDivR_Div8                ((uint32_t)0x00020000)+ H4 H' Q* s3 t2 F
  7. #define RCC_PLLSAIDivR_Div16               ((uint32_t)0x00030000)4 m9 W) ^% H: z) a
  8. #define IS_RCC_PLLSAI_DIVR_VALUE(VALUE) (((VALUE) == RCC_PLLSAIDivR_Div2) ||\
    " i# p0 W4 b. B. y7 P
  9.                                         ((VALUE) == RCC_PLLSAIDivR_Div4)  ||\
    3 _1 c* w8 a9 }$ E4 Z# O# x
  10.                                         ((VALUE) == RCC_PLLSAIDivR_Div8)  ||\
    " Q8 P5 a, X! R0 a& {+ M6 G# W: P
  11.                                         ((VALUE) == RCC_PLLSAIDivR_Div16))
复制代码
9 F$ A4 `& |- d% [( f
RCC_PLL_Clock_Source
& Z' f0 e) E! l0 s# y/ `" Q$ I" G9 E) ^7 e, ], G6 x& f, _8 x
  1. /** @defgroup RCC_PLL_Clock_Source
    ) F4 I8 q) ?- }: {2 q: |
  2.   * @{
    1 d1 p& b' Q9 [
  3.   */
    ) @7 x+ T. }7 L: N. @! V
  4. #define RCC_PLLSource_HSI                ((uint32_t)0x00000000)3 k9 B/ @& c$ n3 Y  x7 r" l5 y. ~
  5. #define RCC_PLLSource_HSE                ((uint32_t)0x00400000); t& U* ?3 [* x4 m( Y0 r0 r
  6. #define IS_RCC_PLL_SOURCE(SOURCE) (((SOURCE) == RCC_PLLSource_HSI) || \' z, g; d) Z( y0 D7 s4 k5 c" ?
  7.                                    ((SOURCE) == RCC_PLLSource_HSE))
    9 m  X- ~' y- H6 y" q% H. h
  8. #define IS_RCC_PLLM_VALUE(VALUE) ((VALUE) <= 63)
    2 W8 L. w4 ^( d, n( S4 c
  9. #define IS_RCC_PLLN_VALUE(VALUE) ((50 <= (VALUE)) && ((VALUE) <= 432))
    & O$ r1 P0 b; y6 m- ^
  10. #define IS_RCC_PLLP_VALUE(VALUE) (((VALUE) == 2) || ((VALUE) == 4) || / f. S0 M  I4 G1 g6 F% H& S& u
  11. ((VALUE) == 6) || ((VALUE) == 8))# {$ j) a! J! x- g: a
  12. #define IS_RCC_PLLQ_VALUE(VALUE) ((4 <= (VALUE)) && ((VALUE) <= 15))
    9 K2 F0 v" X# B
  13. #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) + Q, ]! _5 V" W- k( C& x
  14.     || defined(STM32F446xx) || defined(STM32F469_479xx)8 ]1 \& Q4 [- f4 D: ^, J" T
  15. #define IS_RCC_PLLR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))6 J6 E/ k4 H- r9 {# g
  16. #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx || STM32F446xx
    7 q! X  S: t0 F% J3 P% S2 X' @$ j" P4 x
  17. || STM32F469_479xx */
    3 V8 x0 Z. G2 Y( O" Y# E3 n
  18. $ v' C' U4 S. a0 o
  19. #define IS_RCC_PLLI2SN_VALUE(VALUE) ((50 <= (VALUE)) && ((VALUE) <= 432))
    ' g- k4 L2 a: W$ J
  20. #define IS_RCC_PLLI2SR_VALUE(VALUE) ((2 <= (VALUE))  && ((VALUE) <= 7))
    + r7 z% M- y0 O' X. y
  21. #define IS_RCC_PLLI2SM_VALUE(VALUE) ((2 <= (VALUE))  && ((VALUE) <= 63)). G3 m7 B6 X7 A
  22. #define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2 <= (VALUE))  && ((VALUE) <= 15))
    , G0 Q- W! r5 r3 V& ~" R* b
  23. #if defined(STM32F446xx)
    9 i& [* q3 t1 ]
  24. #define IS_RCC_PLLI2SP_VALUE(VALUE) (((VALUE) == 2) || ((VALUE) == 4) 4 J, w& h* l8 g' V& F7 f- `
  25.     || ((VALUE) == 6) || ((VALUE) == 8))+ _% O! N$ r" n4 k
  26. #define IS_RCC_PLLSAIM_VALUE(VALUE) ((VALUE) <= 63)
    1 o6 N: L7 F% l# y! f- s) F* z
  27. #elif  defined(STM32F412xG) || defined(STM32F413_423xx)/ J1 o( ~! m# N0 Y, I1 y
  28. #define IS_RCC_PLLI2SP_VALUE(VALUE) (((VALUE) == 2) || ((VALUE) == 4)
    ! b* z/ Y$ k" h; g; x7 u
  29.     || ((VALUE) == 6) || ((VALUE) == 8))
    ! v$ x8 A  Q; N  z# k
  30. #else
    * ?4 f3 @0 T9 ^% n6 `2 q, H7 Y2 U# g
  31. #endif /* STM32F446xx */
    ! U, {: h7 f+ S/ r% S  o
  32. #define IS_RCC_PLLSAIN_VALUE(VALUE) ((50 <= (VALUE)) && ((VALUE) <= 432))& z; p( m0 X0 `5 G9 o, ]; ~
  33. #if defined(STM32F446xx) || defined(STM32F469_479xx)
    & m( w9 O( S8 ?* Q
  34. #define IS_RCC_PLLSAIP_VALUE(VALUE) (((VALUE) == 2) || ((VALUE) == 4) 3 o( s0 J/ s. ^6 Q
  35.     || ((VALUE) == 6) || ((VALUE) == 8)), [& z9 ~4 \8 X4 Y' D& g
  36. #endif /* STM32F446xx || STM32F469_479xx */
    , }% v  w, E5 n- Q( c% ]
  37. #define IS_RCC_PLLSAIQ_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 15))
    & X) O! n: r$ {$ H9 U  q) e
  38. #define IS_RCC_PLLSAIR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))  
      J1 i4 ~$ Y# y

  39. 1 P4 Y1 j6 N5 K8 e
  40. #define IS_RCC_PLLSAI_DIVQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))
    0 T5 w+ x- _0 w
  41. #define IS_RCC_PLLI2S_DIVQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))7 M% z9 v/ ]5 g: W
  42. & i9 \4 p, p6 w6 D' A* z
  43. #if defined(STM32F413_423xx)
    9 I5 X2 W& e9 H& Q7 K
  44. #define IS_RCC_PLLI2S_DIVR_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))) K* P( G1 _+ h
  45. #define IS_RCC_PLL_DIVR_VALUE(VALUE)    ((1 <= (VALUE)) && ((VALUE) <= 32))- h6 F4 t# K7 V) P) e% r  S
  46. #endif /* STM32F413_423xx */
复制代码

; Z7 a4 K3 b! F: B# b5 |# cRCC_System_Clock_Source
6 m5 O$ {. v! o* f1 B4 G6 E/ r9 k2 a, V" c
  1. /** @defgroup RCC_System_Clock_Source
    - V! s& |, A, s
  2.   * @{# k+ h6 P, o; Z& C4 ?
  3.   */
    ' j/ W. v2 U1 f& u
  4.   U- S. |1 U. j2 H- B
  5. #if  defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx)
    9 _8 [1 ?; ~" |" o, ?, v5 N( [/ b
  6. #define RCC_SYSCLKSource_HSI             ((uint32_t)0x00000000)) v8 ?) p% N7 o% w' v7 r3 a
  7. #define RCC_SYSCLKSource_HSE             ((uint32_t)0x00000001)
    : Y1 M- k- `* D
  8. #define RCC_SYSCLKSource_PLLPCLK         ((uint32_t)0x00000002)
    # [/ a' ?  A. p( O) Q& |$ H
  9. #define RCC_SYSCLKSource_PLLRCLK         ((uint32_t)0x00000003)2 q2 Z+ W) _$ x3 R  h! ^: Q
  10. #define IS_RCC_SYSCLK_SOURCE(SOURCE) (((SOURCE) == RCC_SYSCLKSource_HSI) || \
    8 V- l# ]% [# W0 N* T) G
  11.                                       ((SOURCE) == RCC_SYSCLKSource_HSE) || \
    % f* t: U% }5 O2 X$ U* T% R7 K5 t
  12.                                       ((SOURCE) == RCC_SYSCLKSource_PLLPCLK) || \" u; g5 u- E" t
  13.                                       ((SOURCE) == RCC_SYSCLKSource_PLLRCLK))
    6 S# Q; K" f1 b  Y: k' p) N
  14. /* Add legacy definition */# U2 [# ~* M, \5 {. Q7 X. r: G
  15. #define  RCC_SYSCLKSource_PLLCLK    RCC_SYSCLKSource_PLLPCLK  , T1 K3 P. U  ]* v- h
  16. #endif /* STM32F446xx */# G- g- X1 W0 h. E! |( R/ s* V
  17. - \3 w1 Y) O$ e3 k+ c$ L
  18. #if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F429_439xx) 3 N8 `/ x6 J' Y5 n# j( _2 d! f
  19. || defined(STM32F401xx) || defined(STM32F410xx) || defined(STM32F411xE) ) v, \( n( T0 {& I3 u* s) |
  20.     || defined(STM32F469_479xx)
    $ G8 s+ p1 K7 e2 P  r) S0 Y
  21. #define RCC_SYSCLKSource_HSI             ((uint32_t)0x00000000)
    5 Z- T" J/ P# S  U2 S1 e! |
  22. #define RCC_SYSCLKSource_HSE             ((uint32_t)0x00000001)& w2 u# C: X! p% t- C
  23. #define RCC_SYSCLKSource_PLLCLK          ((uint32_t)0x00000002)
    4 u! F: ^% B( [5 `& h! \3 b1 }4 @
  24. #define IS_RCC_SYSCLK_SOURCE(SOURCE) (((SOURCE) == RCC_SYSCLKSource_HSI) || \
    ( Y6 y& G8 Q3 ~3 \& p9 f" [( {
  25.                                       ((SOURCE) == RCC_SYSCLKSource_HSE) || \
    + ?! k0 m2 G3 o- c7 @
  26.                                       ((SOURCE) == RCC_SYSCLKSource_PLLCLK))
    % ~( X% w- J4 h+ m2 E8 p
  27. #endif /* STM32F40_41xxx || STM32F427_437xx || STM32F429_439xx || STM32F401xx & r* }# L& M2 w9 r- s
  28. || STM32F410xx || STM32F411xE || STM32F469_479xx */
    ) x& ]# y. L' I# G  a3 k* U
复制代码

# i- N5 K- m( C, ^, F' IRCC_AHB_Clock_Source
# L3 d1 i8 S  s0 k1 e  {+ K/ k0 N6 D- F5 ]% H8 P. C0 x
  1. /** @defgroup RCC_AHB_Clock_Source8 W  J' o4 Z+ Q/ ^* }1 E% M
  2.   * @{3 x! T! G! |4 ^; e9 o0 ^
  3.   */+ k9 ]! e5 Y# d/ s
  4. #define RCC_SYSCLK_Div1                  ((uint32_t)0x00000000)- A) ~8 ~$ @4 C* I8 h3 f9 K+ z$ p. s
  5. #define RCC_SYSCLK_Div2                  ((uint32_t)0x00000080): H0 v, L2 n' h( P3 j. C
  6. #define RCC_SYSCLK_Div4                  ((uint32_t)0x00000090)/ e: I2 Q% p. v9 o4 k: u5 u/ Z
  7. #define RCC_SYSCLK_Div8                  ((uint32_t)0x000000A0)
    0 y6 D: r: b5 Z# ]7 V% f
  8. #define RCC_SYSCLK_Div16                 ((uint32_t)0x000000B0)- y/ i# g2 x* r) V! B5 Q
  9. #define RCC_SYSCLK_Div64                 ((uint32_t)0x000000C0)
    1 e! L; e# `* j: @& z' D
  10. #define RCC_SYSCLK_Div128                ((uint32_t)0x000000D0)
    6 J4 E) a9 n0 e+ R/ F3 G
  11. #define RCC_SYSCLK_Div256                ((uint32_t)0x000000E0)! H  b$ p: z# K' j: ~" K* t
  12. #define RCC_SYSCLK_Div512                ((uint32_t)0x000000F0)
    4 F+ D0 c& k6 Q) }& N
  13. #define IS_RCC_HCLK(HCLK) (((HCLK) == RCC_SYSCLK_Div1) || ((HCLK) == RCC_SYSCLK_Div2) || \4 v' G% F( O, ?0 n0 K4 F; Q
  14.                            ((HCLK) == RCC_SYSCLK_Div4) || ((HCLK) == RCC_SYSCLK_Div8) || \
    7 l- o  j$ m" D# w" E3 k9 c* ~! A
  15.                            ((HCLK) == RCC_SYSCLK_Div16) || ((HCLK) == RCC_SYSCLK_Div64) || \: _% ?0 U" O' [+ k2 h
  16.                            ((HCLK) == RCC_SYSCLK_Div128) || ((HCLK) == RCC_SYSCLK_Div256) || \4 x0 L4 L2 H; _
  17.                            ((HCLK) == RCC_SYSCLK_Div512))
复制代码
: @. a$ ~6 P* y. ^" E; S: U2 ~
RCC_APB1_APB2_Clock_Source( t. O4 {4 o2 X6 `4 {/ z7 X# j8 f" ?5 \

) T7 C1 C* |4 b! {9 V4 g
  1. /** @defgroup RCC_APB1_APB2_Clock_Source
    4 W7 ^3 T) V$ D8 }
  2.   * @{
    8 Y. m) i! Q) ~. r8 V
  3.   */
    ' t+ M! O" l6 o
  4. #define RCC_HCLK_Div1                    ((uint32_t)0x00000000)( U  w, }7 K; a7 {1 Z( c2 \/ K
  5. #define RCC_HCLK_Div2                    ((uint32_t)0x00001000)5 ^9 M# D7 ~0 X
  6. #define RCC_HCLK_Div4                    ((uint32_t)0x00001400)6 I2 K7 L& E8 k% V- T7 F; T
  7. #define RCC_HCLK_Div8                    ((uint32_t)0x00001800)
    ' [, V& ^9 z4 Z" E, K' {( q
  8. #define RCC_HCLK_Div16                   ((uint32_t)0x00001C00)
    , G! |( Z: G% S
  9. #define IS_RCC_PCLK(PCLK) (((PCLK) == RCC_HCLK_Div1) || ((PCLK) == RCC_HCLK_Div2) || \0 i- f+ d1 L% v" L6 B" O8 v" e0 W0 h
  10.                            ((PCLK) == RCC_HCLK_Div4) || ((PCLK) == RCC_HCLK_Div8) || \
    ' C3 f) y' y8 E
  11.                            ((PCLK) == RCC_HCLK_Div16))
    3 |3 {( R; z1 N6 l. ^8 O
复制代码

3 x: z9 E1 q; K, fRCC_Interrupt_Source  p: B: ^2 s3 d
. r% v% Y+ x' b/ K5 U4 h& g: j
  1. /** @defgroup RCC_Interrupt_Source
    " [8 J- P! \7 p. {
  2.   * @{. k  D/ Y- j' Y; X4 ^( ?4 Y4 n1 p4 r9 P
  3.   */, F. z/ q2 j7 @3 k! G5 A9 g
  4. #define RCC_IT_LSIRDY                    ((uint8_t)0x01): [7 _. P8 s5 \: y
  5. #define RCC_IT_LSERDY                    ((uint8_t)0x02)
    , l5 r- U% Z% I; }* S
  6. #define RCC_IT_HSIRDY                    ((uint8_t)0x04)7 c, i7 p1 N3 m; A
  7. #define RCC_IT_HSERDY                    ((uint8_t)0x08)8 i3 e4 U8 z6 C0 r: T# E! [/ _+ F
  8. #define RCC_IT_PLLRDY                    ((uint8_t)0x10)
    " ^: ^; i: f2 G: T" B
  9. #define RCC_IT_PLLI2SRDY                 ((uint8_t)0x20)
    ) z! d8 i( m$ e0 p
  10. #define RCC_IT_PLLSAIRDY                 ((uint8_t)0x40)% D5 }3 Y! W: x
  11. #define RCC_IT_CSS                       ((uint8_t)0x80)( {7 v( T* t0 |; {9 j6 h
  12. * `( _: N  r, L
  13. #define IS_RCC_IT(IT) ((((IT) & (uint8_t)0x80) == 0x00) && ((IT) != 0x00))
    ! G& Q1 j0 H$ ^. s
  14. #define IS_RCC_GET_IT(IT) (((IT) == RCC_IT_LSIRDY) || ((IT) == RCC_IT_LSERDY) || \; |0 Q. S) X) e
  15.                            ((IT) == RCC_IT_HSIRDY) || ((IT) == RCC_IT_HSERDY) || \9 z3 k8 L5 }$ k- O
  16.                            ((IT) == RCC_IT_PLLRDY) || ((IT) == RCC_IT_CSS) || \
    " h: d" H8 \. b6 G6 O+ G! z
  17.                            ((IT) == RCC_IT_PLLSAIRDY) || ((IT) == RCC_IT_PLLI2SRDY))
    * Y4 J  _" c( S+ R/ ?
  18. #define IS_RCC_CLEAR_IT(IT)((IT) != 0x00)
复制代码
% M* E: }. H% e+ e- a  z! n
RCC_LSE_Configuration
* @0 H6 N  U2 J2 k
% n- e$ J3 v! M8 B) N$ `
  1. /** @defgroup RCC_LSE_Configuration . {* L. _9 T- L/ m9 Y  {. ~
  2.   * @{& J: f; s! V  `, P" S! M% q
  3.   */
    # F0 j7 M) V9 H' K# p1 j# ~
  4. #define RCC_LSE_OFF                      ((uint8_t)0x00)8 o, X+ u5 I; Z( V! Q* A1 x
  5. #define RCC_LSE_ON                       ((uint8_t)0x01)
    " k3 {. i+ j3 b- y' G
  6. #define RCC_LSE_Bypass                   ((uint8_t)0x04)+ T2 f" H7 {' r! Y" z# z2 b
  7. #define IS_RCC_LSE(LSE) (((LSE) == RCC_LSE_OFF) || ((LSE) == RCC_LSE_ON) || \+ \+ {5 i9 a; ~( f( c1 e. U
  8.                          ((LSE) == RCC_LSE_Bypass))
复制代码

2 d" n* S, I8 Q4 }; qRCC_RTC_Clock_Source3 D/ W" Y& ~7 x

3 W" u: d- v. }8 a" [
  1. /** @defgroup RCC_RTC_Clock_Source
    / q  h, S4 A( y% R
  2.   * @{( x" B+ a8 q7 [% z/ {% z, e
  3.   */+ B3 a* H  B3 B& G. t& D$ [4 s( M3 Q
  4. #define RCC_RTCCLKSource_LSE             ((uint32_t)0x00000100)" j: p  R. z2 J$ t$ ~2 t
  5. #define RCC_RTCCLKSource_LSI             ((uint32_t)0x00000200); A0 B" c8 t$ K+ {
  6. #define RCC_RTCCLKSource_HSE_Div2        ((uint32_t)0x00020300)/ G. n+ _! T, n1 L/ o
  7. #define RCC_RTCCLKSource_HSE_Div3        ((uint32_t)0x00030300)* Q1 m1 a& K* }9 ~& U
  8. #define RCC_RTCCLKSource_HSE_Div4        ((uint32_t)0x00040300)" Y8 P; @$ i, x6 |1 L
  9. #define RCC_RTCCLKSource_HSE_Div5        ((uint32_t)0x00050300)1 w' g' z" z$ d" C2 ~% D1 m4 _
  10. #define RCC_RTCCLKSource_HSE_Div6        ((uint32_t)0x00060300)
    / h. l" t9 a6 T) @1 L$ l% b( y$ J" ^
  11. #define RCC_RTCCLKSource_HSE_Div7        ((uint32_t)0x00070300)
    7 P9 E4 f5 F- G7 {' }: I" P3 L
  12. #define RCC_RTCCLKSource_HSE_Div8        ((uint32_t)0x00080300)
    ' j- \, A" T: b  }& F# a
  13. #define RCC_RTCCLKSource_HSE_Div9        ((uint32_t)0x00090300)
    ; D: N" y3 M  q$ k
  14. #define RCC_RTCCLKSource_HSE_Div10       ((uint32_t)0x000A0300)
    , l# M; l/ |6 y7 w) G* C3 \
  15. #define RCC_RTCCLKSource_HSE_Div11       ((uint32_t)0x000B0300)- R* ]: y" ]( x8 W! l* v
  16. #define RCC_RTCCLKSource_HSE_Div12       ((uint32_t)0x000C0300)
    " j9 T% a# G2 [) S
  17. #define RCC_RTCCLKSource_HSE_Div13       ((uint32_t)0x000D0300), r0 X0 A! V  Q! U6 [1 M4 ^0 i) I
  18. #define RCC_RTCCLKSource_HSE_Div14       ((uint32_t)0x000E0300)6 H& V) n* K% L+ N3 r+ @
  19. #define RCC_RTCCLKSource_HSE_Div15       ((uint32_t)0x000F0300)/ q) L: K1 [3 S
  20. #define RCC_RTCCLKSource_HSE_Div16       ((uint32_t)0x00100300)
    ) J" S# K$ g6 ^3 p- q* j0 O2 W+ j
  21. #define RCC_RTCCLKSource_HSE_Div17       ((uint32_t)0x00110300)
    $ H" @2 m, E( s8 N  x/ n
  22. #define RCC_RTCCLKSource_HSE_Div18       ((uint32_t)0x00120300)
    7 v& m' V+ n5 }' R; R) u
  23. #define RCC_RTCCLKSource_HSE_Div19       ((uint32_t)0x00130300)
    $ g" L3 C5 b7 [8 ]# K; Z. J
  24. #define RCC_RTCCLKSource_HSE_Div20       ((uint32_t)0x00140300)5 _" z% a3 G+ ~, n" l; W
  25. #define RCC_RTCCLKSource_HSE_Div21       ((uint32_t)0x00150300)6 h+ e1 {3 p; h& h3 ?; ?- x
  26. #define RCC_RTCCLKSource_HSE_Div22       ((uint32_t)0x00160300)
    4 @3 l/ L. q4 E: w7 U0 s
  27. #define RCC_RTCCLKSource_HSE_Div23       ((uint32_t)0x00170300)
    # q  d* K1 O) N6 G' x- n
  28. #define RCC_RTCCLKSource_HSE_Div24       ((uint32_t)0x00180300); I/ M7 G$ J2 Y
  29. #define RCC_RTCCLKSource_HSE_Div25       ((uint32_t)0x00190300)# |: y9 w: c0 P$ ~0 l
  30. #define RCC_RTCCLKSource_HSE_Div26       ((uint32_t)0x001A0300)
    % L! w2 L8 I8 ^1 D; y
  31. #define RCC_RTCCLKSource_HSE_Div27       ((uint32_t)0x001B0300)
    $ ?8 e7 }7 \+ d! v& z+ _* P
  32. #define RCC_RTCCLKSource_HSE_Div28       ((uint32_t)0x001C0300)1 ]% |4 ^$ C, u) d4 g/ H
  33. #define RCC_RTCCLKSource_HSE_Div29       ((uint32_t)0x001D0300)
    % N, N/ [: J% R. I; v# q  z% R0 L1 Y5 R# G
  34. #define RCC_RTCCLKSource_HSE_Div30       ((uint32_t)0x001E0300)1 _7 d$ s% e/ f) g8 z# P$ i" @
  35. #define RCC_RTCCLKSource_HSE_Div31       ((uint32_t)0x001F0300)" b: G8 `8 z. z2 y1 y5 c" Y! q
  36. #define IS_RCC_RTCCLK_SOURCE(SOURCE) (((SOURCE) == RCC_RTCCLKSource_LSE) || \# t* c0 S" ]! A& j
  37.                                       ((SOURCE) == RCC_RTCCLKSource_LSI) || \
    # z$ N" s- z- t
  38.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div2) || \
    9 \1 f* X1 j/ S' S+ o8 ]! \7 r
  39.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div3) || \& F6 S2 ~& |, S3 X, K
  40.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div4) || \
    - N0 I  r8 G) M! u4 w7 L& c
  41.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div5) || \
    ! D* n# J3 G+ ]! T; I4 D" n
  42.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div6) || \+ w: B' W& J. v4 l: V3 Y
  43.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div7) || \- M7 i6 ?8 }! q8 {
  44.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div8) || \
    5 {" p9 i7 [1 K$ g% K
  45.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div9) || \7 H5 r$ E! l6 N& z& j" d# N% S( |: o
  46.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div10) || \
    , H# |3 {) d1 d& M
  47.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div11) || \
    ( L; j4 A- o5 N8 \5 v2 a
  48.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div12) || \; W" F6 Y& A1 a9 B
  49.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div13) || \
    / _/ t+ \% u0 H2 W. p/ ?1 N6 s* I7 s
  50.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div14) || \
    3 |- l3 i7 x6 {# s! c5 @% p; `
  51.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div15) || \- X1 d& c: X3 ]7 h6 B# ^
  52.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div16) || \
    * P: F# ]( v- j: v
  53.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div17) || \! {8 G# j  W' j" l$ M; q
  54.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div18) || \1 e: _# B% _6 b  x
  55.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div19) || \7 M, C2 _0 `) p3 z4 r% O
  56.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div20) || \
    6 R$ [: X2 C% u+ i5 Q/ u+ h
  57.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div21) || \9 x8 C( p* F! H
  58.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div22) || \
    1 n* h$ M* e; O' Z+ G
  59.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div23) || \
    7 Y7 d. a4 M- T7 Y
  60.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div24) || \
    # n7 N9 l3 [1 u- @
  61.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div25) || \; [( S  M- m& t- u, @
  62.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div26) || \( ^. @& D8 @3 f9 l* E, L
  63.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div27) || \' m# [& J, J1 D3 h9 r
  64.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div28) || \
    8 V7 `8 @6 q% y7 H, V1 e2 j
  65.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div29) || \7 Y. ^" ]8 z# o
  66.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div30) || \
    4 X5 e4 R3 R, A; I
  67.                                       ((SOURCE) == RCC_RTCCLKSource_HSE_Div31))
复制代码

, G; O2 f- I, n2 s' QRCC_SAI_BlockA_Clock_Source6 r) N, I# i1 }! L. _6 c/ f
1 Y7 j1 d9 H# }) a: o8 e$ U
  1. /** @defgroup RCC_SAI_BlockA_Clock_Source
    4 J( ~9 Y. i- R3 R% ?- ^4 V4 i
  2.   * @{8 w; a6 Y: I! M, b5 a6 I
  3.   */! x0 _1 Z) O  D7 a
  4. #define RCC_SAIACLKSource_PLLSAI             ((uint32_t)0x00000000)
    0 s1 K& F; d( {, j: ~0 [
  5. #define RCC_SAIACLKSource_PLLI2S             ((uint32_t)0x00100000)
    9 l7 D: G1 a1 e' U' {, _0 Q
  6. #define RCC_SAIACLKSource_Ext                ((uint32_t)0x00200000)
    - i1 q# W, p5 ?2 a& s0 Z

  7. 0 m" F0 N# H# ~( R
  8. #define IS_RCC_SAIACLK_SOURCE(SOURCE) (((SOURCE) == RCC_SAIACLKSource_PLLI2S) ||\2 C& \; B1 I' _7 x7 r* b
  9.                                        ((SOURCE) == RCC_SAIACLKSource_PLLSAI) ||\
    4 S1 N& O  {7 F/ _& k3 q8 I
  10.                                        ((SOURCE) == RCC_SAIACLKSource_Ext))
复制代码

! z( f; g& ~  o6 Q! c/ NRCC_SAI_BlockB_Clock_Source7 d: M9 ~/ Q( C' j- i4 n4 U$ N+ f

# f* {, e% }! X: i6 k
  1. /** @defgroup RCC_SAI_BlockB_Clock_Source
    6 P, Q, p! {/ s' D2 g
  2.   * @{
    + l. P6 l  Z" L7 k, G( z
  3.   */8 Z2 V4 M1 z$ P+ v+ \1 K* d
  4. #define RCC_SAIBCLKSource_PLLSAI             ((uint32_t)0x00000000)
    % D: i2 D; m( E) Y5 G  K+ l
  5. #define RCC_SAIBCLKSource_PLLI2S             ((uint32_t)0x00400000)4 x% E7 K$ N) ~0 `( k+ Q
  6. #define RCC_SAIBCLKSource_Ext                ((uint32_t)0x00800000)
    5 q. M" s5 x! a" c9 N' A2 a
  7. + d% a, W; U, ?" c! E9 b" ]
  8. #define IS_RCC_SAIBCLK_SOURCE(SOURCE) (((SOURCE) == RCC_SAIBCLKSource_PLLI2S) ||\
    2 H6 d) d& G; m5 h' k. L8 I
  9.                                        ((SOURCE) == RCC_SAIBCLKSource_PLLSAI) ||\
    6 }5 O# D$ r. V9 W
  10.                                        ((SOURCE) == RCC_SAIBCLKSource_Ext))
复制代码
' G1 H3 ]% n8 C# r. N
RCC_TIM_PRescaler_Selection* K# f9 q3 [: ?1 T- z0 K  o* S
" [. s. }% E9 P7 L2 l2 X
  1. /** @defgroup RCC_TIM_PRescaler_Selection) U, v9 i; s3 D6 J1 l* g
  2.   * @{
    0 @( v9 f& H5 d4 V* l8 x3 u; \/ ?
  3.   */6 h" p5 n) U9 Z4 `7 o
  4. #define RCC_TIMPrescDesactivated             ((uint8_t)0x00)
    3 M7 b% j: B' ]: b& x
  5. #define RCC_TIMPrescActivated                ((uint8_t)0x01)
    2 {  Y9 d+ L! Y7 b1 i. }, e7 y6 J) O

  6. % \, h1 Y- Y( y& d' B% z& \0 [
  7. #define IS_RCC_TIMCLK_PRESCALER(VALUE) (((VALUE) == RCC_TIMPrescDesactivated) 2 ^0 D8 Z+ x3 ~! t
  8. || ((VALUE) == RCC_TIMPrescActivated))
复制代码

) {/ }  C/ @. ^/ N& HRCC_AHB1_Peripherals# |( }. |' r4 t' o5 x$ V+ Q& \

) M7 J0 m5 m0 }( m: q4 o
  1. /** @defgroup RCC_AHB1_Peripherals
    ' s) P& b! x$ a+ [% a/ T7 i( `; ]' e
  2.   * @{
    ; u# f/ E" L6 W3 a. U
  3.   */
    3 ~# W' h1 F) E6 D4 Y  W
  4. #define RCC_AHB1Periph_GPIOA             ((uint32_t)0x00000001)+ g( w. d, I) J- m# }
  5. #define RCC_AHB1Periph_GPIOB             ((uint32_t)0x00000002)7 o# o& H, H8 ]+ T
  6. #define RCC_AHB1Periph_GPIOC             ((uint32_t)0x00000004)4 h5 a( K; a) F
  7. #define RCC_AHB1Periph_GPIOD             ((uint32_t)0x00000008)% ^7 N. p/ A& k- A: ]
  8. #define RCC_AHB1Periph_GPIOE             ((uint32_t)0x00000010)7 }( n! o: t2 s; u' C
  9. #define RCC_AHB1Periph_GPIOF             ((uint32_t)0x00000020)
    : n2 q! P, D, R1 t. j, |) }
  10. #define RCC_AHB1Periph_GPIOG             ((uint32_t)0x00000040)
    7 t  w; p2 x1 @
  11. #define RCC_AHB1Periph_GPIOH             ((uint32_t)0x00000080)" d( Z" G' |" V* F
  12. #define RCC_AHB1Periph_GPIOI             ((uint32_t)0x00000100) ( e: C4 I7 X5 \# M( @  L7 ~8 }
  13. #define RCC_AHB1Periph_GPIOJ             ((uint32_t)0x00000200)
    : r% b7 a( O5 B$ c( u
  14. #define RCC_AHB1Periph_GPIOK             ((uint32_t)0x00000400)$ s) Y; S( @5 e) ^4 h
  15. #define RCC_AHB1Periph_CRC               ((uint32_t)0x00001000)
    " [1 a8 R$ B' x' H) ~0 x- _/ L* Q
  16. #define RCC_AHB1Periph_FLITF             ((uint32_t)0x00008000)- P) _& b1 {. K  {
  17. #define RCC_AHB1Periph_SRAM1             ((uint32_t)0x00010000)3 }$ P( r% q' s; r; |  ?1 {, k* }
  18. #define RCC_AHB1Periph_SRAM2             ((uint32_t)0x00020000)
    % w6 e+ A* h7 q/ D% `
  19. #define RCC_AHB1Periph_BKPSRAM           ((uint32_t)0x00040000)9 c  c% d; z' s) ^4 x5 H4 Q( D% \
  20. #define RCC_AHB1Periph_SRAM3             ((uint32_t)0x00080000)
    + ^4 S. \" f5 o5 `3 o0 k4 s
  21. #define RCC_AHB1Periph_CCMDATARAMEN      ((uint32_t)0x00100000)
    ; A2 ?: B  n! I6 c6 `
  22. #define RCC_AHB1Periph_DMA1              ((uint32_t)0x00200000)
    . @( g& ^* b" g8 w
  23. #define RCC_AHB1Periph_DMA2              ((uint32_t)0x00400000)
    ' f7 G0 w4 o- w) O; K9 p
  24. #define RCC_AHB1Periph_DMA2D             ((uint32_t)0x00800000)! j- |7 T. `( Q. `6 I; X/ _. e6 q# i
  25. #define RCC_AHB1Periph_ETH_MAC           ((uint32_t)0x02000000)
    2 \, ?& C) W: l
  26. #define RCC_AHB1Periph_ETH_MAC_Tx        ((uint32_t)0x04000000)8 ~+ T" T$ r3 b! Z# D: e
  27. #define RCC_AHB1Periph_ETH_MAC_Rx        ((uint32_t)0x08000000)
    / |% c% I: t+ l. B& X
  28. #define RCC_AHB1Periph_ETH_MAC_PTP       ((uint32_t)0x10000000)/ i1 F7 z8 C: Z+ u; d) b4 G$ n5 Q: j
  29. #define RCC_AHB1Periph_OTG_HS            ((uint32_t)0x20000000)9 e5 z% N6 H0 r1 w$ w6 {
  30. #define RCC_AHB1Periph_OTG_HS_ULPI       ((uint32_t)0x40000000)
    0 H0 k2 }% O+ v" D, u% r

  31. + h2 e$ f, b; t9 l& L' r
  32. #define IS_RCC_AHB1_CLOCK_PERIPH(PERIPH)
    ) T, v6 q* L1 y5 y/ r; q
  33.         ((((PERIPH) & 0x010BE800) == 0x00) && ((PERIPH) != 0x00))% `; {4 w2 x9 d
  34. #define IS_RCC_AHB1_RESET_PERIPH(PERIPH)
    ) T+ \% L9 G  Y
  35.         ((((PERIPH) & 0x51FE800) == 0x00) && ((PERIPH) != 0x00))
    + w3 z6 w/ X# |5 S, U- U8 i: d0 M
  36. #define IS_RCC_AHB1_LPMODE_PERIPH(PERIPH) ' R8 Q( f! i+ u- k9 F1 y
  37.         ((((PERIPH) & 0x01106800) == 0x00) && ((PERIPH) != 0x00))2 k8 w, Y; Q" Q4 s# c
复制代码

& k- ^) M( f9 @9 C! zRCC_APB1_Peripherals
3 u3 i" ?) n2 w' f& F2 r
) ^! t* P' v! \& @$ \
  1. /** @defgroup RCC_APB1_Peripherals 8 d4 G) K$ v" K* U$ S
  2.   * @{
    ! L5 |7 |# g+ A; {( m
  3.   */ 2 G6 L7 S7 ^* p, [9 ~9 @
  4. #define RCC_APB1Periph_TIM2              ((uint32_t)0x00000001)+ {& w4 U9 a4 f- M
  5. #define RCC_APB1Periph_TIM3              ((uint32_t)0x00000002)
    8 Y/ {" h0 D; C1 M4 Q
  6. #define RCC_APB1Periph_TIM4              ((uint32_t)0x00000004)
    ; n8 O- D5 |/ g! o; I+ l$ W% T! _
  7. #define RCC_APB1Periph_TIM5              ((uint32_t)0x00000008)
    0 O% a2 j4 n7 d" B2 a
  8. #define RCC_APB1Periph_TIM6              ((uint32_t)0x00000010)
    - W9 C. ]& l9 y5 l% f& {! O
  9. #define RCC_APB1Periph_TIM7              ((uint32_t)0x00000020); J% m: @1 F3 k, {$ E9 p
  10. #define RCC_APB1Periph_TIM12             ((uint32_t)0x00000040)8 _1 o  N! l' i
  11. #define RCC_APB1Periph_TIM13             ((uint32_t)0x00000080)3 F. Q8 W, I0 h6 V% N  w# I
  12. #define RCC_APB1Periph_TIM14             ((uint32_t)0x00000100)  g% d3 j- ~7 G  u- F. N2 E! T
  13. #if defined(STM32F410xx) || defined(STM32F413_423xx)
    0 }8 p& {* r$ V
  14. #define RCC_APB1Periph_LPTIM1            ((uint32_t)0x00000200)
    ) X" M) \5 E& z/ I7 L* s0 B
  15. #endif /* STM32F410xx || STM32F413_423xx */' U. w4 N2 l2 p3 z3 p9 D
  16. #define RCC_APB1Periph_WWDG              ((uint32_t)0x00000800): c. |* s7 \4 V
  17. #define RCC_APB1Periph_SPI2              ((uint32_t)0x00004000)
    - Z& n2 B; M% I- V! `4 y8 c( v
  18. #define RCC_APB1Periph_SPI3              ((uint32_t)0x00008000)
    / [6 z5 \" Q! P- h
  19. #if defined(STM32F446xx)# X/ @2 x( x3 N% X* m- u  J: l! I0 A
  20. #define RCC_APB1Periph_SPDIFRX           ((uint32_t)0x00010000)
    2 c* J( ~9 ~+ ]3 ~
  21. #endif /* STM32F446xx */
      h, Z9 H6 k  {* |. M, X
  22. #define RCC_APB1Periph_USART2            ((uint32_t)0x00020000)9 |/ H+ @. }$ F( f* n# \: w
  23. #define RCC_APB1Periph_USART3            ((uint32_t)0x00040000)+ v' X+ x, B6 O
  24. #define RCC_APB1Periph_UART4             ((uint32_t)0x00080000)9 G) ?& `) e# Q1 _
  25. #define RCC_APB1Periph_UART5             ((uint32_t)0x00100000)" ]0 v+ h2 H( k% v, R1 ~+ A& I
  26. #define RCC_APB1Periph_I2C1              ((uint32_t)0x00200000)4 z. _1 _. T. J
  27. #define RCC_APB1Periph_I2C2              ((uint32_t)0x00400000)
    / m0 s$ a- ]* W/ A* e& V2 n; N
  28. #define RCC_APB1Periph_I2C3              ((uint32_t)0x00800000); U, I  p7 y6 g. C$ o/ h; F
  29. #if defined(STM32F410xx) || defined(STM32F412xG) 1 G8 N2 ?& N4 }% Z4 k. j
  30. || defined(STM32F413_423xx) || defined(STM32F446xx)$ U6 j& P0 k+ J8 h- c
  31. #define RCC_APB1Periph_FMPI2C1           ((uint32_t)0x01000000)
    # h0 w6 M, @( _, A$ g4 u, b
  32. #endif /* STM32F410xx || STM32F446xx || STM32F413_423xx*/ . j' y2 s- j6 T1 N
  33. #define RCC_APB1Periph_CAN1              ((uint32_t)0x02000000)2 k! q1 q, f$ X" O2 r
  34. #define RCC_APB1Periph_CAN2              ((uint32_t)0x04000000)% o2 x7 ]( s" _: j
  35. #if defined(STM32F413_423xx)
    1 c1 G3 V& F/ ~; w. g, h% V, ^
  36. #define RCC_APB1Periph_CAN3              ((uint32_t)0x08000000)
    4 V  e/ n% M& ]& U
  37. #endif /* STM32F413_423xx */
      X# A8 }! t$ b
  38. #if defined(STM32F446xx)7 q9 S9 X# W/ ?/ z& N
  39. #define RCC_APB1Periph_CEC               ((uint32_t)0x08000000)
    % Q/ s5 i7 s( b2 p& J3 L
  40. #endif /* STM32F446xx */
    ; r& |, i$ D- R& `+ |
  41. #define RCC_APB1Periph_PWR               ((uint32_t)0x10000000)
    ( T5 a$ A: p& |/ R5 C! x8 P1 ~
  42. #define RCC_APB1Periph_DAC               ((uint32_t)0x20000000)$ u5 O7 H) H$ m& n9 z+ O' p
  43. #define RCC_APB1Periph_UART7             ((uint32_t)0x40000000)8 R" n  w: ^$ L- F7 |; u
  44. #define RCC_APB1Periph_UART8             ((uint32_t)0x80000000)
    0 K6 K* U& W) A0 z$ A2 N: o
  45. #define IS_RCC_APB1_PERIPH(PERIPH)
    5 G* n! r. c% H
  46.     ((((PERIPH) & 0x00003600) == 0x00) && ((PERIPH) != 0x00))
复制代码
# E3 \+ a$ p, L( K0 ^3 y' W
RCC_APB2_Peripherals
6 l) O6 |; C' ~2 i6 N3 Q7 a0 R4 A: P, `2 @1 p1 Y- |9 i
  1. /** @defgroup RCC_APB2_Peripherals & y3 J2 r7 \. u* F8 m" p+ N1 f, u
  2.   * @{% Z6 Z' b, r1 G3 }6 Q
  3.   */
    , H; F- c" x* o: e# J
  4. #define RCC_APB2Periph_TIM1              ((uint32_t)0x00000001)0 I. D" ^/ V, ?" M( L& Z( t/ B
  5. #define RCC_APB2Periph_TIM8              ((uint32_t)0x00000002)
    / w+ q) b$ g: n
  6. #define RCC_APB2Periph_USART1            ((uint32_t)0x00000010)
    % d' c, c0 s! f, U7 N2 A, D- c- y
  7. #define RCC_APB2Periph_USART6            ((uint32_t)0x00000020)6 N' V5 J# g3 g5 t* L2 ]
  8. #define RCC_APB2Periph_ADC               ((uint32_t)0x00000100)4 V% B/ j% ]& ?  F; P
  9. #define RCC_APB2Periph_ADC1              ((uint32_t)0x00000100)
    0 D% a# K0 O, M5 q6 w
  10. #define RCC_APB2Periph_ADC2              ((uint32_t)0x00000200)
    9 y, G  y8 a* |, V# j1 t& o
  11. #define RCC_APB2Periph_ADC3              ((uint32_t)0x00000400)) u/ q7 |/ o$ t# N7 X& m- ?+ G; ~
  12. #define RCC_APB2Periph_SDIO              ((uint32_t)0x00000800)+ Y2 k  h! s6 K9 c) c. W
  13. #define RCC_APB2Periph_SPI1              ((uint32_t)0x00001000)
    3 A1 k0 \- ^0 r+ ^
  14. #define RCC_APB2Periph_SPI4              ((uint32_t)0x00002000)% A1 s3 F2 }) P
  15. #define RCC_APB2Periph_SYSCFG            ((uint32_t)0x00004000)
    % O6 r8 x, X+ \  O0 V  u2 m
  16. #define RCC_APB2Periph_EXTIT             ((uint32_t)0x00008000): K8 a: t: A3 p3 t( A! v, b* c! U# {
  17. #define RCC_APB2Periph_TIM9              ((uint32_t)0x00010000)
    % Y$ P% D& c! E5 b/ |$ a, ~" n7 H
  18. #define RCC_APB2Periph_TIM10             ((uint32_t)0x00020000)
    3 v: `# t$ F: G- m$ E% j
  19. #define RCC_APB2Periph_TIM11             ((uint32_t)0x00040000)
    0 C/ A0 C6 f" l' a" K, q, y* M
  20. #define RCC_APB2Periph_SPI5              ((uint32_t)0x00100000)7 a- o: h# i- m) d6 {
  21. #define RCC_APB2Periph_SPI6              ((uint32_t)0x00200000)" B- H( d5 Q$ u1 [1 }
  22. #define RCC_APB2Periph_SAI1              ((uint32_t)0x00400000)
    % S! t# y4 o% e  {) j- l, n% H* F
  23. #if defined(STM32F446xx) || defined(STM32F469_479xx)1 T- G+ Z7 z, E3 r9 R( O
  24. #define RCC_APB2Periph_SAI2              ((uint32_t)0x00800000)
    ; }! H/ t( Y$ H. s: J8 w) W: }& ^
  25. #endif /* STM32F446xx || STM32F469_479xx */
      R7 ]* P! Z% ^  Y
  26. #define RCC_APB2Periph_LTDC              ((uint32_t)0x04000000)9 L: r: k/ L' j1 o5 H' q- c; u+ Z
  27. #if defined(STM32F469_479xx)+ A1 h3 y$ j% s( e
  28. #define RCC_APB2Periph_DSI               ((uint32_t)0x08000000)7 M, t0 K5 v- r
  29. #endif /* STM32F469_479xx */
    4 o8 O0 b+ E1 S/ {2 q
  30. #if defined(STM32F412xG) || defined(STM32F413_423xx); |- C# F9 r" D7 x
  31. #define RCC_APB2Periph_DFSDM1            ((uint32_t)0x01000000)$ ~, x; ^8 b; Q  U0 i
  32. #endif /* STM32F412xG || STM32F413_423xx */. z0 [, g% e  t6 `9 [/ C
  33. #if defined(STM32F413_423xx)
    0 j  Q2 ^  y. S8 J; J, _
  34. #define RCC_APB2Periph_DFSDM2            ((uint32_t)0x02000000)
    1 t' d+ H! M3 _( q& b/ D
  35. #define RCC_APB2Periph_UART9             ((uint32_t)0x02000040)' v2 y+ }( G. v3 k; ^
  36. #define RCC_APB2Periph_UART10            ((uint32_t)0x00000080)
    ) `1 \3 r' n$ h% R: H, ~9 ~1 r
  37. #endif /* STM32F413_423xx */
    ; C) z2 U4 \4 `7 D% q8 u" ~+ M+ U. ~
  38. 3 a5 c  @6 W3 U1 e7 u; Y& m& e% O
  39. /* Legacy Defines */
    : l9 D$ m' p5 C/ `
  40. #define RCC_APB2Periph_DFSDM              RCC_APB2Periph_DFSDM13 O. f: w0 `; V! ?- Q/ v& N

  41. + S/ u0 |5 ]" n+ T6 x
  42. #define IS_RCC_APB2_PERIPH(PERIPH)
    + H5 f6 S) d" m* l! y; a
  43.         ((((PERIPH) & 0xF008000C) == 0x00) && ((PERIPH) != 0x00))
    ( {+ T/ R/ w8 V9 h. s
  44. #define IS_RCC_APB2_RESET_PERIPH(PERIPH) ; Q! U+ g# G$ L: r1 o
  45.         ((((PERIPH) & 0xF208860C) == 0x00) && ((PERIPH) != 0x00))
复制代码
% A* w4 Q1 v2 l& c
RCC_MCO1_Clock_Source_Prescaler
* w( @/ }! {# n% K, ^

6 c9 S. Z8 a; o3 U! y# j+ {* q9 M
  1. /** @defgroup RCC_MCO1_Clock_Source_Prescaler8 \' n2 n9 ^# g" ?7 F1 P7 `+ ^
  2.   * @{! y2 L0 Z$ @1 G2 F5 z9 A9 L5 T
  3.   */
    & k4 ^6 _- H3 z! o. W( j% O  m) a
  4. #define RCC_MCO1Source_HSI               ((uint32_t)0x00000000)
    2 f3 ]& D; z4 [: K4 I# \
  5. #define RCC_MCO1Source_LSE               ((uint32_t)0x00200000)6 p( D, h8 ]) q4 l0 P3 ]
  6. #define RCC_MCO1Source_HSE               ((uint32_t)0x00400000). k) c% I3 M+ i' r& k! ?
  7. #define RCC_MCO1Source_PLLCLK            ((uint32_t)0x00600000)
    ; k/ H- M4 Y+ [7 D
  8. #define RCC_MCO1Div_1                    ((uint32_t)0x00000000)/ p0 K! d- i" {' }
  9. #define RCC_MCO1Div_2                    ((uint32_t)0x04000000)* @4 g8 z# I( [1 \# ^
  10. #define RCC_MCO1Div_3                    ((uint32_t)0x05000000)# u' O6 \% l+ q" @+ o1 {- d
  11. #define RCC_MCO1Div_4                    ((uint32_t)0x06000000)4 i% S( n/ P. I4 A
  12. #define RCC_MCO1Div_5                    ((uint32_t)0x07000000)
    % w: |+ N( {2 V/ \9 |% L
  13. #define IS_RCC_MCO1SOURCE(SOURCE) (((SOURCE) == RCC_MCO1Source_HSI) , E! E8 c) E$ }
  14. || ((SOURCE) == RCC_MCO1Source_LSE) || \
    ) _) p4 h7 y0 t
  15. ((SOURCE) == RCC_MCO1Source_HSE) || ((SOURCE) == RCC_MCO1Source_PLLCLK))
    + k  g( d$ ]/ V  J" M

  16. ( L6 A8 _. U# |# W
  17. #define IS_RCC_MCO1DIV(DIV) (((DIV) == RCC_MCO1Div_1) || ((DIV) == RCC_MCO1Div_2) || \
    - O( |/ L0 H; p/ h1 f
  18.                              ((DIV) == RCC_MCO1Div_3) || ((DIV) == RCC_MCO1Div_4) || \
    / m% f& w. O0 u
  19.                              ((DIV) == RCC_MCO1Div_5))
复制代码
# m' _$ ?1 p% K2 t
RCC_MCO2_Clock_Source_Prescaler+ q, Z% _1 A6 ~0 b
; C6 `* I. ?& M% W* \# E( W& a$ L
  1. /** @defgroup RCC_MCO2_Clock_Source_Prescaler
    0 _4 M6 k. {4 F' H$ |  Y8 H' P: G
  2.   * @{( T) f5 `/ ~6 ~" e% {8 Y- @; \" [
  3.   */
    % m# l: r- P" @! e. g! q& [. @
  4. #define RCC_MCO2Source_SYSCLK            ((uint32_t)0x00000000)
    ( O9 B' m( ?% c8 q. p6 _
  5. #define RCC_MCO2Source_PLLI2SCLK         ((uint32_t)0x40000000)7 M1 a: t. H' u6 m8 I+ H
  6. #define RCC_MCO2Source_HSE               ((uint32_t)0x80000000)
    5 c  b/ v8 r/ r' P; A
  7. #define RCC_MCO2Source_PLLCLK            ((uint32_t)0xC0000000); {4 Y! C; _9 O0 s
  8. #define RCC_MCO2Div_1                    ((uint32_t)0x00000000)
    + J5 W4 k, o4 r# f
  9. #define RCC_MCO2Div_2                    ((uint32_t)0x20000000)
    % I" s& C% u9 y& z
  10. #define RCC_MCO2Div_3                    ((uint32_t)0x28000000)/ f0 N9 A( k$ k7 E+ z  W* Y4 }
  11. #define RCC_MCO2Div_4                    ((uint32_t)0x30000000)
    ; R* s2 N) v. F+ `: }5 }3 U+ ^7 e
  12. #define RCC_MCO2Div_5                    ((uint32_t)0x38000000)1 t" z$ O, e0 ^: t6 g
  13. #define IS_RCC_MCO2SOURCE(SOURCE) (((SOURCE) == RCC_MCO2Source_SYSCLK) 6 n+ o. W  V1 a$ |
  14. || ((SOURCE) == RCC_MCO2Source_PLLI2SCLK)|| \5 l3 O* {; \  w0 X+ u" `; R% F
  15.                                    ((SOURCE) == RCC_MCO2Source_HSE) 0 H$ z5 W# p' C  V; E
  16.     || ((SOURCE) == RCC_MCO2Source_PLLCLK)); E/ t* x0 U- \& `' L

  17. - C$ x  m$ Q( ~
  18. #define IS_RCC_MCO2DIV(DIV) (((DIV) == RCC_MCO2Div_1) || ((DIV) == RCC_MCO2Div_2) || \+ ~. j$ R) P5 K6 p+ w
  19.                              ((DIV) == RCC_MCO2Div_3) || ((DIV) == RCC_MCO2Div_4) || \
    % }: f/ I' y, E
  20.                              ((DIV) == RCC_MCO2Div_5))   
复制代码

+ d* `/ Y( \% s: G% v& {' {RCC_Flag  Z* h# J& V; p+ [9 c; ]- c
, |; y* f0 \* A4 s  P5 o, D9 D
  1. /** @defgroup RCC_Flag
    . C5 }8 y8 u# t* S* t
  2.   * @{0 u9 G0 T* n: |& |
  3.   */2 u2 |6 f. z) G' |$ {9 ~1 l1 r- m
  4. #define RCC_FLAG_HSIRDY                  ((uint8_t)0x21)) K. o! s% |% @- _6 T% z# o+ U
  5. #define RCC_FLAG_HSERDY                  ((uint8_t)0x31)
    & w* C" K5 W9 o3 m9 E) w
  6. #define RCC_FLAG_PLLRDY                  ((uint8_t)0x39)
    + U# C- B/ t, e
  7. #define RCC_FLAG_PLLI2SRDY               ((uint8_t)0x3B)
    * |" ]2 M) ^7 T, z7 h( G
  8. #define RCC_FLAG_PLLSAIRDY               ((uint8_t)0x3D)3 o6 P- s! N' z4 z: U) I
  9. #define RCC_FLAG_LSERDY                  ((uint8_t)0x41)
    : w. `/ N* X9 ^* {) j; a* q
  10. #define RCC_FLAG_LSIRDY                  ((uint8_t)0x61), Q+ z7 T8 P) Z/ U5 W
  11. #define RCC_FLAG_BORRST                  ((uint8_t)0x79); T/ G! n, k( h3 P4 d; I( p; k
  12. #define RCC_FLAG_PINRST                  ((uint8_t)0x7A)
    * H3 t% G  p% Z1 ]. ~
  13. #define RCC_FLAG_PORRST                  ((uint8_t)0x7B)' s( D+ I$ M$ z/ K1 I
  14. #define RCC_FLAG_SFTRST                  ((uint8_t)0x7C)
    9 p) a9 {) D& W5 N! U8 q
  15. #define RCC_FLAG_IWDGRST                 ((uint8_t)0x7D)3 q: b4 n- J* l: A
  16. #define RCC_FLAG_WWDGRST                 ((uint8_t)0x7E)% s4 q$ W+ e) ~6 X8 j; U
  17. #define RCC_FLAG_LPWRRST                 ((uint8_t)0x7F)
    4 U. E. J+ C) `

  18. - O' W, s# z# |" b: y5 ]$ c
  19. #define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSIRDY)   || ((FLAG) == RCC_FLAG_HSERDY) || \  e/ z& t  o9 f0 _
  20.                            ((FLAG) == RCC_FLAG_PLLRDY)   || ((FLAG) == RCC_FLAG_LSERDY) || \
    % l( o  N. z3 z) o( @* ~
  21.                            ((FLAG) == RCC_FLAG_LSIRDY)   || ((FLAG) == RCC_FLAG_BORRST) || \
    ; z' G8 ?! P) k+ I' _0 O5 L
  22.                            ((FLAG) == RCC_FLAG_PINRST)   || ((FLAG) == RCC_FLAG_PORRST) || \
    5 e6 M& Y* J: [) V! K
  23.                            ((FLAG) == RCC_FLAG_SFTRST)   || ((FLAG) == RCC_FLAG_IWDGRST)|| \3 z5 g! B% b. h, n2 a& M3 B: l
  24.                            ((FLAG) == RCC_FLAG_WWDGRST)  || ((FLAG) == RCC_FLAG_LPWRRST)|| \
    3 P1 A) m7 {; \" r
  25.                            ((FLAG) == RCC_FLAG_PLLI2SRDY)|| ((FLAG) == RCC_FLAG_PLLSAIRDY))6 f2 V, Z/ i& t, E
  26. + J4 y8 a: s6 P& C3 q6 \
  27. #define IS_RCC_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x1F)
复制代码
% L2 t8 w# ]  y" N" P0 b
03. 相关函数5 Y& B  ^( n7 j
  1. /* Function used to set the RCC clock configuration to the default reset state */( j$ A! _. C% z+ N# Z6 m
  2. void        RCC_DeInit(void);
    + [9 t5 y" ]0 R
  3. 5 ^: l8 R9 U/ K+ e
  4. /* Internal/external clocks, PLL, CSS and MCO configuration functions *********/4 r0 l7 y8 S+ C8 c/ T, [. x
  5. void        RCC_HSEConfig(uint8_t RCC_HSE);4 E2 Z* D; U+ k- h. c! @
  6. ErrorStatus RCC_WaitForHSEStartUp(void);6 M7 t( k6 A4 F; \: _- c
  7. void        RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue);3 c3 ], a" I$ j$ @. s+ q. T
  8. void        RCC_HSICmd(FunctionalState NewState);# A+ L, e; P; A$ ~0 J3 ^
  9. void        RCC_LSEConfig(uint8_t RCC_LSE);
    + s- s4 L% c3 D0 }  F
  10. void        RCC_LSICmd(FunctionalState NewState);
    * D6 A% g! }! [6 R

  11. 4 n+ _  b$ `) V0 U' J
  12. void        RCC_PLLCmd(FunctionalState NewState);
    8 R2 E9 S+ y: R" j' D% ~
  13. 1 k1 O6 `  r) ^; x5 ?; Y  e$ \
  14. void        RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t PLLM, uint32_t PLLN, ) [8 Y: r* g4 K% K7 ?  n% h
  15.                           uint32_t PLLP, uint32_t PLLQ);
    $ K! g7 ^4 }* a
  16.   v! u4 p* B2 W* Z: B
  17. void        RCC_PLLI2SCmd(FunctionalState NewState);
    3 L, I8 v5 a2 V8 ^' E

  18. + D* c" F% k9 ^/ e5 R5 T& |
  19. void        RCC_PLLI2SConfig(uint32_t PLLI2SN, uint32_t PLLI2SR);2 R4 Q- x4 D; U7 H& {: C
  20. * n+ ^3 M8 B5 z+ |! [$ V
  21. : q# v1 E- c! B2 e6 `  X9 O0 J
  22. void        RCC_PLLSAICmd(FunctionalState NewState);
    . b  N/ f. u- K$ O
  23. 4 Y9 t! P& q4 S3 G6 J! I# u2 H
  24. void        RCC_PLLSAIConfig(uint32_t PLLSAIN, uint32_t PLLSAIQ, uint32_t PLLSAIR);# l  a: s) c/ N7 A3 O. r. S4 K4 ^
  25. void        RCC_ClockSecuritySystemCmd(FunctionalState NewState);
    ( \' s# A9 m# p0 f/ ~
  26. void        RCC_MCO1Config(uint32_t RCC_MCO1Source, uint32_t RCC_MCO1Div);
    6 `; I/ ^/ q& z+ k9 Y
  27. void        RCC_MCO2Config(uint32_t RCC_MCO2Source, uint32_t RCC_MCO2Div);
    + Q: }/ ?  Y8 j6 o5 U
  28. # f! X2 s! h; S) q  S8 \6 H" B

  29. / S6 a" K5 b' l& F$ N5 L
  30. /* System, AHB and APB busses clocks configuration functions ******************/
    # H, l" E2 g& |' O
  31. void        RCC_SYSCLKConfig(uint32_t RCC_SYSCLKSource);% c$ P0 ~' w; t0 p$ Y8 d& T, r, S
  32. uint8_t     RCC_GetSYSCLKSource(void);$ _, H: S& G2 p
  33. void        RCC_HCLKConfig(uint32_t RCC_SYSCLK);; ?: M; m7 K- i' M7 L+ J) T
  34. void        RCC_PCLK1Config(uint32_t RCC_HCLK);; C4 w' i4 Z0 @7 l3 H) M
  35. void        RCC_PCLK2Config(uint32_t RCC_HCLK);
    # e6 S1 k6 E- Z! F+ _" v
  36. void        RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks);
    . n. l: _; ~% F$ G/ K. l3 m+ y
  37. ) d4 Y9 O! W) X4 D: I! {
  38. /* Peripheral clocks configuration functions **********************************/
    5 d3 S$ E  S- Y( e, M5 h
  39. void        RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSource);$ T, q6 I9 V$ ^3 _+ @
  40. void        RCC_RTCCLKCmd(FunctionalState NewState);9 P* \* O1 ^0 k! _2 u
  41. void        RCC_BackupResetCmd(FunctionalState NewState);) ~- N4 E. k: F

  42. * T5 i# _; Y/ O# y- U1 ^! E

  43. 4 G9 f3 g! B  x5 I
  44. void        RCC_I2SCLKConfig(uint32_t RCC_I2SCLKSource);9 l& H. ^2 r6 b4 K

  45. 9 j# Y9 F& J, a, Y; ]3 u4 y' s) D- J  ~
  46. ) k3 b5 a: ^& ?% }2 F
  47. void        RCC_SAIBlockACLKConfig(uint32_t RCC_SAIBlockACLKSource);' H% @8 n1 q9 G. d/ c' k0 z
  48. void        RCC_SAIBlockBCLKConfig(uint32_t RCC_SAIBlockBCLKSource);
    5 q  ^# d" D1 H4 X3 m# L& V# }; Y
  49. ! A1 p1 a  P$ M- d* n6 ~

  50. 1 ?/ Q2 T0 N  P5 _6 r
  51. void        RCC_SAIPLLI2SClkDivConfig(uint32_t RCC_PLLI2SDivQ);4 V- q8 `% T# x3 v, ?$ p5 N
  52. void        RCC_SAIPLLSAIClkDivConfig(uint32_t RCC_PLLSAIDivQ);
    1 u1 |( I) i0 m4 G- {: h% y

  53. 9 ^( B% N. S; c. Q0 `+ x0 v

  54. 9 U- u9 N8 Q+ |
  55. void        RCC_LTDCCLKDivConfig(uint32_t RCC_PLLSAIDivR);# ]; r+ I* ^9 v% k/ O2 W
  56. void        RCC_TIMCLKPresConfig(uint32_t RCC_TIMCLKPrescaler);
    5 h0 d: g9 e6 Y: F- _

  57. / T( H# C- e+ y5 t$ c1 l: o
  58. void        RCC_AHB1PeriphClockCmd(uint32_t RCC_AHB1Periph, FunctionalState NewState);
    . p- Z' ?/ j) B6 ]" I! C. p$ G
  59. void        RCC_AHB2PeriphClockCmd(uint32_t RCC_AHB2Periph, FunctionalState NewState);# \. Z; h  v# z+ S- p5 e5 \
  60. void        RCC_AHB3PeriphClockCmd(uint32_t RCC_AHB3Periph, FunctionalState NewState);" J( I& M9 l: D, u5 U0 x8 m  Q
  61. void        RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
    & }0 R9 o& ~9 ]' {# }4 Q% V% X- E
  62. void        RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);3 R  F* @7 q4 o* }

  63. 0 Q* L5 n+ X! f* T7 z2 G* o) q" z
  64. void        RCC_AHB1PeriphResetCmd(uint32_t RCC_AHB1Periph, FunctionalState NewState);
    4 n3 [: ^: I6 I* }% |& y
  65. void        RCC_AHB2PeriphResetCmd(uint32_t RCC_AHB2Periph, FunctionalState NewState);. L) c# z0 ~( \7 k, g9 i& K; c
  66. void        RCC_AHB3PeriphResetCmd(uint32_t RCC_AHB3Periph, FunctionalState NewState);
    6 G5 e, V( X1 V6 V
  67. void        RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
    % J0 w2 n6 X3 f
  68. void        RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);5 P3 Y! p/ K( M# ?  I7 S

  69. ) X1 P3 R* e+ N+ Z6 e& c
  70. void        RCC_AHB1PeriphClockLPModeCmd(uint32_t RCC_AHB1Periph, FunctionalState NewState);
    ' q: l# U  d# o/ Z7 `
  71. void        RCC_AHB2PeriphClockLPModeCmd(uint32_t RCC_AHB2Periph, FunctionalState NewState);/ M5 T# @6 O; `- Y5 y' D" K
  72. void        RCC_AHB3PeriphClockLPModeCmd(uint32_t RCC_AHB3Periph, FunctionalState NewState);% K, j8 b( J0 l; }
  73. void        RCC_APB1PeriphClockLPModeCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);% e* x. y- U3 q3 m. H/ W
  74. void        RCC_APB2PeriphClockLPModeCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);$ x! `+ E' h* w6 f5 |- Y- P3 ~* A

  75. 0 n* l+ N5 }+ Q) T' W- q: E+ f
  76. 6 X# Q# _% I6 H; U! D1 r
  77. /* Interrupts and flags management functions **********************************/6 j' \4 T4 }+ ]  P
  78. void        RCC_ITConfig(uint8_t RCC_IT, FunctionalState NewState);0 V2 l$ ~8 T7 E; Q  S
  79. FlagStatus  RCC_GetFlagStatus(uint8_t RCC_FLAG);
    0 m4 a1 B2 q6 W( k# m
  80. void        RCC_ClearFlag(void);3 c: P! a8 D- H5 Z( C! ?# l$ u
  81. ITStatus    RCC_GetITStatus(uint8_t RCC_IT);! F% T8 }" ]$ I9 A) w9 e% u
  82. void        RCC_ClearITPendingBit(uint8_t RCC_IT);
复制代码

) R3 A4 _/ J$ G# \) j( x9 d1 E04. 结构体封装
6 |9 ]+ a9 b6 G1 s" [3 K) t
  1. /**
    3 S. b& z9 F1 Q$ }/ T
  2.   * @brief Reset and Clock Control' {& _# V$ {2 z# X
  3.   */
    , u3 C+ B  ^( }$ r

  4. 4 R$ N$ E& V9 k
  5. typedef struct" b  J" P6 @2 W* W
  6. {% Y  f0 y+ ^, g/ u0 ]
  7.   __IO uint32_t CR;            /*!< RCC clock control register,                                  Address offset: 0x00 */
    $ a: [1 v5 F" V' i
  8.   __IO uint32_t PLLCFGR;       /*!< RCC PLL configuration register,                              Address offset: 0x04 */5 M' }/ Y& {! E" O1 Q
  9.   __IO uint32_t CFGR;          /*!< RCC clock configuration register,                            Address offset: 0x08 */" p# `5 D- U' n) M
  10.   __IO uint32_t CIR;           /*!< RCC clock interrupt register,                                Address offset: 0x0C */- _  V; X- r! f( N2 _6 S
  11.   __IO uint32_t AHB1RSTR;      /*!< RCC AHB1 peripheral reset register,                          Address offset: 0x10 */: ~1 d# F% s  D. }# x0 u9 y
  12.   __IO uint32_t AHB2RSTR;      /*!< RCC AHB2 peripheral reset register,                          Address offset: 0x14 */1 _9 \2 @+ h9 `( g2 U
  13.   __IO uint32_t AHB3RSTR;      /*!< RCC AHB3 peripheral reset register,                          Address offset: 0x18 */
    : H( T  O6 v: ^" M2 @/ W' A
  14.   uint32_t      RESERVED0;     /*!< Reserved, 0x1C                                                                    */, m9 ]7 a1 H6 @" |
  15.   __IO uint32_t APB1RSTR;      /*!< RCC APB1 peripheral reset register,                          Address offset: 0x20 */$ v5 ?% R" g0 R
  16.   __IO uint32_t APB2RSTR;      /*!< RCC APB2 peripheral reset register,                          Address offset: 0x24 */
    ) v5 S  Z, Z, w: a
  17.   uint32_t      RESERVED1[2];  /*!< Reserved, 0x28-0x2C                                                               */& T, L& S6 e* ]4 G; b/ Q
  18.   __IO uint32_t AHB1ENR;       /*!< RCC AHB1 peripheral clock register,                          Address offset: 0x30 */: u$ o# E8 H* h9 O, L3 S2 ]5 ^
  19.   __IO uint32_t AHB2ENR;       /*!< RCC AHB2 peripheral clock register,                          Address offset: 0x34 */
    8 k+ p* {7 ~7 p9 a
  20.   __IO uint32_t AHB3ENR;       /*!< RCC AHB3 peripheral clock register,                          Address offset: 0x38 */8 V; H" J  l* d4 J6 \# v7 A+ E
  21.   uint32_t      RESERVED2;     /*!< Reserved, 0x3C                                                                    */
    0 f6 P" A7 H. g
  22.   __IO uint32_t APB1ENR;       /*!< RCC APB1 peripheral clock enable register,                   Address offset: 0x40 */" O4 l# J2 }+ i$ O# D+ P
  23.   __IO uint32_t APB2ENR;       /*!< RCC APB2 peripheral clock enable register,                   Address offset: 0x44 *// Y" O3 o; M4 S7 d
  24.   uint32_t      RESERVED3[2];  /*!< Reserved, 0x48-0x4C                                                               */; A' D: k/ i6 \2 }
  25.   __IO uint32_t AHB1LPENR;     /*!< RCC AHB1 peripheral clock enable in low power mode register, Address offset: 0x50 */7 T/ Q- ?. Y5 q* T
  26.   __IO uint32_t AHB2LPENR;     /*!< RCC AHB2 peripheral clock enable in low power mode register, Address offset: 0x54 */
    4 X$ r8 z& z$ Y; x8 H2 U  M. m
  27.   __IO uint32_t AHB3LPENR;     /*!< RCC AHB3 peripheral clock enable in low power mode register, Address offset: 0x58 */
    $ N) X# c9 W, @% t) n9 _% o
  28.   uint32_t      RESERVED4;     /*!< Reserved, 0x5C                                                                    */. l( m* W7 G. e* l
  29.   __IO uint32_t APB1LPENR;     /*!< RCC APB1 peripheral clock enable in low power mode register, Address offset: 0x60 */( V6 p( K, F1 J: \3 a- ]; f
  30.   __IO uint32_t APB2LPENR;     /*!< RCC APB2 peripheral clock enable in low power mode register, Address offset: 0x64 */$ }% J% a: Y. ]4 P9 U8 c7 H
  31.   uint32_t      RESERVED5[2];  /*!< Reserved, 0x68-0x6C                                                               */
    . Q( |$ h9 K  A" M0 A& G/ V
  32.   __IO uint32_t BDCR;          /*!< RCC Backup domain control register,                          Address offset: 0x70 */; T3 t" p6 N7 Y8 X6 A4 l# O2 h  ~
  33.   __IO uint32_t CSR;           /*!< RCC clock control & status register,                         Address offset: 0x74 */
    8 `. L& s3 {8 h6 I8 A
  34.   uint32_t      RESERVED6[2];  /*!< Reserved, 0x78-0x7C                                                               */# X' \& v* {% i+ w3 T. ?& L( A
  35.   __IO uint32_t SSCGR;         /*!< RCC spread spectrum clock generation register,               Address offset: 0x80 */0 ^  ~4 z9 n" c* ?1 `, c
  36.   __IO uint32_t PLLI2SCFGR;    /*!< RCC PLLI2S configuration register,                           Address offset: 0x84 */# O: Z4 z( V5 a% Z- p7 V% H$ t
  37.   __IO uint32_t PLLSAICFGR;    /*!< RCC PLLSAI configuration register,                           Address offset: 0x88 */
    % D, u& C1 W# H4 Y: P% S  r
  38.   __IO uint32_t DCKCFGR;       /*!< RCC Dedicated Clocks configuration register,                 Address offset: 0x8C */$ W4 l9 B8 |) x" T3 i
  39.   __IO uint32_t CKGATENR;      /*!< RCC Clocks Gated Enable Register,                            Address offset: 0x90 */ /* Only for STM32F412xG, STM32413_423xx and STM32F446xx devices */
    7 g/ M7 s* Q7 w1 ], `# x
  40.   __IO uint32_t DCKCFGR2;      /*!< RCC Dedicated Clocks configuration register 2,               Address offset: 0x94 */ /* Only for STM32F410xx, STM32F412xG, STM32413_423xx and STM32F446xx devices */
    9 W. N3 p3 o& Z" s
  41. 8 k, ?- R9 _/ h  ^, p1 Y8 [9 r
  42. } RCC_TypeDef;
    ! d9 V3 l1 m5 X" C  i3 M4 w
复制代码

. F- T8 ^) p5 v/ n$ Z# J$ K) d05. 其它
! t4 g" X3 X: U
  1. /******************************************************************************/
    3 u6 R% Q( `$ q
  2. /*                                                                            */
    6 E$ L$ Z8 ?8 p1 _4 X/ I
  3. /*                         Reset and Clock Control                            */
    ! I6 T& c5 w% o4 @  R# l
  4. /*                                                                            *// H9 i; \& G# G2 ~1 W
  5. /******************************************************************************/
    9 v/ k* Q+ H+ M: c
  6. /********************  Bit definition for RCC_CR register  ********************/. c) h2 K$ ~# |. S; v
  7. #define  RCC_CR_HSION                        ((uint32_t)0x00000001)0 m: v7 z+ H/ S+ D8 X
  8. #define  RCC_CR_HSIRDY                       ((uint32_t)0x00000002)8 a3 y: j9 ]6 a" Y' c4 o
  9. * n5 n  J$ o" z' P
  10. #define  RCC_CR_HSITRIM                      ((uint32_t)0x000000F8)7 [& q" W& C, B/ k. ?7 f5 a
  11. #define  RCC_CR_HSITRIM_0                    ((uint32_t)0x00000008)/*!<Bit 0 */
    . k2 @. y( f% H! J
  12. #define  RCC_CR_HSITRIM_1                    ((uint32_t)0x00000010)/*!<Bit 1 */; d* \6 s2 a; s" A9 F# J
  13. #define  RCC_CR_HSITRIM_2                    ((uint32_t)0x00000020)/*!<Bit 2 */
    1 z3 p: s& {# U0 `# E% k7 K3 c& C
  14. #define  RCC_CR_HSITRIM_3                    ((uint32_t)0x00000040)/*!<Bit 3 */7 q9 l. i( Q! f4 `) y2 ^3 T
  15. #define  RCC_CR_HSITRIM_4                    ((uint32_t)0x00000080)/*!<Bit 4 */3 p) K+ [6 H0 D% q0 P$ K" X

  16. 2 n- p! E$ W+ c5 n+ r/ N
  17. #define  RCC_CR_HSICAL                       ((uint32_t)0x0000FF00)
    + p3 e+ V  s! w: K
  18. #define  RCC_CR_HSICAL_0                     ((uint32_t)0x00000100)/*!<Bit 0 */( v- m  i3 b' V* {2 H% ?, p8 ]; H/ l
  19. #define  RCC_CR_HSICAL_1                     ((uint32_t)0x00000200)/*!<Bit 1 */
    % K# J4 e+ n$ L9 P2 @
  20. #define  RCC_CR_HSICAL_2                     ((uint32_t)0x00000400)/*!<Bit 2 */
    ) R1 g8 y. |2 a, m, t( w* I; r4 B/ @2 s
  21. #define  RCC_CR_HSICAL_3                     ((uint32_t)0x00000800)/*!<Bit 3 */* h1 w/ \' W) a0 L
  22. #define  RCC_CR_HSICAL_4                     ((uint32_t)0x00001000)/*!<Bit 4 *// s8 G9 {" V5 i" R! a
  23. #define  RCC_CR_HSICAL_5                     ((uint32_t)0x00002000)/*!<Bit 5 */
    6 E- p& L! L& {6 D
  24. #define  RCC_CR_HSICAL_6                     ((uint32_t)0x00004000)/*!<Bit 6 */
    ! c, H3 g, H2 `* n+ E6 r
  25. #define  RCC_CR_HSICAL_7                     ((uint32_t)0x00008000)/*!<Bit 7 */
    * l+ S  G, y- r' N4 A/ J+ r
  26. - f* r& z1 y4 Q& Q5 p( [6 K
  27. #define  RCC_CR_HSEON                        ((uint32_t)0x00010000)& G# \5 H: `! y1 v& j
  28. #define  RCC_CR_HSERDY                       ((uint32_t)0x00020000)
    ; l$ ^# n: z  l$ `4 V, Q$ N
  29. #define  RCC_CR_HSEBYP                       ((uint32_t)0x00040000)
    2 T: ]$ H: J2 `5 T* V
  30. #define  RCC_CR_CSSON                        ((uint32_t)0x00080000). @6 w: V0 Z  D) u' C, K/ Y
  31. #define  RCC_CR_PLLON                        ((uint32_t)0x01000000)) i& k5 H* w; H) ~
  32. #define  RCC_CR_PLLRDY                       ((uint32_t)0x02000000)
    5 C+ x5 v8 `; K2 [9 n
  33. #define  RCC_CR_PLLI2SON                     ((uint32_t)0x04000000)
    $ R0 P( H+ C; P
  34. #define  RCC_CR_PLLI2SRDY                    ((uint32_t)0x08000000)
    : N4 R, y' n5 S, ?0 t
  35. #define  RCC_CR_PLLSAION                     ((uint32_t)0x10000000)
    & h% f! k# k) T9 G
  36. #define  RCC_CR_PLLSAIRDY                    ((uint32_t)0x20000000)
    $ G" f0 P% x$ O  p5 |4 C) ?) R
  37. 3 V$ n+ Q! m. Z
  38. /********************  Bit definition for RCC_PLLCFGR register  ***************/
    8 o* e4 n; G/ c( N( ]0 N# j# V% M" s
  39. #define  RCC_PLLCFGR_PLLM                    ((uint32_t)0x0000003F)
      m9 E% T- @. y7 h& F$ l, T% F4 B
  40. #define  RCC_PLLCFGR_PLLM_0                  ((uint32_t)0x00000001)/ @/ L+ }2 f" X
  41. #define  RCC_PLLCFGR_PLLM_1                  ((uint32_t)0x00000002)6 |# L6 Z4 k5 R9 F1 z
  42. #define  RCC_PLLCFGR_PLLM_2                  ((uint32_t)0x00000004)
    4 s6 C* U' Y) q
  43. #define  RCC_PLLCFGR_PLLM_3                  ((uint32_t)0x00000008)2 Z* T* O) F4 K( G$ h. @
  44. #define  RCC_PLLCFGR_PLLM_4                  ((uint32_t)0x00000010)
    - ]8 k) F. w$ g: E- m  \# r" H! d+ c
  45. #define  RCC_PLLCFGR_PLLM_5                  ((uint32_t)0x00000020). O& c/ l, A( K5 x- ^6 C
  46. 8 ~, X/ V' {; c, G
  47. #define  RCC_PLLCFGR_PLLN                     ((uint32_t)0x00007FC0)
    ! z# t0 {  P$ p) I
  48. #define  RCC_PLLCFGR_PLLN_0                   ((uint32_t)0x00000040)
    1 T: s2 V( w& |$ x: c
  49. #define  RCC_PLLCFGR_PLLN_1                   ((uint32_t)0x00000080)
    3 x! c7 `# M: k* K% w& _0 P
  50. #define  RCC_PLLCFGR_PLLN_2                   ((uint32_t)0x00000100)5 C! l+ {/ I; F4 ?0 E
  51. #define  RCC_PLLCFGR_PLLN_3                   ((uint32_t)0x00000200)
    0 C' i4 C  ?4 s
  52. #define  RCC_PLLCFGR_PLLN_4                   ((uint32_t)0x00000400)
    9 |0 N' k% e1 k! j7 G" \3 H& g
  53. #define  RCC_PLLCFGR_PLLN_5                   ((uint32_t)0x00000800)
    0 _3 O4 x4 @8 K, d
  54. #define  RCC_PLLCFGR_PLLN_6                   ((uint32_t)0x00001000)
    9 f9 n8 z/ O) K1 X: \. j
  55. #define  RCC_PLLCFGR_PLLN_7                   ((uint32_t)0x00002000)
    # F8 G/ G4 L4 h+ N4 b
  56. #define  RCC_PLLCFGR_PLLN_8                   ((uint32_t)0x00004000)
    % y2 b4 E: ]$ u6 h; T% Q& T
  57. ! a% ^9 e. ?5 M! w4 G/ |, f2 P
  58. #define  RCC_PLLCFGR_PLLP                    ((uint32_t)0x00030000)
    9 }! U; J: t1 D: z$ G
  59. #define  RCC_PLLCFGR_PLLP_0                  ((uint32_t)0x00010000)" Q9 I. q0 I6 P2 }3 d) z: X
  60. #define  RCC_PLLCFGR_PLLP_1                  ((uint32_t)0x00020000)
    " t# s! V' x: z. z7 N
  61. 3 f) p) q: v  @; t9 U# L
  62. #define  RCC_PLLCFGR_PLLSRC                  ((uint32_t)0x00400000)+ C  r4 o+ k2 j+ Y4 t
  63. #define  RCC_PLLCFGR_PLLSRC_HSE              ((uint32_t)0x00400000)) `3 M" b* B5 ^& h
  64. #define  RCC_PLLCFGR_PLLSRC_HSI              ((uint32_t)0x00000000)
    ! J' }3 s6 G2 Y, Z5 `8 Z
  65. : a/ J6 Y0 `6 ~0 a- U9 }- C" h
  66. #define  RCC_PLLCFGR_PLLQ                    ((uint32_t)0x0F000000)* E- j0 _8 y# M% }$ _  b4 g2 O
  67. #define  RCC_PLLCFGR_PLLQ_0                  ((uint32_t)0x01000000), J" T8 H2 H1 V5 I/ x. v' h7 F
  68. #define  RCC_PLLCFGR_PLLQ_1                  ((uint32_t)0x02000000)7 h, Y9 G$ V/ n# w
  69. #define  RCC_PLLCFGR_PLLQ_2                  ((uint32_t)0x04000000)3 ]. \5 i1 k9 ]/ \! u" Z
  70. #define  RCC_PLLCFGR_PLLQ_3                  ((uint32_t)0x08000000)2 S! k. Q; a# c% V9 k

  71.   N8 U' A9 {( f
  72. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx)
    2 o! E+ P4 |- ^& F4 H; O" I
  73. #define  RCC_PLLCFGR_PLLR                    ((uint32_t)0x70000000)
    4 x  ^/ W8 G# S
  74. #define  RCC_PLLCFGR_PLLR_0                  ((uint32_t)0x10000000)
    ; G) ~1 [2 j3 Y2 r" i8 D- j
  75. #define  RCC_PLLCFGR_PLLR_1                  ((uint32_t)0x20000000)# |4 l8 n+ ?4 c
  76. #define  RCC_PLLCFGR_PLLR_2                  ((uint32_t)0x40000000). h3 Y! ^7 S- X) m) X
  77. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */
    ; F! h+ W; ^6 L8 A1 j  n: O

  78. " F1 {9 @: Z. z% c0 W
  79. /********************  Bit definition for RCC_CFGR register  ******************/2 m( H  p/ F/ _
  80. /*!< SW configuration */' ?8 E& v. X% b; w+ X
  81. #define  RCC_CFGR_SW                         ((uint32_t)0x00000003)        /*!< SW[1:0] bits (System clock Switch) */3 G: J: p5 o3 ~  z9 s' o
  82. #define  RCC_CFGR_SW_0                       ((uint32_t)0x00000001)        /*!< Bit 0 */& ~2 l6 k( x, y  I- Z
  83. #define  RCC_CFGR_SW_1                       ((uint32_t)0x00000002)        /*!< Bit 1 */' }& R2 v8 A, y0 Q$ d/ ^8 L0 p

  84. + s7 K* K5 O' J6 V' K
  85. #define  RCC_CFGR_SW_HSI                     ((uint32_t)0x00000000)        /*!< HSI selected as system clock */
    : n" o# g8 c% p6 k+ B
  86. #define  RCC_CFGR_SW_HSE                     ((uint32_t)0x00000001)        /*!< HSE selected as system clock */# `: C4 t6 y+ `# I" _$ L5 C/ W9 }$ }
  87. #define  RCC_CFGR_SW_PLL                     ((uint32_t)0x00000002)        /*!< PLL/PLLP selected as system clock */
    5 u# c( x0 Y% Q+ o7 s
  88. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx)
    $ r$ X  y8 X0 C# f5 i; H
  89. #define  RCC_CFGR_SW_PLLR                    ((uint32_t)0x00000003)        /*!< PLL/PLLR selected as system clock */
    + z& N: Q9 P" A: ]4 |! w
  90. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx *// U) d4 R, J6 a" D( J  Q4 q8 h
  91. ; o' E- J0 j8 }9 n4 {
  92. /*!< SWS configuration */
    5 n& d  f) p+ C. j; `6 e! b
  93. #define  RCC_CFGR_SWS                        ((uint32_t)0x0000000C)        /*!< SWS[1:0] bits (System Clock Switch Status) */7 ]( M$ F( H1 [9 }; B$ `. Y4 k
  94. #define  RCC_CFGR_SWS_0                      ((uint32_t)0x00000004)        /*!< Bit 0 */
    : R8 [. `8 }3 E2 R  l% y5 {" B
  95. #define  RCC_CFGR_SWS_1                      ((uint32_t)0x00000008)        /*!< Bit 1 */
    4 i" u% y/ C4 h4 Z) K* r

  96. + v6 z0 {! H3 J5 e
  97. #define  RCC_CFGR_SWS_HSI                    ((uint32_t)0x00000000)        /*!< HSI oscillator used as system clock */
    ! r+ w! a% y3 |2 S8 {
  98. #define  RCC_CFGR_SWS_HSE                    ((uint32_t)0x00000004)        /*!< HSE oscillator used as system clock */
      Y% R7 C+ c) Z% X" ?3 v
  99. #define  RCC_CFGR_SWS_PLL                    ((uint32_t)0x00000008)        /*!< PLL/PLLP used as system clock       */
    3 `. ^3 q: U# w: X
  100. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F469_479xx) || defined(STM32F446xx)
    ' t2 P/ D7 v3 t' N7 U, o
  101. #define  RCC_CFGR_SWS_PLLR                   ((uint32_t)0x0000000C)        /*!< PLL/PLLR used as system clock       */' B5 E( I) `4 j9 I3 J# i
  102. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */* ?9 q# a' \: Z8 M
  103. 2 D9 w7 z) a$ {/ ]( Q7 L# p# C
  104. /*!< HPRE configuration */; t$ }3 [  O' H( M1 V, X6 x2 T% d
  105. #define  RCC_CFGR_HPRE                       ((uint32_t)0x000000F0)        /*!< HPRE[3:0] bits (AHB prescaler) */
    8 F- w  O3 S0 n: x5 |9 T: d
  106. #define  RCC_CFGR_HPRE_0                     ((uint32_t)0x00000010)        /*!< Bit 0 */' X6 V$ C; p/ i1 _
  107. #define  RCC_CFGR_HPRE_1                     ((uint32_t)0x00000020)        /*!< Bit 1 */6 K5 S0 n5 d" P
  108. #define  RCC_CFGR_HPRE_2                     ((uint32_t)0x00000040)        /*!< Bit 2 */
    % v* y* U0 k. n; W+ f
  109. #define  RCC_CFGR_HPRE_3                     ((uint32_t)0x00000080)        /*!< Bit 3 */  b" E- _6 m( e

  110. 2 z7 m, E$ `2 W1 S- o1 J
  111. #define  RCC_CFGR_HPRE_DIV1                  ((uint32_t)0x00000000)        /*!< SYSCLK not divided */9 [2 V- {$ m3 _  b5 F, n
  112. #define  RCC_CFGR_HPRE_DIV2                  ((uint32_t)0x00000080)        /*!< SYSCLK divided by 2 */
    ( N; L5 \! Q* n. L& i  S
  113. #define  RCC_CFGR_HPRE_DIV4                  ((uint32_t)0x00000090)        /*!< SYSCLK divided by 4 */
    ! `: f# ]/ O' A* y, z# q
  114. #define  RCC_CFGR_HPRE_DIV8                  ((uint32_t)0x000000A0)        /*!< SYSCLK divided by 8 */! H; h  m5 y9 G* E$ j4 n6 r
  115. #define  RCC_CFGR_HPRE_DIV16                 ((uint32_t)0x000000B0)        /*!< SYSCLK divided by 16 */
    & M* D" t5 |/ P' }2 O! g) [* s" F& s4 U
  116. #define  RCC_CFGR_HPRE_DIV64                 ((uint32_t)0x000000C0)        /*!< SYSCLK divided by 64 */
      u& U7 m7 q# y3 v
  117. #define  RCC_CFGR_HPRE_DIV128                ((uint32_t)0x000000D0)        /*!< SYSCLK divided by 128 */
    3 ?* b/ o  o) x) m; v% d/ ~- ]( M; F
  118. #define  RCC_CFGR_HPRE_DIV256                ((uint32_t)0x000000E0)        /*!< SYSCLK divided by 256 */! w$ h$ [* |8 T
  119. #define  RCC_CFGR_HPRE_DIV512                ((uint32_t)0x000000F0)        /*!< SYSCLK divided by 512 */
    ( Y: @8 d# f& o
  120. , f- E; A/ }; I2 f/ S
  121. #if defined(STM32F410xx)6 O! t7 B9 c9 q( Z. }
  122. /*!< MCO1EN configuration */
    ; s- G! c( B5 t5 j
  123. #define  RCC_CFGR_MCO1EN                     ((uint32_t)0x00000100)        /*!< MCO1EN bit */! E9 g% a7 b6 ~, d6 K8 E: L
  124. /*!< MCO1EN configuration */
    * Q" j+ G, q$ `8 I; V
  125. #define  RCC_CFGR_MCO2EN                     ((uint32_t)0x00000200)        /*!< MCO2EN bit */& E$ m8 w! C" }4 \' r
  126. #endif /* STM32F410xx */
    3 I0 c7 q# i1 X4 ^" r
  127. /*!< PPRE1 configuration */
    & v; S! {5 B8 W$ D
  128. #define  RCC_CFGR_PPRE1                      ((uint32_t)0x00001C00)        /*!< PRE1[2:0] bits (APB1 prescaler) */" ~9 J. V2 K6 }4 p2 L
  129. #define  RCC_CFGR_PPRE1_0                    ((uint32_t)0x00000400)        /*!< Bit 0 */4 e" \( D# p: u' ^; z
  130. #define  RCC_CFGR_PPRE1_1                    ((uint32_t)0x00000800)        /*!< Bit 1 */
    " v9 P% M+ c5 i
  131. #define  RCC_CFGR_PPRE1_2                    ((uint32_t)0x00001000)        /*!< Bit 2 */
    5 k3 n( ^# x  O6 e9 V9 f
  132. $ l. N' p0 j  l/ M- r  _/ d* U- M+ E
  133. #define  RCC_CFGR_PPRE1_DIV1                 ((uint32_t)0x00000000)        /*!< HCLK not divided */
    , |8 F/ a- Y5 J; [( _( V% r$ ^, p
  134. #define  RCC_CFGR_PPRE1_DIV2                 ((uint32_t)0x00001000)        /*!< HCLK divided by 2 */
    ' L$ g, r0 N* q+ |# Y5 D
  135. #define  RCC_CFGR_PPRE1_DIV4                 ((uint32_t)0x00001400)        /*!< HCLK divided by 4 */' k+ I% {0 `( m: ~4 a
  136. #define  RCC_CFGR_PPRE1_DIV8                 ((uint32_t)0x00001800)        /*!< HCLK divided by 8 *// z2 ?4 D: ]9 o" w7 d
  137. #define  RCC_CFGR_PPRE1_DIV16                ((uint32_t)0x00001C00)        /*!< HCLK divided by 16 */; i3 K# y& t2 }1 g8 r9 T# n* E

  138. ( j' m& U# e  ^4 }
  139. /*!< PPRE2 configuration */
    ' u3 @2 p& |* ]* q9 [+ b0 ^4 h7 D
  140. #define  RCC_CFGR_PPRE2                      ((uint32_t)0x0000E000)        /*!< PRE2[2:0] bits (APB2 prescaler) */
    - R' E1 k- U; D9 H
  141. #define  RCC_CFGR_PPRE2_0                    ((uint32_t)0x00002000)        /*!< Bit 0 */
    4 H1 ^# k/ \8 @" Y' l
  142. #define  RCC_CFGR_PPRE2_1                    ((uint32_t)0x00004000)        /*!< Bit 1 */# y6 G5 I, D3 M) g1 `  z/ J, Y
  143. #define  RCC_CFGR_PPRE2_2                    ((uint32_t)0x00008000)        /*!< Bit 2 */
    ! S; s1 Z, h7 L! p2 w

  144. ' z, e/ q! G2 h" ?8 N
  145. #define  RCC_CFGR_PPRE2_DIV1                 ((uint32_t)0x00000000)        /*!< HCLK not divided */
    ( W( {& k9 B6 _7 R5 ~) I/ Y6 U
  146. #define  RCC_CFGR_PPRE2_DIV2                 ((uint32_t)0x00008000)        /*!< HCLK divided by 2 *// Q* |6 V$ |! B. o1 \
  147. #define  RCC_CFGR_PPRE2_DIV4                 ((uint32_t)0x0000A000)        /*!< HCLK divided by 4 */
    4 D# Y' B# O- W9 j
  148. #define  RCC_CFGR_PPRE2_DIV8                 ((uint32_t)0x0000C000)        /*!< HCLK divided by 8 */6 x/ ]5 ]8 B+ b9 {! o+ ]# W$ z
  149. #define  RCC_CFGR_PPRE2_DIV16                ((uint32_t)0x0000E000)        /*!< HCLK divided by 16 */! n, R+ U8 ~5 K% _% ]3 k

  150. ( P; z( K7 F5 k4 Z7 E
  151. /*!< RTCPRE configuration */
    0 @/ `# _- H3 @9 v' P
  152. #define  RCC_CFGR_RTCPRE                     ((uint32_t)0x001F0000)3 [% k# f. R' [
  153. #define  RCC_CFGR_RTCPRE_0                   ((uint32_t)0x00010000)
    $ t( d6 O1 `7 l+ \' _
  154. #define  RCC_CFGR_RTCPRE_1                   ((uint32_t)0x00020000)
      \1 j, k0 W0 W6 p& D; F
  155. #define  RCC_CFGR_RTCPRE_2                   ((uint32_t)0x00040000)
    ; W  N9 t/ F& k+ F
  156. #define  RCC_CFGR_RTCPRE_3                   ((uint32_t)0x00080000): s, ~( u7 v9 F0 d- n
  157. #define  RCC_CFGR_RTCPRE_4                   ((uint32_t)0x00100000)
    . _6 X  e" i' r( U: x- f$ ~
  158. * T& W# M: G$ b. J. D
  159. /*!< MCO1 configuration */
    3 ?+ U8 p; R1 A3 T9 J
  160. #define  RCC_CFGR_MCO1                       ((uint32_t)0x00600000)
    . ~( n# G  z: a) Y0 s
  161. #define  RCC_CFGR_MCO1_0                     ((uint32_t)0x00200000)
    . ~4 a1 t. N1 Q
  162. #define  RCC_CFGR_MCO1_1                     ((uint32_t)0x00400000)% C& a( r  i3 o1 r1 {, B: ?
  163. # g' ~( U( A# I5 g6 p5 O* @1 k1 o
  164. #define  RCC_CFGR_I2SSRC                     ((uint32_t)0x00800000)
    : x% _, ^; ~; u1 u

  165. 4 B+ g  Y4 ^1 T
  166. #define  RCC_CFGR_MCO1PRE                    ((uint32_t)0x07000000)
    * A5 y9 `7 Z, R% j
  167. #define  RCC_CFGR_MCO1PRE_0                  ((uint32_t)0x01000000)+ T! T; @" x# L" q! y: D& c# A
  168. #define  RCC_CFGR_MCO1PRE_1                  ((uint32_t)0x02000000)
    5 s. s/ E0 R; A  L+ z
  169. #define  RCC_CFGR_MCO1PRE_2                  ((uint32_t)0x04000000)
    8 h! X- p" y& w4 s# X7 t# l# C
  170. , R0 N: ~; ~* a0 |
  171. #define  RCC_CFGR_MCO2PRE                    ((uint32_t)0x38000000)# ~8 G2 e; L+ x3 {; Y
  172. #define  RCC_CFGR_MCO2PRE_0                  ((uint32_t)0x08000000)
    2 q0 |7 `1 G6 L- L3 ?
  173. #define  RCC_CFGR_MCO2PRE_1                  ((uint32_t)0x10000000)
    . T+ [1 N: ^9 F4 L  g) y' P' x
  174. #define  RCC_CFGR_MCO2PRE_2                  ((uint32_t)0x20000000)
    3 f0 E5 Z  ^7 u) ~& G

  175. : Z+ g0 Z! Z/ @% b
  176. #define  RCC_CFGR_MCO2                       ((uint32_t)0xC0000000)
    # u  V# M2 w) `$ ]
  177. #define  RCC_CFGR_MCO2_0                     ((uint32_t)0x40000000)  S7 y' G0 @" ~: C/ p# m  }
  178. #define  RCC_CFGR_MCO2_1                     ((uint32_t)0x80000000)
    ' x3 j. P- I7 Z4 E6 B' n

  179. 1 S5 P9 c' K8 k" u' V0 L. k8 ~
  180. /********************  Bit definition for RCC_CIR register  *******************/, L: S; Y- ]$ |* ~7 F
  181. #define  RCC_CIR_LSIRDYF                     ((uint32_t)0x00000001)
    # s2 y' D- L$ D( N2 u4 ^8 f
  182. #define  RCC_CIR_LSERDYF                     ((uint32_t)0x00000002)2 |  d/ S6 f' g' r
  183. #define  RCC_CIR_HSIRDYF                     ((uint32_t)0x00000004)% m$ b, c7 }: b3 M& N
  184. #define  RCC_CIR_HSERDYF                     ((uint32_t)0x00000008)/ [9 s, i# }5 D% h$ n) S
  185. #define  RCC_CIR_PLLRDYF                     ((uint32_t)0x00000010)% E# J1 n7 J" T% p7 B) M+ m
  186. #define  RCC_CIR_PLLI2SRDYF                  ((uint32_t)0x00000020)
    & |$ a9 D# U6 [: `; p
  187. #define  RCC_CIR_PLLSAIRDYF                  ((uint32_t)0x00000040)  }8 a% C/ O$ Z, T4 A  ^
  188. #define  RCC_CIR_CSSF                        ((uint32_t)0x00000080), P5 X9 h1 c$ j9 x+ {
  189. #define  RCC_CIR_LSIRDYIE                    ((uint32_t)0x00000100)
    : X4 Z8 A1 o7 ]5 F. a' e- N
  190. #define  RCC_CIR_LSERDYIE                    ((uint32_t)0x00000200)
    2 [5 M: U- D8 W" B1 z1 d2 a% P
  191. #define  RCC_CIR_HSIRDYIE                    ((uint32_t)0x00000400)
    7 M: l! ]: r+ b7 \0 s/ H# Y
  192. #define  RCC_CIR_HSERDYIE                    ((uint32_t)0x00000800)
    0 ?' \  X7 a  q% V4 u$ [
  193. #define  RCC_CIR_PLLRDYIE                    ((uint32_t)0x00001000)
    ; Z- w$ _* o0 i% Z( H) G3 ]  f
  194. #define  RCC_CIR_PLLI2SRDYIE                 ((uint32_t)0x00002000). N; Q3 F2 @# v, z( p9 d8 t
  195. #define  RCC_CIR_PLLSAIRDYIE                 ((uint32_t)0x00004000)) ~: n9 a) u; ~
  196. #define  RCC_CIR_LSIRDYC                     ((uint32_t)0x00010000)
    % _3 q& D/ w( Q. k
  197. #define  RCC_CIR_LSERDYC                     ((uint32_t)0x00020000)
    ! k; l1 N) m( u, }( w& L, A
  198. #define  RCC_CIR_HSIRDYC                     ((uint32_t)0x00040000)4 o* v: `, a' `* U$ m' o7 M
  199. #define  RCC_CIR_HSERDYC                     ((uint32_t)0x00080000)5 H' E+ {" h/ o5 H" S
  200. #define  RCC_CIR_PLLRDYC                     ((uint32_t)0x00100000)* e2 `" h" h  _# E2 U# q, o
  201. #define  RCC_CIR_PLLI2SRDYC                  ((uint32_t)0x00200000). H  L. \+ c5 ^. ~; Q, J
  202. #define  RCC_CIR_PLLSAIRDYC                  ((uint32_t)0x00400000)
    ' L# b) H9 ~: j8 ]9 h/ H
  203. #define  RCC_CIR_CSSC                        ((uint32_t)0x00800000)) R8 ?9 v1 q9 o- {
  204. , y9 Y5 n7 @* w' d
  205. /********************  Bit definition for RCC_AHB1RSTR register  **************/$ C" {( E3 k( K& |2 |) o
  206. #define  RCC_AHB1RSTR_GPIOARST               ((uint32_t)0x00000001)
    + g/ n+ z) D. ~1 W3 u" T
  207. #define  RCC_AHB1RSTR_GPIOBRST               ((uint32_t)0x00000002)
    6 _- ^& `! F) ^9 m3 N+ l
  208. #define  RCC_AHB1RSTR_GPIOCRST               ((uint32_t)0x00000004)( M3 f, X7 R# M% j4 v
  209. #define  RCC_AHB1RSTR_GPIODRST               ((uint32_t)0x00000008)$ D: U" O. T  ?/ @+ J* k+ W$ k! f
  210. #define  RCC_AHB1RSTR_GPIOERST               ((uint32_t)0x00000010)
    8 N: l5 C, G& ?. b( g
  211. #define  RCC_AHB1RSTR_GPIOFRST               ((uint32_t)0x00000020)
    $ E: L, [8 X! P3 @! [7 z
  212. #define  RCC_AHB1RSTR_GPIOGRST               ((uint32_t)0x00000040)
    7 {( S, i' r1 ^
  213. #define  RCC_AHB1RSTR_GPIOHRST               ((uint32_t)0x00000080): z* `* b) A- k
  214. #define  RCC_AHB1RSTR_GPIOIRST               ((uint32_t)0x00000100)
    7 H/ I% z& F' A' b: \
  215. #define  RCC_AHB1RSTR_GPIOJRST               ((uint32_t)0x00000200)
    5 M6 z- \9 ?6 R( }; J
  216. #define  RCC_AHB1RSTR_GPIOKRST               ((uint32_t)0x00000400)1 }& N/ f3 I( C* F: y, N
  217. #define  RCC_AHB1RSTR_CRCRST                 ((uint32_t)0x00001000)
    % p5 C) l# b# T& v8 ~. Q- `- A
  218. #define  RCC_AHB1RSTR_DMA1RST                ((uint32_t)0x00200000)& a0 u3 a- T" A
  219. #define  RCC_AHB1RSTR_DMA2RST                ((uint32_t)0x00400000)" G$ k# v1 S3 i/ X
  220. #define  RCC_AHB1RSTR_DMA2DRST               ((uint32_t)0x00800000)
    9 L1 S0 |9 N& X$ k; t
  221. #define  RCC_AHB1RSTR_ETHMACRST              ((uint32_t)0x02000000)5 L1 F* t3 N$ N
  222. #define  RCC_AHB1RSTR_OTGHRST                ((uint32_t)0x10000000)6 P' x  a% u# H+ H
  223. 9 j% B: M' y& m" E) g% Z
  224. /********************  Bit definition for RCC_AHB2RSTR register  **************/
    7 A. A* Q* w7 e! M) J
  225. #define  RCC_AHB2RSTR_DCMIRST                ((uint32_t)0x00000001)
    ( d6 q5 H! Y. [& ?  X
  226. #define  RCC_AHB2RSTR_CRYPRST                ((uint32_t)0x00000010)" u& M3 t- b# g) u+ L
  227. #define  RCC_AHB2RSTR_HASHRST                ((uint32_t)0x00000020)
    , C1 H! R" d* P; R; |4 P; C
  228. /* maintained for legacy purpose */3 N1 U) ?5 Y+ i. m4 D3 I
  229. #define  RCC_AHB2RSTR_HSAHRST                RCC_AHB2RSTR_HASHRST
    : ?5 M6 }% v) V# g6 Y
  230. #define  RCC_AHB2RSTR_RNGRST                 ((uint32_t)0x00000040)9 W. B: `( I% @5 q
  231. #define  RCC_AHB2RSTR_OTGFSRST               ((uint32_t)0x00000080)
    / P6 s; _' Y( {& O; v

  232. * P. v0 w4 U9 l% `
  233. /********************  Bit definition for RCC_AHB3RSTR register  **************/
    + N! K" V: T$ W& G4 Q4 \: O: t0 ]
  234. #if defined(STM32F40_41xxx) || defined(STM32F412xG) || defined(STM32F413_423xx)% `5 s0 v& `, P" G3 |" A
  235. #define  RCC_AHB3RSTR_FSMCRST                ((uint32_t)0x00000001)
    ( E' o$ r/ U9 _7 o7 O+ h) |
  236. #endif /* STM32F40_41xxx || STM32F412xG || STM32F413_423xx */' N- [* ?% o; Q, R

  237. 4 C) H0 r5 w! j( z* J
  238. #if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx)3 h6 t9 x1 q* u) {/ r
  239. #define  RCC_AHB3RSTR_FMCRST                ((uint32_t)0x00000001)
    % `9 U! A, V. w0 s/ ~
  240. #endif /* STM32F427_437xx ||  STM32F429_439xx || STM32F446xx || STM32F469_479xx */
    ' ]% v4 {' i5 ?7 i2 F
  241. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx)8 w* o. h# M% L" {0 m9 d8 z
  242. #define  RCC_AHB3RSTR_QSPIRST               ((uint32_t)0x00000002)
    . [4 ]% a* A* I4 e) ~/ D
  243. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */
    9 U" b. e8 o/ w6 ?: S& G. k8 @
  244. + A/ P; Y  W- Q; _# |8 l9 R3 M
  245. /********************  Bit definition for RCC_APB1RSTR register  **************/5 x( Z! J+ F. ]4 {/ V4 T: x
  246. #define  RCC_APB1RSTR_TIM2RST                ((uint32_t)0x00000001)2 k, z" W( C. g4 c0 K
  247. #define  RCC_APB1RSTR_TIM3RST                ((uint32_t)0x00000002)& F; v4 g$ z! T5 E3 S
  248. #define  RCC_APB1RSTR_TIM4RST                ((uint32_t)0x00000004)
    " A! J9 o+ @/ {/ W3 ~
  249. #define  RCC_APB1RSTR_TIM5RST                ((uint32_t)0x00000008)
    * s) u5 Y4 |+ s5 b' v- n& z" B* ~8 H7 {
  250. #define  RCC_APB1RSTR_TIM6RST                ((uint32_t)0x00000010)/ _9 h0 x' u$ H# Q( w5 K- e1 S
  251. #define  RCC_APB1RSTR_TIM7RST                ((uint32_t)0x00000020)0 n! i: r# p8 L; I4 p5 B# A
  252. #define  RCC_APB1RSTR_TIM12RST               ((uint32_t)0x00000040). o. @+ L7 T- ?1 q. M
  253. #define  RCC_APB1RSTR_TIM13RST               ((uint32_t)0x00000080); I3 m! f- R+ r3 m$ l4 P5 U
  254. #define  RCC_APB1RSTR_TIM14RST               ((uint32_t)0x00000100)5 }( a0 Q0 f9 }& F" z2 M1 }
  255. #if defined(STM32F410xx) || defined(STM32F413_423xx)
    " _: F1 z0 h, q3 j3 P! |% `
  256. #define  RCC_APB1RSTR_LPTIM1RST              ((uint32_t)0x00000200)
    ' n# M9 t  M9 F; e0 R8 s
  257. #endif /* STM32F410xx || STM32F413_423xx */( `0 ~' O6 k  N" x) u9 G( m& O
  258. #define  RCC_APB1RSTR_WWDGRST                ((uint32_t)0x00000800)
    8 w! Y) G" P8 {, m7 ?$ C1 S4 v
  259. #define  RCC_APB1RSTR_SPI2RST                ((uint32_t)0x00004000)
    % o+ X+ ]/ Y9 F6 Z/ z
  260. #define  RCC_APB1RSTR_SPI3RST                ((uint32_t)0x00008000)/ A+ [& C) @4 f- t) y' d: e
  261. #if defined(STM32F446xx)# N) |! d5 k* ~1 H1 `# i6 ^
  262. #define  RCC_APB1RSTR_SPDIFRXRST             ((uint32_t)0x00010000)/ p: F0 v( N! a0 v; z  H0 ^
  263. #endif /* STM32F446xx */. U0 V* X+ }4 w- l
  264. #define  RCC_APB1RSTR_USART2RST              ((uint32_t)0x00020000)
    . {4 c  t! s* m+ E' v
  265. #define  RCC_APB1RSTR_USART3RST              ((uint32_t)0x00040000): t# A( P; z. L; X3 ]7 y$ y
  266. #define  RCC_APB1RSTR_UART4RST               ((uint32_t)0x00080000)0 V% o6 W0 e3 w# B1 z
  267. #define  RCC_APB1RSTR_UART5RST               ((uint32_t)0x00100000)
    ' c- L1 z$ j) O% C4 s1 b0 x
  268. #define  RCC_APB1RSTR_I2C1RST                ((uint32_t)0x00200000)
    4 V# L0 ]9 t. Q5 Q& D
  269. #define  RCC_APB1RSTR_I2C2RST                ((uint32_t)0x00400000)( Y0 @0 H# ^0 N4 d0 }! |9 R
  270. #define  RCC_APB1RSTR_I2C3RST                ((uint32_t)0x00800000)# z: N5 Z/ v: w5 x( O. S
  271. #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx)
    : n! H* c  S) q6 h
  272. #define  RCC_APB1RSTR_FMPI2C1RST             ((uint32_t)0x01000000)
    - g) z4 x# I# T3 H, j- G6 J
  273. #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx || STM32F446xx */
    8 H( J8 u6 i5 ~2 N; }5 ~8 ^( |
  274. #define  RCC_APB1RSTR_CAN1RST                ((uint32_t)0x02000000)
      g% Q. s# X: o3 D( ^; d4 r
  275. #define  RCC_APB1RSTR_CAN2RST                ((uint32_t)0x04000000): y; g, c8 g3 J( s, h# O
  276. #if defined(STM32F446xx)5 Q% U/ O% L; L
  277. #define  RCC_APB1RSTR_CECRST                 ((uint32_t)0x08000000)
    4 Y$ x" [! n0 N) E0 R9 p' c# ?
  278. #endif /* STM32F446xx */
    # {4 ?- R2 J9 d; ?
  279. #define  RCC_APB1RSTR_PWRRST                 ((uint32_t)0x10000000)
    6 G; p- u2 I/ o: O3 Z* P4 @
  280. #define  RCC_APB1RSTR_DACRST                 ((uint32_t)0x20000000)( X9 Y0 {" `" O6 d. }8 ~+ q. h
  281. #define  RCC_APB1RSTR_UART7RST               ((uint32_t)0x40000000)
    + |9 H$ J2 a" m2 I0 V) J' Q, X0 B
  282. #define  RCC_APB1RSTR_UART8RST               ((uint32_t)0x80000000)
    & S* [. e" n3 A
  283. ) ?% C0 |7 c8 a, k
  284. /********************  Bit definition for RCC_APB2RSTR register  **************/
    . V! d3 _0 L) v) d0 `; r
  285. #define  RCC_APB2RSTR_TIM1RST                ((uint32_t)0x00000001)* K; ]; a% O" W1 x5 q4 h. V' y
  286. #define  RCC_APB2RSTR_TIM8RST                ((uint32_t)0x00000002)
    - v. }& y1 a: M1 f* Q
  287. #define  RCC_APB2RSTR_USART1RST              ((uint32_t)0x00000010)( V; k- s3 `  w: h# u3 C+ w2 l
  288. #define  RCC_APB2RSTR_USART6RST              ((uint32_t)0x00000020)8 u* y9 @, V+ O* e; d. l7 g9 \
  289. #define  RCC_APB2RSTR_UART9RST               ((uint32_t)0x00000040)
    - ]9 _3 P& _( I) z$ _# o; K  p
  290. #define  RCC_APB2RSTR_UART10RST              ((uint32_t)0x00000080)
    8 M5 f. P# S" {. c8 e
  291. #define  RCC_APB2RSTR_ADCRST                 ((uint32_t)0x00000100): w. j3 p# ]* T$ [
  292. #define  RCC_APB2RSTR_SDIORST                ((uint32_t)0x00000800)! L9 R3 ]7 I* o, a1 Q
  293. #define  RCC_APB2RSTR_SPI1RST                ((uint32_t)0x00001000)
    * h& |9 |8 T5 A" j, P  k
  294. #define  RCC_APB2RSTR_SPI4RST                ((uint32_t)0x00002000)
    ! m! H% f7 L, U9 y( d
  295. #define  RCC_APB2RSTR_SYSCFGRST              ((uint32_t)0x00004000)! c! ?+ Z8 R. U7 p) y
  296. #define  RCC_APB2RSTR_TIM9RST                ((uint32_t)0x00010000)
    6 `9 y! }/ C3 \  I2 o
  297. #define  RCC_APB2RSTR_TIM10RST               ((uint32_t)0x00020000)
    9 e# a& c- N. }
  298. #define  RCC_APB2RSTR_TIM11RST               ((uint32_t)0x00040000)3 ^+ G1 o' C! y) k6 p
  299. #define  RCC_APB2RSTR_SPI5RST                ((uint32_t)0x00100000)) s. S6 h+ l/ u& f& l" s8 m$ a/ C
  300. #define  RCC_APB2RSTR_SPI6RST                ((uint32_t)0x00200000)0 r# h. e, g6 @6 ]( C9 O6 {" z
  301. #define  RCC_APB2RSTR_SAI1RST                ((uint32_t)0x00400000)* I  d: {  a# l. R5 m1 `0 L6 f
  302. #if defined(STM32F446xx)6 W5 |) b. M+ y" p2 c7 K: {) }/ z, A
  303. #define  RCC_APB2RSTR_SAI2RST                ((uint32_t)0x00800000)5 J5 E2 c4 x# j. y0 D; m
  304. #endif /* STM32F446xx */
    8 @# n# N' Y' E/ j' ?9 X9 ?
  305. #define  RCC_APB2RSTR_LTDCRST                ((uint32_t)0x04000000)8 Y5 H/ I; T3 `; F/ s5 W# q
  306. #if defined(STM32F469_479xx)+ t: P0 Z8 ~" a! L! q
  307. #define  RCC_APB2RSTR_DSIRST                 ((uint32_t)0x08000000)! q# g, X" U. m7 _6 ?1 P9 M+ \
  308. #endif /* STM32F469_479xx */
    & x# j+ S( Q  D( b9 |9 {
  309. #if defined(STM32F412xG) || defined(STM32F413_423xx)
    2 k* l% n. \4 l1 |, O
  310. #define  RCC_APB2RSTR_DFSDM1RST              ((uint32_t)0x01000000)7 D; d0 f8 k: Q4 q5 O: R
  311. #endif /* STM32F412xG || STM32F413_423xx */
    / P' {& ]- R+ \9 Y
  312. 1 M1 Q+ v( M0 r) h  D  j: @3 Y
  313. #if defined(STM32F413_423xx)7 j. Q# I3 D; S) g  H
  314. #define  RCC_APB2RSTR_DFSDM2RST              ((uint32_t)0x02000000)
    8 w7 m/ a5 N( [3 j0 z9 X& f
  315. #endif /* STM32F413_423xx */. C% O9 \$ H. }, Z" Y# O1 o7 c( ~. p
  316. /* Old definitions, maintained for legacy purpose */: I; O, P1 k' g$ Z
  317. #define  RCC_APB2RSTR_SPI1                   RCC_APB2RSTR_SPI1RST$ {8 p1 B' C% g6 u) d
  318. #define  RCC_APB2RSTR_DFSDMRST               RCC_APB2RSTR_DFSDM1RST
    0 Z% c/ \8 U& n' j7 b
  319. 4 \' u* g; o/ k/ {! X
  320. /********************  Bit definition for RCC_AHB1ENR register  ***************/
    $ _  t8 ?- C, Q, G6 y+ j
  321. #define  RCC_AHB1ENR_GPIOAEN                 ((uint32_t)0x00000001)- ?1 q& Z2 }* ?% k* h% L' Q
  322. #define  RCC_AHB1ENR_GPIOBEN                 ((uint32_t)0x00000002)
    $ m) m. L$ C& I1 `0 y
  323. #define  RCC_AHB1ENR_GPIOCEN                 ((uint32_t)0x00000004)4 x. Y1 S9 B* _# Q3 ~
  324. #define  RCC_AHB1ENR_GPIODEN                 ((uint32_t)0x00000008)
    ' M( D9 H9 x" k* A3 [* c
  325. #define  RCC_AHB1ENR_GPIOEEN                 ((uint32_t)0x00000010)  ^( V1 m. b- v  h2 m" o5 O
  326. #define  RCC_AHB1ENR_GPIOFEN                 ((uint32_t)0x00000020)- v9 q: {: _( J
  327. #define  RCC_AHB1ENR_GPIOGEN                 ((uint32_t)0x00000040). A* J1 `  \/ f# e, z$ \' N& T
  328. #define  RCC_AHB1ENR_GPIOHEN                 ((uint32_t)0x00000080), O# C+ P8 A/ F/ ~7 x( X
  329. #define  RCC_AHB1ENR_GPIOIEN                 ((uint32_t)0x00000100)% f2 g' {. X* `& ]7 S- i
  330. #define  RCC_AHB1ENR_GPIOJEN                 ((uint32_t)0x00000200)( m" j- I4 {' p7 Q0 }
  331. #define  RCC_AHB1ENR_GPIOKEN                 ((uint32_t)0x00000400)
    3 e0 C. `& |# r7 I' f
  332. #define  RCC_AHB1ENR_CRCEN                   ((uint32_t)0x00001000), X% ^$ h2 b: ?, @+ z
  333. #define  RCC_AHB1ENR_BKPSRAMEN               ((uint32_t)0x00040000)
    3 p2 p- l* H4 d$ q' Y
  334. #define  RCC_AHB1ENR_CCMDATARAMEN            ((uint32_t)0x00100000)
    1 {7 q8 r8 Z; t) g) S0 \+ `- E
  335. #define  RCC_AHB1ENR_DMA1EN                  ((uint32_t)0x00200000)
    3 O% |2 O! ]. S# M6 B
  336. #define  RCC_AHB1ENR_DMA2EN                  ((uint32_t)0x00400000)
    6 L! \! E! J7 j
  337. #define  RCC_AHB1ENR_DMA2DEN                 ((uint32_t)0x00800000)  |) d8 G! J  [4 Q* L. }
  338. #define  RCC_AHB1ENR_ETHMACEN                ((uint32_t)0x02000000)
    * t) a, m) W% w5 y- |
  339. #define  RCC_AHB1ENR_ETHMACTXEN              ((uint32_t)0x04000000)/ r% k# Z1 L" q1 ~$ ^, P% H
  340. #define  RCC_AHB1ENR_ETHMACRXEN              ((uint32_t)0x08000000)
    ! e  E( m7 S% ?* t" i+ h5 t
  341. #define  RCC_AHB1ENR_ETHMACPTPEN             ((uint32_t)0x10000000)% |, b! y2 G9 P4 v% z
  342. #define  RCC_AHB1ENR_OTGHSEN                 ((uint32_t)0x20000000)
    7 L; Q5 j/ D  s! i
  343. #define  RCC_AHB1ENR_OTGHSULPIEN             ((uint32_t)0x40000000)
    * f2 }- S0 p4 ~: s6 o
  344. 9 H+ S5 I' e8 f. n3 z, G6 J; y
  345. /********************  Bit definition for RCC_AHB2ENR register  ***************/  ^& [& t" |) {6 Z
  346. #define  RCC_AHB2ENR_DCMIEN                  ((uint32_t)0x00000001)' E( K/ m, z: H
  347. #define  RCC_AHB2ENR_CRYPEN                  ((uint32_t)0x00000010)
    0 W& v! M1 v% K, t4 W; o
  348. #define  RCC_AHB2ENR_HASHEN                  ((uint32_t)0x00000020)
    $ o; o+ X) n5 V
  349. #define  RCC_AHB2ENR_RNGEN                   ((uint32_t)0x00000040)8 Z0 k% H4 X! c( R4 v) K5 a
  350. #define  RCC_AHB2ENR_OTGFSEN                 ((uint32_t)0x00000080)* ?* C+ e) \2 ~- ]# w1 r4 E4 Q

  351. 5 M) C2 y: E9 e8 B
  352. /********************  Bit definition for RCC_AHB3ENR register  ***************/
    " N4 m% f9 ?# e1 v! K
  353. % k# A, W% M/ s% v+ c$ y! M$ f
  354. #if defined(STM32F40_41xxx) || defined(STM32F412xG) || defined(STM32F413_423xx); ]- B8 u; K) M4 z8 d  F( O
  355. #define  RCC_AHB3ENR_FSMCEN                  ((uint32_t)0x00000001)8 P! e3 F1 P% g" |. s, L7 @( V
  356. #endif /* STM32F40_41xxx || STM32F412xG || STM32F413_423xx */( B+ W4 z- Q7 ~# p
  357. ( d% `9 P* [; }; U) W
  358. #if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx), c: A% {( V) H, q  M' E/ }
  359. #define  RCC_AHB3ENR_FMCEN                  ((uint32_t)0x00000001)2 ^, G( A; J% {9 L# u
  360. #endif /* STM32F427_437xx ||  STM32F429_439xx || STM32F446xx || STM32F469_479xx */
    3 h- V: e! m" U; j% [

  361. 0 m5 O0 n0 v& f
  362. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx)
    * K; d! v! w' ^( ^# ?& |# l: U
  363. #define  RCC_AHB3ENR_QSPIEN                 ((uint32_t)0x00000002)9 E5 h/ _2 h8 [; h
  364. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */
    4 J8 U! L+ y6 D' a7 G0 d
  365. 9 \( Z6 ^  x- {% |, r" r' F& v( \
  366. /********************  Bit definition for RCC_APB1ENR register  ***************/
    ( C: t2 ]) O2 }4 W) J
  367. #define  RCC_APB1ENR_TIM2EN                  ((uint32_t)0x00000001)
    ) _. D8 H. j1 ~- A7 G. M
  368. #define  RCC_APB1ENR_TIM3EN                  ((uint32_t)0x00000002)
    9 ^* t  Q' b; W% X
  369. #define  RCC_APB1ENR_TIM4EN                  ((uint32_t)0x00000004)
    $ T* D  {' B/ k! T9 e; _; u
  370. #define  RCC_APB1ENR_TIM5EN                  ((uint32_t)0x00000008)
    * q  W. p; d1 l+ ?7 L7 Y$ z
  371. #define  RCC_APB1ENR_TIM6EN                  ((uint32_t)0x00000010)
    * l+ ~! _3 \, k9 f2 J5 R* g4 C; }9 Q
  372. #define  RCC_APB1ENR_TIM7EN                  ((uint32_t)0x00000020)/ j9 i) H9 ?) \- ^+ _4 g
  373. #define  RCC_APB1ENR_TIM12EN                 ((uint32_t)0x00000040)
    ( _5 z+ }( A, O: d3 I
  374. #define  RCC_APB1ENR_TIM13EN                 ((uint32_t)0x00000080)
    ! `: [9 {6 Z( Y; h3 o% j
  375. #define  RCC_APB1ENR_TIM14EN                 ((uint32_t)0x00000100)0 u, a) E( a: w1 C
  376. #if defined(STM32F410xx) || defined(STM32F413_423xx)
    " {2 r1 \! Y/ p
  377. #define  RCC_APB1ENR_LPTIM1EN                ((uint32_t)0x00000200)
    ( t, y  h4 |' K/ d1 G, Y
  378. #endif /* STM32F410xx || STM32F413_423xx */
    2 w# @0 p2 k  I( J6 ^
  379. #define  RCC_APB1ENR_WWDGEN                  ((uint32_t)0x00000800)
    - E7 H* }+ b4 O0 m  W
  380. #define  RCC_APB1ENR_SPI2EN                  ((uint32_t)0x00004000)
    ; _. K5 p$ o' K9 f! ]# Z* g
  381. #define  RCC_APB1ENR_SPI3EN                  ((uint32_t)0x00008000)
    - O  B# v! l' m4 j2 J# A1 j7 b2 h' D
  382. #if defined(STM32F446xx)' [  t; O- Z' V# o8 d) {
  383. #define  RCC_APB1ENR_SPDIFRXEN               ((uint32_t)0x00010000)) L5 Z9 k; }/ U) W! r& ^3 r5 F
  384. #endif /* STM32F446xx */
    5 T2 E' @  m, _+ w5 @1 A
  385. #define  RCC_APB1ENR_USART2EN                ((uint32_t)0x00020000)5 ^% M% [0 \& A( V5 H& A) i
  386. #define  RCC_APB1ENR_USART3EN                ((uint32_t)0x00040000)
    # w/ `. ]. L5 @# `# F1 n
  387. #define  RCC_APB1ENR_UART4EN                 ((uint32_t)0x00080000)
    7 c: a5 D* R& C9 `* p: H
  388. #define  RCC_APB1ENR_UART5EN                 ((uint32_t)0x00100000)
    3 `9 m! S) C4 f$ E. s+ q0 [# k* p% S
  389. #define  RCC_APB1ENR_I2C1EN                  ((uint32_t)0x00200000)  `! \" r" \9 ^* V
  390. #define  RCC_APB1ENR_I2C2EN                  ((uint32_t)0x00400000)* l# J$ l8 x6 [  x0 K  d
  391. #define  RCC_APB1ENR_I2C3EN                  ((uint32_t)0x00800000); i$ q3 R8 X/ T$ }
  392. #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx)) t- L+ E9 L- q! F/ R5 A/ N6 L* L9 i) u
  393. #define  RCC_APB1ENR_FMPI2C1EN               ((uint32_t)0x01000000). z+ R6 }; @# l
  394. #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx || STM32F446xx */: R9 L* u/ p+ p- k5 \6 f; O0 D# h
  395. #define  RCC_APB1ENR_CAN1EN                  ((uint32_t)0x02000000)
    : ~( e* S% v$ \
  396. #define  RCC_APB1ENR_CAN2EN                  ((uint32_t)0x04000000)+ Z8 |& \2 ?, Q1 t6 x7 f4 F9 C/ m5 {; m
  397. #if defined(STM32F446xx)2 z& E5 X% J  y$ `4 g  }5 ~
  398. #define  RCC_APB1ENR_CECEN                   ((uint32_t)0x08000000)
    ( ~# @) \. y9 D6 Y1 _7 j* U
  399. #endif /* STM32F446xx */
    5 R2 n' U( ~$ n! v% ]' A
  400. #define  RCC_APB1ENR_PWREN                   ((uint32_t)0x10000000)% Y" A1 r: s0 M# @. Z7 z6 b+ e0 {( V
  401. #define  RCC_APB1ENR_DACEN                   ((uint32_t)0x20000000)& O" `" P  r- d' n
  402. #define  RCC_APB1ENR_UART7EN                 ((uint32_t)0x40000000)
    ! r9 n/ z/ \4 H: V9 s
  403. #define  RCC_APB1ENR_UART8EN                 ((uint32_t)0x80000000)" }8 ^' v" S( n( P8 \6 j1 f
  404. ( Z# d. f8 l/ v6 L2 V* ]  V; N
  405. /********************  Bit definition for RCC_APB2ENR register  ***************/- t* @* F& s2 Z- n( e3 L7 q
  406. #define  RCC_APB2ENR_TIM1EN                  ((uint32_t)0x00000001)3 H5 Z% C$ d) W  [. a% p" e
  407. #define  RCC_APB2ENR_TIM8EN                  ((uint32_t)0x00000002)
    / l& c: F! k: a3 u% L* x# o
  408. #define  RCC_APB2ENR_USART1EN                ((uint32_t)0x00000010)* N; Q% B+ p" v9 l8 K
  409. #define  RCC_APB2ENR_USART6EN                ((uint32_t)0x00000020)2 ]2 [$ o/ t- i
  410. #define  RCC_APB2ENR_UART9EN                 ((uint32_t)0x00000040)
      D) h7 f' e) h: }" M$ V$ o
  411. #define  RCC_APB2ENR_UART10EN                ((uint32_t)0x00000080)
    # i0 x; J9 R) v2 G6 R
  412. #define  RCC_APB2ENR_ADC1EN                  ((uint32_t)0x00000100)
    4 I' Z9 s, D8 ^9 Y' [- `5 i
  413. #define  RCC_APB2ENR_ADC2EN                  ((uint32_t)0x00000200)/ y' l3 e% P' J; x1 B$ ~
  414. #define  RCC_APB2ENR_ADC3EN                  ((uint32_t)0x00000400)
    ; x9 m9 H% R/ s/ y+ b8 A( I
  415. #define  RCC_APB2ENR_SDIOEN                  ((uint32_t)0x00000800)
    ; R- b! k. H+ r: ~
  416. #define  RCC_APB2ENR_SPI1EN                  ((uint32_t)0x00001000)
    : v& T. d' I- o3 ~" g" v
  417. #define  RCC_APB2ENR_SPI4EN                  ((uint32_t)0x00002000)
    % I$ s& G: I7 ^7 {
  418. #define  RCC_APB2ENR_SYSCFGEN                ((uint32_t)0x00004000)( I5 C. H$ I' F: w' j% O, S, f
  419. #define  RCC_APB2ENR_EXTIEN                  ((uint32_t)0x00008000)
    ! L+ b& G- p; A( ^2 A: c* b
  420. #define  RCC_APB2ENR_TIM9EN                  ((uint32_t)0x00010000)4 Y* }* s" h3 L
  421. #define  RCC_APB2ENR_TIM10EN                 ((uint32_t)0x00020000)
    , I" u* r+ g: N, |9 f" {9 B
  422. #define  RCC_APB2ENR_TIM11EN                 ((uint32_t)0x00040000)
    2 Y8 i8 t) H+ ^9 X
  423. #define  RCC_APB2ENR_SPI5EN                  ((uint32_t)0x00100000)2 x9 k1 W; N5 M% Y
  424. #define  RCC_APB2ENR_SPI6EN                  ((uint32_t)0x00200000)
    ( T+ F; K% z8 w1 {
  425. #define  RCC_APB2ENR_SAI1EN                  ((uint32_t)0x00400000)
    % f( t0 c' P! |5 `( d
  426. #if defined(STM32F446xx)
    * f% O! P9 ^7 [5 E/ ?: Y' D
  427. #define  RCC_APB2ENR_SAI2EN                  ((uint32_t)0x00800000)' I' }- {7 ^* l& i# k
  428. #endif /* STM32F446xx */! n% m8 u" ?% R1 N  b, M; J
  429. #define  RCC_APB2ENR_LTDCEN                  ((uint32_t)0x04000000)
    4 p5 O# Z9 D  O2 \  P: J3 e- q
  430. #if defined(STM32F469_479xx)
    % j( s# B9 O# W9 i3 c
  431. #define  RCC_APB2ENR_DSIEN                   ((uint32_t)0x08000000)+ S4 Z/ o$ S5 I7 t& f
  432. #endif /* STM32F469_479xx */
    3 ^) b# J. I7 [2 `( f5 z
  433. #if defined(STM32F412xG) || defined(STM32F413_423xx)- S  P4 N+ ]% t* W: Z5 K# I
  434. #define  RCC_APB2ENR_DFSDM1EN                ((uint32_t)0x01000000)
    4 a1 W$ h- P2 d9 k9 @
  435. #endif /* STM32F412xG || STM32F413_423xx */
    2 Z& R2 k8 T( A  {& m
  436. #if defined(STM32F413_423xx)
      o$ g6 I" `' k3 X9 h/ m7 v
  437. #define  RCC_APB2ENR_DFSDM2EN                ((uint32_t)0x02000000). _& B+ P, ]( g! y5 h3 C1 a: B" J
  438. #endif /* STM32F413_423xx */
    8 _6 J' s5 z% O( e/ u+ A
  439. /********************  Bit definition for RCC_AHB1LPENR register  *************/. J/ n1 h' w- V5 O# O0 x0 A
  440. #define  RCC_AHB1LPENR_GPIOALPEN             ((uint32_t)0x00000001)
    . s+ v& `+ o# T( p% {. A) {1 Z  @3 @8 N
  441. #define  RCC_AHB1LPENR_GPIOBLPEN             ((uint32_t)0x00000002)  }9 M7 y+ {) k& W3 }
  442. #define  RCC_AHB1LPENR_GPIOCLPEN             ((uint32_t)0x00000004)
    7 g5 @3 Y+ F+ }; i# a* H
  443. #define  RCC_AHB1LPENR_GPIODLPEN             ((uint32_t)0x00000008)8 G( M4 o: Q1 U6 f+ e6 A
  444. #define  RCC_AHB1LPENR_GPIOELPEN             ((uint32_t)0x00000010)* D/ e$ \/ p7 `# y) ^5 B
  445. #define  RCC_AHB1LPENR_GPIOFLPEN             ((uint32_t)0x00000020)
    9 j) }, _% {* I3 S- r' E
  446. #define  RCC_AHB1LPENR_GPIOGLPEN             ((uint32_t)0x00000040), }& X$ ^: `4 p; K2 t! o- x
  447. #define  RCC_AHB1LPENR_GPIOHLPEN             ((uint32_t)0x00000080)
    ; b: t" D2 W+ l- n
  448. #define  RCC_AHB1LPENR_GPIOILPEN             ((uint32_t)0x00000100)& g( v" h# H! T
  449. #define  RCC_AHB1LPENR_GPIOJLPEN             ((uint32_t)0x00000200)
    ) Q% c' B" @1 N6 k# P+ f, q! H" C
  450. #define  RCC_AHB1LPENR_GPIOKLPEN             ((uint32_t)0x00000400)
    9 p/ J' ?5 d1 G0 U4 X4 U
  451. #define  RCC_AHB1LPENR_CRCLPEN               ((uint32_t)0x00001000)4 }1 c$ v/ M8 ^& `; P' C- }
  452. #define  RCC_AHB1LPENR_FLITFLPEN             ((uint32_t)0x00008000)
    3 D) Z8 {1 s7 Q4 k
  453. #define  RCC_AHB1LPENR_SRAM1LPEN             ((uint32_t)0x00010000), C: [# n4 K! ]4 o1 u0 n$ o3 U6 x' @
  454. #define  RCC_AHB1LPENR_SRAM2LPEN             ((uint32_t)0x00020000)
    2 ^# w( l" }8 H" l7 H% k6 S8 q
  455. #define  RCC_AHB1LPENR_BKPSRAMLPEN           ((uint32_t)0x00040000)4 E: L) C  o  N! e( o3 Z
  456. #define  RCC_AHB1LPENR_SRAM3LPEN             ((uint32_t)0x00080000)' ?6 U2 c: v/ _- X+ r( O. r9 L, Y
  457. #define  RCC_AHB1LPENR_DMA1LPEN              ((uint32_t)0x00200000)
    3 z  @" x. w; k
  458. #define  RCC_AHB1LPENR_DMA2LPEN              ((uint32_t)0x00400000)  V1 j: g5 k6 U  |* C, y! f5 a3 F
  459. #define  RCC_AHB1LPENR_DMA2DLPEN             ((uint32_t)0x00800000)2 {$ y. W# A* ]- a3 X# E
  460. #define  RCC_AHB1LPENR_ETHMACLPEN            ((uint32_t)0x02000000)
    . ^$ e& Z5 I8 _: ~2 d8 _+ K
  461. #define  RCC_AHB1LPENR_ETHMACTXLPEN          ((uint32_t)0x04000000)
    ( V5 |( H! B. b) _% S7 ~
  462. #define  RCC_AHB1LPENR_ETHMACRXLPEN          ((uint32_t)0x08000000)2 k! K" q# v$ g5 F) X
  463. #define  RCC_AHB1LPENR_ETHMACPTPLPEN         ((uint32_t)0x10000000)
    & i! [' v  K! R  O+ ^
  464. #define  RCC_AHB1LPENR_OTGHSLPEN             ((uint32_t)0x20000000)  u* `& _6 L: z. P1 p8 Z( W
  465. #define  RCC_AHB1LPENR_OTGHSULPILPEN         ((uint32_t)0x40000000)
    5 s( S. I; d3 J/ ?- a/ p0 e7 Q$ Z
  466. & ~. K2 n: E# d
  467. /********************  Bit definition for RCC_AHB2LPENR register  *************/
      l9 r& m" z' K9 f% ^
  468. #define  RCC_AHB2LPENR_DCMILPEN              ((uint32_t)0x00000001)
    / ], X* {# w0 w2 s
  469. #define  RCC_AHB2LPENR_CRYPLPEN              ((uint32_t)0x00000010)
    + S- |6 S1 M# L! \! h/ G- u0 E
  470. #define  RCC_AHB2LPENR_HASHLPEN              ((uint32_t)0x00000020)
      ^$ r5 x2 V# ^% B3 K  r9 ~4 y
  471. #define  RCC_AHB2LPENR_RNGLPEN               ((uint32_t)0x00000040)
    # h3 ]2 r5 Y' h
  472. #define  RCC_AHB2LPENR_OTGFSLPEN             ((uint32_t)0x00000080)
      c$ n( h4 B- R" E) o. e
  473. . S/ w9 T8 |4 o  r! h
  474. /********************  Bit definition for RCC_AHB3LPENR register  *************/: ?( ^9 w6 X# G
  475. #if defined(STM32F40_41xxx) || defined(STM32F412xG) || defined(STM32F413_423xx)) i5 M* h+ G9 V. c. T
  476. #define  RCC_AHB3LPENR_FSMCLPEN              ((uint32_t)0x00000001); x# \2 v! `1 K" u6 _
  477. #endif /* STM32F40_41xxx || STM32F412xG || STM32F413_423xx */8 f4 |+ X- {1 g5 y% d; b3 |: z, _

  478.   i! ?, h) g- T8 Y5 Z- P+ |
  479. #if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx)& F: Y  A2 J3 p! o2 u3 H) g
  480. #define  RCC_AHB3LPENR_FMCLPEN              ((uint32_t)0x00000001)
    1 i; x, f& w- ~% f% F& d
  481. #endif /* STM32F427_437xx ||  STM32F429_439xx  || STM32F446xx || STM32F469_479xx */
    4 l" Z) B4 {7 {
  482. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx)5 A+ T2 ^9 ^" C& k
  483. #define  RCC_AHB3LPENR_QSPILPEN             ((uint32_t)0x00000002), B8 Q) b& S3 x  _
  484. #endif /* STM32F412xG || STM32F413_423xx || STM32F469_479xx || STM32F446xx */
    0 B: ]! H& H. s. ^' R

  485. ( F/ [/ x$ Q' R! D
  486. /********************  Bit definition for RCC_APB1LPENR register  *************/& Z" s# k$ |8 U0 W6 [5 D
  487. #define  RCC_APB1LPENR_TIM2LPEN              ((uint32_t)0x00000001)
    * v+ E6 J. H5 S1 \
  488. #define  RCC_APB1LPENR_TIM3LPEN              ((uint32_t)0x00000002)
    / z4 K5 v" n$ I1 ?
  489. #define  RCC_APB1LPENR_TIM4LPEN              ((uint32_t)0x00000004)
    . B& L  I4 u& V, w% F# f
  490. #define  RCC_APB1LPENR_TIM5LPEN              ((uint32_t)0x00000008)
    9 e  e0 D# g8 V3 `
  491. #define  RCC_APB1LPENR_TIM6LPEN              ((uint32_t)0x00000010)
    ) m( q) T8 U4 b6 s7 S, z! @* ~
  492. #define  RCC_APB1LPENR_TIM7LPEN              ((uint32_t)0x00000020)3 `1 S9 y+ k, b" y4 o% \& ?6 q5 o/ q
  493. #define  RCC_APB1LPENR_TIM12LPEN             ((uint32_t)0x00000040)
    0 G4 o( y+ D% w) \
  494. #define  RCC_APB1LPENR_TIM13LPEN             ((uint32_t)0x00000080)
    2 @+ `1 z  x7 t7 H2 X2 T
  495. #define  RCC_APB1LPENR_TIM14LPEN             ((uint32_t)0x00000100)
    2 J( x1 \1 O; Q3 N# H/ N
  496. #if defined(STM32F410xx) || defined(STM32F413_423xx)' j8 a- }+ g$ U: e: p$ ?8 S
  497. #define  RCC_APB1LPENR_LPTIM1LPEN            ((uint32_t)0x00000200)0 G% J' F4 l6 V, S. t" t
  498. #endif /* STM32F410xx || STM32F413_423xx */
    : d' a7 w5 l. u
  499. #define  RCC_APB1LPENR_WWDGLPEN              ((uint32_t)0x00000800), [2 x: X9 t( J: Y6 E  w
  500. #define  RCC_APB1LPENR_SPI2LPEN              ((uint32_t)0x00004000)
    $ W! J" O- h. }6 o/ v4 @
  501. #define  RCC_APB1LPENR_SPI3LPEN              ((uint32_t)0x00008000)2 ]! C& ]2 s0 j# m. u! h" g
  502. #if defined(STM32F446xx)
      i( n- Q" \* c  U% B- E: \
  503. #define  RCC_APB1LPENR_SPDIFRXLPEN           ((uint32_t)0x00010000). A$ h( u3 l/ v5 I0 J  L$ D, d, [/ E
  504. #endif /* STM32F446xx */
      M) ~7 x% B7 J1 p/ e
  505. #define  RCC_APB1LPENR_USART2LPEN            ((uint32_t)0x00020000)
    - E5 a: B: _( i% d5 ]' B
  506. #define  RCC_APB1LPENR_USART3LPEN            ((uint32_t)0x00040000)
    * C- |' D# m9 _$ x: s+ |2 o
  507. #define  RCC_APB1LPENR_UART4LPEN             ((uint32_t)0x00080000)0 n6 P" q4 W4 Z( ^
  508. #define  RCC_APB1LPENR_UART5LPEN             ((uint32_t)0x00100000). U$ k* B3 [2 R8 _$ F5 K
  509. #define  RCC_APB1LPENR_I2C1LPEN              ((uint32_t)0x00200000)
    - |  U: |" N1 D' a4 g: H
  510. #define  RCC_APB1LPENR_I2C2LPEN              ((uint32_t)0x00400000)
    3 Y% S! e, S& ^
  511. #define  RCC_APB1LPENR_I2C3LPEN              ((uint32_t)0x00800000)
    ! _" g) B9 z$ g
  512. #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx)/ ]1 t3 z- V" j6 v
  513. #define  RCC_APB1LPENR_FMPI2C1LPEN           ((uint32_t)0x01000000)
    9 d0 Y' o  N; F; E5 ]
  514. #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx || STM32F446xx */
    & r- U+ {/ A) H) W9 F# ], i
  515. #define  RCC_APB1LPENR_CAN1LPEN              ((uint32_t)0x02000000)" f/ Y; ~0 q! S2 q
  516. #define  RCC_APB1LPENR_CAN2LPEN              ((uint32_t)0x04000000)+ o6 Q% S. c* P7 A: }
  517. #if defined(STM32F446xx)& \; L$ _/ N5 {  A
  518. #define  RCC_APB1LPENR_CECLPEN               ((uint32_t)0x08000000)
    2 }; ^8 h* C" @( M" }  K( k8 B: c3 W
  519. #endif /* STM32F446xx */. w( @* W# t" n7 U* B
  520. #define  RCC_APB1LPENR_PWRLPEN               ((uint32_t)0x10000000)
    ! }6 O5 z5 `+ n1 S
  521. #define  RCC_APB1LPENR_DACLPEN               ((uint32_t)0x20000000)' C$ @+ A0 _" c$ f
  522. #define  RCC_APB1LPENR_UART7LPEN             ((uint32_t)0x40000000)
    : _. n! v' d0 A" t! k9 A% N# E
  523. #define  RCC_APB1LPENR_UART8LPEN             ((uint32_t)0x80000000)
    $ o" k; s5 e- z9 I$ g$ t- H. @
  524. : F6 k+ v8 M# i& y- z
  525. /********************  Bit definition for RCC_APB2LPENR register  *************/
    9 {# w5 h) f4 I* s: S! q1 }
  526. #define  RCC_APB2LPENR_TIM1LPEN              ((uint32_t)0x00000001)
    0 i: N# K: W( h! _% L
  527. #define  RCC_APB2LPENR_TIM8LPEN              ((uint32_t)0x00000002)
    4 c5 v8 V: V% e( W
  528. #define  RCC_APB2LPENR_USART1LPEN            ((uint32_t)0x00000010)
    2 W4 \! S- z8 h# }5 w$ y
  529. #define  RCC_APB2LPENR_USART6LPEN            ((uint32_t)0x00000020)8 o( A7 O) W- Y2 x7 r/ r% m0 p8 \
  530. #define  RCC_APB2LPENR_UART9LPEN             ((uint32_t)0x00000040)
    ; @; l: g6 R8 Q
  531. #define  RCC_APB2LPENR_UART10LPEN            ((uint32_t)0x00000080)
    $ }9 N; _) \! g6 X3 h6 A0 z( M
  532. #define  RCC_APB2LPENR_ADC1LPEN              ((uint32_t)0x00000100)' N3 X9 N8 B( ^
  533. #define  RCC_APB2LPENR_ADC2PEN               ((uint32_t)0x00000200)
    7 r/ e/ Q0 v: e4 b
  534. #define  RCC_APB2LPENR_ADC3LPEN              ((uint32_t)0x00000400)
    ) L+ @3 w' o  n
  535. #define  RCC_APB2LPENR_SDIOLPEN              ((uint32_t)0x00000800)
    3 d( j; u! h3 H% ~6 _# V3 c
  536. #define  RCC_APB2LPENR_SPI1LPEN              ((uint32_t)0x00001000)$ u* b& a7 L6 |1 A  W1 W
  537. #define  RCC_APB2LPENR_SPI4LPEN              ((uint32_t)0x00002000)
    9 U% D; w4 q2 g  }4 b
  538. #define  RCC_APB2LPENR_SYSCFGLPEN            ((uint32_t)0x00004000)
    , h% M8 R# D, ?. V9 m( Y$ _; i
  539. #define  RCC_APB2LPENR_TIM9LPEN              ((uint32_t)0x00010000)% d  W! N; `( H' l3 p
  540. #define  RCC_APB2LPENR_TIM10LPEN             ((uint32_t)0x00020000)
    - f" I* w/ i- i+ h) V) L! N
  541. #define  RCC_APB2LPENR_TIM11LPEN             ((uint32_t)0x00040000)% T8 j: N1 G' o( L! O( P0 J& K
  542. #define  RCC_APB2LPENR_SPI5LPEN              ((uint32_t)0x00100000)6 M' r, O" h8 Z" Z6 a
  543. #define  RCC_APB2LPENR_SPI6LPEN              ((uint32_t)0x00200000)
    5 G  m; B+ V, g, m- J3 F% a7 ~
  544. #define  RCC_APB2LPENR_SAI1LPEN              ((uint32_t)0x00400000)8 d% `8 X: S8 N% z, q" ~4 _- d
  545. #if defined(STM32F446xx)2 V6 k+ O( F* o9 X
  546. #define  RCC_APB2LPENR_SAI2LPEN              ((uint32_t)0x00800000)
    4 M( N& t* b3 t# n
  547. #endif /* STM32F446xx */. y; L: s1 i8 U3 i# n
  548. #define  RCC_APB2LPENR_LTDCLPEN              ((uint32_t)0x04000000)0 o" D1 n6 ~8 N( C$ l
  549. #if defined(STM32F469_479xx)' S7 U! s" q: a  E/ V. }
  550. #define  RCC_APB2LPENR_DSILPEN               ((uint32_t)0x08000000)
    9 ~9 P% \1 T$ N5 g1 d$ y- a) d
  551. #endif /* STM32F469_479xx */. N( Z' I4 m' G) D+ X
  552. #if defined(STM32F412xG) || defined(STM32F413_423xx)
    2 o4 b5 b, f7 j& M9 T$ g
  553. #define  RCC_APB2LPENR_DFSDM1LPEN            ((uint32_t)0x01000000)
      h3 ~+ P/ ?7 \. {% D+ A
  554. #endif /* STM32F412xG || STM32F413_423xx */8 C* [' S+ b% G1 \% n
  555. #if defined(STM32F413_423xx)
    ) F% \& Y: U; V
  556. #define  RCC_APB2LPENR_DFSDM2LPEN            ((uint32_t)0x02000000)/ C# i1 `7 G& j" U5 \
  557. #endif /* STM32F413_423xx */
    1 M& B$ V" V; n

  558. 1 x4 g4 l7 Z$ f" G( o* y
  559. /********************  Bit definition for RCC_BDCR register  ******************/! m" f; n9 ^4 I- y1 Q
  560. #define  RCC_BDCR_LSEON                      ((uint32_t)0x00000001)& L  q: [$ U0 ?* w* \
  561. #define  RCC_BDCR_LSERDY                     ((uint32_t)0x00000002)9 ?# ^  _' R2 K
  562. #define  RCC_BDCR_LSEBYP                     ((uint32_t)0x00000004)# j- @. f5 j+ T1 u* \; x# j
  563. #define  RCC_BDCR_LSEMOD                     ((uint32_t)0x00000008)
    ' @  b! y+ t' v8 {# c

  564. - i  O) @' _* x
  565. #define  RCC_BDCR_RTCSEL                    ((uint32_t)0x00000300)
    : A! N' F4 e5 a* `0 ?- M5 g- S! u
  566. #define  RCC_BDCR_RTCSEL_0                  ((uint32_t)0x00000100)
    / R* \7 o7 B$ n- o
  567. #define  RCC_BDCR_RTCSEL_1                  ((uint32_t)0x00000200)- l5 ]; d- z( z* N
  568. & Y; s7 [  X# u5 [
  569. #define  RCC_BDCR_RTCEN                      ((uint32_t)0x00008000)! r- x! T8 `1 z# N' T/ Q
  570. #define  RCC_BDCR_BDRST                      ((uint32_t)0x00010000)
    3 }, d. x" Y& V9 x" I
  571. , _( W  b( y! `6 X3 ?
  572. /********************  Bit definition for RCC_CSR register  *******************/
    $ P1 d  T3 q# q& O
  573. #define  RCC_CSR_LSION                       ((uint32_t)0x00000001). |" s7 O0 j, l" \7 V  b6 f! [$ _! w8 C1 D
  574. #define  RCC_CSR_LSIRDY                      ((uint32_t)0x00000002)
    # c9 L) s# S" ?. K$ T
  575. #define  RCC_CSR_RMVF                        ((uint32_t)0x01000000)
    ( @2 X0 [: U8 @8 I
  576. #define  RCC_CSR_BORRSTF                     ((uint32_t)0x02000000)
    - t  B8 R, t( M' A: x
  577. #define  RCC_CSR_PADRSTF                     ((uint32_t)0x04000000)3 r9 O8 t$ \7 R% I8 E  ~
  578. #define  RCC_CSR_PORRSTF                     ((uint32_t)0x08000000)
    9 D# t, o+ p# o3 f, L* ^$ Y
  579. #define  RCC_CSR_SFTRSTF                     ((uint32_t)0x10000000)4 m$ A+ t/ _+ {
  580. #define  RCC_CSR_WDGRSTF                     ((uint32_t)0x20000000)* W( ]) W) L. L% P, \  J  W
  581. #define  RCC_CSR_WWDGRSTF                    ((uint32_t)0x40000000); R6 k7 H8 h: P, c" f
  582. #define  RCC_CSR_LPWRRSTF                    ((uint32_t)0x80000000)
    3 Y5 n) \- }* I/ E5 \+ g6 p$ e
  583. : F; V% x% X, z, l0 k. d2 B
  584. /********************  Bit definition for RCC_SSCGR register  *****************/
    ' Y5 A, q/ ~: t$ I* g8 t% X& f
  585. #define  RCC_SSCGR_MODPER                    ((uint32_t)0x00001FFF)' n$ L' P" W9 E) k0 u
  586. #define  RCC_SSCGR_INCSTEP                   ((uint32_t)0x0FFFE000)
    # d: D3 ?; T+ o# Y4 }" F& ~
  587. #define  RCC_SSCGR_SPREADSEL                 ((uint32_t)0x40000000)" y  s" U1 C8 B: }
  588. #define  RCC_SSCGR_SSCGEN                    ((uint32_t)0x80000000)
    + [* |, E+ f7 F3 ^( M+ a, U
  589. 9 J9 m' B7 x# R: c7 ~& {4 L
  590. /********************  Bit definition for RCC_PLLI2SCFGR register  ************/- |$ g1 T" {- \1 @" y3 A3 j% B
  591. #define  RCC_PLLI2SCFGR_PLLI2SM              ((uint32_t)0x0000003F): p9 P; p% s8 b6 N+ R0 Y5 \3 D6 w/ _
  592. #define  RCC_PLLI2SCFGR_PLLI2SM_0            ((uint32_t)0x00000001)0 ~* w, P* M( Y% G+ V. c+ A
  593. #define  RCC_PLLI2SCFGR_PLLI2SM_1            ((uint32_t)0x00000002)
    % h$ t  A4 `4 G
  594. #define  RCC_PLLI2SCFGR_PLLI2SM_2            ((uint32_t)0x00000004)/ ^0 G1 @% w, y' g( u! l
  595. #define  RCC_PLLI2SCFGR_PLLI2SM_3            ((uint32_t)0x00000008), A. d3 o  w7 p6 ~. D
  596. #define  RCC_PLLI2SCFGR_PLLI2SM_4            ((uint32_t)0x00000010)
    3 V, H, Q! B8 M1 u
  597. #define  RCC_PLLI2SCFGR_PLLI2SM_5            ((uint32_t)0x00000020)
    2 ], i0 ?; \3 j7 \

  598. ) B7 b; U: N" ^$ q9 Z* E
  599. #define  RCC_PLLI2SCFGR_PLLI2SN              ((uint32_t)0x00007FC0)
    - K0 _( @" `) m, ]1 m
  600. #define  RCC_PLLI2SCFGR_PLLI2SN_0            ((uint32_t)0x00000040)
    ! I+ C+ @3 S. P, [; R8 _2 m
  601. #define  RCC_PLLI2SCFGR_PLLI2SN_1            ((uint32_t)0x00000080)6 G' N1 f8 E9 U& t  S
  602. #define  RCC_PLLI2SCFGR_PLLI2SN_2            ((uint32_t)0x00000100)
    ! j0 ^1 I  }+ @9 R5 t
  603. #define  RCC_PLLI2SCFGR_PLLI2SN_3            ((uint32_t)0x00000200)" x: i- w9 h: A% q- o& F3 w
  604. #define  RCC_PLLI2SCFGR_PLLI2SN_4            ((uint32_t)0x00000400). Z+ x* }7 T8 c# S
  605. #define  RCC_PLLI2SCFGR_PLLI2SN_5            ((uint32_t)0x00000800)
    - C  z/ y; \8 s
  606. #define  RCC_PLLI2SCFGR_PLLI2SN_6            ((uint32_t)0x00001000)5 ^8 e( ?' E# `# r$ j4 \
  607. #define  RCC_PLLI2SCFGR_PLLI2SN_7            ((uint32_t)0x00002000)
    0 v5 k7 T+ A* M. R* n5 P: o
  608. #define  RCC_PLLI2SCFGR_PLLI2SN_8            ((uint32_t)0x00004000); x4 W+ O; n3 \# P; |' J

  609. ) [% n6 K/ d# u7 {2 r" a
  610. #if defined(STM32F412xG) || defined(STM32F413_423xx)) T- P2 [$ K# R$ F+ C& s$ x
  611. #define  RCC_PLLI2SCFGR_PLLI2SSRC            ((uint32_t)0x00400000), L# `: Q) b+ J4 [% Z
  612. #endif /* STM32F412xG || STM32F413_423xx */
    ! S7 R% I- w) Y5 ?0 U, @0 X
  613. 2 M+ W- M7 g/ S
  614. #if defined(STM32F446xx)
    ' Z# u2 T% G. w* I! n) n
  615. #define  RCC_PLLI2SCFGR_PLLI2SP              ((uint32_t)0x00030000)
    5 v& A8 ^  D9 K8 c9 o# R
  616. #define  RCC_PLLI2SCFGR_PLLI2SP_0            ((uint32_t)0x00010000)2 c  Q8 _7 `1 Q0 D1 C  @
  617. #define  RCC_PLLI2SCFGR_PLLI2SP_1            ((uint32_t)0x00020000)
    & n* k" x2 ?* P# |! {  `
  618. #endif /* STM32F446xx */
    % [2 y5 f9 n: G# W1 V4 v/ d

  619. , x5 f& `4 `' M9 D) U" |: K
  620. #define  RCC_PLLI2SCFGR_PLLI2SQ              ((uint32_t)0x0F000000)
    . w' E8 k$ J3 [! Z2 @1 B& j% S* L/ V
  621. #define  RCC_PLLI2SCFGR_PLLI2SQ_0            ((uint32_t)0x01000000)0 ]3 e& q( b7 B& C' ^
  622. #define  RCC_PLLI2SCFGR_PLLI2SQ_1            ((uint32_t)0x02000000)  l9 X2 y! `$ K, U$ e, q
  623. #define  RCC_PLLI2SCFGR_PLLI2SQ_2            ((uint32_t)0x04000000)
    & y* j" R8 z6 N- G7 u
  624. #define  RCC_PLLI2SCFGR_PLLI2SQ_3            ((uint32_t)0x08000000)* }" z3 |) `1 A' v0 S+ [3 i
  625. " O  C$ L4 _; Z0 X- M8 ~; |
  626. #define  RCC_PLLI2SCFGR_PLLI2SR              ((uint32_t)0x70000000)
    8 q& `. t. q/ k) K# y
  627. #define  RCC_PLLI2SCFGR_PLLI2SR_0            ((uint32_t)0x10000000)
    & N8 w& c# E) |. ^5 v1 v
  628. #define  RCC_PLLI2SCFGR_PLLI2SR_1            ((uint32_t)0x20000000)" {  E: E/ S6 x& q
  629. #define  RCC_PLLI2SCFGR_PLLI2SR_2            ((uint32_t)0x40000000)2 p0 S+ c* p# ~" ^

  630. / k! ?4 u' \5 L- s
  631. /********************  Bit definition for RCC_PLLSAICFGR register  ************/6 b9 X! g: m4 d+ J
  632. #if defined(STM32F446xx)+ ^7 {/ Y* M5 O8 }5 k. n9 Z/ Y; S
  633. #define  RCC_PLLSAICFGR_PLLSAIM              ((uint32_t)0x0000003F)
    / H$ i) n- S$ f6 \' w$ p3 i% R
  634. #define  RCC_PLLSAICFGR_PLLSAIM_0            ((uint32_t)0x00000001)" _. d8 e" s! j' X' j
  635. #define  RCC_PLLSAICFGR_PLLSAIM_1            ((uint32_t)0x00000002)
    - m0 z5 g, f. L2 k
  636. #define  RCC_PLLSAICFGR_PLLSAIM_2            ((uint32_t)0x00000004)* s2 Z6 V/ d  P& O( Z9 e$ e" j
  637. #define  RCC_PLLSAICFGR_PLLSAIM_3            ((uint32_t)0x00000008)9 q6 E! l  D1 X4 d7 s0 }
  638. #define  RCC_PLLSAICFGR_PLLSAIM_4            ((uint32_t)0x00000010)' m; L/ L. U6 `& y# ]$ E7 y
  639. #define  RCC_PLLSAICFGR_PLLSAIM_5            ((uint32_t)0x00000020)( C% e: |. \  d1 m0 L7 c2 Q
  640. #endif /* STM32F446xx */0 N; L4 o; i* ~& }0 D" t4 m  Z
  641. % u$ B) @$ f3 X! |8 s6 I3 s
  642. #define  RCC_PLLSAICFGR_PLLSAIN              ((uint32_t)0x00007FC0). }# ?8 {+ v' Y5 }7 G: d
  643. #define  RCC_PLLSAICFGR_PLLSAIN_0            ((uint32_t)0x00000040)
    7 }* |7 Y) c: p; b# O- L/ I
  644. #define  RCC_PLLSAICFGR_PLLSAIN_1            ((uint32_t)0x00000080)
    % H2 d* o  N; ^& J: t( O% p
  645. #define  RCC_PLLSAICFGR_PLLSAIN_2            ((uint32_t)0x00000100)
    3 F) J% i6 t# d" x) s8 Y
  646. #define  RCC_PLLSAICFGR_PLLSAIN_3            ((uint32_t)0x00000200)
    1 L. s* @& @+ \( o0 o
  647. #define  RCC_PLLSAICFGR_PLLSAIN_4            ((uint32_t)0x00000400)
    / Q) A' X, `5 g, Q5 p( B; T
  648. #define  RCC_PLLSAICFGR_PLLSAIN_5            ((uint32_t)0x00000800)4 E" p2 p: P; ]: Y3 O
  649. #define  RCC_PLLSAICFGR_PLLSAIN_6            ((uint32_t)0x00001000)
    * ~/ A! Y: L# Q+ E1 _
  650. #define  RCC_PLLSAICFGR_PLLSAIN_7            ((uint32_t)0x00002000)
    9 i* W6 o7 `6 _
  651. #define  RCC_PLLSAICFGR_PLLSAIN_8            ((uint32_t)0x00004000)8 p0 e+ }5 g2 B* e

  652. / k8 A& H3 A" n' N
  653. #if defined(STM32F446xx) || defined(STM32F469_479xx)  * N. `, ~) c' Y8 y% j
  654. #define  RCC_PLLSAICFGR_PLLSAIP              ((uint32_t)0x00030000)* G8 B9 ?% q3 i# y7 T6 Q' Z
  655. #define  RCC_PLLSAICFGR_PLLSAIP_0            ((uint32_t)0x00010000): Y# s  |* @! U0 l0 A% q/ R
  656. #define  RCC_PLLSAICFGR_PLLSAIP_1            ((uint32_t)0x00020000)& N" |" P% Z5 L% V% y3 n
  657. #endif /* STM32F446xx || STM32F469_479xx */
    ) z5 v' [5 l1 _! ?/ @, p1 y0 u
  658. 0 Z) e- N. d0 u$ m& I2 Z" {
  659. #define  RCC_PLLSAICFGR_PLLSAIQ              ((uint32_t)0x0F000000)
    * E4 ^$ @9 ?$ ?& W5 `
  660. #define  RCC_PLLSAICFGR_PLLSAIQ_0            ((uint32_t)0x01000000)$ ]- f$ N" u7 Q' d& l( d# W; T
  661. #define  RCC_PLLSAICFGR_PLLSAIQ_1            ((uint32_t)0x02000000)
    ) x( B& H, X, z/ Z- o2 e* t6 j
  662. #define  RCC_PLLSAICFGR_PLLSAIQ_2            ((uint32_t)0x04000000)6 F. D* k0 i7 J! b, |
  663. #define  RCC_PLLSAICFGR_PLLSAIQ_3            ((uint32_t)0x08000000)* {* Y! Q! g2 J9 m

  664. ' ^: `) J- x" V9 N( L8 r  J! k
  665. #define  RCC_PLLSAICFGR_PLLSAIR              ((uint32_t)0x70000000)
    0 \2 {8 [- Q+ t0 S0 G
  666. #define  RCC_PLLSAICFGR_PLLSAIR_0            ((uint32_t)0x10000000)
    : j7 c* L0 U, K4 b+ [5 Z
  667. #define  RCC_PLLSAICFGR_PLLSAIR_1            ((uint32_t)0x20000000): v" L# v: C' i: L9 k7 n. U2 [$ }
  668. #define  RCC_PLLSAICFGR_PLLSAIR_2            ((uint32_t)0x40000000)
    $ e8 Z, S3 R1 h/ I5 {& {
  669. 9 I- H. y( _! ^- j
  670. /********************  Bit definition for RCC_DCKCFGR register  ***************/
    5 r' X6 u1 l; D
  671. #define  RCC_DCKCFGR_PLLI2SDIVQ              ((uint32_t)0x0000001F). J% [: u& d. T" I+ W+ W- U) R3 ]
  672. #define  RCC_DCKCFGR_PLLSAIDIVQ              ((uint32_t)0x00001F00)- f2 Y2 N4 l. M6 N1 Z7 ?
  673. #define  RCC_DCKCFGR_PLLSAIDIVR              ((uint32_t)0x00030000)
    - b) d' b4 l$ s% Y

  674. . n9 c8 L! b2 N3 C' t0 G' n' }4 y
  675. #if defined(STM32F412xG) || defined(STM32F413_423xx)( H. g! u4 l& b& L) ^0 y
  676. #define  RCC_DCKCFGR_CKDFSDM1SEL             ((uint32_t)0x80000000)
    . _$ l5 o, o6 |, v) L  o
  677. #define  RCC_DCKCFGR_CKDFSDM1ASEL            ((uint32_t)0x00008000)
    4 f. [: M' z/ ^9 ~" V9 b) \
  678. #endif /* STM32F412xG || STM32F413_423xx */
    . v% a! {6 c4 T. c; |0 ^
  679. * s& Y- q# ]1 H! \% O! C4 f& Y. b
  680. #if defined(STM32F413_423xx)
    ( N2 e2 X5 f# c3 S0 ~1 E
  681. #define  RCC_DCKCFGR_PLLI2SDIVR              ((uint32_t)0x0000001F)
    + ?. ~9 x% x# ^
  682. #define  RCC_DCKCFGR_PLLI2SDIVR_0            ((uint32_t)0x00000001)
    ) E. \" A  c7 Q
  683. #define  RCC_DCKCFGR_PLLI2SDIVR_1            ((uint32_t)0x00000002), {5 P( s8 J" X
  684. #define  RCC_DCKCFGR_PLLI2SDIVR_2            ((uint32_t)0x00000004)
    0 N) Q  N1 h3 j0 ~& L
  685. #define  RCC_DCKCFGR_PLLI2SDIVR_3            ((uint32_t)0x00000008)6 i* K3 J# M' M/ K$ m" U, r
  686. #define  RCC_DCKCFGR_PLLI2SDIVR_4            ((uint32_t)0x00000010)
    1 _! K. b/ |6 P0 o
  687. 0 f/ d  o4 h6 F2 o  R
  688. #define  RCC_DCKCFGR_PLLDIVR                 ((uint32_t)0x00001F00)" P4 y# w) A. r) [
  689. #define  RCC_DCKCFGR_PLLDIVR_0               ((uint32_t)0x00000100)
    , E& a% h# N! ~' \: F( N
  690. #define  RCC_DCKCFGR_PLLDIVR_1               ((uint32_t)0x00000200)& @, s- d. q; G! ^. E3 w" X
  691. #define  RCC_DCKCFGR_PLLDIVR_2               ((uint32_t)0x00000400)' k! o1 r8 ~2 m
  692. #define  RCC_DCKCFGR_PLLDIVR_3               ((uint32_t)0x00000800)5 u+ G1 ~5 R- n2 f6 D! s
  693. #define  RCC_DCKCFGR_PLLDIVR_4               ((uint32_t)0x00001000)
    1 O0 |. o. i$ J
  694. #define  RCC_DCKCFGR_CKDFSDM2ASEL            ((uint32_t)0x00004000)
    8 W  ^% W5 ]6 I$ ~6 E
  695. #endif /* STM32F413_423xx */
    # H3 K0 @- I: m( a9 L$ K( X

  696. 8 `& }  P  c3 S$ V  A' c: P
  697. #define  RCC_DCKCFGR_SAI1ASRC                ((uint32_t)0x00300000)5 d* a& i  M9 G% X6 ^: D
  698. #define  RCC_DCKCFGR_SAI1ASRC_0              ((uint32_t)0x00100000)$ }7 b2 f0 K# Z, B
  699. #define  RCC_DCKCFGR_SAI1ASRC_1              ((uint32_t)0x00200000)) W' [2 X9 d0 g, f2 w) K* R2 [5 @
  700. #if defined(STM32F446xx)' Q3 N# W3 R8 l) m" l
  701. #define  RCC_DCKCFGR_SAI1SRC                 ((uint32_t)0x00300000)
    : Q1 {9 P4 _& `
  702. #define  RCC_DCKCFGR_SAI1SRC_0               ((uint32_t)0x00100000), `+ W* T( @; h6 Q0 t0 |
  703. #define  RCC_DCKCFGR_SAI1SRC_1               ((uint32_t)0x00200000)
    * F, a' I, y  _( A- e7 t& @
  704. #endif /* STM32F446xx */; @* [! N2 b! j4 U

  705. 8 s- N9 Q+ j- f6 {" k9 b
  706. #define  RCC_DCKCFGR_SAI1BSRC                ((uint32_t)0x00C00000)
    : E# ~' @4 [$ p$ S# J% J% ~# ^
  707. #define  RCC_DCKCFGR_SAI1BSRC_0              ((uint32_t)0x00400000); u7 G  S5 g: O1 v; R3 K: y
  708. #define  RCC_DCKCFGR_SAI1BSRC_1              ((uint32_t)0x00800000)
    0 f; v7 z% m* C) X6 ?+ |
  709. #if defined(STM32F446xx)1 C) n- `8 M, G$ f! \; F8 o! [3 L4 L
  710. #define  RCC_DCKCFGR_SAI2SRC                 ((uint32_t)0x00C00000)
    1 G9 Q. G5 i! N/ G! s
  711. #define  RCC_DCKCFGR_SAI2SRC_0               ((uint32_t)0x00400000)
    8 a  e- I1 x5 }# H) r/ A$ r8 U1 p9 B
  712. #define  RCC_DCKCFGR_SAI2SRC_1               ((uint32_t)0x00800000)' ]6 O4 M( p! e' |  W1 R2 k
  713. #endif /* STM32F446xx */
    4 {0 n3 C( p+ i1 x# O% u8 d4 M( Y

  714. 3 R5 N# C2 v; {7 w( R/ |( a7 z
  715. #define  RCC_DCKCFGR_TIMPRE                  ((uint32_t)0x01000000)
    # l8 B7 u0 w6 I
  716. #if defined(STM32F469_479xx)$ o1 ]: u$ S3 [: A7 m1 I
  717. #define  RCC_DCKCFGR_CK48MSEL                ((uint32_t)0x08000000)
    7 _& u2 X# V7 O0 d6 n2 s
  718. #define  RCC_DCKCFGR_SDIOSEL                 ((uint32_t)0x10000000)( x5 \. T( |! `/ v; C3 W; b: J
  719. #define  RCC_DCKCFGR_DSISEL                  ((uint32_t)0x20000000)
    9 @& Z4 i) C3 k4 q& P
  720. #endif /* STM32F469_479xx */
    . R/ W( q9 s) {- j

  721. : `4 U2 W8 ^; l0 s
  722. #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx)
    6 I8 e" V# f; x  s% G. t# n
  723. #define  RCC_DCKCFGR_I2S1SRC                 ((uint32_t)0x06000000)
    9 B) e$ C# v7 E9 U" q' p* }( W( x; G( s* S
  724. #define  RCC_DCKCFGR_I2S1SRC_0               ((uint32_t)0x02000000)! H& F7 _2 X, Z  F
  725. #define  RCC_DCKCFGR_I2S1SRC_1               ((uint32_t)0x04000000)' i3 a! S! q$ M
  726. #define  RCC_DCKCFGR_I2S2SRC                 ((uint32_t)0x18000000)
    % _: M' J1 m# r" G& \
  727. #define  RCC_DCKCFGR_I2S2SRC_0               ((uint32_t)0x08000000). M" [2 f3 L/ B
  728. #define  RCC_DCKCFGR_I2S2SRC_1               ((uint32_t)0x10000000)# d7 ?+ N- H/ p& h
  729. 3 Y% M# X" x# {4 o
  730. /********************  Bit definition for RCC_CKGATENR register  ***************/
    % E, b6 y) d) p7 w( Z
  731. #define  RCC_CKGATENR_AHB2APB1_CKEN          ((uint32_t)0x00000001)6 _' u9 f! ~" y. T- ~1 }) k; Y
  732. #define  RCC_CKGATENR_AHB2APB2_CKEN          ((uint32_t)0x00000002)
    + x8 p! ^- w& l1 V/ O4 o
  733. #define  RCC_CKGATENR_CM4DBG_CKEN            ((uint32_t)0x00000004)
    ) V! A& Z3 q+ m; _
  734. #define  RCC_CKGATENR_SPARE_CKEN             ((uint32_t)0x00000008)
    % {7 q  K& n, M. F; Z+ u
  735. #define  RCC_CKGATENR_SRAM_CKEN              ((uint32_t)0x00000010)
    + |  ?) T: \  m6 T( S4 C  h4 I0 a: ]
  736. #define  RCC_CKGATENR_FLITF_CKEN             ((uint32_t)0x00000020)- e! X, c# i! c+ f6 j5 h- `
  737. #define  RCC_CKGATENR_RCC_CKEN               ((uint32_t)0x00000040)
    * m$ @5 Q3 `0 ~" `1 P1 g. b0 Q7 c- a( ~
  738. #if defined(STM32F412xG) || defined(STM32F413_423xx)! J' D/ G% E4 F; {" e9 W
  739. #define  RCC_CKGATENR_RCC_EVTCTL             ((uint32_t)0x00000080). h' [( @8 U1 ]- }0 G8 i
  740. #endif /* STM32F412xG || STM32F413_423xx */+ F& f4 H- f7 a% y4 j4 T' n1 ^2 {

  741. + T+ z( m6 R2 G9 [# K0 `- x) R
  742. /********************  Bit definition for RCC_DCKCFGR2 register  ***************/
    5 q5 T7 H) r/ D, Q' l' n
  743. #define  RCC_DCKCFGR2_FMPI2C1SEL             ((uint32_t)0x00C00000)9 m, e# p5 {  |; i- F( x
  744. #define  RCC_DCKCFGR2_FMPI2C1SEL_0           ((uint32_t)0x00400000)
    ' q) f7 Y( b6 L2 y/ c$ H4 c
  745. #define  RCC_DCKCFGR2_FMPI2C1SEL_1           ((uint32_t)0x00800000)& P: i8 N. Z& I/ ^' v( k
  746. #define  RCC_DCKCFGR2_CECSEL                 ((uint32_t)0x04000000)
    / K: p9 h7 @+ Q! b
  747. #define  RCC_DCKCFGR2_CK48MSEL               ((uint32_t)0x08000000)+ u# T* t) J+ M: n5 l  x
  748. #define  RCC_DCKCFGR2_SDIOSEL                ((uint32_t)0x10000000)
    + f+ T- ?# E- q! m( _2 [
  749. #if defined(STM32F446xx)  J2 @0 d5 L7 Q% I$ v
  750. #define  RCC_DCKCFGR2_SPDIFRXSEL             ((uint32_t)0x20000000)# l* R  l& m! h& T
  751. #endif /* STM32F446xx */
    ( `, |% M2 m8 q+ Y" {- n
  752. #if defined(STM32F413_423xx)
    . a* o' x% x/ K8 l6 Z: Z  m( v
  753. #define  RCC_DCKCFGR2_LPTIM1SEL              ((uint32_t)0xC0000000)
    % M7 ^2 o; E! H5 ^
  754. #define  RCC_DCKCFGR2_LPTIM1SEL_0            ((uint32_t)0x40000000)
    % `+ Q' a* M$ U% K- `
  755. #define  RCC_DCKCFGR2_LPTIM1SEL_1            ((uint32_t)0x80000000)" V1 M% }- @) D5 t+ I4 F( P& U( S5 U7 U
  756. #endif /* STM32F413_423xx */
    . {6 Z( _2 u7 ?% F) l6 U0 V5 w
  757. #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx */
    0 O$ [: }7 V4 w% Q: s5 o& q. l
  758. 6 }! b2 P7 s9 M' G
  759. #if defined(STM32F410xx)$ S6 p( |! _! m6 z7 q, ]
  760. #define  RCC_DCKCFGR_I2SSRC                  ((uint32_t)0x06000000)
    3 @0 ^* {9 o% b1 \: ?
  761. #define  RCC_DCKCFGR_I2SSRC_0                ((uint32_t)0x02000000)- `- y/ z9 W. F/ P0 U4 S; w9 n
  762. #define  RCC_DCKCFGR_I2SSRC_1                ((uint32_t)0x04000000)
      U. ]7 E0 ~" d, Q. n3 l  K
  763. #endif /* STM32F410xx */8 }7 w2 O! m5 a2 [+ a
  764. + q  ~) M& V% A8 R- x4 l; y! G
  765. #if defined(STM32F410xx)3 ~& f& \5 X0 o$ ?3 o% F2 |
  766. /********************  Bit definition for RCC_DCKCFGR2 register  **************/
    2 M% f1 J' @! ]" W6 R2 l
  767. #define  RCC_DCKCFGR2_FMPI2C1SEL             ((uint32_t)0x00C00000)
    ! B9 w" K$ \' B0 K  P# s! m
  768. #define  RCC_DCKCFGR2_FMPI2C1SEL_0           ((uint32_t)0x00400000)# G" N; G* S( [% [7 W
  769. #define  RCC_DCKCFGR2_FMPI2C1SEL_1           ((uint32_t)0x00800000)( ~" X- ?4 k5 g3 ?
  770. #define  RCC_DCKCFGR2_LPTIM1SEL              ((uint32_t)0xC0000000)7 \6 O: p: }4 j) I2 D; ?
  771. #define  RCC_DCKCFGR2_LPTIM1SEL_0            ((uint32_t)0x40000000)2 e' X$ W, ?; R3 F) I
  772. #define  RCC_DCKCFGR2_LPTIM1SEL_1            ((uint32_t)0x80000000)9 y; o* i' b$ v  q
  773. #endif /* STM32F410xx */
    " q1 G+ J7 B, t( B, f) @1 K
复制代码
; X2 U  Q7 T' }5 B: G  p/ N) z
赞 收藏 评论0 发布时间:2022-3-31 11:00

举报

0个回答

所属标签

相似技术帖

官网相关资源

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