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

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

[复制链接]
STMCU小助手 发布时间:2022-3-29 09:52
01. 概述
' t5 R% @5 J0 ?4 l. x" N# A5 wFSMC 相关的库函数分布在 stm32f4xx_fsmc.c 文件和头文件 stm32f4xx_fsmc.h 中。7 j: K9 y" r1 L7 [2 H: J

) @$ x4 U3 c! i) J$ S02. 相关类型
, b; d3 n0 O! _9 j! f2 c3 b8 ?FSMC_NORSRAMTimingInitTypeDef类型/ E5 B5 N) C. Y+ E. g3 h

+ Z: f$ s6 n' U, q: S

  1. 1 s; `, {. ]% N& a8 e
  2. /**
      u: m5 _+ N( P8 P' k. c0 a
  3.   * @brief  Timing parameters For NOR/SRAM Banks  9 j  a* b* ]5 ^) z. I
  4.   */
    ' M" n1 r$ A4 M" Y% w. r
  5. typedef struct
    ' v7 F& U# t( n; [
  6. {+ N, _" J' D+ V
  7.   uint32_t FSMC_AddressSetupTime;       /*!< Defines the number of HCLK cycles to configure
    4 p. B0 t) t9 S* }) b& P3 @
  8.                                              the duration of the address setup time. $ c0 v6 f* s; |( [' G8 \& A
  9.                                              This parameter can be a value between 0 and 0xF.
    , r3 o# l$ X: c- \7 p# I, l
  10.                                              @note This parameter is not used with synchronous NOR Flash memories. */
    6 x3 Y- r4 _7 D- R' F' U' c
  11. 7 F( N; s2 h" M7 R( O
  12.   uint32_t FSMC_AddressHoldTime;        /*!< Defines the number of HCLK cycles to configure
    7 }- }4 a3 ~, g& ^' C% p3 E
  13.                                              the duration of the address hold time.
    % J( M- Q. i; R" Q
  14.                                              This parameter can be a value between 0 and 0xF.
    " F' c  D3 G7 A% d4 a: K5 G8 _
  15.                                              @note This parameter is not used with synchronous NOR Flash memories.*/
    5 o: |5 x( b% }+ r
  16. & P0 a5 ]) `* v- ~/ @" u
  17.   uint32_t FSMC_DataSetupTime;          /*!< Defines the number of HCLK cycles to configure
    % N" D; S! m8 |; `% `
  18.                                              the duration of the data setup time.
    ) Y1 G- L1 O$ O5 `& b  }5 B
  19.                                              This parameter can be a value between 0 and 0xFF.3 C+ V$ ~% w; i- P. [3 m8 P# {
  20.                                              @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed NOR Flash memories. */
    $ j4 B1 k# d9 F' Z
  21. ' C, O% o7 V9 w5 y) F+ A. Q
  22.   uint32_t FSMC_BusTurnAroundDuration;  /*!< Defines the number of HCLK cycles to configure5 ?% |5 Q. d: }+ k6 b
  23.                                              the duration of the bus turnaround.( e( Y' t; _: |
  24.                                              This parameter can be a value between 0 and 0xF.
    $ D0 q$ d% I- u8 i1 S1 D
  25.                                              @note This parameter is only used for multiplexed NOR Flash memories. */
    # G4 A9 K" z3 K8 ]$ l

  26. . _5 B$ T  ?% n& g4 O" _* C
  27.   uint32_t FSMC_CLKDivision;            /*!< Defines the period of CLK clock output signal, expressed in number of HCLK cycles.
    8 z2 P3 H  a* N# Y
  28.                                              This parameter can be a value between 1 and 0xF.9 J( X" t' ^- {* T' g8 a5 P
  29.                                              @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM accesses. */
    ' r- J$ o# Y1 O8 Q, {4 i9 M

  30. ! T& r" z) P# j/ d+ e& w
  31.   uint32_t FSMC_DataLatency;            /*!< Defines the number of memory clock cycles to issue2 _+ t! s' G4 s2 a& F3 L2 o# H
  32.                                              to the memory before getting the first data.
    ( w/ E2 A3 p# b
  33.                                              The parameter value depends on the memory type as shown below:! a/ }- q. Q1 |
  34.                                               - It must be set to 0 in case of a CRAM7 \/ c) j, F' {+ Y3 U* j4 B
  35.                                               - It is don't care in asynchronous NOR, SRAM or ROM accesses3 }! g- u% {1 c8 m' T% p! K0 i
  36.                                               - It may assume a value between 0 and 0xF in NOR Flash memories& Z" \( z: x0 S6 }- ]+ n
  37.                                                 with synchronous burst mode enable */
    , c4 _$ S+ G! A% u# \+ N: @
  38. $ s) w# x1 @) ~5 E6 A
  39.   uint32_t FSMC_AccessMode;             /*!< Specifies the asynchronous access mode. 6 Z5 q9 L0 s! A3 S) T7 P
  40.                                              This parameter can be a value of @ref FSMC_Access_Mode */* e+ {  ]9 @4 V2 \; Y
  41. }FSMC_NORSRAMTimingInitTypeDef;
复制代码
$ v, X% I$ y# J7 H/ }! N( R7 A
FSMC_NORSRAMInitTypeDef类型
# j. _5 ^% ?# }9 a9 N
+ ^& L5 G7 ?8 }, D" |5 d1 y
  1. /** # m% J0 B/ \( g! a3 v) q5 t, S
  2.   * @brief  FSMC NOR/SRAM Init structure definition
    4 ?! N& B6 j/ k4 z# ~/ t/ k9 F
  3.   */0 ]8 y/ t) p# {2 n
  4. typedef struct" E8 \/ ?8 f( ]: R$ V5 t- b
  5. {
    * d4 J' `& ~5 Y& c' ]" X9 {: C
  6.   uint32_t FSMC_Bank;                /*!< Specifies the NOR/SRAM memory bank that will be used.
    & d# y& m& L2 M8 J. g# \& N7 m$ H! B
  7.                                           This parameter can be a value of @ref FSMC_NORSRAM_Bank */
    $ _# r( P& x$ A8 o$ j3 Y% O; H

  8. " x0 Q, v4 n/ }' U: }# g/ N' O( @
  9.   uint32_t FSMC_DataAddressMux;      /*!< Specifies whether the address and data values are) @9 o5 k3 F; a* [
  10.                                           multiplexed on the data bus or not. ! B. f$ V6 `5 _7 U* m
  11.                                           This parameter can be a value of @ref FSMC_Data_Address_Bus_Multiplexing */& J9 u" J4 b1 V/ a7 F% p7 X

  12. 4 M  E4 Z5 v; N. e6 d% O- o+ D
  13.   uint32_t FSMC_MemoryType;          /*!< Specifies the type of external memory attached to: U2 ^2 e  d$ k% M9 i8 a
  14.                                           the corresponding memory bank.4 V" ~" w% e1 m9 R3 A; D
  15.                                           This parameter can be a value of @ref FSMC_Memory_Type */
    8 z. l% }0 g. X) u! U

  16. ! v. G; I8 A) R" i
  17.   uint32_t FSMC_MemoryDataWidth;     /*!< Specifies the external memory device width.: N4 P! D3 Q- M! N. \0 Y  D$ [3 r1 D
  18.                                           This parameter can be a value of @ref FSMC_Data_Width */1 [% y  M1 [/ b, Z. u4 _1 j
  19. * F  Z1 G9 k) c5 z
  20.   uint32_t FSMC_BurstAccessMode;     /*!< Enables or disables the burst access mode for Flash memory,; P0 N0 t8 \$ X$ d
  21.                                           valid only with synchronous burst Flash memories.
    : S5 R. B, x1 \$ h0 j
  22.                                           This parameter can be a value of @ref FSMC_Burst_Access_Mode */
    ; ]1 x# |, K/ H) i1 |5 i* D# {
  23. / c1 A# m* G) J6 @# @9 T
  24.   uint32_t FSMC_AsynchronousWait;     /*!< Enables or disables wait signal during asynchronous transfers,
    5 q3 }$ H2 l9 M
  25.                                           valid only with asynchronous Flash memories.7 {6 j' o5 z8 M, p& Q, C
  26.                                           This parameter can be a value of @ref FSMC_AsynchronousWait */                                          
    0 k# [* ^8 C- o. b* H& ^) b

  27. . Q* c1 K, R! U
  28.   uint32_t FSMC_WaitSignalPolarity;  /*!< Specifies the wait signal polarity, valid only when accessing6 J) o  E$ J- t) ]1 e. O& p. [# k" L
  29.                                           the Flash memory in burst mode.! K9 o8 t* B- m' o& J0 W8 W! T
  30.                                           This parameter can be a value of @ref FSMC_Wait_Signal_Polarity *// U' c) i2 c3 N  D. U8 z; [
  31. ( p5 ~, u" q: Y7 O0 A
  32.   uint32_t FSMC_WrapMode;            /*!< Enables or disables the Wrapped burst access mode for Flash  l  Z! Z, T2 j% y
  33.                                           memory, valid only when accessing Flash memories in burst mode.
    : z( g$ }/ Y8 y8 d% z7 q! u
  34.                                           This parameter can be a value of @ref FSMC_Wrap_Mode */$ `5 {) m+ k5 z0 x0 e: K( G
  35. # _6 c& e) M, ]. y6 A  R' N5 o! K
  36.   uint32_t FSMC_WaitSignalActive;    /*!< Specifies if the wait signal is asserted by the memory one
    " A& E7 o4 q5 W' F9 S8 x2 x7 L
  37.                                           clock cycle before the wait state or during the wait state,
    ) E' B3 P8 G9 [& [0 b
  38.                                           valid only when accessing memories in burst mode. , T0 x1 }0 F. A6 x' f9 W6 p( [% U! r# v
  39.                                           This parameter can be a value of @ref FSMC_Wait_Timing */
    7 p( }1 N# t& e
  40. ( {( p- ]( F; P* w/ M
  41.   uint32_t FSMC_WriteOperation;      /*!< Enables or disables the write operation in the selected bank by the FSMC. ) x3 B8 a& Q1 F( X% P8 F
  42.                                           This parameter can be a value of @ref FSMC_Write_Operation */
    2 K2 a6 i/ F5 ~6 N6 o
  43. " e: G$ O6 n7 m, S$ _! b# B! ]
  44.   uint32_t FSMC_WaitSignal;          /*!< Enables or disables the wait state insertion via wait, r5 v7 `3 A. f* n! [0 M" U2 l) a! Z; U
  45.                                           signal, valid for Flash memory access in burst mode. , \4 d4 J; x) t1 G4 B
  46.                                           This parameter can be a value of @ref FSMC_Wait_Signal */
      Q, Z* v# u) l  X# S" X/ T
  47. 8 n+ q. o" s/ t5 J  W: m
  48.   uint32_t FSMC_ExtendedMode;        /*!< Enables or disables the extended mode.
    ( Y& w! n1 @9 R
  49.                                           This parameter can be a value of @ref FSMC_Extended_Mode */8 W( z# o: H+ H, n6 `

  50.   s; n, y) j; S5 S
  51.   uint32_t FSMC_WriteBurst;          /*!< Enables or disables the write burst operation.0 P, R' T1 W/ l, R! l
  52.                                           This parameter can be a value of @ref FSMC_Write_Burst */ 9 o1 S1 C' {1 c$ x% t
  53. ' v, b: n0 r1 O6 e
  54.   FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct; /*!< Timing Parameters for write and read access if the  Extended Mode is not used*/  
    7 A' r% E2 ?( t( Z" c
  55. 2 T! a, C3 ?6 Y" c( ^& z9 ]
  56.   FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct;     /*!< Timing Parameters for write access if the  Extended Mode is used*/      
    0 j) R% Y) T) w+ v
  57. }FSMC_NORSRAMInitTypeDef;
复制代码

: B5 N9 x# w- g3 [! nFSMC_NAND_PCCARDTimingInitTypeDef类型
+ k! d8 \7 B) x& |# a, ~
% Y0 h. t' y7 d! B/ Y# S
  1. /**
    % g) Q) G* [6 F2 K8 B! ]
  2.   * @brief  Timing parameters For FSMC NAND and PCCARD Banks9 I# V. z) ~+ H; M7 x- R
  3.   */
    6 r$ V' o5 t, `& }, d
  4. typedef struct! @2 \; D/ N/ B0 V% y5 l
  5. {
    ) v6 }+ |7 w$ d% }9 N5 F
  6.   uint32_t FSMC_SetupTime;      /*!< Defines the number of HCLK cycles to setup address before6 ^! r5 H6 Z4 z
  7.                                      the command assertion for NAND Flash read or write access6 _( _- P2 k2 v, ]) L
  8.                                      to common/Attribute or I/O memory space (depending on
    + L" c; r: M0 y& l
  9.                                      the memory space timing to be configured).
    . n. L. q6 v! j' F- J
  10.                                      This parameter can be a value between 0 and 0xFF.*/, p" u' s" ?  ~% c$ Y
  11. # E* \' l  b9 m' W
  12.   uint32_t FSMC_WaitSetupTime;  /*!< Defines the minimum number of HCLK cycles to assert the
    6 R9 _: Y4 Z- M# T7 x, Y& W
  13.                                      command for NAND Flash read or write access to4 y3 B6 s; ]+ l6 N4 @% L- z9 l
  14.                                      common/Attribute or I/O memory space (depending on the
    % C, _+ T& E: _! q: ^
  15.                                      memory space timing to be configured).
    2 K& b5 ]* q& ?/ p( e( o& B
  16.                                      This parameter can be a number between 0x00 and 0xFF */* o! }0 g& W" N0 T  n* C
  17. " Z3 w* `$ K$ U% s2 d
  18.   uint32_t FSMC_HoldSetupTime;  /*!< Defines the number of HCLK clock cycles to hold address1 w4 {# _* s1 ]; B3 @8 D9 V
  19.                                      (and data for write access) after the command de-assertion" {7 ?5 u; T, R$ d, L7 H$ ^
  20.                                      for NAND Flash read or write access to common/Attribute
    " \! ]$ q7 s: j
  21.                                      or I/O memory space (depending on the memory space timing  G0 H( L4 ^; H
  22.                                      to be configured).2 i9 k) V  I6 Y  \  \; f/ ~. r) c
  23.                                      This parameter can be a number between 0x00 and 0xFF */
    , _# ~( [6 q' x" E. j

  24. ! O: j; {5 U& t8 n0 X
  25.   uint32_t FSMC_HiZSetupTime;   /*!< Defines the number of HCLK clock cycles during which the
    # i2 ?4 _8 _: M
  26.                                      data bus is kept in HiZ after the start of a NAND Flash* K- |3 j3 H. b9 z! Q! c0 E, t. {
  27.                                      write access to common/Attribute or I/O memory space (depending4 H2 i! E# o) d; l7 y
  28.                                      on the memory space timing to be configured).) z' ?/ g1 H$ i
  29.                                      This parameter can be a number between 0x00 and 0xFF */7 q6 K" R" J. h, p, Q4 w
  30. }FSMC_NAND_PCCARDTimingInitTypeDef;
复制代码
* s# L: }; S/ n6 }
FSMC_NANDInitTypeDef类型( r3 y8 Q) a+ W+ O' g- V0 |1 {
* J/ {) Z4 w, `; `- c/ e) K" J
  1. /** : z! J$ |, E  [" h
  2.   * @brief  FSMC NAND Init structure definition
    # J# m4 E! p+ Q" @7 W* }8 C
  3.   */6 O9 w( [3 n# z- E* N/ m
  4. typedef struct
    ; @# J: L% @! s& M! T) g# g
  5. {
    " S' Y% G- X, ]2 v; A
  6.   uint32_t FSMC_Bank;              /*!< Specifies the NAND memory bank that will be used.( T7 p7 F3 W; V# d$ X: C  H
  7.                                       This parameter can be a value of @ref FSMC_NAND_Bank */
      ~+ X4 J1 }, I/ ^, d
  8. 8 z  V3 _5 o8 m1 x
  9.   uint32_t FSMC_Waitfeature;      /*!< Enables or disables the Wait feature for the NAND Memory Bank.) n5 @( V4 w' N* }" i3 L8 |
  10.                                        This parameter can be any value of @ref FSMC_Wait_feature */! l" _' k' e: [. h+ \: U, Y

  11. ) f6 J9 p4 _% G6 _# o
  12.   uint32_t FSMC_MemoryDataWidth;  /*!< Specifies the external memory device width.
    0 f3 ^- L6 }8 k& J+ m* Y0 |
  13.                                        This parameter can be any value of @ref FSMC_Data_Width */1 K& I# V' Y0 l/ F9 O& _
  14. % ?6 P" g! N% ?% ~
  15.   uint32_t FSMC_ECC;              /*!< Enables or disables the ECC computation.
    ; \* r; e. u' @+ b7 e
  16.                                        This parameter can be any value of @ref FSMC_ECC */4 Y1 S8 f) J& m9 J8 M& [6 X

  17. 8 D5 b5 M0 ?& j* `' I1 a0 Z2 E
  18.   uint32_t FSMC_ECCPageSize;      /*!< Defines the page size for the extended ECC.5 J! m" Z# k/ g" x6 E
  19.                                        This parameter can be any value of @ref FSMC_ECC_Page_Size */3 S: M( @& G8 I5 H1 R& [  S1 n
  20. 5 D* l/ f6 Q& L2 X! n0 @. f
  21.   uint32_t FSMC_TCLRSetupTime;    /*!< Defines the number of HCLK cycles to configure the
    0 v" W( h1 a$ |* N# f: v* I, p
  22.                                        delay between CLE low and RE low.
    ) N# D8 J' Q  `. s0 `3 ]$ P7 D
  23.                                        This parameter can be a value between 0 and 0xFF. */  Q6 O" N  r! D6 j3 o
  24. ' I6 `7 J9 {8 ~( n9 y0 |# ?3 w0 e
  25.   uint32_t FSMC_TARSetupTime;     /*!< Defines the number of HCLK cycles to configure the* y( G5 l1 G7 v3 F
  26.                                        delay between ALE low and RE low.
    ( `0 O0 w% I6 j& ^& t- n
  27.                                        This parameter can be a number between 0x0 and 0xFF */ ; a: g. v* T. L/ S$ i; q) i
  28. % G! V4 F5 v0 u
  29.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct;   /*!< FSMC Common Space Timing */ 9 |4 [# }, j8 Z7 U2 t1 B0 F! U
  30.   I% p& e8 P% X- P% d
  31.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct; /*!< FSMC Attribute Space Timing */% l8 l! D) p8 `6 u
  32. }FSMC_NANDInitTypeDef;
复制代码

0 _& w1 C. e% L2 {3 NFSMC_PCCARDInitTypeDef类型
6 U# |, x+ r8 N3 l. h7 P+ J

5 T. d+ g3 f+ _, {  a. E
  1. /** : p* a/ j2 i" O
  2.   * @brief  FSMC PCCARD Init structure definition% \. G# K' @, U, q- X# G
  3.   */
    * K6 P  D3 c+ y6 T$ x3 L! A5 ^
  4. 1 _7 l  R4 c' y. u8 a5 ^
  5. typedef struct6 u+ i4 ]( e3 U8 y. B! Y
  6. {
    , h) t8 n0 P) T! v# h8 [4 f
  7.   uint32_t FSMC_Waitfeature;    /*!< Enables or disables the Wait feature for the Memory Bank.) T  p6 N( h7 y
  8.                                     This parameter can be any value of @ref FSMC_Wait_feature *// H8 z5 ?4 h; R

  9. 3 J9 U. l9 o" F8 G( S; j
  10.   uint32_t FSMC_TCLRSetupTime;  /*!< Defines the number of HCLK cycles to configure the
    - H: t; |- U- ^$ U
  11.                                      delay between CLE low and RE low.. O  }! Y& u% s% V/ |
  12.                                      This parameter can be a value between 0 and 0xFF. */" F- a9 Y$ Y$ N2 _

  13.   J0 C7 u! g8 k7 I9 |8 d1 M
  14.   uint32_t FSMC_TARSetupTime;   /*!< Defines the number of HCLK cycles to configure the2 j# |" Z4 {  a% ~6 _
  15.                                      delay between ALE low and RE low.
    " u/ P/ q, ^& I5 K" z
  16.                                      This parameter can be a number between 0x0 and 0xFF */
    / m' m* }* I( s/ ]3 n, w4 _  X( j
  17. $ ~) f+ I- t6 W' T# ?$ x

  18. 0 E5 }+ N1 L( L
  19.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct; /*!< FSMC Common Space Timing */8 p" s8 _" v& ]0 @: Y7 ^) k. {
  20. # m6 z- `% [9 n  `5 r" n
  21.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct;  /*!< FSMC Attribute Space Timing */
    * G; ~) G0 ?! p, ?) B" N6 K6 J

  22. # F7 F, I- P4 d, p+ m, d6 E; R* r
  23.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_IOSpaceTimingStruct; /*!< FSMC IO Space Timing */  . T' C( o. X1 g. p
  24. }FSMC_PCCARDInitTypeDef;
    0 U6 v. d; c5 U
复制代码

3 B2 K% ^# J; ]! c1 Q. l相关宏定义
& V& [! `) F4 m
# l4 N3 Y, e; u- X( @# s
  1. /** @defgroup FSMC_Exported_Constants, \, c: O, r% \5 a3 \
  2.   * @{9 A+ n( L' O0 i& f4 B& \* |: l! g
  3.   */+ ^" `  F% j. K0 N
  4. . F( @. {5 y( R' }. Q% J1 e
  5. /** @defgroup FSMC_NORSRAM_Bank , |5 T, }) Z5 f
  6.   * @{7 s5 z9 G5 n& v0 n. U
  7.   */
    8 k# _! Y" Y8 R5 |8 f5 _: _  `$ u
  8. #define FSMC_Bank1_NORSRAM1                      ((uint32_t)0x00000000)
    1 G. U+ l( b8 I% @) C
  9. #define FSMC_Bank1_NORSRAM2                      ((uint32_t)0x00000002)$ L6 Y% w' S1 t# Z& [# n
  10. #define FSMC_Bank1_NORSRAM3                      ((uint32_t)0x00000004)
    : @" F3 L! P# j! i* ?+ Z% e
  11. #define FSMC_Bank1_NORSRAM4                      ((uint32_t)0x00000006)
    9 q1 [; F8 {" l
  12. /**
    ( S* P/ z# \+ f- v
  13.   * @}! |! Z9 S- Y' }7 H; {1 }
  14.   */- k  K2 H9 d. L1 k% ]

  15. 2 q- [3 m: f8 r  s) d
  16. /** @defgroup FSMC_NAND_Bank $ T; K" F5 F6 h) Q. Q" E
  17.   * @{9 N, L1 g! V  L
  18.   */  
    9 K5 d0 _/ g* v7 o' s# V$ ?
  19. #define FSMC_Bank2_NAND                          ((uint32_t)0x00000010)
    & ^, d. Y6 K) i7 _0 X
  20. #define FSMC_Bank3_NAND                          ((uint32_t)0x00000100)
    6 {2 x( E/ L0 J* b$ a, G
  21. /**  p6 H+ `  e9 h  K
  22.   * @}
    ! Q! Y2 L& l* ]4 M
  23.   */
    0 D$ J% R; ~* \- L- z! W

  24. 7 O8 D  z9 T# Y7 E+ g/ N2 q
  25. /** @defgroup FSMC_PCCARD_Bank - \8 u8 T( u9 t5 S9 C, ^* o5 D
  26.   * @{
    ! u3 J: J1 s% u9 W* B# A7 \' O
  27.   */    % R8 |9 b7 r( T, H2 i! X5 K2 B
  28. #define FSMC_Bank4_PCCARD                        ((uint32_t)0x00001000): u$ }) y* e: t* S3 v/ h
  29. /**. l' D6 z3 Q0 w0 `3 O; d2 X
  30.   * @}
    , b% E( ~2 H% U6 J6 h% W1 S+ }
  31.   */
    % H! I+ Q0 g1 J* P" n, N7 O( P
  32. ! r8 z! \9 m( |* g( {
  33. #define IS_FSMC_NORSRAM_BANK(BANK) (((BANK) == FSMC_Bank1_NORSRAM1) || \
    , X* s! S0 C- l$ J
  34.                                     ((BANK) == FSMC_Bank1_NORSRAM2) || \1 ^5 p& D1 g, C' s
  35.                                     ((BANK) == FSMC_Bank1_NORSRAM3) || \) w# h( \1 G) S: o
  36.                                     ((BANK) == FSMC_Bank1_NORSRAM4))- Y+ Y! Y: s% Q/ f! v
  37. : y2 k, f- b) H4 q
  38. #define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \7 O/ ^9 X* q) }% r
  39.                                  ((BANK) == FSMC_Bank3_NAND))
    , G0 j8 s5 x  ?# K! N3 }

  40. ( y8 ?, K' k& @1 V
  41. #define IS_FSMC_GETFLAG_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
    / z& K5 e$ w( i! P
  42.                                     ((BANK) == FSMC_Bank3_NAND) || \7 r( m7 D7 ~, r# o: a6 G. Q
  43.                                     ((BANK) == FSMC_Bank4_PCCARD))
    & |. J  C' _% x6 ]* D

  44. ' Q: p( c, v0 l
  45. #define IS_FSMC_IT_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \4 M( [! t: ?0 O2 J; V
  46.                                ((BANK) == FSMC_Bank3_NAND) || \
    & i! u; e+ B- J0 [
  47.                                ((BANK) == FSMC_Bank4_PCCARD))
    9 i' Q2 S, q  S* U2 K  ?
  48. 3 E/ h; Z' M) ]" k1 K7 t/ ^
  49. /** @defgroup FSMC_NOR_SRAM_Controller
    3 }$ }: B3 K# J
  50.   * @{
    9 P1 u  O. T3 Y. g3 v$ {* I6 Y
  51.   */# @/ H( O% q- q* y

  52. 2 Z$ ]1 Y& M8 E
  53. /** @defgroup FSMC_Data_Address_Bus_Multiplexing
    0 b" D. L$ w+ G
  54.   * @{
    ) [3 A1 o1 Z) @2 S% `& H
  55.   */# k( O* Q& R; m- f1 l2 C$ c

  56. $ n* L4 g; s1 n& ]
  57. #define FSMC_DataAddressMux_Disable                ((uint32_t)0x00000000)" L4 Z* ?0 x; ^+ w: d) v
  58. #define FSMC_DataAddressMux_Enable                 ((uint32_t)0x00000002)" ^) u- N( U6 S, w2 U3 v! P
  59. #define IS_FSMC_MUX(MUX) (((MUX) == FSMC_DataAddressMux_Disable) || \$ G/ h: ]7 b- m
  60.                           ((MUX) == FSMC_DataAddressMux_Enable))
    0 Y  U) y& Y+ u0 _3 }
  61. /**+ z! h2 X6 |8 c' N
  62.   * @}
    ; {5 m: \4 _* @/ U2 u4 x* X% S) M
  63.   */! X  V5 n' q, H

  64. - P  K% _6 D! s/ H' l" z
  65. /** @defgroup FSMC_Memory_Type , T2 i3 M& w- R9 t$ D/ u$ r  |
  66.   * @{
    7 x1 N5 D# f0 }4 ^1 s- w
  67.   */
    6 U% T, _; y  s3 X

  68. 4 z* A5 I# @8 z6 j# M# t- h
  69. #define FSMC_MemoryType_SRAM                     ((uint32_t)0x00000000). [8 b9 I, `% W! h
  70. #define FSMC_MemoryType_PSRAM                    ((uint32_t)0x00000004)
    % T5 @$ ]1 }$ `/ a& Y
  71. #define FSMC_MemoryType_NOR                      ((uint32_t)0x00000008)4 B2 L0 V* J+ M" b8 x9 v2 g) Z9 a
  72. #define IS_FSMC_MEMORY(MEMORY) (((MEMORY) == FSMC_MemoryType_SRAM) || \
    ( i2 w+ {8 _" _& ?
  73.                                 ((MEMORY) == FSMC_MemoryType_PSRAM)|| \4 O) w+ X# ?/ s9 ?
  74.                                 ((MEMORY) == FSMC_MemoryType_NOR))! u: F3 L# M$ {3 @/ J+ r1 [, R$ p
  75. /**% s& m1 f- I- q% b7 }% H
  76.   * @}
    - T: c6 m1 o, r2 a1 @
  77.   */
    7 I& _8 @( J, N. t7 l

  78. 8 S% K8 e, H+ _8 r6 i
  79. /** @defgroup FSMC_Data_Width
    ; P( d' I9 @$ ]2 V0 C1 G
  80.   * @{4 }: t" t4 f+ f  l
  81.   */
    + e1 R& E5 z8 s$ i7 h

  82. ) P. F- Q- Q3 k2 u# [
  83. #define FSMC_MemoryDataWidth_8b                  ((uint32_t)0x00000000)
    ! P+ h: a- V& p" B
  84. #define FSMC_MemoryDataWidth_16b                 ((uint32_t)0x00000010)) H' R, @9 g, C& M7 P
  85. #define IS_FSMC_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \4 z; ]$ x$ [* T: O  k4 o- R
  86.                                      ((WIDTH) == FSMC_MemoryDataWidth_16b))
    5 [2 N4 y# v1 G6 f8 B& m" z6 h( I! V
  87. /**4 X+ N* G) ?0 P; D0 S: k
  88.   * @}1 Q0 F% W- C5 [9 Q! r
  89.   */5 \4 S* B4 `$ q  X  r, \/ i

  90. 8 U( g+ r# ^! u) t
  91. /** @defgroup FSMC_Burst_Access_Mode 4 P! N( ]$ c7 g" p9 ^
  92.   * @{
    " M5 g! U& R# z: u, M
  93.   */
    8 G4 [7 J: S$ G2 P7 Q, g( h
  94. 8 }' g" ]" `; w
  95. #define FSMC_BurstAccessMode_Disable             ((uint32_t)0x00000000) " {, n3 S! ]1 x3 _' P
  96. #define FSMC_BurstAccessMode_Enable              ((uint32_t)0x00000100)
    & ^* `" d) A$ x: ?
  97. #define IS_FSMC_BURSTMODE(STATE) (((STATE) == FSMC_BurstAccessMode_Disable) || \
    0 I6 T, V- @8 s% e4 g$ R8 K
  98.                                   ((STATE) == FSMC_BurstAccessMode_Enable))
    : I- i9 G' ^4 C% |/ q
  99. /**
    # d2 X, a$ Q8 }9 E. o9 v) ?5 k
  100.   * @}2 c8 p4 d5 I% n+ s0 {# i6 E
  101.   *// k7 g$ Z. S& {2 Z

  102. 1 D- P6 H  U: @+ I5 d  c! a
  103. /** @defgroup FSMC_AsynchronousWait 6 {; B6 v& {- X  ]
  104.   * @{5 I9 L7 o7 d! H6 b5 T8 Y" T
  105.   */3 w; ^# ~$ Q1 f) ]  u/ o
  106. #define FSMC_AsynchronousWait_Disable            ((uint32_t)0x00000000)
      X' Z; W2 }4 g# w( K& @
  107. #define FSMC_AsynchronousWait_Enable             ((uint32_t)0x00008000)
    - w0 G8 G7 F1 v( x  o5 A
  108. #define IS_FSMC_ASYNWAIT(STATE) (((STATE) == FSMC_AsynchronousWait_Disable) || \$ s2 _+ m, F( C, N3 [: u
  109.                                  ((STATE) == FSMC_AsynchronousWait_Enable))6 ?$ _! L  O2 y( M% c; B) ?
  110. /**: q9 z1 ~; y% H' Y5 Q
  111.   * @}, X5 @5 x* g' v7 L
  112.   */" @/ A3 }( z, h! `3 c
  113. + d& B* b  P$ r0 r* w+ b
  114. /** @defgroup FSMC_Wait_Signal_Polarity ; Q% J. g: D) A; i2 B
  115.   * @{  }' \- e0 W' C+ J, S
  116.   */* l& ~; }: [- K6 K0 o$ A) ?$ B+ S
  117. #define FSMC_WaitSignalPolarity_Low              ((uint32_t)0x00000000)
    9 {5 V7 I9 V& |  k: Q/ r+ F
  118. #define FSMC_WaitSignalPolarity_High             ((uint32_t)0x00000200)! c) G* y% f7 t1 r
  119. #define IS_FSMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FSMC_WaitSignalPolarity_Low) || \
    * Y* }4 b0 w9 [5 _+ K+ i
  120.                                          ((POLARITY) == FSMC_WaitSignalPolarity_High))
    % w' [; i( G$ R7 t) ~/ t
  121. /**$ Q2 v  f4 u$ \1 A9 k. z+ w7 A' U4 t$ Z' Z
  122.   * @}# t. c8 b6 {& z0 B+ B1 \8 f
  123.   */1 [! {9 V7 }- N. D" T
  124. 5 |/ C  q7 r) t! o8 y
  125. /** @defgroup FSMC_Wrap_Mode
    ' i* P, J4 m% |0 @
  126.   * @{
    4 K6 H# \: q: R" `& |+ c: L  E
  127.   */
    : [: a9 H  T, X
  128. #define FSMC_WrapMode_Disable                    ((uint32_t)0x00000000)5 l( {" N, j: F8 |* u
  129. #define FSMC_WrapMode_Enable                     ((uint32_t)0x00000400)
    ; V  e6 l, \2 @/ L2 x9 ^
  130. #define IS_FSMC_WRAP_MODE(MODE) (((MODE) == FSMC_WrapMode_Disable) || \
    - L4 k) ?' V+ J: O% r8 I7 \5 A3 p
  131.                                  ((MODE) == FSMC_WrapMode_Enable))5 q2 }2 v( f5 R- l
  132. /**; I) M5 I+ k/ Q* J+ F
  133.   * @}3 p* W, K- L- P/ u/ o3 p' d
  134.   */0 W/ A. B+ Q0 P& z, z4 B

  135. 0 C& k* n7 |3 ^8 E2 a
  136. /** @defgroup FSMC_Wait_Timing . I4 k- W8 R, E# p4 [
  137.   * @{( Z2 V2 S8 ]; x! H1 P
  138.   */
    ' {* ~# S7 x; u8 u/ a7 z+ u
  139. #define FSMC_WaitSignalActive_BeforeWaitState    ((uint32_t)0x00000000)% t/ ~2 K/ A) b( H
  140. #define FSMC_WaitSignalActive_DuringWaitState    ((uint32_t)0x00000800)   a5 w5 u! ~# v' J" Y2 O
  141. #define IS_FSMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FSMC_WaitSignalActive_BeforeWaitState) || \# |; G1 H8 y- }
  142.                                             ((ACTIVE) == FSMC_WaitSignalActive_DuringWaitState))
    7 O5 r8 @: h4 G5 ~7 d1 |  h
  143. /**" C' s, R5 Q/ O7 F* f- `
  144.   * @}) x3 m/ U( V2 `8 @. L+ A' j1 g
  145.   */$ c7 g' M* i0 m1 {1 }# R
  146. 5 G$ v4 L" e. Q* y
  147. /** @defgroup FSMC_Write_Operation * I$ k3 `0 F- ?/ I! I, I, F
  148.   * @{
    - m$ w; ^8 c. Q! l! o6 K& W7 e
  149.   */$ Y0 o  s( c. |9 X4 b
  150. #define FSMC_WriteOperation_Disable                     ((uint32_t)0x00000000)
    ' ]; E- w+ a8 p
  151. #define FSMC_WriteOperation_Enable                      ((uint32_t)0x00001000)
    # c4 w& }' w7 ?! r( z
  152. #define IS_FSMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FSMC_WriteOperation_Disable) || \
    ' j: W2 x6 \# w  p; @. n) Q
  153.                                             ((OPERATION) == FSMC_WriteOperation_Enable))                         1 F* K# z; Y; d
  154. /**
    $ K2 u0 H: f- X/ ^5 {2 y5 E. b: S
  155.   * @}7 {2 c  I( B9 X) j( `
  156.   */
    ' X4 V" L& c" G: [) ~# t
  157. : Q" k% `, e( e9 R5 m! y
  158. /** @defgroup FSMC_Wait_Signal
    ; A; h8 a/ p/ A9 \$ `4 D: E  o
  159.   * @{/ a- Q- x5 X# F9 s+ J
  160.   */- a8 E' g% Y, f/ l8 Q% u5 n" N) j
  161. #define FSMC_WaitSignal_Disable                  ((uint32_t)0x00000000)' c1 ~/ m( z8 {- i3 U) b4 z
  162. #define FSMC_WaitSignal_Enable                   ((uint32_t)0x00002000)
    ) u, ~: Q; ?' t  x. C; b
  163. #define IS_FSMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FSMC_WaitSignal_Disable) || \
    ) |8 s! D. t7 a: z* j0 O
  164.                                       ((SIGNAL) == FSMC_WaitSignal_Enable))7 q# \; F/ c+ B' D, j% I+ x
  165. /**
    2 ~; u! z/ D% t& W) o8 }
  166.   * @}
    ! r* Z2 b& Q' F% w' P
  167.   */0 J' F+ X) B8 H8 f+ [% n

  168. " ~4 {9 \; t: g8 F" E. ]# a' y
  169. /** @defgroup FSMC_Extended_Mode . M6 v, M; M7 h, u" O
  170.   * @{
    " p" o- C8 }+ X* _2 X
  171.   */- B+ N- E3 d# H' O7 I$ f
  172. #define FSMC_ExtendedMode_Disable                ((uint32_t)0x00000000), h4 g; h5 L: t. K: o/ J* m
  173. #define FSMC_ExtendedMode_Enable                 ((uint32_t)0x00004000)
    & h6 R' n4 X" S9 C: x9 d

  174. 3 b7 X# B1 I! q0 y; a
  175. #define IS_FSMC_EXTENDED_MODE(MODE) (((MODE) == FSMC_ExtendedMode_Disable) || \
    - d1 n- o, L3 H4 ^
  176.                                      ((MODE) == FSMC_ExtendedMode_Enable)) ! W- W& v2 e4 L
  177. /**- u: F3 t% T" |" U6 o1 A
  178.   * @}( z2 K* O# ]  X7 {2 y- c
  179.   */1 Q* ^4 Q4 {4 t3 A( g) X: {
  180.   ]( Q# l8 y8 v/ m7 P6 _
  181. /** @defgroup FSMC_Write_Burst 0 R0 x+ e, W: ]. Q
  182.   * @{: k/ l! l% F( e
  183.   */; U) Q* S. }$ k8 L

  184. # V9 _" P1 g. |, Y, g2 f; o+ [
  185. #define FSMC_WriteBurst_Disable                  ((uint32_t)0x00000000)" ?; I' M& u; z% O
  186. #define FSMC_WriteBurst_Enable                   ((uint32_t)0x00080000)
    - c2 l$ ^1 @4 {7 j6 b
  187. #define IS_FSMC_WRITE_BURST(BURST) (((BURST) == FSMC_WriteBurst_Disable) || \4 i+ T# b# r% Q6 E' c! u6 t4 P
  188.                                     ((BURST) == FSMC_WriteBurst_Enable)). N2 s7 k7 Z- A' ~
  189. /**) |8 J# d* ]" a0 }
  190.   * @}
    , p# l3 I0 T" _2 ?
  191.   */
    ; l- m* J  b0 F
  192. - D, k3 z: V" H6 p* P$ k5 {
  193. /** @defgroup FSMC_Address_Setup_Time " q4 ~" H: N6 x; i( t3 G
  194.   * @{2 L9 @4 S) K: D
  195.   */
    0 d3 C" z8 ?( z9 U
  196. #define IS_FSMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 0xF)! I7 O/ X9 s6 r$ J0 X  Y# v
  197. /**  l  T/ q. j! O9 s
  198.   * @}( R7 X2 t7 W3 `9 b
  199.   */
    ( C  o8 m2 Z+ x2 |7 X

  200. 4 K# y; z3 a) f/ B
  201. /** @defgroup FSMC_Address_Hold_Time ( j, w; I) m% `) v# \" d( x
  202.   * @{# N2 u  g/ w% |) a. j; Y" Z
  203.   */
    . J3 U& }! R9 ~% w1 [# k
  204. #define IS_FSMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF)
    " S; \$ A7 R. S1 S3 }
  205. /**7 w6 n! Q5 B  Z4 |0 w+ f
  206.   * @}. R, h0 h9 V! |4 i" R: C
  207.   */6 X: F  H2 m, m4 P6 H
  208. ) {1 x/ ^4 ^# J6 E8 z
  209. /** @defgroup FSMC_Data_Setup_Time
    ' B7 \% g; r$ C) q: N8 U  _$ @
  210.   * @{
    ' F) X' R3 v" M: X6 y; Y4 z8 x
  211.   */
    ; d; y; X2 P! k' R( U( B  o1 X  @
  212. #define IS_FSMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF))9 H* L2 a% i+ W3 @+ s
  213. /**
    1 F5 p% X4 t1 l5 f6 e1 A
  214.   * @}
      x1 m# L3 K" Y. h
  215.   */
    , H  C' E4 q/ D" y

  216. 6 r6 R" B. Q) N' Z6 n; o$ x' }
  217. /** @defgroup FSMC_Bus_Turn_around_Duration
    - o/ L. {+ F0 ]+ ]" J% V7 g# g/ r
  218.   * @{
    3 w" Z9 h6 n5 ]* y9 d. C  B; ^
  219.   */) Q7 O9 g5 @: i( w
  220. #define IS_FSMC_TURNAROUND_TIME(TIME) ((TIME) <= 0xF)4 `0 \8 ]: k/ n0 x. }; I. N/ f& L& a6 S
  221. /**' Z/ A7 O  |4 j3 D) R2 ^
  222.   * @}% K4 ?2 S9 J; k+ v
  223.   */
    $ S0 l6 H- p4 x* D. m

  224. 9 ~, y& x1 ?+ o5 y# @% y8 V+ z. Z
  225. /** @defgroup FSMC_CLK_Division
    ; v3 O( R* u8 Z) F
  226.   * @{) @8 d1 \9 s. C7 ?
  227.   */3 p) v6 r- u6 y# ~; e9 z
  228. #define IS_FSMC_CLK_DIV(DIV) ((DIV) <= 0xF)
    2 C9 W: y: S3 [6 }' l' g# C' R
  229. /**& l, x! f: s4 S9 s- o+ D% g4 k
  230.   * @}
    ! b, q% `- v- J
  231.   */
    ; d! y9 c" p5 S- d. k# Y- Z
  232. 8 X! e0 J% n0 I6 ~, w  e
  233. /** @defgroup FSMC_Data_Latency   ^! w( R: R$ \+ L- P
  234.   * @{
    2 I2 f2 j# U+ J7 k
  235.   */' W$ y0 T- e2 _' I' C8 b' Z7 ~
  236. #define IS_FSMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 0xF); Y( d, R$ M8 m( z$ u: Z
  237. /**  O6 v/ d$ M; J8 K! T8 x
  238.   * @}
    $ k/ i. M: Q3 g+ Q" c
  239.   */% m. {: F* J/ M+ G( f  `

  240. ; r; c( z" _( ~
  241. /** @defgroup FSMC_Access_Mode / l5 l. C- A. F  o: S, @' s2 B4 g
  242.   * @{4 C, b, u: O$ n1 I* ]
  243.   */
    ' r: E" {+ t/ Z; i
  244. #define FSMC_AccessMode_A                        ((uint32_t)0x00000000)* j2 z' ?$ o6 t! W, w2 G
  245. #define FSMC_AccessMode_B                        ((uint32_t)0x10000000) , n& X* i5 ]1 O) T( |5 e" L
  246. #define FSMC_AccessMode_C                        ((uint32_t)0x20000000)
    % r8 v$ {) O& b" y
  247. #define FSMC_AccessMode_D                        ((uint32_t)0x30000000)
    ! |* }6 `7 _/ a+ Z. l
  248. #define IS_FSMC_ACCESS_MODE(MODE) (((MODE) == FSMC_AccessMode_A) || \
    3 \4 b. l- ?4 A7 P
  249.                                    ((MODE) == FSMC_AccessMode_B) || \5 z3 Y  o& ]- d/ t0 _$ [
  250.                                    ((MODE) == FSMC_AccessMode_C) || \6 o) s* q* D9 s6 \# y
  251.                                    ((MODE) == FSMC_AccessMode_D))
    7 j! v/ ^/ P6 N4 e& a( x
  252. /**+ S* q1 T( M0 {5 |/ N  _
  253.   * @}0 _" S+ I! S  h7 n8 Q
  254.   */
    * P7 D% r: u7 }& K# T% n: i7 c

  255. 3 j5 T$ }# y/ ], {* N# e
  256. /**
    ' y( K7 G9 s! m9 H; l
  257.   * @}, g! w% W3 z/ O
  258.   */
    $ \. S+ ?- M6 |6 T
  259. * ?/ l, [+ i# g$ a
  260. /** @defgroup FSMC_NAND_PCCARD_Controller
    3 f4 e( f; I' P7 |  q2 X
  261.   * @{# X. \6 k1 U# S( c" t: X
  262.   */7 O  q* z5 Y1 P

  263. ; d% Y0 R+ Y. h- X
  264. /** @defgroup FSMC_Wait_feature + r( v* [8 \# V) h' c
  265.   * @{
    + ^4 u8 u! F% O) w
  266.   */. A! b9 R4 N5 O- |
  267. #define FSMC_Waitfeature_Disable                 ((uint32_t)0x00000000)' E4 f  C: B. I# V" W. I* i7 }
  268. #define FSMC_Waitfeature_Enable                  ((uint32_t)0x00000002). x6 v6 ~  a( _' D' X$ O( ^& I; _0 ?
  269. #define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_Waitfeature_Disable) || \
    , ^# ?% }2 q1 y, S
  270.                                        ((FEATURE) == FSMC_Waitfeature_Enable))8 s9 }/ X) p( u# {9 S; P
  271. /**7 K9 B( w% t; k& i
  272.   * @}
    3 z' ?( S: J) K6 y# e" C7 D
  273.   */
    % [( t8 t' ?4 B' ]- @0 ^
  274. 3 j$ a( Y; H5 Z0 v

  275.   Q& s7 n( V1 S/ j- R
  276. /** @defgroup FSMC_ECC 1 N2 t" `/ D( {3 W9 q! o
  277.   * @{3 P6 d5 V/ R. I2 V& q
  278.   */
    - D3 v" J8 H9 s: w: F2 Y
  279. #define FSMC_ECC_Disable                         ((uint32_t)0x00000000)
    5 \, i" a$ R: Q5 `2 _( ~
  280. #define FSMC_ECC_Enable                          ((uint32_t)0x00000040)
    & C$ v( n& d/ s& q1 `$ @
  281. #define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_ECC_Disable) || \
    ) u  l* h9 p1 X, Z, h1 M
  282.                                   ((STATE) == FSMC_ECC_Enable))
    ) o$ y1 p$ \1 Z' ]4 ^! F
  283. /**# m8 v0 i! y/ H. _" B
  284.   * @}
    % j; W; d1 Y' {8 S5 E8 p9 n
  285.   */
    " l- y1 m' R, I7 \$ V& M! h! b

  286. 8 v4 x& d$ u3 E; x  u  v3 a2 ^6 |
  287. /** @defgroup FSMC_ECC_Page_Size
    ! z' ^$ m; w' [2 m8 o2 }
  288.   * @{
    4 X: W) O: l, U6 D1 C) [+ f
  289.   */
    2 W  V  v* e5 N. T
  290. #define FSMC_ECCPageSize_256Bytes                ((uint32_t)0x00000000)
    + W! _4 j/ K' k7 O  ?+ k
  291. #define FSMC_ECCPageSize_512Bytes                ((uint32_t)0x00020000)0 [- k! t- x- n* E% D8 R& E9 a
  292. #define FSMC_ECCPageSize_1024Bytes               ((uint32_t)0x00040000)
    : p+ i# F% G! E$ r/ B3 B
  293. #define FSMC_ECCPageSize_2048Bytes               ((uint32_t)0x00060000)% j2 `6 V; p& Y- q) |( _
  294. #define FSMC_ECCPageSize_4096Bytes               ((uint32_t)0x00080000)
    - w9 r3 n; P8 j% p/ l0 j% Y
  295. #define FSMC_ECCPageSize_8192Bytes               ((uint32_t)0x000A0000)
    6 A! ~1 m( r% N+ j, d! P6 s
  296. #define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_ECCPageSize_256Bytes) || \/ J/ m) |$ }8 P$ z! S
  297.                                     ((SIZE) == FSMC_ECCPageSize_512Bytes) || \, W2 V2 D7 q: I. [7 K
  298.                                     ((SIZE) == FSMC_ECCPageSize_1024Bytes) || \% i7 u& V$ i7 B3 O
  299.                                     ((SIZE) == FSMC_ECCPageSize_2048Bytes) || \
    * ~, W2 G: f4 R1 T9 p8 m: i% X
  300.                                     ((SIZE) == FSMC_ECCPageSize_4096Bytes) || \+ {/ O/ j3 k7 V; W! `5 Q6 D
  301.                                     ((SIZE) == FSMC_ECCPageSize_8192Bytes))0 E! `8 @! X- H, D# X" p
  302. /*** g$ j4 j# E7 E& d3 j
  303.   * @}
    % A8 H5 v! P! i
  304.   */: P( V% K/ P: k4 I; i

  305. 9 i4 R7 t& t5 X$ y
  306. /** @defgroup FSMC_TCLR_Setup_Time - q/ [* e7 m8 m3 N
  307.   * @{
    8 S+ L8 y* ?5 T( I0 g" L
  308.   */
    " e& n- \; s0 _5 j$ Z
  309. #define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 0xFF)- ~9 j# i% B8 k. T4 I
  310. /**$ n) [) b3 X$ T! g+ s% w
  311.   * @}
    & O$ W( f/ ^6 o6 q& c
  312.   */
    - y* \  H9 j1 i6 }, p% H: Y9 t
  313. * I8 K; K5 ~" j3 U1 J: A: ?
  314. /** @defgroup FSMC_TAR_Setup_Time 9 T* R0 y6 N' i+ R. q
  315.   * @{
    0 a* v7 p, w* L1 p; d
  316.   */- W1 M, i  l' X  k, _! o: Z* o! Q
  317. #define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 0xFF)
    , o0 ~$ L  T0 S) |& u8 s9 n
  318. /**& Z+ e) e9 X1 U' @# p/ V
  319.   * @}* \: @: C- @& \4 \& k+ P) b% ~( p
  320.   */
    $ r% g) J; G" L
  321. 5 z/ t) g. [  F  W# F& z
  322. /** @defgroup FSMC_Setup_Time ! A! y* ~. g/ B* m
  323.   * @{6 r# \4 _5 V$ x$ ^* n, U9 T
  324.   */- d8 v  j* {; Y& h
  325. #define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 0xFF)
    , m' {6 P# }4 X. @! u
  326. /**
    * k! n7 _8 o8 \/ i8 n
  327.   * @}' @3 R. ?" }' T' H0 V' _% g; j
  328.   */% k: D; l2 K' G  @% [! k! @
  329. , _& g) \3 T6 v3 E7 d/ t# }
  330. /** @defgroup FSMC_Wait_Setup_Time ( ~9 E* s  f; z- O# B
  331.   * @{
    ! T) y7 Q* z$ M
  332.   */2 r/ \, ^& g  A/ r
  333. #define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 0xFF)
    7 K& R+ @# R6 [$ ]9 k; q
  334. /**
    $ e8 x. K0 H1 I8 ~. p  |; R
  335.   * @}( |% w+ ~2 f9 ]+ z7 S8 v9 s# `6 B5 r; V/ ^
  336.   */
    ) K6 j8 g: r* F3 n% E2 g$ g4 \; f
  337. $ L; A- W0 Y- |% D9 [
  338. /** @defgroup FSMC_Hold_Setup_Time
    1 j; t' M# j3 ]4 \+ v
  339.   * @{
    . @7 i( v4 D6 H
  340.   */7 c) \# c+ V" J$ a! n) o. F
  341. #define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 0xFF)
    4 k4 ]3 y% z: y" t, s6 ^$ t
  342. /**
    5 M* ]5 O+ ^0 V! t
  343.   * @}
    % a# `' R* `. p9 Q! @) n5 L
  344.   */& x' n! C- l- F
  345. 2 o5 b: p( z) h3 Q! ^
  346. /** @defgroup FSMC_HiZ_Setup_Time
    6 J$ x: M. W9 z  a$ {" _) I( Q
  347.   * @{
    9 a6 ~$ b6 W4 C* y. m# K
  348.   */  c  w/ o& {, r! \8 Q
  349. #define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 0xFF)' X1 F# Y9 m  y- z
  350. /**. L! u7 b2 g0 u( p$ x7 H
  351.   * @}
    1 |0 y; n% k1 u7 ~& M' S
  352.   */1 B; J* ~; A& U$ {+ ?% [) b

  353. : d$ v$ l) u/ W5 }. h5 k
  354. /** @defgroup FSMC_Interrupt_sources
    , z! C& U  B1 B3 A7 y
  355.   * @{: q* J7 T! ]. I6 ]2 [' t" j, X
  356.   */+ X' R0 H. d) A# c* E
  357. #define FSMC_IT_RisingEdge                       ((uint32_t)0x00000008)  z: I: {- z( I" s% C/ q) k
  358. #define FSMC_IT_Level                            ((uint32_t)0x00000010)
    6 P1 [4 q; n% O1 |% Z2 C" i
  359. #define FSMC_IT_FallingEdge                      ((uint32_t)0x00000020)
    + R( \+ e; A+ S1 v
  360. #define IS_FSMC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((IT) != 0x00000000))
    ' {. ]3 f0 b- c; i! a
  361. #define IS_FSMC_GET_IT(IT) (((IT) == FSMC_IT_RisingEdge) || \
      k% o" `) C  [; y9 A/ ^- t5 d
  362.                             ((IT) == FSMC_IT_Level) || \6 ]$ r0 N1 `* y# i  g
  363.                             ((IT) == FSMC_IT_FallingEdge))
    , c  P) T3 a. u7 G1 f+ O
  364. /**
      g- b+ b$ ?; X* n0 w3 B* ~
  365.   * @}
    + c" Y/ v0 R7 u5 s
  366.   */3 T. P6 w: u+ P* q

  367. : B( O+ r6 [; G# x1 Y3 }
  368. /** @defgroup FSMC_Flags * e( D% K6 n3 B! Z
  369.   * @{
    4 d* x- d* R3 {
  370.   */
    5 W9 K- u" p3 N* M+ U
  371. #define FSMC_FLAG_RisingEdge                     ((uint32_t)0x00000001)
    + a$ C& k6 S4 z# q" O3 p! F7 R* G- Q, P
  372. #define FSMC_FLAG_Level                          ((uint32_t)0x00000002)
    ! v2 D1 u  Z( |+ P) V& @3 y
  373. #define FSMC_FLAG_FallingEdge                    ((uint32_t)0x00000004)$ d2 @1 c) P0 _
  374. #define FSMC_FLAG_FEMPT                          ((uint32_t)0x00000040)
    + ^2 Z+ R; s- ~' J( y0 q6 O6 c
  375. #define IS_FSMC_GET_FLAG(FLAG) (((FLAG) == FSMC_FLAG_RisingEdge) || \7 l* O1 [6 x- A
  376.                                 ((FLAG) == FSMC_FLAG_Level) || \5 f3 [8 N) p$ i' m, Q2 P, [
  377.                                 ((FLAG) == FSMC_FLAG_FallingEdge) || \; g: d9 x" A& [6 k! ], Z7 a
  378.                                 ((FLAG) == FSMC_FLAG_FEMPT))
    # A. }  j0 y6 N6 T7 s' J
  379. 9 K$ f9 G- j& q2 ^6 W$ _6 V
  380. #define IS_FSMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))/ `8 _. w7 Q2 z( i
复制代码
  s/ N* z0 `" J5 P4 I  Y: k
03. 相关函数7 X: H0 B5 W1 i3 w0 }
  1. /* NOR/SRAM Controller functions **********************************************/
    : G. C' p  f0 r( `  Q# Z/ `* Y
  2. void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank);
    & k5 d  Q: M0 \( o* o1 A% _" i8 _( r9 n
  3. void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);  j$ x2 \$ f# y( s$ F/ k" \  h9 b1 y
  4. void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);( g$ j8 ~7 h) s% g
  5. void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState);1 Z$ ^4 C# s9 e1 X1 k
  6. ( K% Y( d$ c8 v- K; D, |
  7. /* NAND Controller functions **************************************************/3 h5 y- G8 w# W
  8. void FSMC_NANDDeInit(uint32_t FSMC_Bank);
    2 Q2 X: O# g/ S- z
  9. void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);& l9 G. \5 i  I. h$ k4 m; }
  10. void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);! \& d4 y" U9 C0 R  I
  11. void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState);
    ( T3 ?8 G9 @5 ^* W. J2 ?# r% Q0 q
  12. void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState);: O' \8 l, J+ ]
  13. uint32_t FSMC_GetECC(uint32_t FSMC_Bank);: J  w) a9 |* h$ n% N* c

  14. $ _+ b/ U# `# |+ O
  15. /* PCCARD Controller functions ************************************************/& m% b! t  z1 W6 J7 _3 i$ D
  16. void FSMC_PCCARDDeInit(void);. |( r. S7 n: E
  17. void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);( v% {, E8 R( f. I( b& w
  18. void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
    ; q* e$ M' s  i9 R/ A2 N
  19. void FSMC_PCCARDCmd(FunctionalState NewState);
    * \- i  g9 W4 C0 r7 t

  20. 2 e5 M9 t& Y6 c2 m+ ^
  21. /* Interrupts and flags management functions **********************************/' ]0 H/ }2 s' X3 |  e
  22. void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState);2 A$ a3 l* ~; X! t
  23. FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);  {! h/ J6 k9 U' X
  24. void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
    . Z+ s1 n# N  U9 {# L. m! \
  25. ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT);) |. J8 I/ l+ x* o# l, e
  26. void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT);
复制代码
/ d3 _) `7 b9 A% X% }3 M
04. 结构体封装
  }7 O7 K6 Y% K) |* P
  1. typedef struct* ~2 G! I4 z; J" T: ^7 M* h
  2. {
    9 A' a- Y* H' I  |  ^9 S1 ~
  3.   __IO uint32_t BTCR[8];    /*!< NOR/PSRAM chip-select control register(BCR) and chip-select timing register(BTR), Address offset: 0x00-1C */   
    ; p1 }, W3 v1 G! |+ l) @2 J
  4. } FSMC_Bank1_TypeDef;
    . p- l. l, `; T" _; R1 l

  5. 2 S8 V; `8 {2 D& h* [
  6. /**
    6 d* ]; x5 ]% o
  7.   * @brief Flexible Static Memory Controller Bank1E
    ( W( I* {2 S9 E" E. @
  8.   */9 t4 O$ j, c& x' G0 w' L9 X
  9. 2 x- o4 }* ]/ i& H2 I7 Y9 U
  10. typedef struct
    / V0 c5 T4 ^5 @8 Y# G
  11. {0 s* b0 v  J9 ~' b3 A
  12.   __IO uint32_t BWTR[7];    /*!< NOR/PSRAM write timing registers, Address offset: 0x104-0x11C *// Z5 R' h$ ^9 g6 |
  13. } FSMC_Bank1E_TypeDef;
    0 n9 l" Z7 z" _& h( S6 F; B! K2 t7 d4 A
  14. : c: A0 m  e6 v5 |  c( S8 ?( F& Y
  15. /**
    $ J$ H- q, I. D  A
  16.   * @brief Flexible Static Memory Controller Bank2
    8 ?  M% B2 E: u$ u) J
  17.   */
    0 N3 B. b0 s7 V. b- q# s/ m' Y- p% c; K

  18. 2 ~, K) I! a  T* W  T9 o. K
  19. typedef struct; k! H  Q/ V, w6 E% _- W( F/ S
  20. {2 x0 x' X, y( |4 }% k) S$ A- M6 \
  21.   __IO uint32_t PCR2;       /*!< NAND Flash control register 2,                       Address offset: 0x60 */5 n/ _3 e% }) n; i
  22.   __IO uint32_t SR2;        /*!< NAND Flash FIFO status and interrupt register 2,     Address offset: 0x64 */- `8 J$ F! K2 T" {  l, J
  23.   __IO uint32_t PMEM2;      /*!< NAND Flash Common memory space timing register 2,    Address offset: 0x68 */1 {: b/ [1 }; T# b
  24.   __IO uint32_t PATT2;      /*!< NAND Flash Attribute memory space timing register 2, Address offset: 0x6C */
    3 m9 g% R3 l% t' T- Z; Q5 Q9 J3 X
  25.   uint32_t      RESERVED0;  /*!< Reserved, 0x70                                                            */
    " Q. H6 o  K, t9 [
  26.   __IO uint32_t ECCR2;      /*!< NAND Flash ECC result registers 2,                   Address offset: 0x74 */1 ~8 x! v2 d8 }; b5 a
  27. } FSMC_Bank2_TypeDef;
    / {' z6 l- f+ s9 T: g2 n2 a# X: X0 h

  28. , b' I3 g# w/ ]
  29. /**
    7 L5 W: s  a* @1 g1 s7 P; e
  30.   * @brief Flexible Static Memory Controller Bank3" n5 t7 l) T' R/ ^2 n: c( S; w
  31.   */
    9 t* B5 J# u: d2 J* p; V

  32. # r- u4 X6 C# q, t' a
  33. typedef struct
    ( z2 L) ^- z+ |  ^* R' u( ~* x
  34. {
    / c, B- y/ k. v
  35.   __IO uint32_t PCR3;       /*!< NAND Flash control register 3,                       Address offset: 0x80 */
    : E( b1 x. b9 P& w1 Y+ T
  36.   __IO uint32_t SR3;        /*!< NAND Flash FIFO status and interrupt register 3,     Address offset: 0x84 */
    7 c7 P; ]. \: G0 L- I1 l5 ]: c
  37.   __IO uint32_t PMEM3;      /*!< NAND Flash Common memory space timing register 3,    Address offset: 0x88 */6 p, N: F1 V/ V4 s
  38.   __IO uint32_t PATT3;      /*!< NAND Flash Attribute memory space timing register 3, Address offset: 0x8C */
    # a8 U: X2 w9 Q& q
  39.   uint32_t      RESERVED0;  /*!< Reserved, 0x90                                                            */
    ' C8 i1 \2 r4 Y: G0 s- {, H
  40.   __IO uint32_t ECCR3;      /*!< NAND Flash ECC result registers 3,                   Address offset: 0x94 */, c) v3 \+ K3 j+ C
  41. } FSMC_Bank3_TypeDef;" i  v3 a- u) o3 R2 `: A

  42. % }- I5 n, V$ ~7 ^+ J$ B! S' R% b
  43. /** & |1 P4 u# a- \* b0 ?; i! _  b
  44.   * @brief Flexible Static Memory Controller Bank46 h! v8 Y) E. S5 ?" k1 d3 ]3 N% s
  45.   */6 ?4 D+ O+ o0 I7 L
  46. / C$ y8 e2 v7 P4 w+ }$ |
  47. typedef struct8 j: }2 e* H  b/ t
  48. {
    2 K! ~- z; R1 k* w4 Z; H
  49.   __IO uint32_t PCR4;       /*!< PC Card  control register 4,                       Address offset: 0xA0 */7 ^' T8 v7 w7 ^  Z4 ^6 |
  50.   __IO uint32_t SR4;        /*!< PC Card  FIFO status and interrupt register 4,     Address offset: 0xA4 */3 M7 W: B9 R( b+ e
  51.   __IO uint32_t PMEM4;      /*!< PC Card  Common memory space timing register 4,    Address offset: 0xA8 */
    8 c2 q1 M" Q) N4 r8 G- y7 x! s8 u
  52.   __IO uint32_t PATT4;      /*!< PC Card  Attribute memory space timing register 4, Address offset: 0xAC */
      O7 H$ \! d9 U1 V. W/ P5 ]2 s
  53.   __IO uint32_t PIO4;       /*!< PC Card  I/O space timing register 4,              Address offset: 0xB0 */) R) s% `2 E" I1 ]1 R6 ]
  54. } FSMC_Bank4_TypeDef;
    ) v8 r' |2 U% E( z0 Z: A, ~3 H

  55. : T7 y" K- j, G, D6 H5 q
复制代码
) Q/ D0 o- h9 }
收藏 评论0 发布时间:2022-3-29 09:52

举报

0个回答

所属标签

相似分享

官网相关资源

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版