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

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

[复制链接]
STMCU小助手 发布时间:2022-6-14 13:47
01. 概述
8 U9 ~* w- k& v; ]! gFSMC 相关的库函数分布在 stm32f4xx_fsmc.c 文件和头文件 stm32f4xx_fsmc.h 中。1 b& R% w. d! J2 Q9 W, P
$ z! S4 F7 \4 M
02. 相关类型2 {3 u2 a# {& T- m0 E+ _+ N
FSMC_NORSRAMTimingInitTypeDef类型
' `  S; M4 s. E$ J6 ^; C* U! A% w
  1. % d, R/ A' U. A6 y
  2. /**
    - f* \: S+ Y6 C' s" K3 p) W; ]
  3.   * @brief  Timing parameters For NOR/SRAM Banks  % j6 k9 ?. J2 z7 A* N6 q
  4.   */
    6 ?7 e9 X, L& H
  5. typedef struct
    ! n* n7 @2 g) C: d7 Z  ~
  6. {; t7 U: O7 L) j! a" v& i4 @
  7.   uint32_t FSMC_AddressSetupTime;       /*!< Defines the number of HCLK cycles to configure* w5 L1 }% f. ~( K2 k$ g/ G
  8.                                              the duration of the address setup time.
    ; \1 D0 h: \% t' K# `: B
  9.                                              This parameter can be a value between 0 and 0xF.8 w% s4 f4 w' P& t# d& F
  10.                                              @note This parameter is not used with synchronous NOR Flash memories. */, Y( i/ Q) M1 a' W
  11. 7 _" f5 b& i! K$ p% W
  12.   uint32_t FSMC_AddressHoldTime;        /*!< Defines the number of HCLK cycles to configure
    1 ]$ L4 j$ A1 c6 ]+ Q$ S! ]& e
  13.                                              the duration of the address hold time.9 L/ G6 H4 Q" d3 i" P( ?
  14.                                              This parameter can be a value between 0 and 0xF.
      K6 W( d; A) n4 f+ c1 u: H1 h
  15.                                              @note This parameter is not used with synchronous NOR Flash memories.*/. s6 s! a+ O0 b8 D" `

  16. # k' Z! b0 m5 G3 j2 f
  17.   uint32_t FSMC_DataSetupTime;          /*!< Defines the number of HCLK cycles to configure
    9 b  `) @% o. J2 [' e8 h1 i- a& L5 G
  18.                                              the duration of the data setup time.
    % j9 B, p9 U2 b" H! m7 v- E2 P
  19.                                              This parameter can be a value between 0 and 0xFF.
    # z+ d  B4 `% k/ J0 S  ~* {
  20.                                              @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed NOR Flash memories. */& }  R* R5 h3 Z

  21. + w) Y0 i' @% l/ e6 A# Y
  22.   uint32_t FSMC_BusTurnAroundDuration;  /*!< Defines the number of HCLK cycles to configure5 e5 @& x) M9 ?1 p5 `
  23.                                              the duration of the bus turnaround.
    5 ]1 Z: C2 I& K0 a2 V! m
  24.                                              This parameter can be a value between 0 and 0xF.
    , U& o" x/ x9 S/ C, [) N: s! B) E
  25.                                              @note This parameter is only used for multiplexed NOR Flash memories. */
    / N+ b# P+ b! ?, _& {: g) [7 L
  26. - e' ]* d6 g) n! E4 t
  27.   uint32_t FSMC_CLKDivision;            /*!< Defines the period of CLK clock output signal, expressed in number of HCLK cycles.
    # n2 C, \6 d' {, f- C& f9 q, }+ T
  28.                                              This parameter can be a value between 1 and 0xF.
    % g" y2 }9 Q7 a1 Q: A" `
  29.                                              @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM accesses. */
    ! `( a5 i3 L; s" m3 O# F; \

  30. 2 o; B2 E7 H0 ?  P8 J8 ?6 R
  31.   uint32_t FSMC_DataLatency;            /*!< Defines the number of memory clock cycles to issue* o; x' o& u  N
  32.                                              to the memory before getting the first data.
    . b0 S& e, c1 f* ?
  33.                                              The parameter value depends on the memory type as shown below:9 n( Y6 k8 g6 {3 O1 S3 }9 `
  34.                                               - It must be set to 0 in case of a CRAM$ ~5 D5 E7 N4 d7 |% L/ U; y4 `
  35.                                               - It is don't care in asynchronous NOR, SRAM or ROM accesses
    8 k1 n* K  g1 k0 R, W1 c
  36.                                               - It may assume a value between 0 and 0xF in NOR Flash memories
    , t0 V* _" ~5 U" R; b
  37.                                                 with synchronous burst mode enable */
    + N& k  A% {% `7 M

  38. ! z( }" X$ `+ e. N- m0 o$ t5 }$ n3 w+ W
  39.   uint32_t FSMC_AccessMode;             /*!< Specifies the asynchronous access mode. ( j8 ~7 d# n7 b. I- P9 a3 s; d
  40.                                              This parameter can be a value of @ref FSMC_Access_Mode */
    & K4 v$ ^6 B5 i& s6 }
  41. }FSMC_NORSRAMTimingInitTypeDef;
复制代码
) ?: [2 A3 g0 s1 m
FSMC_NORSRAMInitTypeDef类型
& V2 W  T" }" x- A7 H# V' w
6 N; e* q% v. R* O: y+ r8 ?
  1. /** " g/ j" H5 U, [& q
  2.   * @brief  FSMC NOR/SRAM Init structure definition% s% u2 w' ]) D* ]! m; ^
  3.   */
    ; _9 @$ |, Y4 Q3 w) x3 n" P
  4. typedef struct# ~9 Q& i! A0 i2 v
  5. {
    , a. H& l! }! y3 E
  6.   uint32_t FSMC_Bank;                /*!< Specifies the NOR/SRAM memory bank that will be used.7 T" j5 n8 l5 v
  7.                                           This parameter can be a value of @ref FSMC_NORSRAM_Bank */5 l9 c% x+ ^) G4 n, ^5 K
  8. ( S$ F4 f4 A1 F0 _' Q
  9.   uint32_t FSMC_DataAddressMux;      /*!< Specifies whether the address and data values are+ i+ q: L% I1 p5 A# S5 _
  10.                                           multiplexed on the data bus or not. , A9 i* I' c8 o1 u
  11.                                           This parameter can be a value of @ref FSMC_Data_Address_Bus_Multiplexing */* q( l9 j4 W5 M: G' D

  12. , ]- [; K. ]4 D- |$ ?. i
  13.   uint32_t FSMC_MemoryType;          /*!< Specifies the type of external memory attached to2 F  g. Q1 j; I$ f0 g
  14.                                           the corresponding memory bank.
    % M* \$ M2 d% g1 Y0 F& c' N& d6 i! n
  15.                                           This parameter can be a value of @ref FSMC_Memory_Type */" F3 M# _1 f8 `, O$ E

  16. ; w1 a& V( P7 r) ^7 U+ x
  17.   uint32_t FSMC_MemoryDataWidth;     /*!< Specifies the external memory device width.
    , G! b# S4 G( t# k+ Y" ]
  18.                                           This parameter can be a value of @ref FSMC_Data_Width */! K( M0 _, `. _" E2 g

  19. $ u" M  p# S7 _: u# w7 V. [4 q
  20.   uint32_t FSMC_BurstAccessMode;     /*!< Enables or disables the burst access mode for Flash memory,
    ! K4 O. k) a6 ^; y6 h
  21.                                           valid only with synchronous burst Flash memories.
    , s% v6 ^$ {! }% S* ~& c; S! a
  22.                                           This parameter can be a value of @ref FSMC_Burst_Access_Mode */
      O  @% K% ]" u+ A. U
  23. ! w& [0 a; G. y6 I
  24.   uint32_t FSMC_AsynchronousWait;     /*!< Enables or disables wait signal during asynchronous transfers,
    , V4 h  v+ p' M+ }
  25.                                           valid only with asynchronous Flash memories.
    - Z9 [. N  j+ o% Z# h6 w! v
  26.                                           This parameter can be a value of @ref FSMC_AsynchronousWait */                                          
    ) H% \- G" ]1 ~6 v* C" N+ x
  27. 7 |* ^# U! s: ?) Q7 U
  28.   uint32_t FSMC_WaitSignalPolarity;  /*!< Specifies the wait signal polarity, valid only when accessing$ X# V. h3 |! V0 N2 _
  29.                                           the Flash memory in burst mode.! A' \9 k) b, a$ u0 M0 O* [
  30.                                           This parameter can be a value of @ref FSMC_Wait_Signal_Polarity */5 j' k  M4 I' r* s
  31. " M1 b3 J6 ]; n+ Z. b3 Q# [
  32.   uint32_t FSMC_WrapMode;            /*!< Enables or disables the Wrapped burst access mode for Flash
    " [- [( I* d" C& z( \, j8 o/ i
  33.                                           memory, valid only when accessing Flash memories in burst mode.5 C% M0 }8 I# ^$ n& I5 H% P' b
  34.                                           This parameter can be a value of @ref FSMC_Wrap_Mode */
    ) `/ B: z4 h6 |& e( ]" {: E3 Z- K9 _% K

  35. - v  H! S" S  r
  36.   uint32_t FSMC_WaitSignalActive;    /*!< Specifies if the wait signal is asserted by the memory one3 f9 X' y0 E1 K3 |6 I3 h
  37.                                           clock cycle before the wait state or during the wait state,: p5 o$ f, G+ {" a/ D1 H% v2 u! ]
  38.                                           valid only when accessing memories in burst mode.
    + y4 o* O+ y4 i3 x6 x/ o
  39.                                           This parameter can be a value of @ref FSMC_Wait_Timing */
    - B( V: Z7 j% Z; s$ p

  40. & L3 V# T( ^4 f
  41.   uint32_t FSMC_WriteOperation;      /*!< Enables or disables the write operation in the selected bank by the FSMC.
    4 {5 J7 A6 b0 R. B& g  ]
  42.                                           This parameter can be a value of @ref FSMC_Write_Operation */
    ) q$ n' R) C! g# B$ \' @; c: x6 U
  43. $ R( }( @1 K3 X3 {* b# J4 _7 g
  44.   uint32_t FSMC_WaitSignal;          /*!< Enables or disables the wait state insertion via wait9 d6 `6 l" r7 C
  45.                                           signal, valid for Flash memory access in burst mode.
    ) D" q1 K9 [3 _2 B
  46.                                           This parameter can be a value of @ref FSMC_Wait_Signal */
    2 @9 N  j8 `' x2 _: f" ]4 u
  47. 5 K! \" i+ \( O2 e$ }: _$ r- ~6 {# u* x4 Z
  48.   uint32_t FSMC_ExtendedMode;        /*!< Enables or disables the extended mode.
    ! E# }2 f7 X. }7 w/ z6 b( K
  49.                                           This parameter can be a value of @ref FSMC_Extended_Mode */
    * T' ~7 C. E' Z: {& Y* s* v
  50. / o: P0 ?) Q# l9 u% G2 f- w% a
  51.   uint32_t FSMC_WriteBurst;          /*!< Enables or disables the write burst operation.  z* q7 D7 g6 {9 Y% {5 U; t
  52.                                           This parameter can be a value of @ref FSMC_Write_Burst */
    4 d/ j0 q# s4 \2 s- Q: y; ]

  53. * Z0 \; I9 s- e7 p' r% r' ~
  54.   FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct; /*!< Timing Parameters for write and read access if the  Extended Mode is not used*/  
    0 m% U1 O( w3 V' m) u& ~
  55. . H- A9 N5 u+ X% O, R8 h) \/ Z4 t
  56.   FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct;     /*!< Timing Parameters for write access if the  Extended Mode is used*/      
    6 s* l/ d: b9 |3 y1 Y
  57. }FSMC_NORSRAMInitTypeDef;
复制代码

3 w! A1 K7 D$ C, l" rFSMC_NAND_PCCARDTimingInitTypeDef类型% k+ g( l; \: O' W& G

4 N9 W6 a2 E8 Y$ S2 j
  1. /**
    6 P+ v- S: r1 J) d* B
  2.   * @brief  Timing parameters For FSMC NAND and PCCARD Banks1 M) O; y3 u5 m& j! R7 d
  3.   */
    : p. c  P/ E+ Q" ~7 M
  4. typedef struct# j" c7 s' C. s: w- T" ?5 U
  5. {; F* ?) N) s: d' B0 ^! Q
  6.   uint32_t FSMC_SetupTime;      /*!< Defines the number of HCLK cycles to setup address before/ k1 P9 p4 f# Z$ |' \$ P
  7.                                      the command assertion for NAND Flash read or write access
    ) r4 L$ a4 f7 `; u+ t. }
  8.                                      to common/Attribute or I/O memory space (depending on) W4 l( T- |  I
  9.                                      the memory space timing to be configured).
    ) I& V* h. e$ H) H
  10.                                      This parameter can be a value between 0 and 0xFF.*/$ F* u3 V- f) R- H7 S# H& X

  11. + ~$ v: H$ U- q5 u/ Z8 w; Y
  12.   uint32_t FSMC_WaitSetupTime;  /*!< Defines the minimum number of HCLK cycles to assert the- ^3 `' c6 [' R4 G3 f
  13.                                      command for NAND Flash read or write access to
    2 Q" K! n: T' P0 k5 u
  14.                                      common/Attribute or I/O memory space (depending on the  L5 C* G( o& a
  15.                                      memory space timing to be configured).
    # t& W- ~4 a/ v: R
  16.                                      This parameter can be a number between 0x00 and 0xFF */
    " u* _" J- Q5 o5 i* `

  17. 8 S, x3 \6 T7 y8 `
  18.   uint32_t FSMC_HoldSetupTime;  /*!< Defines the number of HCLK clock cycles to hold address" U9 R1 d5 S, k7 z* u
  19.                                      (and data for write access) after the command de-assertion4 Y0 z5 Q7 {! y* z1 I3 g
  20.                                      for NAND Flash read or write access to common/Attribute
    ( ]2 W5 L  T1 Z5 ^0 C5 Y. Y4 s
  21.                                      or I/O memory space (depending on the memory space timing
    . M2 z* h- Q0 ~0 X  |7 z
  22.                                      to be configured).3 }" \. D' k$ q
  23.                                      This parameter can be a number between 0x00 and 0xFF */; v, h3 b7 N6 F& J0 a) d

  24. 9 X6 d4 R3 \! ^9 C8 q
  25.   uint32_t FSMC_HiZSetupTime;   /*!< Defines the number of HCLK clock cycles during which the; Z$ G, p& M& u" z0 s3 y
  26.                                      data bus is kept in HiZ after the start of a NAND Flash: L" E  _) m& t' ]9 I+ u4 m
  27.                                      write access to common/Attribute or I/O memory space (depending
    . ^' }: |& Z* E5 u0 `1 s5 D
  28.                                      on the memory space timing to be configured).' y2 Z8 ]( t7 M
  29.                                      This parameter can be a number between 0x00 and 0xFF */1 s" x' W. v& {( K  m
  30. }FSMC_NAND_PCCARDTimingInitTypeDef;
复制代码

' u$ K; l! O  d, JFSMC_NANDInitTypeDef类型
: b2 x- P2 u$ x
$ f6 s! V  a/ i0 j5 I
  1. /**
    : s- Y4 B+ ?! s8 U: ?& G  r
  2.   * @brief  FSMC NAND Init structure definition
    4 }* U" A$ @! |3 [! Y& O
  3.   */
    : }, H8 A8 s* y* l& c
  4. typedef struct2 }0 z: z  Y3 F0 |, k2 y' v
  5. {
    * Y! s+ M1 x! y/ j+ y6 C+ n2 f& w( l- k
  6.   uint32_t FSMC_Bank;              /*!< Specifies the NAND memory bank that will be used.
    $ U: s  f& k3 P7 w; y. b- U
  7.                                       This parameter can be a value of @ref FSMC_NAND_Bank */% x- q3 W- d3 b- j+ u
  8. - e4 K: a" s" S
  9.   uint32_t FSMC_Waitfeature;      /*!< Enables or disables the Wait feature for the NAND Memory Bank., a; {8 j7 G& O& G
  10.                                        This parameter can be any value of @ref FSMC_Wait_feature */! y7 m, y, K: E. j5 C" x1 c9 q
  11. 5 \" u5 i( h" E( g4 D3 t
  12.   uint32_t FSMC_MemoryDataWidth;  /*!< Specifies the external memory device width.9 y( P) A; i. L9 r
  13.                                        This parameter can be any value of @ref FSMC_Data_Width */
    2 |- ?/ k$ T0 h- y' M$ y

  14. 0 L) N7 Z3 |! [0 h" \
  15.   uint32_t FSMC_ECC;              /*!< Enables or disables the ECC computation.
    4 M* x; h& c6 h
  16.                                        This parameter can be any value of @ref FSMC_ECC */
    2 D) v* O1 _, ^/ n& \. i: N
  17. ) C/ o, G7 p8 I  t6 @
  18.   uint32_t FSMC_ECCPageSize;      /*!< Defines the page size for the extended ECC.* E  A: a* y* r9 c! q3 L, Z* b
  19.                                        This parameter can be any value of @ref FSMC_ECC_Page_Size */
    $ d& L. p% m5 _2 W' W, Y

  20. 2 y( I3 ~1 ~/ E8 d$ v) z
  21.   uint32_t FSMC_TCLRSetupTime;    /*!< Defines the number of HCLK cycles to configure the
    % [/ L8 [5 K! ?$ L' X" [$ R& N
  22.                                        delay between CLE low and RE low.
    ! `  Y  Y  c0 ~
  23.                                        This parameter can be a value between 0 and 0xFF. */
    % Y6 \# Q& T1 Z& ?2 ~$ S: Y8 ]
  24. ! G4 O/ b5 N6 ?) N1 P
  25.   uint32_t FSMC_TARSetupTime;     /*!< Defines the number of HCLK cycles to configure the0 Q3 {, M- [9 y, t) N% @% y
  26.                                        delay between ALE low and RE low.
    - J1 H' L" r' L4 R1 x5 `1 i& L) M3 X  _  C
  27.                                        This parameter can be a number between 0x0 and 0xFF */ : X- F" I2 K; X$ ?5 ]0 H
  28. 3 p# x) X9 K- R
  29.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct;   /*!< FSMC Common Space Timing */
    % X# E, D/ G( o: X& X
  30. + O1 w( w- _- v; r
  31.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct; /*!< FSMC Attribute Space Timing */# Y' r7 z6 ^# U5 V
  32. }FSMC_NANDInitTypeDef;
复制代码
3 u& v2 n: T* m5 j8 ]3 L
FSMC_PCCARDInitTypeDef类型7 i1 R) S, _0 M  Q  B+ t! R0 h/ \; v
. E5 m- `5 n% O8 \8 M
  1. /** 0 ]2 \0 E4 `% r3 z) E" T* E$ B
  2.   * @brief  FSMC PCCARD Init structure definition
    / d8 c& v. p$ H' b
  3.   */' v, J& U9 ?0 J' @6 \

  4. ' I2 P  R( z2 Z/ g
  5. typedef struct/ {0 s" [( G" n
  6. {! l6 O8 ~% _+ T! p4 ?. g. |
  7.   uint32_t FSMC_Waitfeature;    /*!< Enables or disables the Wait feature for the Memory Bank.+ o4 a# _' m( S8 J- B+ f3 t
  8.                                     This parameter can be any value of @ref FSMC_Wait_feature */
    0 y% m$ U, V; n( b* C
  9. ' m  p  @- H8 G: i7 F# }6 A8 ^5 d3 j
  10.   uint32_t FSMC_TCLRSetupTime;  /*!< Defines the number of HCLK cycles to configure the
    ) }! L# X$ D( J5 k& l
  11.                                      delay between CLE low and RE low.
    - X+ c5 L( ?! q) Q# I, q
  12.                                      This parameter can be a value between 0 and 0xFF. */$ H2 L2 N0 h4 h* x- I
  13. # Y- {$ a8 ]$ B, P( n- p0 z
  14.   uint32_t FSMC_TARSetupTime;   /*!< Defines the number of HCLK cycles to configure the
    4 L* X8 {7 T3 _( D' S
  15.                                      delay between ALE low and RE low.! ]/ ^' S% o! M/ ~; M
  16.                                      This parameter can be a number between 0x0 and 0xFF */
    7 A6 U* `9 e0 X; _6 H: B- w+ ?
  17. ' H- C/ V" o' W5 d7 a

  18. 7 R4 G3 Y3 `7 p8 H# t
  19.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct; /*!< FSMC Common Space Timing */
    * |, G3 x# i7 o# o6 j

  20. 0 U3 q8 }# C. P/ x
  21.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct;  /*!< FSMC Attribute Space Timing */
    / B& s% \9 X" ^

  22. " D9 W5 v" \3 O! y% n, u4 c
  23.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_IOSpaceTimingStruct; /*!< FSMC IO Space Timing */  / U: E  M5 Z: Q0 z3 u
  24. }FSMC_PCCARDInitTypeDef;
复制代码

& d+ y  J2 M. Q9 H5 ?. |相关宏定义
+ K7 J0 p5 p2 W
5 `# `4 }% M( @( E* j
  1. /** @defgroup FSMC_Exported_Constants! n  ~/ x# w9 T, v: z4 r5 b. W/ T
  2.   * @{
    : N! B2 X! w' ]% ]/ m# Q! V
  3.   */
    " L' C& s/ ^9 e) r( T0 o

  4. - ^: g; r5 n. J5 G( G9 x
  5. /** @defgroup FSMC_NORSRAM_Bank 1 Y, y, n0 n! V* R1 r
  6.   * @{
    ' x# ~7 t  T& p2 [6 y% X$ D7 l
  7.   */1 a1 Q. @5 Y. p  O& p" \
  8. #define FSMC_Bank1_NORSRAM1                      ((uint32_t)0x00000000)8 w* C! ^# O) r. t
  9. #define FSMC_Bank1_NORSRAM2                      ((uint32_t)0x00000002): ]: B' s9 ^1 R
  10. #define FSMC_Bank1_NORSRAM3                      ((uint32_t)0x00000004)
    / h$ ~7 t7 ?0 m/ W: |/ k' h
  11. #define FSMC_Bank1_NORSRAM4                      ((uint32_t)0x00000006)
    ; q' q: p2 w2 X9 r
  12. /**! Q. k8 C4 @1 ]7 [' u/ y& E
  13.   * @}" Z- @7 U! t7 t# f4 V+ B1 L' k5 F2 a
  14.   */
    : u, U7 @1 m% D5 R; j: b' B: Y  B

  15. " V- e+ r& O# ?) w- r# u
  16. /** @defgroup FSMC_NAND_Bank
    : \$ k3 p; b. [% y6 M% `% u! L7 t; s
  17.   * @{
    $ ^* k9 i/ h4 a3 O# o& w" G8 `0 s
  18.   */  
    ( N( b' I' z/ k9 F0 i' d* T( g
  19. #define FSMC_Bank2_NAND                          ((uint32_t)0x00000010)* k/ Z& j) r6 m4 P6 X! P2 I
  20. #define FSMC_Bank3_NAND                          ((uint32_t)0x00000100)9 n: \' Y+ W7 a
  21. /**0 P5 G1 H; m$ x( M5 U
  22.   * @}- r& I  ]8 s( s7 o, J  w
  23.   */" s6 c" X: ]9 c% [6 T
  24. 5 V6 D, E* \  `) H0 b
  25. /** @defgroup FSMC_PCCARD_Bank 1 s# W* D  O8 {
  26.   * @{
    $ z. K/ \5 }3 |0 n
  27.   */    ! ~( }9 t5 e  j& P
  28. #define FSMC_Bank4_PCCARD                        ((uint32_t)0x00001000)" [( x4 |6 |5 @) l' v5 z0 `) [* t
  29. /**9 U: d; @8 w4 B9 K% A" m# @; w
  30.   * @}$ I1 {% t& z* M4 p7 d& i
  31.   */, \3 _& B  b8 S: K

  32. + u6 V9 y0 g6 G
  33. #define IS_FSMC_NORSRAM_BANK(BANK) (((BANK) == FSMC_Bank1_NORSRAM1) || \
    5 O  w  d, h4 A! w  A% M$ h
  34.                                     ((BANK) == FSMC_Bank1_NORSRAM2) || \! }! B) r, C6 d! |7 }, S
  35.                                     ((BANK) == FSMC_Bank1_NORSRAM3) || \" k& A: }+ f, y
  36.                                     ((BANK) == FSMC_Bank1_NORSRAM4))' N) i/ L6 a! _* N0 x; S

  37. 4 }" k. i, X; Q* L/ S, i% `
  38. #define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \6 P: G, j9 I0 T# W5 R, J' I
  39.                                  ((BANK) == FSMC_Bank3_NAND))# s. \* H; h% y3 w+ f! t! K

  40. % A: u$ V$ }( h* q: s2 y
  41. #define IS_FSMC_GETFLAG_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \3 B0 i. g( E& b1 C! r0 K8 [
  42.                                     ((BANK) == FSMC_Bank3_NAND) || \' S4 s3 q' w; g2 K2 A1 |6 p
  43.                                     ((BANK) == FSMC_Bank4_PCCARD))% A" y) g3 t% x7 `/ l' m5 j
  44. 9 p- u% j8 ]9 e4 m' o) a) t, ?
  45. #define IS_FSMC_IT_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
    & w9 G* p; H; I3 [, w" F
  46.                                ((BANK) == FSMC_Bank3_NAND) || \
    4 N! g5 P6 T! f1 G. s; n8 B
  47.                                ((BANK) == FSMC_Bank4_PCCARD))
    0 S! k' C- U' \

  48. & b) D  U/ G1 a, X- q  r* i  \7 {
  49. /** @defgroup FSMC_NOR_SRAM_Controller ; F( C1 \! A* q  h8 G3 U
  50.   * @{; r  v7 L5 n8 Y
  51.   */
    - _0 \4 R2 B% Z, t
  52. : H, u/ W, c" ]4 E7 j: }
  53. /** @defgroup FSMC_Data_Address_Bus_Multiplexing : N% h- j" d* h7 b% A6 x
  54.   * @{
    9 @- E0 J! k; f6 B
  55.   */+ u$ _) m7 i/ a6 u
  56. 4 m- t1 f1 ~! v* l/ v$ v
  57. #define FSMC_DataAddressMux_Disable                ((uint32_t)0x00000000)
    , ?4 u8 e3 s' y+ F
  58. #define FSMC_DataAddressMux_Enable                 ((uint32_t)0x00000002)- z3 e5 W  _( @
  59. #define IS_FSMC_MUX(MUX) (((MUX) == FSMC_DataAddressMux_Disable) || \
    1 @9 _2 I- Z( N( y6 G& A0 E5 O
  60.                           ((MUX) == FSMC_DataAddressMux_Enable))6 f% M0 i: I; W2 ?7 e% Q! ]( g" j% \
  61. /**7 q+ r1 J! I# T' R8 Z- ?6 _
  62.   * @}
    6 @' C* f' o6 Y, d, C& y  N) [
  63.   */
    / e- t) N" M5 L
  64.   v! c9 F- m" Q8 c
  65. /** @defgroup FSMC_Memory_Type
    8 v3 G9 S+ }% e& l; @0 v1 c
  66.   * @{- R0 J) Y) `8 r
  67.   */
    ' u4 }3 B, S9 k  ]
  68. 2 ^5 v: O0 v. J; X' ^8 P# q" ]
  69. #define FSMC_MemoryType_SRAM                     ((uint32_t)0x00000000)
    8 t  F6 x2 N1 x; i* w
  70. #define FSMC_MemoryType_PSRAM                    ((uint32_t)0x00000004), Z% G4 k$ V- Y$ y! R
  71. #define FSMC_MemoryType_NOR                      ((uint32_t)0x00000008)
    5 y( _+ s) K% I3 X. F3 J# L2 P7 ~
  72. #define IS_FSMC_MEMORY(MEMORY) (((MEMORY) == FSMC_MemoryType_SRAM) || \
    ) h1 T, @6 s. l7 L
  73.                                 ((MEMORY) == FSMC_MemoryType_PSRAM)|| \
    ) [% l+ {& C  \( L: v; C+ _, o
  74.                                 ((MEMORY) == FSMC_MemoryType_NOR))( X) M/ A2 e2 J4 J- ~9 n
  75. /**  ~/ i* q$ M( i
  76.   * @}
    ( u- e1 U. m6 {; _& N$ E3 q5 X
  77.   */
    4 v% J8 s4 q/ w, s* @) _
  78. ) V: @, \" D# Z
  79. /** @defgroup FSMC_Data_Width 1 j- S) H6 B% p1 n
  80.   * @{
    7 n3 |* r: a, A6 i9 P5 r: `+ O
  81.   */7 n$ s3 n& y3 ]

  82. 6 `! B% ^/ O; _- E3 R" F5 g
  83. #define FSMC_MemoryDataWidth_8b                  ((uint32_t)0x00000000)
    5 ^9 ^; X" X% b" Q, L
  84. #define FSMC_MemoryDataWidth_16b                 ((uint32_t)0x00000010). l" `+ }2 J( h3 M  l$ a
  85. #define IS_FSMC_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \% k$ j4 c5 V9 b
  86.                                      ((WIDTH) == FSMC_MemoryDataWidth_16b)), c, ~3 K) u3 S( D
  87. /**
    " D6 {* [# S; A
  88.   * @}- [1 P( Z- k! x7 g( f9 a# V
  89.   */
    7 k7 G9 }, T/ L" W" X4 H
  90. ' x- O  C4 l: J  y+ P4 @* ~
  91. /** @defgroup FSMC_Burst_Access_Mode
    : O4 ~, L# [& L4 z- U3 T
  92.   * @{
    3 E1 W" B- g; `5 J. F7 f7 J7 s) o
  93.   */& C3 d5 w- N$ `

  94. ( N+ D( B  R3 v& [- V  k( q
  95. #define FSMC_BurstAccessMode_Disable             ((uint32_t)0x00000000) 9 c3 w7 h3 y& u- i% p+ w1 `
  96. #define FSMC_BurstAccessMode_Enable              ((uint32_t)0x00000100)
    $ `3 H( ^3 P% `7 B2 w
  97. #define IS_FSMC_BURSTMODE(STATE) (((STATE) == FSMC_BurstAccessMode_Disable) || \
    ' j4 ]- ^, x* e; g- {
  98.                                   ((STATE) == FSMC_BurstAccessMode_Enable))
    ) B3 R" j5 r7 [0 i
  99. /**: B6 |5 Y5 }& S! i7 h$ d
  100.   * @}' V1 `# \  G- x$ u" C
  101.   */2 e7 X- T9 O& t! H; i( t
  102. / u. J; D3 f( ^1 ^
  103. /** @defgroup FSMC_AsynchronousWait " [/ v+ G, r# L8 P
  104.   * @{$ ]" `) {% j8 T- f# k4 t2 ~
  105.   */: ^+ |% G/ ~% Q' P# p
  106. #define FSMC_AsynchronousWait_Disable            ((uint32_t)0x00000000)
      ^; b" g/ B. M+ N3 T. H: _
  107. #define FSMC_AsynchronousWait_Enable             ((uint32_t)0x00008000)
    ' ~" v% V3 t/ L% o
  108. #define IS_FSMC_ASYNWAIT(STATE) (((STATE) == FSMC_AsynchronousWait_Disable) || \
    # R* H- Z7 i- f) G- y4 p
  109.                                  ((STATE) == FSMC_AsynchronousWait_Enable))3 O5 L+ Z( N; d
  110. /**
    # O: `- A$ @) x+ p5 i" o
  111.   * @}
    " X/ ^. Z" m# ?9 C
  112.   */
    . L9 w. T4 _9 b0 W; Z  O
  113. ' U, g9 y; R6 u
  114. /** @defgroup FSMC_Wait_Signal_Polarity / b8 [  Y3 G! e
  115.   * @{
    1 L4 d8 w/ w. `% b: y( ^. B
  116.   */
    ( S* ?$ i8 i$ @. ?5 i' v
  117. #define FSMC_WaitSignalPolarity_Low              ((uint32_t)0x00000000)
    / B: g  {7 I- u6 c& n/ K9 y
  118. #define FSMC_WaitSignalPolarity_High             ((uint32_t)0x00000200)" ^- L* S' T/ c! H
  119. #define IS_FSMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FSMC_WaitSignalPolarity_Low) || \
    2 h( s: w9 h' I& K- M
  120.                                          ((POLARITY) == FSMC_WaitSignalPolarity_High))
    6 D; s& F) a6 p% D! a- {. a
  121. /**7 }# _; d( K4 t& `3 ]# e
  122.   * @}
    - p  `1 M9 |+ J1 N
  123.   *// k  V; \8 j! T, u4 k. }2 a

  124. - E9 Z& Y4 V' A+ C2 K+ H
  125. /** @defgroup FSMC_Wrap_Mode
    2 A/ N! [7 H1 K/ d
  126.   * @{$ o1 A: P, d* p1 h0 j3 u3 O" }
  127.   */0 M$ y+ v- _$ `  I5 ]) T3 T" D4 I
  128. #define FSMC_WrapMode_Disable                    ((uint32_t)0x00000000)* h, Q$ H% O7 M6 i' f1 ^
  129. #define FSMC_WrapMode_Enable                     ((uint32_t)0x00000400)
    + c# `& z, T9 J5 l& L9 {  p
  130. #define IS_FSMC_WRAP_MODE(MODE) (((MODE) == FSMC_WrapMode_Disable) || \2 r- _$ E  Y! _9 K& m2 _' R
  131.                                  ((MODE) == FSMC_WrapMode_Enable))8 p" v* p7 D* g7 F/ }1 |2 ^4 M
  132. /**" i. `2 f' i' |, S5 J
  133.   * @}
    ; o& q; P& _, Q/ a
  134.   */; ]. i1 G/ Z% a9 p2 b9 a2 K* T8 s
  135. ; f5 g, l9 V; H
  136. /** @defgroup FSMC_Wait_Timing 4 L. C9 \. V7 |7 K  p" C% w( e. C
  137.   * @{" G1 X, D( ?5 n% H" r+ q
  138.   */
    " X+ n6 E7 u( J3 ^. A
  139. #define FSMC_WaitSignalActive_BeforeWaitState    ((uint32_t)0x00000000)
    ' e4 E# p+ g/ C4 `6 \$ n. K
  140. #define FSMC_WaitSignalActive_DuringWaitState    ((uint32_t)0x00000800)
    - Q5 C1 ^3 Q# w3 s. P7 ]
  141. #define IS_FSMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FSMC_WaitSignalActive_BeforeWaitState) || \
    : Z; p) R0 M) d; [5 ^0 p
  142.                                             ((ACTIVE) == FSMC_WaitSignalActive_DuringWaitState))" C. M# w; T: V
  143. /**
    5 X$ W: r9 {$ u5 E3 {" g7 r) F- U  _
  144.   * @}# s' D2 I8 ?& s  u& j
  145.   */
    & i; P( P( ?. T+ u  z

  146. * o( u/ f7 `2 ]2 O
  147. /** @defgroup FSMC_Write_Operation * u0 F/ B) g5 w2 V' _. a
  148.   * @{
    ) Y* T9 z; h0 {; A$ x+ g
  149.   */2 M. P5 z5 F+ v& n7 X' _$ X6 ~" [
  150. #define FSMC_WriteOperation_Disable                     ((uint32_t)0x00000000)6 g! f! |; D, a8 m3 ]
  151. #define FSMC_WriteOperation_Enable                      ((uint32_t)0x00001000)3 R* X3 D9 L  F' h; c
  152. #define IS_FSMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FSMC_WriteOperation_Disable) || \7 M7 J! D% S! U4 ?5 ?
  153.                                             ((OPERATION) == FSMC_WriteOperation_Enable))                        
      T& R3 t5 s& e% G9 m
  154. /**$ a2 x% A! X/ z
  155.   * @}
    " ^3 X. X; @! j
  156.   */) t- m* R& h$ H* @7 r

  157. 8 {" h* i9 E5 }
  158. /** @defgroup FSMC_Wait_Signal
    4 O" Z8 z7 Z- _8 }( k% U# m( y
  159.   * @{
    ! L/ K( z$ _, O& L% P
  160.   */- }, q% k0 Y2 D
  161. #define FSMC_WaitSignal_Disable                  ((uint32_t)0x00000000)& H! x6 Z  F0 F8 o0 p3 J. @1 S
  162. #define FSMC_WaitSignal_Enable                   ((uint32_t)0x00002000) $ ?' i% R! e) T  |3 ?
  163. #define IS_FSMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FSMC_WaitSignal_Disable) || \) T% L; K1 b$ z# s. l
  164.                                       ((SIGNAL) == FSMC_WaitSignal_Enable))* p* [+ a- L" j5 X& O0 X2 p
  165. /**2 |4 T% i1 l- T; ^  W: J
  166.   * @}
    # f; S+ F% j9 o7 Y
  167.   */4 q0 q7 R0 m4 N6 c( U
  168. 6 l  \# H! {) X& }% N- A  ~
  169. /** @defgroup FSMC_Extended_Mode 5 J9 z' \5 I$ p7 G' |9 @3 u. V
  170.   * @{
    * d7 h% x3 }+ C& n2 J: `
  171.   */* V# N& @4 D, l+ [0 I6 B
  172. #define FSMC_ExtendedMode_Disable                ((uint32_t)0x00000000)
    : @3 u9 q& y0 M6 r6 O
  173. #define FSMC_ExtendedMode_Enable                 ((uint32_t)0x00004000)2 z4 A9 X$ V1 I, O) O3 b( [
  174. - m. O6 v: I! H
  175. #define IS_FSMC_EXTENDED_MODE(MODE) (((MODE) == FSMC_ExtendedMode_Disable) || \
    5 U% `. X3 n  J% p" a
  176.                                      ((MODE) == FSMC_ExtendedMode_Enable))
    : ?( C, q3 ?; ~$ v, d8 V7 ~5 {
  177. /**
    ) H3 b; g+ _7 O6 f8 o
  178.   * @}2 B0 s* w6 \- o0 j8 n
  179.   */
      B  \; U$ e: l' j) i) R! O1 d  H
  180. 9 {5 o% ]8 x2 z- Z8 v. }
  181. /** @defgroup FSMC_Write_Burst
    : H* d3 q% E# [4 S9 _
  182.   * @{
    " q, ^. h+ j: [. |9 F9 C
  183.   */
    - `8 g6 q0 s3 P  |- h! h
  184. 8 q# F4 a6 G/ y! s' o0 c/ Z$ ]
  185. #define FSMC_WriteBurst_Disable                  ((uint32_t)0x00000000)
    6 U: W4 X- M7 t3 k8 K
  186. #define FSMC_WriteBurst_Enable                   ((uint32_t)0x00080000)
    4 |+ w  C# n( m4 W
  187. #define IS_FSMC_WRITE_BURST(BURST) (((BURST) == FSMC_WriteBurst_Disable) || \
      x# z9 p% P8 Y. Z* U8 j/ R4 V
  188.                                     ((BURST) == FSMC_WriteBurst_Enable))
    # ], r" N. V  M3 V$ d" X1 H
  189. /**
    2 [2 w$ Y$ z- n% l) `( M% _# m
  190.   * @}2 V; P9 p, M5 q3 G' l- D3 ]6 z- f
  191.   */6 \, X. a9 m% J# i% N

  192. 1 f! {/ M8 o4 |. n" L% G
  193. /** @defgroup FSMC_Address_Setup_Time / Y# I* h6 p% n4 Z0 Z# m
  194.   * @{6 t8 k( K* y& J1 ^: ]6 r
  195.   */
    $ X/ Z$ ]. M" h# s  C* {% \
  196. #define IS_FSMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 0xF)
    ) F: _5 ^3 g/ A4 }4 I
  197. /**
    " H) c2 |5 Y, T# ~) O  k: w
  198.   * @}
    + N' T+ p  G, m( ^+ j1 K
  199.   */; b9 ~" j- d4 R
  200. 2 Q9 P/ G, ?. r8 I7 b- D
  201. /** @defgroup FSMC_Address_Hold_Time
    7 d& ?) f* |& o. p
  202.   * @{! M1 Y) m4 ~% s
  203.   */: j( z  ?/ ?6 Z1 u/ z! u
  204. #define IS_FSMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF)& v3 A0 {* q5 H2 f) V8 I, O3 j
  205. /**
    3 m5 Y; n# n4 l. U" _
  206.   * @}9 P& F8 B' g; n3 Q4 G. Z3 D
  207.   */8 ]$ E0 ]2 s) d4 J! C- D6 O
  208. $ X- z+ D1 T3 k% |6 w% ]: s
  209. /** @defgroup FSMC_Data_Setup_Time % `' d& O9 X- _+ n, u& g
  210.   * @{
    / Z0 k/ q+ r2 \9 ]1 J1 B
  211.   */* s' F0 Q. Y5 a- j, v  R* t
  212. #define IS_FSMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF))- {. R1 I7 j! y( Y) ]- P8 g
  213. /**
    ! J# n' v6 o0 j+ y' ^& p0 q
  214.   * @}7 m6 c, H0 _- d7 X- C$ B. ]8 K; ?
  215.   */. n! m8 E% y8 A; [, s9 c
  216. 9 @- H3 }* m. U+ O/ f+ S* h
  217. /** @defgroup FSMC_Bus_Turn_around_Duration $ S& M# h: S$ Q
  218.   * @{
    # l, N; K0 t. j5 Z
  219.   */  y+ M3 }3 W) J& B! x) f' k
  220. #define IS_FSMC_TURNAROUND_TIME(TIME) ((TIME) <= 0xF)* x5 K4 y+ T1 S% W# h* t* V# }
  221. /**
    9 o, v; l6 w" V/ l: f, S% Q$ A
  222.   * @}
    7 ^$ M; H7 n- M8 ~  ~
  223.   */
    * C: f) S, k2 r" N, n

  224. , c5 P# u; y6 n# w: i) Q
  225. /** @defgroup FSMC_CLK_Division
    + V# n* }; W! f* q3 W2 H
  226.   * @{
    + s* }6 u* G+ ~& p2 Z7 {
  227.   */  ]; N, N! ?5 c; F9 V7 _: q
  228. #define IS_FSMC_CLK_DIV(DIV) ((DIV) <= 0xF)
    3 [( e" D! X9 {* j8 |. B- \- C( V
  229. /**
    ! p0 V# Q/ b# j# K
  230.   * @}' v1 c$ x4 s7 s2 Y
  231.   */9 ?* J$ w# a0 ^' w% j7 ]- d7 H9 _
  232. 0 A" o: x" y' H8 e) ?) i0 e" @* ?
  233. /** @defgroup FSMC_Data_Latency
      P( M0 L* T* y) N% D7 L
  234.   * @{
    ( q. g9 t; n7 O8 M( j. }
  235.   */
    5 R0 h+ V6 D" c6 i* U% n9 b
  236. #define IS_FSMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 0xF)/ A9 ?9 T! P: Y  ?; y. y/ c6 l2 Y
  237. /**
    , S1 K! P/ t: ?
  238.   * @}
    1 }1 ?  S  s4 N, _
  239.   */
    ( e& O; b+ _: O  d- ?$ @: Z( g

  240. ( X! ^6 E9 k/ \, h1 f; t9 u
  241. /** @defgroup FSMC_Access_Mode 6 G/ a2 t& Q$ U: {& e2 X" z" F3 J3 v
  242.   * @{
    1 ]. N  {) m9 B6 M! S# M/ O
  243.   */7 ^$ K/ L( w7 ^' ^" ~
  244. #define FSMC_AccessMode_A                        ((uint32_t)0x00000000)' D! V  g; `: V! m
  245. #define FSMC_AccessMode_B                        ((uint32_t)0x10000000) % @6 d3 ^0 F: I. [$ O
  246. #define FSMC_AccessMode_C                        ((uint32_t)0x20000000)3 i6 q4 h; q+ ]0 x- r9 S
  247. #define FSMC_AccessMode_D                        ((uint32_t)0x30000000)" N. [- ?# g2 `3 `1 P, |+ P: w, v
  248. #define IS_FSMC_ACCESS_MODE(MODE) (((MODE) == FSMC_AccessMode_A) || \
    : @' ~- X& f/ J/ n- ?
  249.                                    ((MODE) == FSMC_AccessMode_B) || \
    2 S3 J* \8 J+ d6 e! }3 M
  250.                                    ((MODE) == FSMC_AccessMode_C) || \
    5 [! h8 f0 z+ y% H. B$ L0 F
  251.                                    ((MODE) == FSMC_AccessMode_D))' B3 @  }6 x& z+ \* A
  252. /**
    6 I- R1 {" ]  a" r
  253.   * @}. i5 E' y( Q1 p# a) n' F( g$ ^
  254.   */
    5 q$ n7 `/ R: _) A( \

  255. 1 L  ^/ \: L) W8 o# f
  256. /**9 ~6 A( `+ b  I/ D0 X. t
  257.   * @}
    / A' x. r5 Y, ?# \8 |
  258.   */+ U/ T& d; L+ w3 W4 `: j- @

  259. ! \& R, g) y6 l. x' A2 [: T; \0 H
  260. /** @defgroup FSMC_NAND_PCCARD_Controller / p: Q, n- a2 _% N
  261.   * @{
    . d! Y8 P' i6 E9 C  a& \+ v
  262.   */
    8 j- h/ w* R0 z1 T
  263. $ V1 n- f% e. V: q2 v" T' @; e
  264. /** @defgroup FSMC_Wait_feature
    " M8 Q& K$ B1 F6 M3 k! `0 \
  265.   * @{
    / d! R0 \* y1 t6 W5 a, g
  266.   */
    & X* s' @& R  d
  267. #define FSMC_Waitfeature_Disable                 ((uint32_t)0x00000000)' Q0 l; G" {+ `" |# J' r
  268. #define FSMC_Waitfeature_Enable                  ((uint32_t)0x00000002)
    0 M4 O# {9 W! J* k! f; ~- _
  269. #define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_Waitfeature_Disable) || \- _/ e1 }! O0 e% ?' t
  270.                                        ((FEATURE) == FSMC_Waitfeature_Enable))& @9 z1 [7 X; D$ t) c7 d
  271. /**
    ! F0 }  Y9 [6 s7 V2 v
  272.   * @}
    6 n* [3 j) n8 e$ H0 }0 P
  273.   */& ?/ q2 i# |4 A) V
  274. + Y. e# j, x/ Y' F. q% @! Q' U

  275. & O8 Z: {4 z& L( \
  276. /** @defgroup FSMC_ECC
    ' O$ r6 C% F) h7 y# ?+ c9 ]
  277.   * @{) a3 F" a' ]7 H' v: G
  278.   */
    ; E/ `& d$ \9 v3 U8 l8 T* O9 b
  279. #define FSMC_ECC_Disable                         ((uint32_t)0x00000000)  S1 K" m! g* b
  280. #define FSMC_ECC_Enable                          ((uint32_t)0x00000040)
    ( G% U$ c7 U$ `. h- T% R9 i* f
  281. #define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_ECC_Disable) || \: q3 a+ x! L. F/ a8 W
  282.                                   ((STATE) == FSMC_ECC_Enable))
    # q3 Q. @) R: K+ {) `  o4 j
  283. /**
    0 H5 y& r3 ?7 ]* U4 O
  284.   * @}0 U# L3 j9 k  i1 Q7 @
  285.   */- \: J: T. b# |$ u
  286. & S: s# C4 C' k  Q0 n
  287. /** @defgroup FSMC_ECC_Page_Size
    2 v6 r5 K/ U3 h$ y0 v* c
  288.   * @{; l& d" T4 i  D7 V% G5 m+ g1 L. y; `* V
  289.   */
    4 R$ ~7 C4 v! A8 `3 r' ^
  290. #define FSMC_ECCPageSize_256Bytes                ((uint32_t)0x00000000)
    1 l5 N5 ~" m4 T
  291. #define FSMC_ECCPageSize_512Bytes                ((uint32_t)0x00020000)
    ' T! g6 t* g  W) l$ i- U4 Z
  292. #define FSMC_ECCPageSize_1024Bytes               ((uint32_t)0x00040000)* N& E) L3 L  K0 y) ]: X' l
  293. #define FSMC_ECCPageSize_2048Bytes               ((uint32_t)0x00060000)- s% Y$ I& z' A, O* B8 P# G
  294. #define FSMC_ECCPageSize_4096Bytes               ((uint32_t)0x00080000)
    6 Q8 s5 g; U8 w$ j  c& E# T( ]
  295. #define FSMC_ECCPageSize_8192Bytes               ((uint32_t)0x000A0000)
    % h% b2 H( }' L  ~
  296. #define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_ECCPageSize_256Bytes) || \3 p  E: ^; T6 t) w
  297.                                     ((SIZE) == FSMC_ECCPageSize_512Bytes) || \
    " {- z( F* f% z- h& U- b, V
  298.                                     ((SIZE) == FSMC_ECCPageSize_1024Bytes) || \) f+ D/ D& P3 z% z- U- N
  299.                                     ((SIZE) == FSMC_ECCPageSize_2048Bytes) || \' p" g1 y5 P  r
  300.                                     ((SIZE) == FSMC_ECCPageSize_4096Bytes) || \& X2 S! U1 Z/ s4 N* P7 x4 o* e
  301.                                     ((SIZE) == FSMC_ECCPageSize_8192Bytes))! F9 P* j0 e5 W7 n; K
  302. /**$ X  y4 r: `( z
  303.   * @}: t9 |5 L0 x) r/ S, D: I5 A7 `
  304.   */2 x2 Z/ l& Q9 }

  305. 1 I% a% _' J" a4 N1 Q
  306. /** @defgroup FSMC_TCLR_Setup_Time $ z% I" j2 o5 t& O" w1 ~
  307.   * @{
    . G+ f7 ^, K' J' X
  308.   */
    5 \: B0 [6 u3 D
  309. #define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 0xFF)
    - N: R, C5 v2 W6 T! p( q* |
  310. /**1 R) g& \( k3 X
  311.   * @}8 p" J4 l9 a) T
  312.   */2 h4 b. f& m9 P& z: E; ^. {
  313. 2 P% R& T% }& K# p/ q1 O
  314. /** @defgroup FSMC_TAR_Setup_Time
    5 D3 [; c1 f! B2 Q/ d3 C+ Y
  315.   * @{9 o% K1 ]& q, _9 _. _' \
  316.   */+ j( t' ?4 u: H$ V. J
  317. #define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 0xFF)
    & d  f) T% r" z, D# O9 c& x* C# K, y
  318. /**
    4 m0 X: W1 ~( S0 Z7 A8 a/ {
  319.   * @}& v+ F6 J7 M3 `- d' U" X7 R
  320.   */
    6 ]: y3 z( a& e! n

  321. ; ?7 e) E4 R( Z) X' ~
  322. /** @defgroup FSMC_Setup_Time 6 W0 S1 L% n, K! }3 X+ k! ]
  323.   * @{' D- P4 M( m$ ]# o
  324.   */1 X, V6 Z' i0 z; V: H( U/ ^
  325. #define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 0xFF)7 o/ h7 U/ g- Z: m! l
  326. /**2 K" b4 \& R. v, {9 U; E
  327.   * @}
    ! h. R3 `9 W! {0 D  C/ z5 R
  328.   */
    3 H7 w, r- E- _/ H- Z6 n
  329. 7 K+ L& m+ _  W* n& P& G5 E, S) |: V
  330. /** @defgroup FSMC_Wait_Setup_Time
    " Y! k6 Z. |: t9 E# `$ l$ ?
  331.   * @{
    & x8 L$ l" k" _' g
  332.   */' _7 E7 m. m6 P: O) U4 _. n$ ]
  333. #define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 0xFF)
    : ^1 j; x) g$ t. R
  334. /**
    0 ?1 H9 f2 u( h: V6 c" c! q% Q
  335.   * @}9 M6 H$ R, J+ G; y# g
  336.   */* y, p9 R; o- N, {9 x; Y
  337. 8 J+ l: x4 O& N5 B
  338. /** @defgroup FSMC_Hold_Setup_Time 3 x5 p% Q7 h/ ?: @8 ~& ^' X
  339.   * @{5 Q* c. V, X) S7 q
  340.   */( \7 _; p+ K! _' Z, ~7 l; s5 |
  341. #define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 0xFF); Y3 _! \% S) _8 x+ N$ V
  342. /**" R7 X8 h- T! i/ Y8 {9 S9 w1 O. d
  343.   * @}
    / T& N7 M# M7 n" @# M2 s9 ?
  344.   */% V0 J1 G  @0 @: Z

  345. * h9 S4 n5 V6 O! S4 A- I. u
  346. /** @defgroup FSMC_HiZ_Setup_Time ; I3 S+ {! }: T* q3 z& s1 V
  347.   * @{" M9 o/ y% r$ g+ j) K
  348.   */+ w" ]; m! e' S: j9 v
  349. #define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 0xFF)
    1 l3 B& B7 u; Z# D, E
  350. /**
    ! S* R1 m: y: d$ L  t
  351.   * @}$ J0 w0 f- ?3 u% K* R5 h# M
  352.   */' I9 G9 M2 H' y
  353. 9 X& J8 j; k/ K+ Z5 {' ~& x
  354. /** @defgroup FSMC_Interrupt_sources
    ( W! a& S+ u! M# L
  355.   * @{
    % u7 a" B" Q; J/ V- e5 _* K
  356.   */
    - U: B; [4 Y3 Y. x9 @& Y9 D
  357. #define FSMC_IT_RisingEdge                       ((uint32_t)0x00000008)5 L- d- f$ N3 G/ D$ L& F
  358. #define FSMC_IT_Level                            ((uint32_t)0x00000010)
    " W) X3 J! v/ w+ ]  u
  359. #define FSMC_IT_FallingEdge                      ((uint32_t)0x00000020)
    6 b8 t: @; ]5 ?, V: }) f6 L
  360. #define IS_FSMC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((IT) != 0x00000000))
    ; C0 n3 k5 q6 o- R6 ?* G
  361. #define IS_FSMC_GET_IT(IT) (((IT) == FSMC_IT_RisingEdge) || \
    / n) n# h/ H% A. a* ~; h& i$ d
  362.                             ((IT) == FSMC_IT_Level) || \- ]3 x! Z) g4 Y# L0 C1 o; z  N2 y
  363.                             ((IT) == FSMC_IT_FallingEdge)) + V: \; Z/ p" ~! e: X7 c! r
  364. /**
    % I; n' s( R! U- h; D: R0 W: L6 X
  365.   * @}* u1 }9 {( D/ }6 R
  366.   */
      I! [$ ?+ j4 h( d# i
  367. , t1 N, u1 q* M: ^, Q2 ^1 N" @2 ~
  368. /** @defgroup FSMC_Flags 8 q" P4 m" Z6 c& `
  369.   * @{( Y% F& i) \' ~7 ^
  370.   */
    2 ^/ \4 @" Q& q2 `. x  u. Q/ p8 J
  371. #define FSMC_FLAG_RisingEdge                     ((uint32_t)0x00000001)
    8 `9 @, e: J* d0 Q3 q$ S
  372. #define FSMC_FLAG_Level                          ((uint32_t)0x00000002)# }+ }: F3 f& E8 Z  u7 G' Q
  373. #define FSMC_FLAG_FallingEdge                    ((uint32_t)0x00000004)
    / g* y; }3 E3 ?
  374. #define FSMC_FLAG_FEMPT                          ((uint32_t)0x00000040)$ y5 l6 G/ o; ]6 M( d' n# ?  T! l- }
  375. #define IS_FSMC_GET_FLAG(FLAG) (((FLAG) == FSMC_FLAG_RisingEdge) || \
    1 Z* p: `# T1 Z0 ^# E( W" g' U+ ?
  376.                                 ((FLAG) == FSMC_FLAG_Level) || \2 |$ \) G. {, g
  377.                                 ((FLAG) == FSMC_FLAG_FallingEdge) || \1 d5 y" S/ I8 U- Z6 y0 e
  378.                                 ((FLAG) == FSMC_FLAG_FEMPT))5 l$ @( M# f6 f& @) w8 B' ]
  379. 8 Q* S3 b/ H, I% y* H
  380. #define IS_FSMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))
复制代码

: S8 p9 ]4 Y$ O: {0 Z" w( }03. 相关函数: a/ y5 @. Q4 n" [
  1. /* NOR/SRAM Controller functions **********************************************/+ |: J* i2 `# {' n
  2. void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank);0 x+ _7 p) O( U6 \. E8 ^7 f+ ?
  3. void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);: Y/ }( h1 p- N
  4. void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
    8 Y2 G4 U8 B% Q1 k: L
  5. void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState);
    & l/ x1 o- [1 O, K4 C" u

  6. 8 q. Y! ^' y/ X. K% x5 a
  7. /* NAND Controller functions **************************************************/
    0 u9 @3 J$ r% x4 p; Q2 O' M; |
  8. void FSMC_NANDDeInit(uint32_t FSMC_Bank);
    # P2 H/ Y) t7 k/ I9 F7 a; y9 [( n
  9. void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);$ `- \2 j1 h, o; ]% g
  10. void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);  {& I* T, s% R
  11. void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState);
    / x- i2 u8 h3 A8 `
  12. void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState);
    , H! C) l6 O0 B1 ]
  13. uint32_t FSMC_GetECC(uint32_t FSMC_Bank);
    9 \, G- c7 X+ V" S! k
  14. ' l: P, ?0 R0 V& L
  15. /* PCCARD Controller functions ************************************************/' P+ ^- s* x4 }. v3 G
  16. void FSMC_PCCARDDeInit(void);4 T' b6 ~; _6 A& e6 t( p; l( c
  17. void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
    ; o* s: D% p8 r6 ]
  18. void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
    + ]  P( c5 u$ C! w) G" V! p( b$ ^+ E; ?
  19. void FSMC_PCCARDCmd(FunctionalState NewState);
    8 J! ~0 a+ |$ l4 I

  20. , l# I/ A& f+ d7 X$ ]$ j/ F3 K
  21. /* Interrupts and flags management functions **********************************/5 F0 s' R! z$ ?1 a0 P8 F
  22. void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState);+ ^$ k- V6 g: S( H* T; l
  23. FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
    , R; {* o7 X' E: Z4 b% d( {
  24. void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
    ; `% }7 u! A! p- b; y! Y
  25. ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT);
    8 t8 S6 L9 ]6 J! e  R4 a
  26. void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT);
复制代码
+ }8 O& K& o9 I6 [2 I* I
04. 结构体封装
* Q9 M% N$ I1 i5 f' M+ x
  1. typedef struct
    # |+ a' a9 ]# i# ?
  2. {
    ) w8 u. Y/ |$ X7 H7 W
  3.   __IO uint32_t BTCR[8];    /*!< NOR/PSRAM chip-select control register(BCR) and chip-select timing register(BTR), Address offset: 0x00-1C */   & r) {: u5 q5 n' q5 W- y
  4. } FSMC_Bank1_TypeDef;
    6 y3 }. K$ b9 E

  5. $ L4 @/ ~+ k0 E0 M
  6. /**
    7 `2 g5 U4 X3 N) m0 f# z
  7.   * @brief Flexible Static Memory Controller Bank1E. s2 W7 e# R0 D! x( |7 ^+ x* H
  8.   */2 M6 w- C# [3 s: u% U+ _4 E' p
  9. ! _" y, C1 f) K7 q% b2 p2 X
  10. typedef struct" ?; u+ Y. Q6 x+ ?8 r
  11. {# z" f0 s6 o5 k. ~2 I
  12.   __IO uint32_t BWTR[7];    /*!< NOR/PSRAM write timing registers, Address offset: 0x104-0x11C */
    ) J: h0 i" O* L$ T7 @
  13. } FSMC_Bank1E_TypeDef;
    9 t6 M4 x+ a* ?9 Y
  14. * c9 ]2 J+ p& i: D. o
  15. /** . {9 B* r6 e. Y. v
  16.   * @brief Flexible Static Memory Controller Bank2
    % w0 o4 n( p+ o) v2 y6 p: l8 |
  17.   */
    ; b9 c9 G. g# H5 h

  18. + v5 K5 I6 t5 C2 E( x* N. u
  19. typedef struct* Z% h5 n% x! k
  20. {
    % z/ W( I+ }, ~. U6 w" O+ Z; Q
  21.   __IO uint32_t PCR2;       /*!< NAND Flash control register 2,                       Address offset: 0x60 */
    4 q1 u1 A; ?5 X% ~
  22.   __IO uint32_t SR2;        /*!< NAND Flash FIFO status and interrupt register 2,     Address offset: 0x64 *// l7 Z% v: }+ V! f8 W! c
  23.   __IO uint32_t PMEM2;      /*!< NAND Flash Common memory space timing register 2,    Address offset: 0x68 */
    - r. \( L5 {3 E# ]3 ?* e1 I
  24.   __IO uint32_t PATT2;      /*!< NAND Flash Attribute memory space timing register 2, Address offset: 0x6C */0 M9 l  V5 o8 _3 Y4 H7 y
  25.   uint32_t      RESERVED0;  /*!< Reserved, 0x70                                                            */
      ]0 ]- e( w/ Q. G8 r
  26.   __IO uint32_t ECCR2;      /*!< NAND Flash ECC result registers 2,                   Address offset: 0x74 */$ Y7 o! u/ u# y$ K
  27. } FSMC_Bank2_TypeDef;4 Z% P& e9 M: h0 ~
  28. # k+ @6 h6 f4 C
  29. /** ! L# M# R5 I7 k$ Q% L
  30.   * @brief Flexible Static Memory Controller Bank3: I! q( k- \6 G  |% i1 r- ?3 j2 C, f9 w
  31.   */
    " o# E8 G" O. o5 Z9 R$ q
  32. ; R" V1 Z0 c( a0 f  Q' [  ?
  33. typedef struct( N* c( e3 ^+ e4 z
  34. {: @0 m9 t6 R, W2 Z: k: N; _
  35.   __IO uint32_t PCR3;       /*!< NAND Flash control register 3,                       Address offset: 0x80 */
    / o! }  q1 ], ~$ R
  36.   __IO uint32_t SR3;        /*!< NAND Flash FIFO status and interrupt register 3,     Address offset: 0x84 */4 |9 }% {( P# @+ _' p/ Z" P
  37.   __IO uint32_t PMEM3;      /*!< NAND Flash Common memory space timing register 3,    Address offset: 0x88 */
    ' @0 u: ^) \( O+ o9 F# C% |3 _8 }9 H
  38.   __IO uint32_t PATT3;      /*!< NAND Flash Attribute memory space timing register 3, Address offset: 0x8C */! h3 P+ k% s5 ~6 h8 }4 |
  39.   uint32_t      RESERVED0;  /*!< Reserved, 0x90                                                            */# l9 I2 Q! y" _/ t6 U% ^  ^
  40.   __IO uint32_t ECCR3;      /*!< NAND Flash ECC result registers 3,                   Address offset: 0x94 */
    , C/ l: a' T; _: X0 K; N
  41. } FSMC_Bank3_TypeDef;
    ) C; }$ U6 ]* r5 v

  42. 0 Z: h) a( v7 e7 v% \. d
  43. /**
    9 |* y( j5 j! ]4 M8 ~
  44.   * @brief Flexible Static Memory Controller Bank4
    ' k; n- B& _3 @  Z2 N
  45.   */+ @/ `& ?+ I4 W# S2 \
  46. * ]" m- ]  e+ i, i. t' {+ D
  47. typedef struct
    . K6 a  {: S5 }" i. t
  48. {# T) U& o: r/ S" A' b5 r& A
  49.   __IO uint32_t PCR4;       /*!< PC Card  control register 4,                       Address offset: 0xA0 */& Y  {9 y- _5 e& n, H. b7 h2 y3 Y
  50.   __IO uint32_t SR4;        /*!< PC Card  FIFO status and interrupt register 4,     Address offset: 0xA4 */
    & c2 A: C; d. W& v' c+ o  z
  51.   __IO uint32_t PMEM4;      /*!< PC Card  Common memory space timing register 4,    Address offset: 0xA8 */! g; J; b/ Z  n  r, U, j
  52.   __IO uint32_t PATT4;      /*!< PC Card  Attribute memory space timing register 4, Address offset: 0xAC */: c' Q. X9 h8 x
  53.   __IO uint32_t PIO4;       /*!< PC Card  I/O space timing register 4,              Address offset: 0xB0 */
    , X& O/ D: b9 p
  54. } FSMC_Bank4_TypeDef;
复制代码

7 s( d% B( T. b9 C
& J1 ^# X$ R( l- O) G% P9 E" H! @& p# N  H2 }( |+ G
赞 收藏 评论0 发布时间:2022-6-14 13:47

举报

0个回答

所属标签

相似技术帖

官网相关资源

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