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

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

[复制链接]
STMCU小助手 发布时间:2022-3-29 09:52
01. 概述
& {; b+ U+ b) J/ g: zFSMC 相关的库函数分布在 stm32f4xx_fsmc.c 文件和头文件 stm32f4xx_fsmc.h 中。/ I, F: S: Q8 W- \5 l

/ {+ ~- _& w. m7 X3 f4 E; i+ s5 v) Y02. 相关类型! p' K  B/ O8 N3 e2 q
FSMC_NORSRAMTimingInitTypeDef类型
, |! \4 Y4 k' p+ k3 T/ |) \6 {5 W% |& y& z$ z$ O: c

  1.   F* Q$ y6 ?. a% I
  2. /** + H9 y% Q( v6 r5 d, ?
  3.   * @brief  Timing parameters For NOR/SRAM Banks  5 E& R/ ]" b0 h$ Y5 i3 g
  4.   */  {! n/ A  z2 ^! u
  5. typedef struct
    3 t* L% F: y$ w% S9 B
  6. {5 b- ~7 I: ^( r, A. ~
  7.   uint32_t FSMC_AddressSetupTime;       /*!< Defines the number of HCLK cycles to configure
    # g( ^+ M1 n* ^& s6 W2 V
  8.                                              the duration of the address setup time. , E( R3 T& [* u$ E7 k9 a" q; s: X
  9.                                              This parameter can be a value between 0 and 0xF.
    $ F" ?6 V1 f; A. k, h. ]* H
  10.                                              @note This parameter is not used with synchronous NOR Flash memories. */5 ~  D2 ]% }0 O$ B

  11. , D) J$ R6 h9 E2 W, F
  12.   uint32_t FSMC_AddressHoldTime;        /*!< Defines the number of HCLK cycles to configure- H/ O: h; G4 ^7 Z/ N+ Y  q, C4 V
  13.                                              the duration of the address hold time.
    + `  @1 w' x1 ^+ t( S0 s6 D9 a
  14.                                              This parameter can be a value between 0 and 0xF. " [% S: `/ n. M8 L$ a& N
  15.                                              @note This parameter is not used with synchronous NOR Flash memories.*/
    ( E: |7 n) Q; D7 r% V7 ^; B6 D' v4 y
  16. # J9 P: u; G7 v
  17.   uint32_t FSMC_DataSetupTime;          /*!< Defines the number of HCLK cycles to configure  j' @8 k8 V' ?: b9 ^9 G' q1 R
  18.                                              the duration of the data setup time.
    ' J* d! J2 W( h3 _0 p/ I
  19.                                              This parameter can be a value between 0 and 0xFF.% k2 W( M; k1 i9 R! `. C
  20.                                              @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed NOR Flash memories. */
    ' J  U  J3 ?, W5 V) d7 ?9 G: Q
  21. % b5 q- F' a. d( A( {8 O3 k4 B
  22.   uint32_t FSMC_BusTurnAroundDuration;  /*!< Defines the number of HCLK cycles to configure# a& i/ D/ e7 ?1 \' B( s& F
  23.                                              the duration of the bus turnaround.. X+ k" D( W/ D( A. f
  24.                                              This parameter can be a value between 0 and 0xF.  h2 _; e* }  T" h% l% {
  25.                                              @note This parameter is only used for multiplexed NOR Flash memories. */
    / J5 m/ W" q  `5 C) \
  26. + i& F" p0 b! M
  27.   uint32_t FSMC_CLKDivision;            /*!< Defines the period of CLK clock output signal, expressed in number of HCLK cycles.( c; |& r* _$ {+ K9 S2 f  N( T
  28.                                              This parameter can be a value between 1 and 0xF.3 `3 @; ?6 {1 _! H* }) t$ n
  29.                                              @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM accesses. */
    : H' C9 T, _6 Z" A9 t- p0 B
  30. " T+ b2 V# D" ~
  31.   uint32_t FSMC_DataLatency;            /*!< Defines the number of memory clock cycles to issue% ^7 \" m( u" p2 J4 r
  32.                                              to the memory before getting the first data.0 V" L( `1 C% r8 b8 g$ L! ?0 n
  33.                                              The parameter value depends on the memory type as shown below:4 g& }3 T1 ^: @: {, Z4 D
  34.                                               - It must be set to 0 in case of a CRAM
    - P$ A' u7 X6 e/ j0 y' x, g
  35.                                               - It is don't care in asynchronous NOR, SRAM or ROM accesses; `9 B. K0 d% C0 \! ^1 Z
  36.                                               - It may assume a value between 0 and 0xF in NOR Flash memories
    " Y' H: j7 M5 q2 l
  37.                                                 with synchronous burst mode enable */
    ! q% N9 z9 a; Y1 ]+ G1 ~- G+ y8 \

  38. % z% z0 s% W  Y; z/ a5 C
  39.   uint32_t FSMC_AccessMode;             /*!< Specifies the asynchronous access mode. ) }; w* K) ]9 o8 }* ^3 h
  40.                                              This parameter can be a value of @ref FSMC_Access_Mode */- P( t! W& E3 l. j
  41. }FSMC_NORSRAMTimingInitTypeDef;
复制代码
1 W$ h4 f4 ~% v" [" v3 E( t
FSMC_NORSRAMInitTypeDef类型
$ n4 `3 Q# |* \& l- X, w7 W" |+ P$ R( \7 U  `* `5 q
  1. /**
    ; o2 E( |% R3 B- ]4 }
  2.   * @brief  FSMC NOR/SRAM Init structure definition! K/ d' U6 K" m. R$ t
  3.   */( G9 }( s0 k0 _' K- m3 y+ h# F+ N2 q
  4. typedef struct
    ( M1 D# Z' W8 B: T
  5. {
    * N3 Z( m$ w/ B8 \5 s" N- \2 U
  6.   uint32_t FSMC_Bank;                /*!< Specifies the NOR/SRAM memory bank that will be used.* c5 r% Z& U) ^& V/ C
  7.                                           This parameter can be a value of @ref FSMC_NORSRAM_Bank */! B3 D" C4 ~. t& c/ G6 h
  8. $ e: ~8 g( k. G' R8 d
  9.   uint32_t FSMC_DataAddressMux;      /*!< Specifies whether the address and data values are/ b) K" A( `5 k9 F( d+ X1 Z) v
  10.                                           multiplexed on the data bus or not.
    8 p( F9 S1 h) T# I
  11.                                           This parameter can be a value of @ref FSMC_Data_Address_Bus_Multiplexing */, M: n" B  ?% I# J# J

  12. / {+ A" S$ {: z! r7 K& O# b& c
  13.   uint32_t FSMC_MemoryType;          /*!< Specifies the type of external memory attached to
    , |) ]' j/ P) E5 B; F
  14.                                           the corresponding memory bank.
    9 d( `# g8 ]  r3 z6 ^- a
  15.                                           This parameter can be a value of @ref FSMC_Memory_Type */
    7 h4 P- i+ ]% d, {
  16. 6 ^' S. B- w1 R/ d( {
  17.   uint32_t FSMC_MemoryDataWidth;     /*!< Specifies the external memory device width.
    ' h1 K1 \- U) u2 |, _
  18.                                           This parameter can be a value of @ref FSMC_Data_Width */6 T" f- ^- x3 W; r7 ?

  19. ( i4 v) x. n' J' s9 y% H
  20.   uint32_t FSMC_BurstAccessMode;     /*!< Enables or disables the burst access mode for Flash memory,
    ! a; J: B" ~3 y1 y/ N( F& v( h! ^3 A
  21.                                           valid only with synchronous burst Flash memories.
    ( z9 P5 v* J7 Z1 Y$ x' m- _
  22.                                           This parameter can be a value of @ref FSMC_Burst_Access_Mode */
    6 C7 k, i1 i0 \9 H5 p

  23. ( z% D+ G  t1 D8 `7 t1 @0 q$ {
  24.   uint32_t FSMC_AsynchronousWait;     /*!< Enables or disables wait signal during asynchronous transfers,2 J7 x! n4 [' c" r( O$ ^- @" P; d
  25.                                           valid only with asynchronous Flash memories.
    , `3 N' W3 [" ?, M4 ^2 k
  26.                                           This parameter can be a value of @ref FSMC_AsynchronousWait */                                          3 E5 }. u* X. Z4 E3 n

  27. / _& a3 d& m; r
  28.   uint32_t FSMC_WaitSignalPolarity;  /*!< Specifies the wait signal polarity, valid only when accessing, H6 Q$ ^3 O- y1 g2 L
  29.                                           the Flash memory in burst mode./ O( p) U7 c+ W4 g( U  g( n
  30.                                           This parameter can be a value of @ref FSMC_Wait_Signal_Polarity */) x6 ?$ _4 @' T- H& V6 B
  31. ! t# q# Y; B2 C  a+ C: [+ u* |9 `
  32.   uint32_t FSMC_WrapMode;            /*!< Enables or disables the Wrapped burst access mode for Flash: F# t( L1 m/ P% R8 ^2 ]! a* l
  33.                                           memory, valid only when accessing Flash memories in burst mode.
    $ o, ]2 {) |0 @& |( s% D% T
  34.                                           This parameter can be a value of @ref FSMC_Wrap_Mode */+ g6 `& b) g# M4 E1 |1 }

  35. ) w# E& k. S. M
  36.   uint32_t FSMC_WaitSignalActive;    /*!< Specifies if the wait signal is asserted by the memory one
    , [- a' X% j5 K2 b4 @- n
  37.                                           clock cycle before the wait state or during the wait state,
    7 O. Q, j; J3 t7 N
  38.                                           valid only when accessing memories in burst mode. $ g- }" F: b4 a7 c, a+ {9 N
  39.                                           This parameter can be a value of @ref FSMC_Wait_Timing */
    7 f3 `! k* t- a+ V% |' f. w

  40. + u4 S, v9 R) c
  41.   uint32_t FSMC_WriteOperation;      /*!< Enables or disables the write operation in the selected bank by the FSMC. ' M4 o9 u8 t8 S% d- R
  42.                                           This parameter can be a value of @ref FSMC_Write_Operation */2 E' [. `( o" H+ e1 ^1 f
  43. 6 g5 S& y& {0 o& g' o- J& K& Z
  44.   uint32_t FSMC_WaitSignal;          /*!< Enables or disables the wait state insertion via wait
    ' m: f& Q( U2 p- V; L, f7 h
  45.                                           signal, valid for Flash memory access in burst mode. 2 H5 I' @& A. u) k" J  H
  46.                                           This parameter can be a value of @ref FSMC_Wait_Signal */! z8 C+ h- S1 `- _

  47. ! q& q# ~5 ~6 c: v1 X
  48.   uint32_t FSMC_ExtendedMode;        /*!< Enables or disables the extended mode.
    , R2 j3 n+ F! u
  49.                                           This parameter can be a value of @ref FSMC_Extended_Mode */! x* s9 ?' ?6 Z* e! c
  50. 7 T$ _4 N0 w0 d8 s: D6 @9 i
  51.   uint32_t FSMC_WriteBurst;          /*!< Enables or disables the write burst operation.( h0 F* n  `! _! U/ ]
  52.                                           This parameter can be a value of @ref FSMC_Write_Burst */
    $ S, U' l! K2 T8 F; ?( ]

  53. " [, m# _3 @2 A3 F" m$ U7 O0 L
  54.   FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct; /*!< Timing Parameters for write and read access if the  Extended Mode is not used*/  ' T' B+ k$ `5 H6 _; C: s! ~4 f
  55. 0 p" N8 A$ V' \* W4 a
  56.   FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct;     /*!< Timing Parameters for write access if the  Extended Mode is used*/        e. m" Y7 [0 ^/ Q/ _) M! j" F$ r
  57. }FSMC_NORSRAMInitTypeDef;
复制代码

6 f5 k9 r7 g7 V- S# nFSMC_NAND_PCCARDTimingInitTypeDef类型1 d3 C7 i) V  R1 T4 S+ j2 {# m
# j9 x0 I, Q  }0 b/ U
  1. /**
    & e( t4 A3 n2 T! A% S, o" b
  2.   * @brief  Timing parameters For FSMC NAND and PCCARD Banks
    6 I4 h2 y# l3 r& F6 x
  3.   */: J4 C7 Y, O! }( O
  4. typedef struct
    . n6 k1 |6 B1 U5 T7 W( F& }* Y1 O
  5. {
    9 a3 R; A6 R  u) W4 ^
  6.   uint32_t FSMC_SetupTime;      /*!< Defines the number of HCLK cycles to setup address before
    . q% {, a6 R( Q% o
  7.                                      the command assertion for NAND Flash read or write access/ B3 M# L) T" C6 m+ M
  8.                                      to common/Attribute or I/O memory space (depending on
    * V" ^! a6 @- P4 h! W
  9.                                      the memory space timing to be configured).
    " w: }2 E" ]* g9 G+ m1 h
  10.                                      This parameter can be a value between 0 and 0xFF.*/
    # C' V& [$ u2 e: Q& x3 P4 K

  11. 5 I6 U4 f, w! y
  12.   uint32_t FSMC_WaitSetupTime;  /*!< Defines the minimum number of HCLK cycles to assert the
    3 l7 M, K/ y5 {, Q; D9 b
  13.                                      command for NAND Flash read or write access to% Y6 D6 J1 S6 u$ t! {* d3 x  F; i
  14.                                      common/Attribute or I/O memory space (depending on the: f7 }$ u+ b% x9 ^
  15.                                      memory space timing to be configured). , Z* i& j' k- O7 |
  16.                                      This parameter can be a number between 0x00 and 0xFF */. Y. G! x, X% O7 B; @& u
  17. ) K8 P$ _6 I$ m9 m; Y0 X: z5 K
  18.   uint32_t FSMC_HoldSetupTime;  /*!< Defines the number of HCLK clock cycles to hold address# O1 e& H4 K! K
  19.                                      (and data for write access) after the command de-assertion
    # r7 y+ J4 Z& C) C) j/ s
  20.                                      for NAND Flash read or write access to common/Attribute
    ! z/ F$ ?; J  w
  21.                                      or I/O memory space (depending on the memory space timing
    ) y$ @# K2 }) ^" p  ^/ N* x
  22.                                      to be configured).
    9 O, M' c6 l$ z
  23.                                      This parameter can be a number between 0x00 and 0xFF */
    . Z- E8 D: _+ Z

  24. ! M. N  y' `, C& q/ T7 z
  25.   uint32_t FSMC_HiZSetupTime;   /*!< Defines the number of HCLK clock cycles during which the
    + n( z" g- k0 `$ r* n# {% M
  26.                                      data bus is kept in HiZ after the start of a NAND Flash" {% f7 t! A& e2 ~+ p
  27.                                      write access to common/Attribute or I/O memory space (depending
    . O5 o1 J( ?% N
  28.                                      on the memory space timing to be configured).
    6 {" k0 _& _" F( U0 M
  29.                                      This parameter can be a number between 0x00 and 0xFF */6 g9 I2 a, K  U& Q+ M* t  a8 ]
  30. }FSMC_NAND_PCCARDTimingInitTypeDef;
复制代码

8 N# H8 s0 n& R7 z! c* X" D$ jFSMC_NANDInitTypeDef类型+ r7 n. ?9 d4 N- x4 V; Y# q; n/ E
1 g$ ^4 j8 `% K% _
  1. /** ) }* F! V( |" z4 j6 S5 V- o
  2.   * @brief  FSMC NAND Init structure definition9 A, X# D1 \% E7 L! W
  3.   */
    & S( C5 |/ ^$ u4 r
  4. typedef struct. L  {% k. [: _$ Z" i! c
  5. {9 H. E( }! F0 E9 E
  6.   uint32_t FSMC_Bank;              /*!< Specifies the NAND memory bank that will be used.- p7 P) U1 p: {( k& |1 M% P
  7.                                       This parameter can be a value of @ref FSMC_NAND_Bank */
    0 R! I0 s# F- G* y3 f. N2 s

  8. 1 g. J1 _5 ~/ y8 q. j& y1 g. e
  9.   uint32_t FSMC_Waitfeature;      /*!< Enables or disables the Wait feature for the NAND Memory Bank.1 h" V- N; _% j& X% _" [
  10.                                        This parameter can be any value of @ref FSMC_Wait_feature */: r" v( r9 }& y
  11. ! b$ {& g  U3 n- w% ?) h. |
  12.   uint32_t FSMC_MemoryDataWidth;  /*!< Specifies the external memory device width.
    , G$ f- v: ^- }( g
  13.                                        This parameter can be any value of @ref FSMC_Data_Width */
    0 W: S  u8 v+ o# K7 [. d7 s4 U1 e! {
  14.   {3 {) `3 w. {3 Y: M. {
  15.   uint32_t FSMC_ECC;              /*!< Enables or disables the ECC computation.
    ) s3 M: p% d. i
  16.                                        This parameter can be any value of @ref FSMC_ECC */) M' L  I3 Q0 r! B7 t9 M
  17. - U; [5 D  t& N- w4 K7 [* g
  18.   uint32_t FSMC_ECCPageSize;      /*!< Defines the page size for the extended ECC.6 Q/ T, [0 V1 {( Q6 C, `
  19.                                        This parameter can be any value of @ref FSMC_ECC_Page_Size */' O+ L: J/ ?8 p! A
  20. 4 A( v/ a) r( n$ A7 I% P  V6 S- a
  21.   uint32_t FSMC_TCLRSetupTime;    /*!< Defines the number of HCLK cycles to configure the2 [% W, u  w9 S/ L: r- c
  22.                                        delay between CLE low and RE low.
    : Q, s( U; r' n
  23.                                        This parameter can be a value between 0 and 0xFF. */
    : z! s0 D& _6 z# k

  24. 2 R* N0 N  _' d, x
  25.   uint32_t FSMC_TARSetupTime;     /*!< Defines the number of HCLK cycles to configure the
    5 R3 c1 R+ o+ ^' v% G+ d
  26.                                        delay between ALE low and RE low./ J6 ^3 x' s6 E3 k9 l. f
  27.                                        This parameter can be a number between 0x0 and 0xFF */ + M% V9 Z4 o- q/ k# w" f

  28. 5 D1 ~) r/ k9 x+ t$ z' j$ o
  29.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct;   /*!< FSMC Common Space Timing */ $ v: P& h, z1 d( V: K% B
  30. - b* [4 h$ o  j' b$ k
  31.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct; /*!< FSMC Attribute Space Timing */. j2 b9 ^1 D4 R2 r2 [
  32. }FSMC_NANDInitTypeDef;
复制代码

" d) C$ y7 R  h# x! l% h# rFSMC_PCCARDInitTypeDef类型
1 _0 n/ T  f, U+ x! X

) g( T5 q% `- o, _# ~8 A8 _
  1. /**
    ' o+ H- X8 ]! g
  2.   * @brief  FSMC PCCARD Init structure definition
    ( F- \1 |. P) w& Z4 d3 r
  3.   */& d* z  G0 u- s& w

  4. 3 v" T1 ?) c1 v
  5. typedef struct
    5 V4 p3 C  j: P$ X# m
  6. {
    , }  [1 d2 H8 g0 O) g# T& u
  7.   uint32_t FSMC_Waitfeature;    /*!< Enables or disables the Wait feature for the Memory Bank.
    ( Y& e# }1 C- N# V% K
  8.                                     This parameter can be any value of @ref FSMC_Wait_feature */' N: F; ^' v) ^- n- r7 I$ V
  9. ' l0 J( N- H& Y2 N
  10.   uint32_t FSMC_TCLRSetupTime;  /*!< Defines the number of HCLK cycles to configure the+ L3 C7 M' ^) W4 H
  11.                                      delay between CLE low and RE low.
    $ S. s% _# ]3 i/ O+ [0 Z
  12.                                      This parameter can be a value between 0 and 0xFF. */4 C  Z8 h$ @2 T: P) I- f8 e

  13. & M4 d+ F$ r0 ^) U, C9 G
  14.   uint32_t FSMC_TARSetupTime;   /*!< Defines the number of HCLK cycles to configure the4 L4 G& ]8 k; K
  15.                                      delay between ALE low and RE low.1 w0 t) {" r: T
  16.                                      This parameter can be a number between 0x0 and 0xFF */ ( x+ x0 [1 f/ z" e5 ]

  17. - j- o  _- H" r# I9 B, O$ D/ h6 {! m
  18. , B* X, F5 @' o7 \# M
  19.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct; /*!< FSMC Common Space Timing */
    # }6 ?) W  |3 D) ]
  20. ( L. d+ K1 p3 j; @
  21.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct;  /*!< FSMC Attribute Space Timing */
    % h! s$ {& J) Q! J! x+ X' Q1 R

  22. & e# w2 v' E6 w2 [8 B- d
  23.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_IOSpaceTimingStruct; /*!< FSMC IO Space Timing */  % S3 O! N( ^4 |+ x  l" F
  24. }FSMC_PCCARDInitTypeDef;
    + W; g5 L  M- Z* ^8 H
复制代码

) `3 [) f4 r. [) w! B7 q相关宏定义
1 E) _' w; X7 ~' d2 m0 T4 X
: J$ N5 X0 E8 |8 w2 P' R: d
  1. /** @defgroup FSMC_Exported_Constants
    5 L2 B9 r; i& g- [( `* ]/ N7 G- k
  2.   * @{
    ) N  t* d6 n7 E% N. _3 D* y
  3.   */
    % n4 b4 S& g# S3 g+ }% I7 \$ R
  4. + z+ ?2 R3 b" r3 V3 p! B
  5. /** @defgroup FSMC_NORSRAM_Bank % d  h( U- N  _2 g7 Q! g3 c9 e/ [/ y
  6.   * @{
    + W) E2 \) `% Y- m. z: N
  7.   */
    6 A2 h! v3 M# N6 t3 t, R" X
  8. #define FSMC_Bank1_NORSRAM1                      ((uint32_t)0x00000000)
    8 n2 f: s7 Q7 w, v, Q
  9. #define FSMC_Bank1_NORSRAM2                      ((uint32_t)0x00000002)! d5 r; D/ q* {) s& ?% O: ^
  10. #define FSMC_Bank1_NORSRAM3                      ((uint32_t)0x00000004)! X' T9 W0 j$ y: b% K  R: n
  11. #define FSMC_Bank1_NORSRAM4                      ((uint32_t)0x00000006)/ Z% H! r: W) c! |
  12. /**
    9 D% p- v  d' q( @
  13.   * @}
    9 n1 w9 n$ V) g% y
  14.   */
    " ^. Y" x3 C4 Y! j3 C+ i

  15. # H' v6 d1 b# C
  16. /** @defgroup FSMC_NAND_Bank
    . J/ p5 k. [+ l$ W6 I6 [1 Z
  17.   * @{" [  z2 n/ H3 g. e
  18.   */  " |! c# A# ~5 |* l
  19. #define FSMC_Bank2_NAND                          ((uint32_t)0x00000010)3 }* \* ^4 v* p) v1 a5 w
  20. #define FSMC_Bank3_NAND                          ((uint32_t)0x00000100)* i0 l5 V4 k8 O/ l
  21. /**
    7 s9 o& Z  O  X9 }2 f0 [0 z
  22.   * @}
    5 s4 |7 t  H* S) P( S! H! c
  23.   */& h: R5 e  v0 e( f9 U, j
  24. ! m7 ]' @9 @& b( |6 p* d
  25. /** @defgroup FSMC_PCCARD_Bank + g8 f4 A  D, O9 u( m! a
  26.   * @{
    % m9 ]8 V1 R1 p0 T! y3 T
  27.   */   
    + e9 D' T% [- `; W: R/ p
  28. #define FSMC_Bank4_PCCARD                        ((uint32_t)0x00001000)
    : I3 M7 L( U. ]6 j# F4 F
  29. /**
    5 ^  |9 V1 r  l, y% B# y$ t: V
  30.   * @}
    # ~# d/ ~* a4 f; G
  31.   */
    & y1 ?+ z6 f% O
  32. 0 h- a1 ~% n, V; t% o
  33. #define IS_FSMC_NORSRAM_BANK(BANK) (((BANK) == FSMC_Bank1_NORSRAM1) || \2 {' Q/ J  N- q9 k, Z- q
  34.                                     ((BANK) == FSMC_Bank1_NORSRAM2) || \
    2 b. ?5 R1 p; U6 }7 R
  35.                                     ((BANK) == FSMC_Bank1_NORSRAM3) || \5 u7 z$ Q/ R& y1 e
  36.                                     ((BANK) == FSMC_Bank1_NORSRAM4))
    ) h9 y$ \; F# D' ^% b) I% ^  \
  37. & @) c& R5 e( E) h& z
  38. #define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
      e! c. L) o2 |/ ^4 l2 _0 W
  39.                                  ((BANK) == FSMC_Bank3_NAND))
    5 o7 P" w0 ?- O& Q7 U7 v

  40.   F" a" O& d$ y- f0 E- ~
  41. #define IS_FSMC_GETFLAG_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
    2 i( Q' z2 r) B8 Y2 s% }, q
  42.                                     ((BANK) == FSMC_Bank3_NAND) || \
    % U0 o# h- \- \
  43.                                     ((BANK) == FSMC_Bank4_PCCARD))
    2 T9 k! c9 n: Q4 l: f
  44. $ P& H* u2 |9 j1 K; s
  45. #define IS_FSMC_IT_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
    . k& N/ B7 s2 G' ~5 e8 }
  46.                                ((BANK) == FSMC_Bank3_NAND) || \
    4 m; p+ a; O- w4 a+ }
  47.                                ((BANK) == FSMC_Bank4_PCCARD))# d0 [" r( [, t3 D% A% l
  48. % P* @" h$ _; ~3 Z) X
  49. /** @defgroup FSMC_NOR_SRAM_Controller
    3 ]# z% n1 M1 K5 o
  50.   * @{
    % O. O2 R; d' t4 O/ i
  51.   */
    9 m  t: e4 F+ @  G( j
  52. # e5 m3 A. J$ J
  53. /** @defgroup FSMC_Data_Address_Bus_Multiplexing
    * _# z* {" j+ S( X  [6 ]  {3 \+ \
  54.   * @{
    3 ?$ d& Z- n. p- j9 v* K; v! [
  55.   */
    * `/ r. {: l" x/ o; y5 u

  56. 1 |$ @2 n4 V( J- d3 L: c% \# H$ d( \
  57. #define FSMC_DataAddressMux_Disable                ((uint32_t)0x00000000)3 R0 L" {( L0 w/ x7 @
  58. #define FSMC_DataAddressMux_Enable                 ((uint32_t)0x00000002)
    . n7 Q9 N; y. l
  59. #define IS_FSMC_MUX(MUX) (((MUX) == FSMC_DataAddressMux_Disable) || \
    7 i( M& }  {5 {7 Z" }, M0 d
  60.                           ((MUX) == FSMC_DataAddressMux_Enable))
    1 U6 L% |0 s) Y
  61. /**
    % W) p) D* a) a- M8 ]9 C
  62.   * @}
    % \# M8 Y, f7 O3 J
  63.   */* s; [* j3 u) r5 l% g4 d
  64. ( h  `+ |4 ^0 l1 r4 {5 K
  65. /** @defgroup FSMC_Memory_Type
    9 l# |3 m( \' z8 c2 y
  66.   * @{0 T" a% B# A2 ~8 I3 \& J# x8 f8 y% b& r
  67.   */5 _- e1 X7 v) a& d' I7 D2 V! R  A9 n

  68. 7 |  N2 ^) G4 D9 L+ G5 H+ ^$ l7 o
  69. #define FSMC_MemoryType_SRAM                     ((uint32_t)0x00000000)
    ; z1 X9 j& S" ~5 O
  70. #define FSMC_MemoryType_PSRAM                    ((uint32_t)0x00000004)( R8 u2 k! {( ]5 i4 h- y. `! Z
  71. #define FSMC_MemoryType_NOR                      ((uint32_t)0x00000008)# r) @  Y7 S3 K& Q( [" ^# T
  72. #define IS_FSMC_MEMORY(MEMORY) (((MEMORY) == FSMC_MemoryType_SRAM) || \
    ) D; o5 z- h  L8 Q, O( a
  73.                                 ((MEMORY) == FSMC_MemoryType_PSRAM)|| \% Q$ J. E; V) v$ F$ b: O! _* O
  74.                                 ((MEMORY) == FSMC_MemoryType_NOR))3 j+ f5 N1 e3 }. n" ~
  75. /**
    , O, N0 _6 Y4 r+ @0 T& x4 x
  76.   * @}
    3 n# \" p1 W2 C1 E
  77.   */, l' K& Z7 p# @4 B1 [6 C& D1 ~# R
  78. 0 s9 V* I) y/ `6 D/ i/ x
  79. /** @defgroup FSMC_Data_Width
    4 k( ?) J/ c# W
  80.   * @{
    - b0 d/ C: Q& R9 M# b, Q; x% ^& V% H
  81.   */! B7 r& e8 Y8 U- e
  82. ) M2 v1 w4 T# m  a/ A
  83. #define FSMC_MemoryDataWidth_8b                  ((uint32_t)0x00000000); J6 n3 T$ F# e3 F+ I$ _4 z
  84. #define FSMC_MemoryDataWidth_16b                 ((uint32_t)0x00000010)3 F  [& m0 D/ B! o. O
  85. #define IS_FSMC_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \
    $ N( b4 q7 v5 V0 e
  86.                                      ((WIDTH) == FSMC_MemoryDataWidth_16b))+ C0 F$ i; d. d4 p) Y; X
  87. /**
    $ L% W2 m0 H. m+ b9 X1 {! w
  88.   * @}. ~0 _: N  L+ I- C/ ~
  89.   */2 K: w% M) N5 a  {3 l

  90. ; B5 V2 M0 T7 R: z3 a  j# h
  91. /** @defgroup FSMC_Burst_Access_Mode 2 {2 z+ `! t: f5 y9 P
  92.   * @{- Y- l; h  H/ J5 \0 L  a
  93.   */
    , G! {$ A& w$ r, N1 C
  94. 0 K8 N) P2 q+ V4 S) |& U
  95. #define FSMC_BurstAccessMode_Disable             ((uint32_t)0x00000000) 8 M6 f; }+ \/ ^3 d7 A
  96. #define FSMC_BurstAccessMode_Enable              ((uint32_t)0x00000100)
    . q( I8 p$ i0 z( R5 U) [
  97. #define IS_FSMC_BURSTMODE(STATE) (((STATE) == FSMC_BurstAccessMode_Disable) || \8 [* o) A$ e+ t/ }0 r1 [2 h
  98.                                   ((STATE) == FSMC_BurstAccessMode_Enable))
    9 G8 g6 Y- G# _0 a4 t! [1 a
  99. /**
    9 v3 ^$ k- u2 k3 K/ ]5 c9 ^
  100.   * @}
    8 n! F: D3 v1 L1 A( E
  101.   */
    / f6 B: E! \, N7 U

  102. # c  N) N8 j# v% }8 K
  103. /** @defgroup FSMC_AsynchronousWait / {) p+ H  w2 o! Y0 \5 \+ B
  104.   * @{" r* P$ B" U1 I% K* K
  105.   */+ i- Z) a3 \, R
  106. #define FSMC_AsynchronousWait_Disable            ((uint32_t)0x00000000)$ y/ @7 @9 I# U$ b" f1 }- J
  107. #define FSMC_AsynchronousWait_Enable             ((uint32_t)0x00008000). |# Y2 t7 {/ G( x
  108. #define IS_FSMC_ASYNWAIT(STATE) (((STATE) == FSMC_AsynchronousWait_Disable) || \& z0 ^0 K, l! p' t( T0 x/ p
  109.                                  ((STATE) == FSMC_AsynchronousWait_Enable))
    * @, F: `. q8 z3 x6 e7 g2 ~: E
  110. /**7 _# |- I" b$ y1 b  N3 ~$ r
  111.   * @}
    0 G4 @0 c  ~" Y" w; g) M: e
  112.   */
    / D$ P; r' J5 h: }  b! c

  113. ' s( Z. ~: e, R- g
  114. /** @defgroup FSMC_Wait_Signal_Polarity
    4 S" N0 @1 I0 D' }
  115.   * @{# y" x, v' r! |( v) T, A
  116.   */9 b- z9 m, C2 b% D
  117. #define FSMC_WaitSignalPolarity_Low              ((uint32_t)0x00000000)
    4 D3 h% X# v. T4 ]! |
  118. #define FSMC_WaitSignalPolarity_High             ((uint32_t)0x00000200)  ^+ F  W5 f1 F- B6 j7 K9 Q
  119. #define IS_FSMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FSMC_WaitSignalPolarity_Low) || \
    6 B% `1 _8 a! |2 {0 ]( a
  120.                                          ((POLARITY) == FSMC_WaitSignalPolarity_High))
    / c( @. |9 q5 |5 a
  121. /**
    8 U6 f$ L5 t. u* X, J
  122.   * @}
    $ Q9 U, A6 e, m$ y3 F, k
  123.   */- i" }1 m( u" w4 h3 b

  124. 8 P- j$ W7 Q: ~  C$ T
  125. /** @defgroup FSMC_Wrap_Mode
      ]( \1 S4 \7 p! e
  126.   * @{
    ( M" \  X- E4 v- E
  127.   */
      M( g, @& m# g6 C  u  E4 p
  128. #define FSMC_WrapMode_Disable                    ((uint32_t)0x00000000)
    % d4 s5 D9 u3 H; L) a
  129. #define FSMC_WrapMode_Enable                     ((uint32_t)0x00000400)
      l* Z* k" }5 |3 \
  130. #define IS_FSMC_WRAP_MODE(MODE) (((MODE) == FSMC_WrapMode_Disable) || \# V& I7 E* g; D" f
  131.                                  ((MODE) == FSMC_WrapMode_Enable))
    ! T$ Z" n) h5 f! X8 G
  132. /**
    / v7 T1 p9 I$ }* M- I+ M' a6 _/ W
  133.   * @}) O& M, {5 d9 X  R; g( e& w
  134.   */1 m9 H/ o! d0 e0 |5 k

  135. 0 ]* C& c9 i" Y6 U$ ], a! [
  136. /** @defgroup FSMC_Wait_Timing # I! B7 z2 k7 E/ l
  137.   * @{0 o" p; m7 ]- g0 i* j
  138.   */. z) F1 @: }, s* `. \8 H# D5 Q
  139. #define FSMC_WaitSignalActive_BeforeWaitState    ((uint32_t)0x00000000)
    * d# ~" t, E/ J/ `  \
  140. #define FSMC_WaitSignalActive_DuringWaitState    ((uint32_t)0x00000800) % {0 a9 E9 B3 ^1 T- S
  141. #define IS_FSMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FSMC_WaitSignalActive_BeforeWaitState) || \: w" A, M9 m) Y. {! I. F1 O
  142.                                             ((ACTIVE) == FSMC_WaitSignalActive_DuringWaitState))" S! q8 ]% u( _& M
  143. /**
    $ s5 G: A4 P/ y% B' _7 D
  144.   * @}
    + R4 M4 G7 s2 Z7 j/ i
  145.   */$ _4 h7 x" `5 ?9 u* U6 A

  146. 3 A: W/ i  v# |, j2 F
  147. /** @defgroup FSMC_Write_Operation
    . ~+ @/ m. M$ J1 l
  148.   * @{
    5 J8 F# R. W9 T1 Z
  149.   */
    1 G' O3 `" x; n
  150. #define FSMC_WriteOperation_Disable                     ((uint32_t)0x00000000)
    6 o  K3 E! S; B7 T0 Z4 `1 C
  151. #define FSMC_WriteOperation_Enable                      ((uint32_t)0x00001000)
    * q( X* ~6 H. K6 G. S
  152. #define IS_FSMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FSMC_WriteOperation_Disable) || \
    % W) C& B+ i. h2 z1 x0 c0 C
  153.                                             ((OPERATION) == FSMC_WriteOperation_Enable))                         ! t) a, |/ a, |  }/ W
  154. /**& I+ H$ f0 R7 N5 z, w9 b  U
  155.   * @}
    / H" N( m0 ^" G
  156.   *// W# c# A/ {6 m' Z0 Z/ @
  157. / y2 W3 ]! D7 p9 K$ I/ i
  158. /** @defgroup FSMC_Wait_Signal   ~) G+ H' A1 e5 Z" O7 Z! _% U
  159.   * @{/ B6 t9 j; C3 }! v; }
  160.   */% _. T  u8 \$ ?2 G2 Z
  161. #define FSMC_WaitSignal_Disable                  ((uint32_t)0x00000000)/ _( a2 a# C- d) s/ D, y/ b
  162. #define FSMC_WaitSignal_Enable                   ((uint32_t)0x00002000) " s0 o: X$ Y6 J/ j3 H/ M+ s+ Q. V
  163. #define IS_FSMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FSMC_WaitSignal_Disable) || \
    8 q5 Y6 j4 J& j
  164.                                       ((SIGNAL) == FSMC_WaitSignal_Enable))* G# r6 l0 x3 U( u
  165. /**
    ; _3 ~9 Z8 ]! D2 I9 I
  166.   * @}
    3 {% x  f5 U, u; u) j
  167.   */
    1 {* m" ~% m. r6 }3 W) o% `

  168. 6 K; i/ F3 l% a5 k
  169. /** @defgroup FSMC_Extended_Mode . f% R' f8 H4 W, N" G
  170.   * @{
    8 W  K8 H6 b/ S/ M& X/ _; ~5 r; f
  171.   */! m6 z0 c/ n( H, M8 b) j3 k
  172. #define FSMC_ExtendedMode_Disable                ((uint32_t)0x00000000)
      `( t7 K8 A# I7 Z
  173. #define FSMC_ExtendedMode_Enable                 ((uint32_t)0x00004000)
    4 c! a- |9 @( {+ A2 b

  174. . B' O6 ?, A  U3 g, A5 B$ Y, P" i/ W
  175. #define IS_FSMC_EXTENDED_MODE(MODE) (((MODE) == FSMC_ExtendedMode_Disable) || \
    - A( f: R7 p% f
  176.                                      ((MODE) == FSMC_ExtendedMode_Enable)) ; j2 X* \2 m! {# x
  177. /**1 X; f8 `1 @% h7 B( j8 z
  178.   * @}5 l+ k- W7 g! V' ]/ t0 `+ H' J: c
  179.   */+ r" I8 n; V5 D% b

  180. 2 B) [7 `6 ~+ f2 V- Z1 F
  181. /** @defgroup FSMC_Write_Burst # M. C9 J: z1 U. C/ b
  182.   * @{, t5 x+ N+ r, x6 W$ p
  183.   */& N+ H" V" b- e0 a7 f# p3 q( q
  184. . M6 R$ {5 x2 q) R% v! i5 P
  185. #define FSMC_WriteBurst_Disable                  ((uint32_t)0x00000000)" r- _- F% e' D
  186. #define FSMC_WriteBurst_Enable                   ((uint32_t)0x00080000) ' L8 m' @& ]( O
  187. #define IS_FSMC_WRITE_BURST(BURST) (((BURST) == FSMC_WriteBurst_Disable) || \# K; V1 F6 u4 T* d. m/ r
  188.                                     ((BURST) == FSMC_WriteBurst_Enable))0 n) _, u" |" N7 H) H6 O
  189. /**
    - j' l/ g. {0 M  x9 ^3 W
  190.   * @}' F& ]  [8 K/ A  t6 V) c+ y
  191.   */
    1 K6 A+ Q- d" ~9 u

  192. & _* l% j* U+ w  P) x- h
  193. /** @defgroup FSMC_Address_Setup_Time
    % G# E' F! p6 e4 o
  194.   * @{
    + b& u) E" V- R: P" H
  195.   */: _# H; v, a- K4 h( l
  196. #define IS_FSMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 0xF). }" D! B! l: E+ F' y. E
  197. /**) x4 Y9 T3 D% R6 S( ?: H, U
  198.   * @}
    4 |; t+ u" I* @- V# m
  199.   */) {- x6 n9 b7 U: H5 m' V9 P6 N

  200. ' J2 f4 v' s1 J! F7 p
  201. /** @defgroup FSMC_Address_Hold_Time
    8 d, M( z- r7 z8 o( s
  202.   * @{, n0 K7 O# ]& T/ k+ Q
  203.   */2 A& |4 q1 X5 Q) D# V) i% ]3 ?: E
  204. #define IS_FSMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF)3 [0 Q! N+ F/ @3 x4 X4 f
  205. /**
    * x8 A1 U  c$ {& p  D
  206.   * @}( E$ e2 i  U1 V1 H
  207.   *// B4 x/ `7 o; e

  208. 8 b  q9 h) j/ }+ v0 Y
  209. /** @defgroup FSMC_Data_Setup_Time 5 v  S# ?3 H2 y2 o) k; S
  210.   * @{
    $ ?; p# C4 `8 L( Y4 _5 y
  211.   */
    8 n5 h; j9 @) b# V: o3 c9 Q/ ?
  212. #define IS_FSMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF))
    8 `( q0 c' [" N0 f, l
  213. /**9 ]$ Z+ ~! H) ^0 L3 L
  214.   * @}
    ) B# J% E! h9 ?) ~! I
  215.   */% f8 T; P. E  G/ v5 U- t: F5 Y, [

  216. 6 d5 g2 k+ g0 ]8 K# W0 R0 {7 i
  217. /** @defgroup FSMC_Bus_Turn_around_Duration
    5 L( \. l8 V  G+ F+ C
  218.   * @{- D' @/ t# [& k, H
  219.   */
    5 Q7 \6 ?6 p* ]7 ~" i3 e5 A# L+ C4 j
  220. #define IS_FSMC_TURNAROUND_TIME(TIME) ((TIME) <= 0xF)
    0 J' Z, ]% D+ R% r) z
  221. /**
    9 l3 x1 Z2 k4 \; N$ ^
  222.   * @}
    . ^; }; _5 |+ Y/ L" a! j, O0 k
  223.   */
    : f) }, Q5 e2 I2 {3 w2 B
  224. ! j5 e3 [0 U8 \2 Y5 L" r. K% n
  225. /** @defgroup FSMC_CLK_Division % U% j4 D# V  I8 R' ]" ?/ L
  226.   * @{
    * e% V) A* ?* f$ q1 b7 L
  227.   */
    1 |2 O, f5 d( \; N2 g/ W' |' |
  228. #define IS_FSMC_CLK_DIV(DIV) ((DIV) <= 0xF)
    , `- z) C# M- H6 B
  229. /**
    0 v5 p- a0 z) G# G: g# a
  230.   * @}
    & Z; _) S& S7 {6 w) k
  231.   */" g% O0 K( s9 N8 a7 G$ O
  232. 7 C, X, x3 J  ]7 ?! C7 ~2 a
  233. /** @defgroup FSMC_Data_Latency
    2 Q" c0 ^/ x& {& r0 }* q$ G
  234.   * @{
    ; e, j, k5 L9 w0 b
  235.   */
    ! r4 ?& o+ p/ T! `
  236. #define IS_FSMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 0xF)
    - |8 b1 m% d( U4 T7 T9 I
  237. /**
    " J5 [; ]/ m0 r% J% C, h! d
  238.   * @}
    # E7 ?2 c( e6 _. b0 J
  239.   */7 ?2 G: k( s% U( E

  240. # C4 j1 p2 ?" R/ B8 O% |
  241. /** @defgroup FSMC_Access_Mode 8 b+ Y7 Z( d- m
  242.   * @{5 I( a$ N6 D$ T" R
  243.   */5 `% z+ }  P1 e" o1 U6 O* v+ k8 V
  244. #define FSMC_AccessMode_A                        ((uint32_t)0x00000000)5 b( z, e# B* s
  245. #define FSMC_AccessMode_B                        ((uint32_t)0x10000000) / H( b  n. T7 ~5 ?- |1 ~5 o
  246. #define FSMC_AccessMode_C                        ((uint32_t)0x20000000)
    1 v# R8 b1 L; G6 M% `" ?' @7 ^) Z3 z
  247. #define FSMC_AccessMode_D                        ((uint32_t)0x30000000)
    0 d0 O0 t0 v' j  }0 |
  248. #define IS_FSMC_ACCESS_MODE(MODE) (((MODE) == FSMC_AccessMode_A) || \
    ' _: r( x" q( n' ]2 `1 s
  249.                                    ((MODE) == FSMC_AccessMode_B) || \2 E/ `+ ^5 i1 A) ]
  250.                                    ((MODE) == FSMC_AccessMode_C) || \! j/ a" a5 G) v+ v: U
  251.                                    ((MODE) == FSMC_AccessMode_D))! u# o2 F" _/ [
  252. /**4 _# u2 C8 |8 W+ U3 A* u( Q+ k2 Z* E+ w
  253.   * @}2 I0 Z" Y' B6 e0 V1 \8 f% Z9 o
  254.   */  Y# u1 m1 |- G- E. r; e& H

  255. 3 ~3 j) e! h( H% ?$ [
  256. /**8 I9 G  O4 ~5 u. t/ K. A# B
  257.   * @}
    * G  D) y+ a6 W( r) {% Z
  258.   */
    4 I# t5 R- d; p/ Z" d

  259. 8 I) e. S9 S8 o
  260. /** @defgroup FSMC_NAND_PCCARD_Controller
    " k& j9 ?) }5 X; O
  261.   * @{2 q9 k% t, P* ?' _) x
  262.   */1 K. Z$ S# t! N4 w) `, T/ E- z

  263. + S; ?7 R( {; N4 J; N8 ?* I' d
  264. /** @defgroup FSMC_Wait_feature * u* T/ V4 t7 I5 t
  265.   * @{
    9 V1 U9 I, T* f8 u# \) h8 H% s* t# n
  266.   */) S  B$ {, H+ W8 y. b5 j# z
  267. #define FSMC_Waitfeature_Disable                 ((uint32_t)0x00000000)
    # D7 o% `) A4 `3 ?5 E0 W* O
  268. #define FSMC_Waitfeature_Enable                  ((uint32_t)0x00000002), |8 |9 _6 w8 _" S2 L  u
  269. #define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_Waitfeature_Disable) || \; T5 O+ N5 x$ }% Y4 G3 W
  270.                                        ((FEATURE) == FSMC_Waitfeature_Enable))- N1 i# \' k- ~' F
  271. /**5 z& a  d0 H" y3 l% T' ?/ Z, v4 @
  272.   * @}
    , s' [& z; h4 B! j: Q3 M6 o6 H6 z
  273.   */  x$ P, `5 m* H, M" C$ p0 c
  274. 1 o' r6 z; s9 h( g0 \

  275. . K3 ~1 p' n" Q8 _7 E% p" Z9 Z& h3 _
  276. /** @defgroup FSMC_ECC 0 B1 b% H6 f% G: a' O9 N
  277.   * @{( k; B+ ^* t; K7 A- @8 @
  278.   */
    2 _5 n+ O1 `! l# x
  279. #define FSMC_ECC_Disable                         ((uint32_t)0x00000000)3 p: R6 I+ _, z* A7 D3 m
  280. #define FSMC_ECC_Enable                          ((uint32_t)0x00000040)) P. {  T4 u2 B) c+ }: k* c" V& J
  281. #define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_ECC_Disable) || \6 M3 Q: o1 e' ]6 F1 f
  282.                                   ((STATE) == FSMC_ECC_Enable))( ?3 |2 U7 p7 h6 L
  283. /**: K+ V5 _- M- m; Y6 i+ y9 f
  284.   * @}
    & e1 Z; D, _) }, f
  285.   */1 S4 ~% a/ e$ `/ H8 J1 e5 H
  286. . ]1 l2 v8 W9 O+ C
  287. /** @defgroup FSMC_ECC_Page_Size 8 m( t6 X" z' D' e1 z5 n; x1 p
  288.   * @{
    % ^: f$ v* }0 e
  289.   */
    $ T' |4 Z/ I' a2 v
  290. #define FSMC_ECCPageSize_256Bytes                ((uint32_t)0x00000000)
    " d2 c7 ?, ~8 G! t4 {% q) D
  291. #define FSMC_ECCPageSize_512Bytes                ((uint32_t)0x00020000)6 A" k7 k# u) K! T: b; w2 Z+ ~
  292. #define FSMC_ECCPageSize_1024Bytes               ((uint32_t)0x00040000)3 S3 E/ G: @+ }7 p% H% X3 U
  293. #define FSMC_ECCPageSize_2048Bytes               ((uint32_t)0x00060000)
    ! R2 K; y1 h- ]' y/ ~+ c
  294. #define FSMC_ECCPageSize_4096Bytes               ((uint32_t)0x00080000)% [! j, u1 P% g: l* x- x* u' I# p
  295. #define FSMC_ECCPageSize_8192Bytes               ((uint32_t)0x000A0000)
    5 g6 w$ H5 l( F; ?0 G& Q
  296. #define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_ECCPageSize_256Bytes) || \- m* u# y$ i) ~& A
  297.                                     ((SIZE) == FSMC_ECCPageSize_512Bytes) || \
    * s8 d3 A1 `6 o9 d* S
  298.                                     ((SIZE) == FSMC_ECCPageSize_1024Bytes) || \6 S% A7 i: {# I2 N
  299.                                     ((SIZE) == FSMC_ECCPageSize_2048Bytes) || \' l7 S: l4 c3 t7 P8 m) F% g5 u
  300.                                     ((SIZE) == FSMC_ECCPageSize_4096Bytes) || \6 Z; I8 k9 F7 u# ]7 |- q6 W8 ]
  301.                                     ((SIZE) == FSMC_ECCPageSize_8192Bytes))
    0 F% K( R2 J7 j" g& H
  302. /**
    / L% Y- j; L% T# C/ ~8 X
  303.   * @}7 V$ c! O- p, K& P1 |' s! Y/ G$ x
  304.   */
    ; R" v; _+ p$ ?$ Q: ^
  305. 4 p* `1 F, Z3 [/ M* v( U
  306. /** @defgroup FSMC_TCLR_Setup_Time + m1 |# n$ ~& O. C  T' E) X
  307.   * @{$ c5 C4 v9 y0 `6 Y3 t# t
  308.   */" y4 W7 S9 x3 B
  309. #define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 0xFF)
    - [7 a% q5 j* p0 h1 H4 ]7 a' p; ~
  310. /**
    ! R& Q# Z7 Y: D; p+ @( }' I
  311.   * @}
    2 w5 d+ ?9 I/ y
  312.   */& d7 F% }! q- \# K; P* D" A( g' w. r

  313. $ c$ I9 K7 v5 C& Y, C
  314. /** @defgroup FSMC_TAR_Setup_Time % y: D; v7 i3 ]
  315.   * @{3 q' F2 V. _: a. L8 O' l
  316.   */
    ! Z0 J# y% ^$ e5 b$ K1 _; c
  317. #define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 0xFF)
    , A0 Q3 Q' i4 A' B0 J
  318. /**3 d; Q* `2 m. _2 L* C  i8 F( H
  319.   * @}% t- q) U' f8 M! D; S# P
  320.   */9 ^8 `/ K5 S5 k' E8 ]) V& E, g1 S) k
  321. 6 D) ?3 n0 W# x4 [
  322. /** @defgroup FSMC_Setup_Time
    " U3 P; g5 C4 `6 [
  323.   * @{' A1 t0 _# g. J; s& O& z
  324.   */3 w) U& n, u. Q5 A9 J( Y
  325. #define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 0xFF)
    , a1 V$ ^" W, U/ o6 S. g
  326. /**1 ]3 i8 n; y/ ^5 g" \- l& G
  327.   * @}3 z# O/ m$ W2 ~
  328.   */1 V% f* Q/ x  R  E& R
  329. " Q7 ~! s$ Y: t" X' ?
  330. /** @defgroup FSMC_Wait_Setup_Time
      J- {; |/ ]: z
  331.   * @{. p, _+ J6 i% @& q( r
  332.   */
    % C2 `5 J0 n' Z! p; p) G0 z
  333. #define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 0xFF). E$ T" |* H& q2 x: Y
  334. /**
    - F* Z  {, Q4 y7 l  G: F9 o+ I) y
  335.   * @}3 ^4 J' ^2 L. g4 A/ i6 J
  336.   */0 b3 K) y2 @8 G0 K

  337. ' {5 y! F5 `+ x; J% n9 Z
  338. /** @defgroup FSMC_Hold_Setup_Time
    4 O/ u( K, l1 N% Y* U) B
  339.   * @{
    ' O4 K5 ?/ k! `8 o2 `' ~
  340.   */# [* a, P" f  d0 ^- A
  341. #define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 0xFF)
    ; e. X; V/ U9 H' G* I
  342. /**
    ! f  ?6 ~, X. @0 {( I5 y
  343.   * @}9 _: u* f, O) c9 e2 A
  344.   */$ x3 T$ H* I& a. R" O

  345. ( M: g2 l' [) r
  346. /** @defgroup FSMC_HiZ_Setup_Time 2 z+ y* x: |6 [  j
  347.   * @{6 b% ]1 _. P/ L7 J
  348.   */
    ) O0 u" q; T% h: W) ]; l) x
  349. #define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 0xFF)
    0 z/ V  u1 ]7 {
  350. /**
    2 m! c6 z- Y" P1 u
  351.   * @}
    0 A" O& T* [: P8 H/ F$ I
  352.   */
    ; J8 @; u! E4 I' ^( y
  353. % k; {, F6 d. j- h7 R
  354. /** @defgroup FSMC_Interrupt_sources
    $ u+ v/ y5 W$ j7 u, V& ~
  355.   * @{
      Z) c' E: d( F7 W* C) |8 E
  356.   */% `9 ~; v9 I6 k3 F2 U$ `
  357. #define FSMC_IT_RisingEdge                       ((uint32_t)0x00000008)
    & u- ^/ L1 ]9 |  v
  358. #define FSMC_IT_Level                            ((uint32_t)0x00000010)
    7 f* U' z' j" p- w* F, i
  359. #define FSMC_IT_FallingEdge                      ((uint32_t)0x00000020)% x. m6 {" b' B0 ~" s7 n; _+ ^6 S
  360. #define IS_FSMC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((IT) != 0x00000000))
    + b& T4 h' R0 j0 y: h7 ^* w
  361. #define IS_FSMC_GET_IT(IT) (((IT) == FSMC_IT_RisingEdge) || \
    # ]! n& N) D2 F5 y3 P; n! I; l
  362.                             ((IT) == FSMC_IT_Level) || \8 X  R8 T* w5 a+ j! v7 ^: Q1 l% C9 F
  363.                             ((IT) == FSMC_IT_FallingEdge)) , M" N2 l8 p8 Q# t) A6 S" {
  364. /**
    - N5 c$ B* K$ W) ^4 l* t
  365.   * @}
    8 X0 b9 d# F' L, e. k$ q7 [$ ?
  366.   */- h9 Q" C0 A# {) }
  367. 1 g& u2 K! {$ R8 s6 [
  368. /** @defgroup FSMC_Flags
    4 O: _4 V% a( k& _+ w" h
  369.   * @{0 B% R3 F: O' S9 B/ U5 ^
  370.   */
    ) f) F4 @/ i! M" @2 i
  371. #define FSMC_FLAG_RisingEdge                     ((uint32_t)0x00000001)8 A. L: T; i8 I+ [
  372. #define FSMC_FLAG_Level                          ((uint32_t)0x00000002)
    . }$ m9 q8 l4 ~! k- ^- w" k
  373. #define FSMC_FLAG_FallingEdge                    ((uint32_t)0x00000004)
    0 A  z& I; J- r
  374. #define FSMC_FLAG_FEMPT                          ((uint32_t)0x00000040), W3 N/ D6 @8 l- l6 {
  375. #define IS_FSMC_GET_FLAG(FLAG) (((FLAG) == FSMC_FLAG_RisingEdge) || \
    2 q0 e) ~* h$ C9 N
  376.                                 ((FLAG) == FSMC_FLAG_Level) || \
    + U& O% M" v$ w4 z% O: r9 G7 D
  377.                                 ((FLAG) == FSMC_FLAG_FallingEdge) || \! ?  ^/ ]" D, k8 _  {0 \
  378.                                 ((FLAG) == FSMC_FLAG_FEMPT))3 D. S% I6 E6 G6 ]8 k9 h. g

  379. 6 h6 `: I2 S& c/ F5 ]& S! y
  380. #define IS_FSMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))
    + A/ X6 }3 r3 M  f% Q
复制代码
9 E, h5 d9 f0 Y$ r3 k
03. 相关函数" U( b9 H! O+ r. Q5 U
  1. /* NOR/SRAM Controller functions **********************************************/
    ( A; A; B( }2 W; f% X+ C: U
  2. void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank);7 V) |' Y* e, ^+ O
  3. void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
    : F1 ?! X/ h0 C9 @
  4. void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);4 E6 |& h* [0 c9 z
  5. void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState);
    " ^0 b. G& t+ Y0 d& i# L4 B7 A- _
  6. . A) n9 r/ T6 r" P2 ~" G5 h
  7. /* NAND Controller functions **************************************************/
    : V$ n; F2 }, U6 w* L. h
  8. void FSMC_NANDDeInit(uint32_t FSMC_Bank);
    4 ?; b$ s& Z3 D
  9. void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
    ; u8 W! g- `: J4 s; _+ a
  10. void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
    + h: N. _* g% v5 Q: j, E# U. t, ~
  11. void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState);
    - k4 s) C6 V# H* n# q$ n$ k
  12. void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState);
    6 o. z/ ?" h. r7 A9 c
  13. uint32_t FSMC_GetECC(uint32_t FSMC_Bank);
    : g0 R2 Y" p% i$ L

  14. 2 {7 c9 l. \) c2 x; P4 Y/ ?% Y7 t
  15. /* PCCARD Controller functions ************************************************/# e% I+ R) K: L' w) i' S
  16. void FSMC_PCCARDDeInit(void);$ I* B" \# ?: Q
  17. void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);; W/ [' l8 M4 n* Y
  18. void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);) u. x& O9 j1 K% x
  19. void FSMC_PCCARDCmd(FunctionalState NewState);! m# u& ?  e1 r* R
  20. ' \3 D) X) z" G2 p; d5 \! H
  21. /* Interrupts and flags management functions **********************************/
    $ T* C0 y! }2 @" a; T
  22. void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState);
    % d) _  w1 h7 ^, n) n0 i4 c: w* d
  23. FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
    3 R1 r* y( i1 L, c, K
  24. void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);9 K- U$ J' u( i5 t
  25. ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT);* @5 A$ U. s$ D
  26. void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT);
复制代码

" b+ A5 _6 m6 ^# h% l3 o* a04. 结构体封装, l9 }# I8 m/ ?( ~8 E% b; V( c, S
  1. typedef struct
    ) U7 p1 `( M+ J4 T0 X
  2. {
    ( A/ X3 }; \2 U- ]7 B
  3.   __IO uint32_t BTCR[8];    /*!< NOR/PSRAM chip-select control register(BCR) and chip-select timing register(BTR), Address offset: 0x00-1C */   9 \; n6 W. s6 |' J' S
  4. } FSMC_Bank1_TypeDef;
    1 @" C/ ^! T! k8 O% y* y; X

  5. * x8 y) ]! B) }
  6. /**
      |0 J6 t" M  g8 f% `
  7.   * @brief Flexible Static Memory Controller Bank1E" l" `: H0 w3 j5 r
  8.   */% m. V4 C4 ]+ q8 R5 g

  9. ; l) U& t) e4 t* J% i
  10. typedef struct
    9 d) R! G* O4 R* Z7 X# P" ^; C
  11. {. V/ z1 a- H- K% N' A8 S2 J' @
  12.   __IO uint32_t BWTR[7];    /*!< NOR/PSRAM write timing registers, Address offset: 0x104-0x11C */* h, M, S( V) ]& I# T/ K
  13. } FSMC_Bank1E_TypeDef;
    4 A- f" p  ^  C+ z

  14. $ G& C, \, U! h$ @1 g
  15. /**
    " L! Q3 M2 M  [$ a9 x1 N
  16.   * @brief Flexible Static Memory Controller Bank2
    ; _, u2 S7 G3 O7 Z  _5 O# m' i
  17.   */$ `  R, q" {9 W$ j

  18. 4 _2 y& D! J  I* s
  19. typedef struct
    3 h% h/ F$ q0 f0 S
  20. {$ w& m" d8 }" e; W5 Q0 V* J
  21.   __IO uint32_t PCR2;       /*!< NAND Flash control register 2,                       Address offset: 0x60 */
    0 d: e! {2 c" Y9 u. m) T
  22.   __IO uint32_t SR2;        /*!< NAND Flash FIFO status and interrupt register 2,     Address offset: 0x64 */' X( b: N- A4 u( Z* H. c! R
  23.   __IO uint32_t PMEM2;      /*!< NAND Flash Common memory space timing register 2,    Address offset: 0x68 */
    ; g( j+ J; X1 ]4 o! N0 s7 U
  24.   __IO uint32_t PATT2;      /*!< NAND Flash Attribute memory space timing register 2, Address offset: 0x6C */
    & i9 l' ~2 c) ^! a) E; a1 g
  25.   uint32_t      RESERVED0;  /*!< Reserved, 0x70                                                            *// c8 ?2 U# d* K7 z
  26.   __IO uint32_t ECCR2;      /*!< NAND Flash ECC result registers 2,                   Address offset: 0x74 */
    . \( A- {8 f9 G. D' \: M( r
  27. } FSMC_Bank2_TypeDef;
    6 u& t+ B- d8 f  f2 ?

  28. - C0 A  Z! g' z, C* {1 G
  29. /** - V. j/ L4 O" F# o7 w- Y8 H
  30.   * @brief Flexible Static Memory Controller Bank3) D  g7 b' g( O$ l
  31.   */
    % V8 ~  v! Y- S# z" B, Q3 W

  32. 5 o$ i3 b5 k' {& ?2 q' D. D7 ^. h
  33. typedef struct5 ]: R8 @5 R  \8 c4 o- H1 q4 V
  34. {7 Y( A0 G+ b& s4 N3 ~5 [2 ]
  35.   __IO uint32_t PCR3;       /*!< NAND Flash control register 3,                       Address offset: 0x80 */' ~2 x: q2 p7 F9 r8 _& l, @/ j* ^* Q
  36.   __IO uint32_t SR3;        /*!< NAND Flash FIFO status and interrupt register 3,     Address offset: 0x84 */4 c- ~$ Y/ v1 H
  37.   __IO uint32_t PMEM3;      /*!< NAND Flash Common memory space timing register 3,    Address offset: 0x88 */
    , Y* |. Z6 b# ?  e6 I# r
  38.   __IO uint32_t PATT3;      /*!< NAND Flash Attribute memory space timing register 3, Address offset: 0x8C */
    6 \& b: S2 a/ ^+ Z2 x
  39.   uint32_t      RESERVED0;  /*!< Reserved, 0x90                                                            *// G! e- n6 w$ A- K2 L5 g# c) ^
  40.   __IO uint32_t ECCR3;      /*!< NAND Flash ECC result registers 3,                   Address offset: 0x94 */
    ' {1 R) R; r* k4 g+ y: V
  41. } FSMC_Bank3_TypeDef;
    ' [. S2 R/ ]) |% W

  42. " j: N9 v% I- v5 B) m  O2 t( T+ ]
  43. /** 6 y; B+ z: E5 `0 d2 d
  44.   * @brief Flexible Static Memory Controller Bank4
    " ]- t. |/ O# ~2 m2 S  x9 [
  45.   */+ h; {# B  Y+ ]% `% ?! l

  46. ; p. b4 d: Q/ u  B6 f9 }6 [# _
  47. typedef struct
    - o  @* j' Q7 Q. v, F
  48. {  x# ]- N+ y: K# Q* \. l' V0 p
  49.   __IO uint32_t PCR4;       /*!< PC Card  control register 4,                       Address offset: 0xA0 */6 d& C9 d  G0 i$ r" c4 s
  50.   __IO uint32_t SR4;        /*!< PC Card  FIFO status and interrupt register 4,     Address offset: 0xA4 */
    ; _! P9 X0 s3 ^' W7 t, `
  51.   __IO uint32_t PMEM4;      /*!< PC Card  Common memory space timing register 4,    Address offset: 0xA8 */
      \% \4 ?$ T! _/ ^$ e
  52.   __IO uint32_t PATT4;      /*!< PC Card  Attribute memory space timing register 4, Address offset: 0xAC */7 m$ e3 ]% a. F9 R
  53.   __IO uint32_t PIO4;       /*!< PC Card  I/O space timing register 4,              Address offset: 0xB0 */
    * W  g! c4 ~2 l" j& U
  54. } FSMC_Bank4_TypeDef; 9 v2 _! s8 ?4 Q8 V) Q1 ?3 z+ @

  55. 9 _1 [4 |1 Q; C6 K/ S
复制代码

1 f1 r* M" k; E; H* H& M
赞 收藏 评论0 发布时间:2022-3-29 09:52

举报

0个回答

所属标签

相似技术帖

官网相关资源

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