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

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

[复制链接]
STMCU小助手 发布时间:2022-3-29 09:52
01. 概述
; p8 n& K7 g/ ^6 `$ I: u" aFSMC 相关的库函数分布在 stm32f4xx_fsmc.c 文件和头文件 stm32f4xx_fsmc.h 中。
/ g$ r1 ?3 ~& h6 f$ I) H7 c% l0 X- M0 |! V* W# `4 F
02. 相关类型% {8 A& `7 V1 I) ?. d! i: z. ?! X6 A
FSMC_NORSRAMTimingInitTypeDef类型
: H7 _1 I) z& j8 z- }" W- r; v. I' p, v* `7 Y, O
  1. 5 `/ T" \: M' N; c6 m  @; f
  2. /** ) t) d2 a; S' H8 Q- y
  3.   * @brief  Timing parameters For NOR/SRAM Banks  
    : W) G; T8 W4 c0 ?
  4.   */
    # v9 x) e# E2 F
  5. typedef struct8 A  U! m( g/ ^; N7 E
  6. {
    & j& J7 T7 {) m8 K; n$ S
  7.   uint32_t FSMC_AddressSetupTime;       /*!< Defines the number of HCLK cycles to configure7 T* q! H& q6 w- ~5 o& R  {
  8.                                              the duration of the address setup time.
    : q$ d4 |$ U: p5 X
  9.                                              This parameter can be a value between 0 and 0xF.8 t. C. m! g; z/ H
  10.                                              @note This parameter is not used with synchronous NOR Flash memories. */% p$ n! q; f) r% @

  11. : y/ P. C2 q; r5 n# M4 l8 C1 U0 O" X
  12.   uint32_t FSMC_AddressHoldTime;        /*!< Defines the number of HCLK cycles to configure
    ( \* J  n- P- I8 u3 a/ L! b
  13.                                              the duration of the address hold time.
    2 `$ d) X* A0 p% q" h6 i
  14.                                              This parameter can be a value between 0 and 0xF. / k, c; k+ d* x5 v( b! k8 l
  15.                                              @note This parameter is not used with synchronous NOR Flash memories.*/
    ) H9 c6 L. k5 }) m+ n; L

  16. * v; ?7 Z1 ?# o/ n
  17.   uint32_t FSMC_DataSetupTime;          /*!< Defines the number of HCLK cycles to configure; _' G% j2 O$ k: |: ?
  18.                                              the duration of the data setup time.9 M/ j) n! V$ G
  19.                                              This parameter can be a value between 0 and 0xFF.
    : a: x3 }3 {0 J+ \
  20.                                              @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed NOR Flash memories. */
    ) u/ T3 \9 Q6 q7 a: T3 @$ ^7 C
  21. " F( U0 L: k& a: }0 X2 I% Q
  22.   uint32_t FSMC_BusTurnAroundDuration;  /*!< Defines the number of HCLK cycles to configure
    7 T; D# q- K! G1 X& V
  23.                                              the duration of the bus turnaround.$ v9 s, ?; \0 J$ r) O& S" s; v! L
  24.                                              This parameter can be a value between 0 and 0xF.- n) I( g6 V0 ^6 L' l$ o# u" f
  25.                                              @note This parameter is only used for multiplexed NOR Flash memories. */) D% A7 r3 T) R" u: ~, H3 g( T

  26. # S0 n  Q/ }/ O5 p$ c/ i' d
  27.   uint32_t FSMC_CLKDivision;            /*!< Defines the period of CLK clock output signal, expressed in number of HCLK cycles.4 k/ Y# K6 E) w
  28.                                              This parameter can be a value between 1 and 0xF.
    1 Y; h+ z1 N4 T. i  b7 A0 J
  29.                                              @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM accesses. */* T* \0 e- S) ], {1 @

  30. # B7 V% S8 f. d/ d' L" g
  31.   uint32_t FSMC_DataLatency;            /*!< Defines the number of memory clock cycles to issue% ]$ u' f( l( L! e4 I9 \
  32.                                              to the memory before getting the first data.6 w# S" l( l. \; R# i
  33.                                              The parameter value depends on the memory type as shown below:
    " u6 y- _7 B) U) S& ~, l
  34.                                               - It must be set to 0 in case of a CRAM
    9 V& U9 s0 x( B! m) G# r. `
  35.                                               - It is don't care in asynchronous NOR, SRAM or ROM accesses' f: j1 Y4 U) [, B% z
  36.                                               - It may assume a value between 0 and 0xF in NOR Flash memories
    " c3 M2 `8 G9 i8 {& z3 X2 K
  37.                                                 with synchronous burst mode enable *// k7 P. V' e/ N! M( c
  38. ; V, b4 R1 w  |4 e5 a
  39.   uint32_t FSMC_AccessMode;             /*!< Specifies the asynchronous access mode. 7 F- }+ g; X* }: W0 @. d( ^& G/ ?
  40.                                              This parameter can be a value of @ref FSMC_Access_Mode */. f5 t9 {- z) t% E
  41. }FSMC_NORSRAMTimingInitTypeDef;
复制代码
9 R* K. k, j& y, f* T2 a. E, S
FSMC_NORSRAMInitTypeDef类型
+ H9 }6 `' g, @% f& G) p; D5 O8 m' i
  1. /**
    8 U. @* M( q8 {) _: @5 i
  2.   * @brief  FSMC NOR/SRAM Init structure definition
    1 e) H4 h- o' T" ^) ^" s( ~# H
  3.   */
    % |) }+ W! |5 a5 K0 _; J& G  w  H; ]
  4. typedef struct4 v+ s: |  K! }) B* {; f
  5. {1 L+ ~5 L; `2 C1 u/ b
  6.   uint32_t FSMC_Bank;                /*!< Specifies the NOR/SRAM memory bank that will be used.
    & u& s* C* `  h+ i% D# R+ o
  7.                                           This parameter can be a value of @ref FSMC_NORSRAM_Bank */- c" b1 \9 R5 V6 I5 I2 G+ k

  8. 6 \7 d: b- c* H7 G
  9.   uint32_t FSMC_DataAddressMux;      /*!< Specifies whether the address and data values are
      Y: P4 o- Z) M, C- G
  10.                                           multiplexed on the data bus or not.
    ; v+ S. \- N4 m- a% H4 p
  11.                                           This parameter can be a value of @ref FSMC_Data_Address_Bus_Multiplexing */
    # Y9 x, D% y) I7 u6 S2 z
  12. , r! ]' d" Q; \4 e+ F' o  Z0 a( m( P
  13.   uint32_t FSMC_MemoryType;          /*!< Specifies the type of external memory attached to
    % i1 R$ ]/ l: k& N
  14.                                           the corresponding memory bank.. b! r  U% c9 C8 ^3 u
  15.                                           This parameter can be a value of @ref FSMC_Memory_Type */
    ; l7 i' \7 d7 k- W+ Y2 R& U

  16. 3 E4 |$ |+ O" \2 L2 V0 i
  17.   uint32_t FSMC_MemoryDataWidth;     /*!< Specifies the external memory device width.( t0 p) X$ F8 ?0 h
  18.                                           This parameter can be a value of @ref FSMC_Data_Width */
    0 t, A  w9 T" g: @( I. V0 A; j
  19. / }: {& c! w: `: Z3 K
  20.   uint32_t FSMC_BurstAccessMode;     /*!< Enables or disables the burst access mode for Flash memory,
    , [* E" Z/ U/ y4 E/ s+ o3 C. n3 e
  21.                                           valid only with synchronous burst Flash memories.
    ' a: W, N2 D3 ^
  22.                                           This parameter can be a value of @ref FSMC_Burst_Access_Mode */; O+ I% S% _; |( R/ x

  23. ; P3 h$ n5 j% V
  24.   uint32_t FSMC_AsynchronousWait;     /*!< Enables or disables wait signal during asynchronous transfers,
    7 u3 X. g0 X9 V. }/ e
  25.                                           valid only with asynchronous Flash memories.
    & B2 [% V# |0 K) W& A! m( K
  26.                                           This parameter can be a value of @ref FSMC_AsynchronousWait */                                          
    $ S- x" @6 @6 a# i. ^" `7 z

  27. : \* T) |1 q& v( e9 o
  28.   uint32_t FSMC_WaitSignalPolarity;  /*!< Specifies the wait signal polarity, valid only when accessing
    ( X; j3 u) l  {( J6 j) j
  29.                                           the Flash memory in burst mode.
    3 |2 N& E3 j3 E8 x6 d
  30.                                           This parameter can be a value of @ref FSMC_Wait_Signal_Polarity */! d& @6 I" n$ P: Z5 z7 }! [2 {

  31. 7 @0 P  a- J" A. c; ]: C
  32.   uint32_t FSMC_WrapMode;            /*!< Enables or disables the Wrapped burst access mode for Flash
    ! u, I+ ]# y5 y2 y
  33.                                           memory, valid only when accessing Flash memories in burst mode.9 z3 F: s6 w& z: p1 u  d
  34.                                           This parameter can be a value of @ref FSMC_Wrap_Mode */. J' w! k2 B0 V0 F: W/ `% a2 |; a

  35. * m# x9 F0 @# Z! B! t& [
  36.   uint32_t FSMC_WaitSignalActive;    /*!< Specifies if the wait signal is asserted by the memory one
    : t/ `3 C/ Q! \5 {4 x- ?7 H
  37.                                           clock cycle before the wait state or during the wait state,9 [* p$ y: Q/ k8 }8 k6 y$ j% H
  38.                                           valid only when accessing memories in burst mode. ' u9 r! w0 a! ?$ @8 w, i
  39.                                           This parameter can be a value of @ref FSMC_Wait_Timing */! M0 ?3 ?9 n* A

  40. ! b5 y/ }% O1 N1 w
  41.   uint32_t FSMC_WriteOperation;      /*!< Enables or disables the write operation in the selected bank by the FSMC.
    ; b9 x7 S9 ]- V/ L5 u- N
  42.                                           This parameter can be a value of @ref FSMC_Write_Operation */' b- P4 [! I9 i9 j( n
  43. - p4 q: Q9 c! ]0 u( x/ N
  44.   uint32_t FSMC_WaitSignal;          /*!< Enables or disables the wait state insertion via wait( G- y) V- ~% R4 k; f7 G
  45.                                           signal, valid for Flash memory access in burst mode. / t8 B5 ^& l" o3 o7 T' k
  46.                                           This parameter can be a value of @ref FSMC_Wait_Signal */6 a/ E  B$ n4 P0 r$ c3 F# F  Z- z  u6 F
  47. ! u( J6 W* q$ F: M4 C
  48.   uint32_t FSMC_ExtendedMode;        /*!< Enables or disables the extended mode.9 i, s1 _* Q. D& H* r2 n8 R! {
  49.                                           This parameter can be a value of @ref FSMC_Extended_Mode */# ^: R9 m8 c: q5 W5 i# K
  50. 7 _2 q- _6 M9 C% ~, m" I
  51.   uint32_t FSMC_WriteBurst;          /*!< Enables or disables the write burst operation.% T* e; q, s1 m0 H9 ~
  52.                                           This parameter can be a value of @ref FSMC_Write_Burst */
    ! d! ?/ L  W2 T  P$ F5 Y

  53. , H  d% w3 t8 A2 I$ h
  54.   FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct; /*!< Timing Parameters for write and read access if the  Extended Mode is not used*/  
    / A. w4 \: A! j6 r# }0 n6 O
  55. : P: H# Q; X7 h( l- x: H7 d
  56.   FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct;     /*!< Timing Parameters for write access if the  Extended Mode is used*/      
    7 u2 l0 Q- ~; M( h' T7 s  n$ i
  57. }FSMC_NORSRAMInitTypeDef;
复制代码
8 _8 V$ n6 \% R
FSMC_NAND_PCCARDTimingInitTypeDef类型+ X% L+ O3 C$ U+ L5 @/ i$ l
7 x( L' b# m: J9 H/ e
  1. /** # G& P5 X- S, o" e- U5 O9 o; B
  2.   * @brief  Timing parameters For FSMC NAND and PCCARD Banks
    ( O4 o, I4 H* a) r  i5 z0 `
  3.   */
    $ |1 J1 e) ~$ }
  4. typedef struct$ P. d: s0 L  h, L) ^& b
  5. {
    2 {$ Z- H6 `6 L' N: l
  6.   uint32_t FSMC_SetupTime;      /*!< Defines the number of HCLK cycles to setup address before
    & T6 B: }- M* D
  7.                                      the command assertion for NAND Flash read or write access* L" [: t4 |6 U7 A
  8.                                      to common/Attribute or I/O memory space (depending on
    1 r1 I9 T; J9 k( @- W9 b* I  q
  9.                                      the memory space timing to be configured).
    8 |, Z- ?, J' r5 f) Q
  10.                                      This parameter can be a value between 0 and 0xFF.*/
    - i+ |/ O8 u) H4 L, {$ @2 W
  11. 3 D7 P- E5 {0 ]6 y. `8 i# V$ ~0 h
  12.   uint32_t FSMC_WaitSetupTime;  /*!< Defines the minimum number of HCLK cycles to assert the
    3 E3 C) H4 A4 ^; u% O
  13.                                      command for NAND Flash read or write access to) M; O. b1 b3 O1 X5 u8 q
  14.                                      common/Attribute or I/O memory space (depending on the
    / b) v) Y# U- k# V) j: g
  15.                                      memory space timing to be configured). 3 a5 z, y2 r/ ^3 `2 W" P
  16.                                      This parameter can be a number between 0x00 and 0xFF */; T; P# o5 M7 H. S& v

  17. + }; v- x1 {2 V! B2 d1 ]' s$ Y
  18.   uint32_t FSMC_HoldSetupTime;  /*!< Defines the number of HCLK clock cycles to hold address# C4 t4 c0 ^' j
  19.                                      (and data for write access) after the command de-assertion: q2 V7 l' q4 ]  W- y
  20.                                      for NAND Flash read or write access to common/Attribute
    4 ]# K; l% X6 s; |9 w$ ?2 Y% \. Z
  21.                                      or I/O memory space (depending on the memory space timing
    ! E& G$ O. @8 F. s) g/ l
  22.                                      to be configured).
    2 K  x% r. q& ^; P
  23.                                      This parameter can be a number between 0x00 and 0xFF */% O* f1 N6 D7 i. P( I% C( Q1 v: V

  24. ) q; p2 R  E1 m7 \0 ]. a3 g
  25.   uint32_t FSMC_HiZSetupTime;   /*!< Defines the number of HCLK clock cycles during which the
    4 O0 f7 Z# ?) F1 V
  26.                                      data bus is kept in HiZ after the start of a NAND Flash% ]0 o# H" z. h( m: ~0 f$ P
  27.                                      write access to common/Attribute or I/O memory space (depending
    * L" b; X: c. z+ g8 F
  28.                                      on the memory space timing to be configured).
    . ]) z' J5 @* N2 I' s1 m
  29.                                      This parameter can be a number between 0x00 and 0xFF */
    0 u+ r' z% J+ Y1 M  A
  30. }FSMC_NAND_PCCARDTimingInitTypeDef;
复制代码
0 v- r, T7 _) b" t* Y
FSMC_NANDInitTypeDef类型  J4 |4 n3 B4 P5 ~

. M9 c- i1 @) N) f+ V
  1. /** $ W  K3 ?. u9 z( F
  2.   * @brief  FSMC NAND Init structure definition
    4 A9 H9 r9 o( e7 C( c7 d+ n
  3.   */
    3 k/ L- G0 p5 F! H# _  t+ M) o8 P
  4. typedef struct
    / c( b8 h' b4 w8 V+ B  p
  5. {
    7 w1 P5 P2 a: C# S+ b
  6.   uint32_t FSMC_Bank;              /*!< Specifies the NAND memory bank that will be used.9 O* t8 |5 Y- E6 w2 `% j* `1 i
  7.                                       This parameter can be a value of @ref FSMC_NAND_Bank */
      p+ i+ ?6 M7 ^% O: U& {& V) K
  8. . O/ ]! I* Y, B. O4 t
  9.   uint32_t FSMC_Waitfeature;      /*!< Enables or disables the Wait feature for the NAND Memory Bank.3 `# A$ m* e7 c- ~, D6 ^
  10.                                        This parameter can be any value of @ref FSMC_Wait_feature */
    " s# U4 m  K7 q& p( |& @7 _. T

  11. 8 q: [/ n8 u( B+ Q" B  {6 Y3 ~
  12.   uint32_t FSMC_MemoryDataWidth;  /*!< Specifies the external memory device width./ y( y( b# w* H
  13.                                        This parameter can be any value of @ref FSMC_Data_Width */2 D0 V! z* s  s4 Y" a

  14. 2 t& S% j7 X/ ]) _' ?7 }9 C
  15.   uint32_t FSMC_ECC;              /*!< Enables or disables the ECC computation.$ B4 y5 @; {! D5 `; X+ e8 L* F3 u
  16.                                        This parameter can be any value of @ref FSMC_ECC */
    $ J6 D/ s- P7 T( t& D

  17. " n  _" ?  b1 F
  18.   uint32_t FSMC_ECCPageSize;      /*!< Defines the page size for the extended ECC.
    - h5 A. a, a1 r
  19.                                        This parameter can be any value of @ref FSMC_ECC_Page_Size */9 U! O1 `3 u$ k( z& T3 g
  20. / u9 F7 ?! w2 N& R1 k; ^8 y$ ?
  21.   uint32_t FSMC_TCLRSetupTime;    /*!< Defines the number of HCLK cycles to configure the. A0 U: M, `6 D. R' ?* K
  22.                                        delay between CLE low and RE low.
    , W2 o' }9 H2 l- I
  23.                                        This parameter can be a value between 0 and 0xFF. */
    , U2 G) M5 `0 _
  24.   ^  t1 \3 c) ?( |& h
  25.   uint32_t FSMC_TARSetupTime;     /*!< Defines the number of HCLK cycles to configure the/ {. D& `/ y0 L9 ]" K8 p; G
  26.                                        delay between ALE low and RE low.
    ! N& L$ x, u3 S$ T* f4 ~
  27.                                        This parameter can be a number between 0x0 and 0xFF */
    5 q! z/ ]$ ]( J! |, w0 n

  28. 4 o! {  T- Q1 p3 E
  29.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct;   /*!< FSMC Common Space Timing */
    ; q1 E2 A; n( I: L# ~' ]8 p

  30. ' R  m# ]4 [6 U2 Z2 ~: |
  31.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct; /*!< FSMC Attribute Space Timing */
    / o) J  o, G6 ?6 ^
  32. }FSMC_NANDInitTypeDef;
复制代码

# O3 w1 J& y' Q( JFSMC_PCCARDInitTypeDef类型

" }( v% N. q7 o$ b! F' m7 v( v: \& W
- d7 b  S8 P3 J
  1. /** 8 N, G; I3 F( g1 I, U
  2.   * @brief  FSMC PCCARD Init structure definition
    & _; \" g7 q( P
  3.   */
    # A9 A# p( A; Y% q5 m2 ]: a
  4. % l* n0 D, J$ b7 d5 q' @6 ?" }
  5. typedef struct7 n; @* V3 j& p- c) s* ]
  6. {9 u3 l1 M4 [$ Q# W6 G
  7.   uint32_t FSMC_Waitfeature;    /*!< Enables or disables the Wait feature for the Memory Bank.
    9 r  p# `) b+ R$ [' `
  8.                                     This parameter can be any value of @ref FSMC_Wait_feature */. Z/ c- F# L, m

  9. # T/ O' D" s/ j7 Y* e
  10.   uint32_t FSMC_TCLRSetupTime;  /*!< Defines the number of HCLK cycles to configure the
    ; b, y( K  H6 z" S, {3 z
  11.                                      delay between CLE low and RE low.
    4 |7 E4 F& V$ U. _& g2 {% H- x
  12.                                      This parameter can be a value between 0 and 0xFF. */
    , ~+ ?- a! J& u* m+ f

  13. 2 T9 L# J* y+ T# P
  14.   uint32_t FSMC_TARSetupTime;   /*!< Defines the number of HCLK cycles to configure the
    0 ]' q: a4 O5 D) C# d
  15.                                      delay between ALE low and RE low., M7 e3 D  w( `
  16.                                      This parameter can be a number between 0x0 and 0xFF */
    ' v: G# x4 @- r7 }2 e* b
  17. . f9 `0 O1 X5 p2 L( {. s) Z) Y% e- n

  18. . t5 M8 c6 ?7 J) N; q
  19.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct; /*!< FSMC Common Space Timing */6 [% U7 p: a" Y& J+ m
  20. 7 ^2 W6 n/ a4 P( W  ~1 ~/ x# L
  21.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct;  /*!< FSMC Attribute Space Timing */
    - z: O, z/ Y# k9 R& k0 c; G! ]

  22. 0 z' O2 m5 j& Y& D
  23.   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_IOSpaceTimingStruct; /*!< FSMC IO Space Timing */  
    8 Y! I; G* \1 c. i* d" ]! T
  24. }FSMC_PCCARDInitTypeDef;9 g+ S3 z/ ^, ?
复制代码

; l! |! j8 ?+ A$ Q1 j9 a# Q/ S相关宏定义
1 k  R8 q( _7 Y) t, x% _" h6 J) ?& L  [- I
  1. /** @defgroup FSMC_Exported_Constants2 v8 e; r+ c* m7 m) Z( w
  2.   * @{
    $ y$ k( ~! x" H. H+ @
  3.   */) r/ |! s- L) S' X' s, S
  4. 6 n0 \7 f% w+ L8 [9 e
  5. /** @defgroup FSMC_NORSRAM_Bank 4 {' k$ x& `* |0 s% p  Z6 r$ F, q! s
  6.   * @{
    6 W9 J8 y/ g$ V  x
  7.   */1 H+ v- v* j; [/ f5 g2 f7 K
  8. #define FSMC_Bank1_NORSRAM1                      ((uint32_t)0x00000000): F% e& R: c4 b; z3 X+ [
  9. #define FSMC_Bank1_NORSRAM2                      ((uint32_t)0x00000002)
    $ f/ y5 S( F: Y; j- m2 `# c) {
  10. #define FSMC_Bank1_NORSRAM3                      ((uint32_t)0x00000004)3 K' E) z7 Z7 C7 T
  11. #define FSMC_Bank1_NORSRAM4                      ((uint32_t)0x00000006); |, Z6 x: n7 I" a2 O) N4 p/ V
  12. /**5 Q* }4 W0 C$ D+ R& f
  13.   * @}
    ! G! |5 Y- N; X. e% Z
  14.   */. i3 R! e8 N) L3 e

  15. 2 {' n3 B. S" G- U' I
  16. /** @defgroup FSMC_NAND_Bank : \/ \; M9 F/ T1 j: A) w' P
  17.   * @{
    ; O; B. }+ J  m: B
  18.   */  
    $ E2 e4 [0 G8 }) q: x# ]
  19. #define FSMC_Bank2_NAND                          ((uint32_t)0x00000010)3 Z& V3 m5 P4 e) t8 H6 i
  20. #define FSMC_Bank3_NAND                          ((uint32_t)0x00000100)- W4 p8 ?, p6 H- P: L7 x3 ?
  21. /**, z2 h3 w" c7 Y
  22.   * @}
    ' l, f8 ~# o! y  q. s* R9 D
  23.   */
    . \% T3 r% q7 U6 s  {
  24. ( g) ~! H( k) q( t' }" M* \5 X- q! E
  25. /** @defgroup FSMC_PCCARD_Bank
    # K( E% {" n5 n/ q* |2 ^3 M5 s2 e6 ^
  26.   * @{
    ) s9 s; U& g- }8 N
  27.   */    * m0 m; n' I9 R- T) b
  28. #define FSMC_Bank4_PCCARD                        ((uint32_t)0x00001000). e# r! k/ i, v/ p# L" k
  29. /**5 R+ p: F+ g3 T
  30.   * @}9 q! S% t/ Y5 D3 p& Q
  31.   */
      E6 Q% f' P# @7 i- k' `1 I
  32. # M: s! D) l$ a6 s! t4 Q
  33. #define IS_FSMC_NORSRAM_BANK(BANK) (((BANK) == FSMC_Bank1_NORSRAM1) || \
    ! i% t5 _5 \% R) x$ ?
  34.                                     ((BANK) == FSMC_Bank1_NORSRAM2) || \
    5 k. S; f$ a! M4 ~6 E
  35.                                     ((BANK) == FSMC_Bank1_NORSRAM3) || \
    , y+ Y: u* i4 G, l
  36.                                     ((BANK) == FSMC_Bank1_NORSRAM4))
    8 C; F! x; u2 i# _4 g% |

  37. * f: l8 Y2 B' ?! \/ A$ a( D
  38. #define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \- y! C9 t% X- z
  39.                                  ((BANK) == FSMC_Bank3_NAND))3 Z4 U9 o) [2 R# O

  40. 4 s: g; J) K7 h' L
  41. #define IS_FSMC_GETFLAG_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
    7 U# }! c* g  w5 c8 o. S- G
  42.                                     ((BANK) == FSMC_Bank3_NAND) || \- c8 Q- M: p# Z
  43.                                     ((BANK) == FSMC_Bank4_PCCARD))
    * P% s9 A' b* Q! W3 \* y" i
  44.   e" _! B  n; y9 F" Z6 |
  45. #define IS_FSMC_IT_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
    7 Z6 Y9 t3 K6 ^6 W  ~. d* E) z" Q
  46.                                ((BANK) == FSMC_Bank3_NAND) || \
    2 Q/ n5 [9 f" l6 U5 u, \
  47.                                ((BANK) == FSMC_Bank4_PCCARD))
    : s" ^+ V- T0 T* [% s' D
  48. ; g4 \, ~8 v# _$ A7 Q& [) C
  49. /** @defgroup FSMC_NOR_SRAM_Controller ! |0 S5 \' j  m! \
  50.   * @{
    ( ~/ ~  b* Q! J& x7 |4 p: O
  51.   */* l( r# k& t' f4 c

  52. 7 m7 _' L0 T, b" F
  53. /** @defgroup FSMC_Data_Address_Bus_Multiplexing 3 b9 [6 O; L  H7 _0 h$ J" ]4 h% @
  54.   * @{
    ) D- ~/ H5 B' @) b' R" L
  55.   */
    ( n' r& w- e  h4 \: ?5 h% j

  56. 9 c- L+ [' ~* Q/ d( J% C( J4 M/ j- X
  57. #define FSMC_DataAddressMux_Disable                ((uint32_t)0x00000000)3 ^& |2 e% j- \1 z" p8 U
  58. #define FSMC_DataAddressMux_Enable                 ((uint32_t)0x00000002)
    # B) t0 J  b3 h5 Y. r; s
  59. #define IS_FSMC_MUX(MUX) (((MUX) == FSMC_DataAddressMux_Disable) || \
    5 |; w$ B/ W/ Q, Y* ]* X
  60.                           ((MUX) == FSMC_DataAddressMux_Enable))
    0 _0 @# E# ^9 E
  61. /**. K0 t/ C# l7 D/ r( _5 {
  62.   * @}9 v- {, }4 J( L) c8 Q0 t8 |
  63.   */$ r2 }: x3 S4 o" ?/ o

  64. % U1 T7 q  w+ b0 b( ~6 w
  65. /** @defgroup FSMC_Memory_Type
    * a/ j* D  I6 p' |3 s9 S  Y
  66.   * @{: |/ Y, |/ a3 F
  67.   */
    % G# k% w1 K" Q. W6 j( q7 e

  68. 3 h; C6 u' W+ T+ Y7 N# P
  69. #define FSMC_MemoryType_SRAM                     ((uint32_t)0x00000000)
    / g, W. v/ j  d! W, L  N! v# |. |
  70. #define FSMC_MemoryType_PSRAM                    ((uint32_t)0x00000004)8 x% }4 q! j" ]1 [* i5 Y
  71. #define FSMC_MemoryType_NOR                      ((uint32_t)0x00000008)
    : I- E- N& r; q
  72. #define IS_FSMC_MEMORY(MEMORY) (((MEMORY) == FSMC_MemoryType_SRAM) || \
    : ~7 g6 {) P5 ~3 p$ k
  73.                                 ((MEMORY) == FSMC_MemoryType_PSRAM)|| \0 A0 {& J3 N. f% r1 p0 x/ u
  74.                                 ((MEMORY) == FSMC_MemoryType_NOR))
    $ d2 I! U0 l( j, F! v) t
  75. /**2 `, @+ H" Q. @! J% `! j
  76.   * @}
    . |6 B: p& U+ a: L+ X4 I
  77.   */7 e  o  {  L5 q

  78. * C$ r$ O& `: @3 t7 P
  79. /** @defgroup FSMC_Data_Width 9 N+ P) k, s5 f1 N  C0 A
  80.   * @{
    8 x( G8 B% v+ v( o& z2 G
  81.   */
    # O* ]' ~# _. R. z+ n
  82. + j: X2 R* e; P  a$ B! |& p' w3 k
  83. #define FSMC_MemoryDataWidth_8b                  ((uint32_t)0x00000000)
    , H& R0 T$ N9 {% L$ ]
  84. #define FSMC_MemoryDataWidth_16b                 ((uint32_t)0x00000010). G. ~! s, {$ h
  85. #define IS_FSMC_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \
    : l5 e0 d/ ~/ P. @8 z9 i6 e
  86.                                      ((WIDTH) == FSMC_MemoryDataWidth_16b))
    6 O' E* j7 W, e* F0 r5 V" G- z
  87. /**
    9 ]  X$ @' {/ L: B/ Z% ]
  88.   * @}- O# J( m+ c4 I: O6 B& \# |
  89.   */
    ( k7 G& S9 m4 i5 S8 c
  90. + ^' m' f. `3 J8 A
  91. /** @defgroup FSMC_Burst_Access_Mode & t( R- N! E; K0 P0 q: i. W! I. k7 Y
  92.   * @{- X  e1 F3 ]/ c
  93.   */' q2 e3 V: ?7 Z3 b
  94. ( W# t( e* x# i  D/ x
  95. #define FSMC_BurstAccessMode_Disable             ((uint32_t)0x00000000)
    5 k* o4 Q0 b3 S( X
  96. #define FSMC_BurstAccessMode_Enable              ((uint32_t)0x00000100)
    $ N; X6 L4 n6 d# G! a+ H
  97. #define IS_FSMC_BURSTMODE(STATE) (((STATE) == FSMC_BurstAccessMode_Disable) || \8 N+ v9 V! P  l2 ^. k4 p
  98.                                   ((STATE) == FSMC_BurstAccessMode_Enable))) u4 i, ^% b$ Y: }7 A' ^
  99. /**! t2 l) e! [" V+ a3 a, R( t1 ?  ^
  100.   * @}* D! b. L9 q7 w
  101.   */
      e0 J3 t7 s, O
  102. : u) I+ K- P, t7 i. a
  103. /** @defgroup FSMC_AsynchronousWait
    % w6 w3 [$ b; |) b# f- p$ A& R4 Y$ y) z
  104.   * @{+ T) N/ n. j5 E+ T0 `! r4 n3 z
  105.   */
    7 {5 I, A# V/ S
  106. #define FSMC_AsynchronousWait_Disable            ((uint32_t)0x00000000)
    % C; {) W* s& ]( Y4 Z
  107. #define FSMC_AsynchronousWait_Enable             ((uint32_t)0x00008000)- I9 i0 ^( u% `# U3 ?. r8 ~# G/ H
  108. #define IS_FSMC_ASYNWAIT(STATE) (((STATE) == FSMC_AsynchronousWait_Disable) || \
    ' D% q: F- N8 |2 a
  109.                                  ((STATE) == FSMC_AsynchronousWait_Enable))
    : d; a& U( K, W: |1 w7 u
  110. /**  U) Y' O2 ^1 v* t! N7 o" |# l
  111.   * @}5 r" r. W6 V0 s0 G. v( E
  112.   */; D7 z! j4 B, \6 ^* W1 Q
  113. # t3 W# C  ]( h* u) ^
  114. /** @defgroup FSMC_Wait_Signal_Polarity
    ' @2 C) v7 z: D* p* d
  115.   * @{
    0 @5 L) a9 ?# `5 \! I6 O
  116.   */2 _1 w# |- O4 v/ V2 n" n& }3 |
  117. #define FSMC_WaitSignalPolarity_Low              ((uint32_t)0x00000000): }/ s2 H, b, e
  118. #define FSMC_WaitSignalPolarity_High             ((uint32_t)0x00000200); \& X7 h3 @0 X0 }7 ?' u
  119. #define IS_FSMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FSMC_WaitSignalPolarity_Low) || \7 Z" C" k" U& Q( Y
  120.                                          ((POLARITY) == FSMC_WaitSignalPolarity_High))
    4 i# u$ U8 p9 O- z5 K
  121. /**
    $ b; R$ Q% L; ~: S
  122.   * @}
    ' G% \1 f7 V" j  ]+ X
  123.   */
    1 f1 V% P5 U3 r9 Y
  124. 2 X% t7 ?* l% L, S, P! F
  125. /** @defgroup FSMC_Wrap_Mode : l! |: ?, p8 N" _2 {: K, q
  126.   * @{* X7 h. S9 D- n9 R; X: s; J
  127.   */
    ; e, ?0 P6 l% F% c4 _
  128. #define FSMC_WrapMode_Disable                    ((uint32_t)0x00000000); T. m4 H% [3 O; c& m
  129. #define FSMC_WrapMode_Enable                     ((uint32_t)0x00000400) 2 _: l" P6 J. E
  130. #define IS_FSMC_WRAP_MODE(MODE) (((MODE) == FSMC_WrapMode_Disable) || \- m/ ~3 Y& Y5 p& V2 r
  131.                                  ((MODE) == FSMC_WrapMode_Enable))# [$ [2 c. I7 O; P$ g/ t
  132. /**
    7 B2 p6 F  |8 b
  133.   * @}
    ! Y( D  W) a. l6 J0 I6 u
  134.   */4 V  M5 }' ~2 e

  135. ; u5 ]3 `! I' Q7 `
  136. /** @defgroup FSMC_Wait_Timing
    . g' O1 x1 t; P- \! W
  137.   * @{' `: {- h6 A2 W
  138.   */
    " {6 G. ^8 b3 f* s1 j
  139. #define FSMC_WaitSignalActive_BeforeWaitState    ((uint32_t)0x00000000)- d0 k+ X, S4 D, Z
  140. #define FSMC_WaitSignalActive_DuringWaitState    ((uint32_t)0x00000800) 1 g$ y# c- N+ X6 Q( }( G0 l; p% D
  141. #define IS_FSMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FSMC_WaitSignalActive_BeforeWaitState) || \% ^* B: E# `! I3 _! W) z
  142.                                             ((ACTIVE) == FSMC_WaitSignalActive_DuringWaitState))
    ; B% w& C: k$ |  a' E8 D1 R/ S
  143. /**, _2 ^; p/ W3 G: |# V
  144.   * @}4 q9 t$ M( H4 w, Z3 u
  145.   */
    4 K, m# x  q1 m% j1 t0 _) I
  146. ' e" i& L; B# l- [
  147. /** @defgroup FSMC_Write_Operation
    # I2 V0 o  |/ ^
  148.   * @{- x, ^1 @9 X1 e+ {& }/ C
  149.   */% n) V0 X2 q  {& S3 F* ?
  150. #define FSMC_WriteOperation_Disable                     ((uint32_t)0x00000000)
    & B2 [$ c5 q+ y8 u# h& M3 I
  151. #define FSMC_WriteOperation_Enable                      ((uint32_t)0x00001000)
    " C5 \# d3 F. {. Y
  152. #define IS_FSMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FSMC_WriteOperation_Disable) || \& l8 ~4 O# A+ ~' g3 _' K
  153.                                             ((OPERATION) == FSMC_WriteOperation_Enable))                         , K9 `; m8 e+ Q  J& o
  154. /**
    ( i! N% t% L( Y) z/ e2 \
  155.   * @}3 J2 O3 c$ \" B7 k% A# G  a
  156.   */
    ' ]& L. _! s0 Y- |8 o; {: a) E

  157. " H7 g/ `5 r7 N9 n) ]
  158. /** @defgroup FSMC_Wait_Signal
    0 i2 D: Z% q# P. B
  159.   * @{% L) a& L: j2 F0 X( H
  160.   */# @% y  }  c5 `) T
  161. #define FSMC_WaitSignal_Disable                  ((uint32_t)0x00000000). j9 B6 ?5 V) ~% G, [' O
  162. #define FSMC_WaitSignal_Enable                   ((uint32_t)0x00002000) 1 K6 R* j8 `7 c# y
  163. #define IS_FSMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FSMC_WaitSignal_Disable) || \7 a5 v, F( Z- p- B/ I& P: `9 Y
  164.                                       ((SIGNAL) == FSMC_WaitSignal_Enable))5 S9 I  l' v7 R
  165. /**
    6 L$ b: h' l, I. C2 z
  166.   * @}
    6 r' u& b$ v2 M% x* ~" M# R) S. i
  167.   */3 }) m$ Y& a# I2 P8 U
  168. . d6 a3 C  M/ |# e
  169. /** @defgroup FSMC_Extended_Mode
    , s6 \4 [# y! ]$ u! g: I% P
  170.   * @{
    + M5 x- E3 J9 X( ]8 Q' f3 `# _
  171.   */
    - m+ S- C& x9 R! Z/ @4 }
  172. #define FSMC_ExtendedMode_Disable                ((uint32_t)0x00000000)
    : g  |( r* h/ J; {/ i, X# I
  173. #define FSMC_ExtendedMode_Enable                 ((uint32_t)0x00004000)( M1 u' L+ p7 T9 K! Q

  174. 0 A" X; v' U# N# ^2 J6 |, `
  175. #define IS_FSMC_EXTENDED_MODE(MODE) (((MODE) == FSMC_ExtendedMode_Disable) || \
    1 @3 S( }2 [4 Y8 G1 p* y
  176.                                      ((MODE) == FSMC_ExtendedMode_Enable)) ( V. y" s$ B4 _% M, S: t4 E
  177. /**9 b1 M* M! ]) E9 v: d" ^
  178.   * @}
    + o4 ?* e% b4 l' P5 G8 o$ m! _
  179.   */1 y) Q2 y, P# ^  R: H$ C! s
  180. % z9 J: D  N$ ?1 Y
  181. /** @defgroup FSMC_Write_Burst : z/ s6 ^; U1 _' @) J7 S9 y8 z
  182.   * @{
    % y# Z+ X8 i# a2 v, P
  183.   */$ V- g; B6 K  j% O) C
  184. * f6 N; v5 {4 t7 a; l; C' @6 e
  185. #define FSMC_WriteBurst_Disable                  ((uint32_t)0x00000000)3 j% Y0 |' f. ^8 W7 `0 B
  186. #define FSMC_WriteBurst_Enable                   ((uint32_t)0x00080000)
    & L. g$ W+ _( V% A1 }
  187. #define IS_FSMC_WRITE_BURST(BURST) (((BURST) == FSMC_WriteBurst_Disable) || \
    % X$ b2 }1 P0 p# U! u4 C" e5 ~- X$ m; U
  188.                                     ((BURST) == FSMC_WriteBurst_Enable))
    2 l* M+ L9 o1 V+ g+ `: G
  189. /**1 C. S$ o" i3 r& m
  190.   * @}
    . t* f7 {$ t; U/ {6 q" }
  191.   */
      \1 P" D- p% z5 Q: S3 d6 |- P

  192. 1 g; c+ A' X- z$ |* ^: d; x) w
  193. /** @defgroup FSMC_Address_Setup_Time 0 W+ F# I, i/ f4 h' t  Z( l
  194.   * @{6 P8 \5 W! {* }, M7 \( H  u
  195.   */8 W' w2 `! M/ |. {4 o/ E+ Q! \; O
  196. #define IS_FSMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 0xF). A+ A! ?: h. }1 N1 `/ `
  197. /**7 t7 ^; j0 d* k
  198.   * @}
    / ]% v8 {* B; S2 H& z) f8 H. S$ c
  199.   */
    , H9 x5 {1 H1 n* W; U" [: Y6 \
  200. ! ]  Z) K3 A& p! `/ _$ ]
  201. /** @defgroup FSMC_Address_Hold_Time
    8 |# Y# O; I" ~
  202.   * @{3 |8 V+ A8 c- J% W& ^! G
  203.   */" a4 i  [/ Z$ @2 I) j: e
  204. #define IS_FSMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF)
    " U' t9 I5 j, j' _! E+ Y/ S
  205. /**
    , G" h- ]; U5 _7 p2 E! @0 ~
  206.   * @}
    ; `) K- T$ d( j# S
  207.   */
    # [$ c2 n* u( c& b' X

  208. 3 t7 v! P+ L( I  d  v
  209. /** @defgroup FSMC_Data_Setup_Time ( M4 U9 a8 k" h  s( G- s) ~
  210.   * @{
    / ]0 m) \1 d. ?& ~5 m6 M
  211.   */0 H* z7 X7 C4 l" r
  212. #define IS_FSMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF))
    9 z# i' T! _+ @1 q( B( f
  213. /**2 c  A# `- T3 R7 g2 O6 C
  214.   * @}
    1 K. g- Z- B: ~" a% z  G; b
  215.   */
    $ c: t2 I2 f* }1 i) j+ |3 ^
  216. ( j+ Y4 n0 n. Z# ?8 M! c3 v: t
  217. /** @defgroup FSMC_Bus_Turn_around_Duration + {! S( J( P5 ]' M; O  Z
  218.   * @{
    # n1 P! k% o/ B. V
  219.   */
    7 Z! o0 J: M+ m. ~4 C9 L" J, T
  220. #define IS_FSMC_TURNAROUND_TIME(TIME) ((TIME) <= 0xF)
    % p) K7 f# U6 C6 F
  221. /**! v& t5 G" E& V6 j; r+ D. n
  222.   * @}% G9 X2 f8 I0 N
  223.   */
    . d( q6 Q" j5 U9 J- ^
  224. # z' ]5 ]$ p) l/ [) x; v2 T( n
  225. /** @defgroup FSMC_CLK_Division 1 `) P; u) x2 r, P% ?, _# [8 l! K
  226.   * @{
    9 M0 l) ]3 E& H& W5 `/ l5 L! J
  227.   */
    3 Y* H: S) x* K/ X+ K! T7 X
  228. #define IS_FSMC_CLK_DIV(DIV) ((DIV) <= 0xF)
      w8 a1 o8 e" k* o* `$ A) S, g
  229. /**
    & o% E& h* K. }8 Q8 S' I7 N
  230.   * @}1 I& F4 J5 d% U: S) ]1 ?
  231.   */4 B% [3 K/ y3 B0 p

  232. & f- P) x# `, Y' I! L
  233. /** @defgroup FSMC_Data_Latency . ^7 L0 `$ k' x/ ^2 u
  234.   * @{# z1 c4 p( ], H
  235.   */
    / T8 B$ S% v* Z& ?2 {6 P
  236. #define IS_FSMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 0xF)" [6 H1 Y6 x: s/ s
  237. /**
    : w: U7 b+ j; X4 b
  238.   * @}
    6 G; d/ z$ {' e8 S( S" K
  239.   */" W' T3 J  X& }; S, y7 S6 ^( d! s5 |3 f8 h

  240. + C3 @- t' f8 N/ s3 o& J
  241. /** @defgroup FSMC_Access_Mode
    ( @$ A3 S3 Y% ^% A) B
  242.   * @{# b! h' k; x9 z1 u: b
  243.   */& A7 }; B# F' W% U4 t! i
  244. #define FSMC_AccessMode_A                        ((uint32_t)0x00000000)6 \: M  h5 B4 X. F; F
  245. #define FSMC_AccessMode_B                        ((uint32_t)0x10000000)
      l9 @: a9 Z; l
  246. #define FSMC_AccessMode_C                        ((uint32_t)0x20000000)
    : T2 S2 m, K0 m( G% G# ]
  247. #define FSMC_AccessMode_D                        ((uint32_t)0x30000000)
    " u, z' c( j  U4 Z0 M$ g; {
  248. #define IS_FSMC_ACCESS_MODE(MODE) (((MODE) == FSMC_AccessMode_A) || \& }  ^7 P5 R. M4 p7 a' d
  249.                                    ((MODE) == FSMC_AccessMode_B) || \
    2 l2 r) G  Z6 [1 q4 }# j1 r, i
  250.                                    ((MODE) == FSMC_AccessMode_C) || \  \+ }# Z# q2 a$ ^! r6 }
  251.                                    ((MODE) == FSMC_AccessMode_D))" }2 m& N" l  s$ T3 t" D
  252. /**
    4 N4 P# H/ z" V$ C# I2 k
  253.   * @}
    2 W6 F( V" A3 V$ i! t# `2 j
  254.   */4 Z6 t* l% B9 E# Z; h9 z+ @
  255. 2 z* e( p7 |/ o2 O
  256. /**
    1 ?# f- @) K7 y5 s& C
  257.   * @}( U- I( p' @, {. }
  258.   */) x6 Q/ v3 H# a; d
  259. 3 K8 i& I" P; e5 b# g3 D
  260. /** @defgroup FSMC_NAND_PCCARD_Controller
    9 J3 c/ C6 t: u8 C# I& q& y
  261.   * @{3 U* w2 F% v3 B! ~1 `6 d5 W  Q
  262.   */
    4 o+ R) M: _5 A( \; S/ f
  263. ! Y/ S8 N5 i0 N# `& R
  264. /** @defgroup FSMC_Wait_feature
    + ~0 F! C% n; `4 D
  265.   * @{8 |; |9 B& P3 o
  266.   */# j9 `( ~5 G- }$ i
  267. #define FSMC_Waitfeature_Disable                 ((uint32_t)0x00000000)# l$ q& w2 s0 R
  268. #define FSMC_Waitfeature_Enable                  ((uint32_t)0x00000002)
    & x/ k7 \' m/ u5 I# y! P
  269. #define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_Waitfeature_Disable) || \9 ~& I9 K7 o3 s" y4 Q  K+ z
  270.                                        ((FEATURE) == FSMC_Waitfeature_Enable))$ G- n& x+ O) g* ?' _4 g: _' I( u
  271. /**. ~, ]' C+ x" G$ Z3 g& \
  272.   * @}
    $ {# Z7 Q8 W* d% J$ E6 k
  273.   */
    ) ]" j' P# d' ^$ u9 W8 ?1 r  X1 B. f
  274. 9 R! @8 N6 L7 w4 @2 m4 @
  275. % H4 @" g) R' V  p2 `* U$ f
  276. /** @defgroup FSMC_ECC - C. Y' ?) L* ^; M9 F& h
  277.   * @{" }0 \4 k( U8 l- v  {  a! j" t  g
  278.   */5 P7 n4 _5 U. f& B; |1 A& K, N9 g
  279. #define FSMC_ECC_Disable                         ((uint32_t)0x00000000)* A; y- T: g- f7 U0 j% s6 d
  280. #define FSMC_ECC_Enable                          ((uint32_t)0x00000040)9 \% r8 o: g: M( w9 e% E
  281. #define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_ECC_Disable) || \' @# ~9 V) c4 P/ L  j
  282.                                   ((STATE) == FSMC_ECC_Enable))
    , Q" [) f1 b: h+ Q, S0 ?7 J
  283. /**
    - p: \# B* g  q! D, M
  284.   * @}
    ! b) A+ }' ^3 Q) q2 @3 J7 }
  285.   */4 L) O" w' f* T% B) Q( p
  286. 4 `5 N) P6 l  p) |2 Q
  287. /** @defgroup FSMC_ECC_Page_Size & T8 W: a; Z7 j* h1 ~1 `* A
  288.   * @{
    & i- u; _$ V% F5 u4 b( U" Y% O# v
  289.   */
    / Y2 v1 B* B+ g. {" n% y9 K6 Q
  290. #define FSMC_ECCPageSize_256Bytes                ((uint32_t)0x00000000)' m! Z+ I$ ~8 f# C
  291. #define FSMC_ECCPageSize_512Bytes                ((uint32_t)0x00020000)
    4 x# S2 j; Y5 c( a# [8 x
  292. #define FSMC_ECCPageSize_1024Bytes               ((uint32_t)0x00040000)
    ! P4 B: G: @$ ^2 j& {
  293. #define FSMC_ECCPageSize_2048Bytes               ((uint32_t)0x00060000)
    + z' {5 U* T) r& k$ i
  294. #define FSMC_ECCPageSize_4096Bytes               ((uint32_t)0x00080000)
    ! h2 u0 J3 \4 }$ {) \: h
  295. #define FSMC_ECCPageSize_8192Bytes               ((uint32_t)0x000A0000)7 u, g6 b" U9 \  ~- }8 s6 [: d
  296. #define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_ECCPageSize_256Bytes) || \
    & n( F& H4 _% W( C- s
  297.                                     ((SIZE) == FSMC_ECCPageSize_512Bytes) || \
    7 l5 G0 G( q  A" t
  298.                                     ((SIZE) == FSMC_ECCPageSize_1024Bytes) || \
    4 V0 }7 _" V; m- ~4 ?' q; r
  299.                                     ((SIZE) == FSMC_ECCPageSize_2048Bytes) || \
    ) l- ~3 w2 n& I; I
  300.                                     ((SIZE) == FSMC_ECCPageSize_4096Bytes) || \
    ) d' t" o7 e( C
  301.                                     ((SIZE) == FSMC_ECCPageSize_8192Bytes))7 m& s( H- p# d: `
  302. /**& B! q& ^3 O; E
  303.   * @}8 a& \1 L. ~" W3 V" h
  304.   */  e$ H8 O3 Y5 u- r- m
  305. " Q3 |, x& k' t
  306. /** @defgroup FSMC_TCLR_Setup_Time 9 w! x' e! J6 m$ L
  307.   * @{
    % h6 k2 C( }6 k) D( Z( {3 F7 |# d
  308.   */
    : K+ n$ h. f  a) p. w  Z6 C
  309. #define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 0xFF)
    ( X) J$ {6 e  N8 A, p7 x6 L! b8 m
  310. /**
    + g2 z! U6 R" y' |! i
  311.   * @}6 k1 N+ `; N4 R9 U8 c6 u
  312.   */. j: F4 n( ]& t( r+ i. a" U
  313.   g, X2 j" u1 q2 @
  314. /** @defgroup FSMC_TAR_Setup_Time
    5 O, n. q$ y$ o6 [
  315.   * @{/ C' R4 t9 k6 d# L" J; {3 p
  316.   */! [* {. O. n/ r; b5 r
  317. #define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 0xFF), @- ?; R- z, S4 \, Y; a4 v) K& C" P
  318. /**! Y  K8 N5 c9 K
  319.   * @}
    6 Q& S7 x/ z1 n- o) ?* ?2 a
  320.   */
    , `1 y0 `1 ]5 u9 z% k5 U

  321. 1 [4 R# L! Q9 w; k7 \
  322. /** @defgroup FSMC_Setup_Time ' A- i) E1 l# i' F: u- v
  323.   * @{5 S) U+ p+ d3 w$ K
  324.   */$ \7 M# u- C1 F1 B; P9 I5 `* r
  325. #define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 0xFF)
    + `# A  Q' {0 N1 @' x
  326. /**/ h' l% v/ \# y3 {$ ]9 [4 q! F
  327.   * @}: x8 w- F, n2 C7 T7 b" V: S" {
  328.   */3 W& F4 s4 W, i) N) w: b

  329. 7 {& O% W# |# u4 r! b
  330. /** @defgroup FSMC_Wait_Setup_Time
    ) I  B* t, ^- E, ^1 @- g4 H- x
  331.   * @{2 L0 `. x! h1 D. Q4 B5 r& s
  332.   */3 y6 V4 B6 P6 U' R/ V
  333. #define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 0xFF)* ?# E3 x* Y. d9 J/ [( j4 |
  334. /**
    . P' B, W  I1 ^# ~) b
  335.   * @}
    ' o0 }( U- Y5 X- d, P8 g7 g
  336.   */
    5 ~1 H  C5 D' z6 c9 ~

  337. / r4 F- H% Z( B- R# ?5 h
  338. /** @defgroup FSMC_Hold_Setup_Time
    ; s  i, [. z/ [& Z' ?
  339.   * @{
    , Q- ?" S9 s# j5 H
  340.   */8 Z: t0 C3 K( z  O5 _0 X
  341. #define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 0xFF)3 k% [7 i( _$ P+ S. e5 C
  342. /**9 d) Z& L  k6 y. |+ ?
  343.   * @}7 a/ Q( D% }& e' ?
  344.   */& l  L3 ]% G) I
  345. : {) p4 \( y2 @- ?2 J
  346. /** @defgroup FSMC_HiZ_Setup_Time ) v! k+ [7 x0 Y7 v
  347.   * @{
    : a& F8 k$ l" ?/ c4 f$ o, m5 r# G
  348.   */5 c$ G3 L8 d0 w1 A5 ^- Z  H1 J8 N
  349. #define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 0xFF)
    0 _0 t/ G) b, P- F7 ^; A( B' Y" g
  350. /**! b! w. x  q1 \+ P! u
  351.   * @}
    * P1 ]6 d6 ~: E3 E
  352.   */
    8 w, E" L( H2 t+ z/ j# N8 ^- d

  353. . Y6 {+ {: l# g: ^' }+ X
  354. /** @defgroup FSMC_Interrupt_sources
    ) W# S5 W# x. a8 A  ]& h
  355.   * @{
    0 s0 N: ]% T2 p& d
  356.   */: \* m3 W, y/ u1 u
  357. #define FSMC_IT_RisingEdge                       ((uint32_t)0x00000008)
    & F+ y* e+ J0 {
  358. #define FSMC_IT_Level                            ((uint32_t)0x00000010). w6 C6 d; f+ M7 P
  359. #define FSMC_IT_FallingEdge                      ((uint32_t)0x00000020). S" D3 x2 L; n$ ?% g' s
  360. #define IS_FSMC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((IT) != 0x00000000))
    % r$ h* B& ?5 M; B6 W
  361. #define IS_FSMC_GET_IT(IT) (((IT) == FSMC_IT_RisingEdge) || \* x8 W8 o0 p3 {& t- j7 ]' B
  362.                             ((IT) == FSMC_IT_Level) || \0 \/ }) P1 `% s2 v
  363.                             ((IT) == FSMC_IT_FallingEdge)) - R( z& Q- @' s" j: p
  364. /**% V" Y) u+ o; @8 }
  365.   * @}
    # J+ i7 C. F! p3 h
  366.   */4 @5 c, G/ A8 A0 i

  367. + u9 F- ]# r2 C5 ^% |/ ^
  368. /** @defgroup FSMC_Flags / t: Q  M) B3 w% a, w7 e  R
  369.   * @{
    2 o8 v2 O' Z8 F3 T0 h) [
  370.   */
    ' Q0 j1 W, v) l8 o8 u- d6 [
  371. #define FSMC_FLAG_RisingEdge                     ((uint32_t)0x00000001)
    ) G0 f% c" A" B6 g/ c" b7 R5 p/ J' H3 o
  372. #define FSMC_FLAG_Level                          ((uint32_t)0x00000002)7 q, r0 p. e* A9 k
  373. #define FSMC_FLAG_FallingEdge                    ((uint32_t)0x00000004)
    ! ?& M+ h5 Q& |0 \' z8 n0 S/ D/ W: h
  374. #define FSMC_FLAG_FEMPT                          ((uint32_t)0x00000040)8 b: W( K) r/ m4 s. A' r
  375. #define IS_FSMC_GET_FLAG(FLAG) (((FLAG) == FSMC_FLAG_RisingEdge) || \
    + n5 J5 |' g+ w5 V5 R
  376.                                 ((FLAG) == FSMC_FLAG_Level) || \
    $ `0 {% K1 x6 Y, ^) ^
  377.                                 ((FLAG) == FSMC_FLAG_FallingEdge) || \
    9 u+ S1 J$ z( d0 \9 g! P* t
  378.                                 ((FLAG) == FSMC_FLAG_FEMPT))
    3 N. f8 k  a4 e3 W8 h. w' i
  379. / K6 I; ^4 N- l6 e  y0 E
  380. #define IS_FSMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))
    9 \! R8 E  j7 T( b9 |
复制代码
" h9 U& t0 T) G& ]& x( {! W) s! J: P
03. 相关函数; J$ f8 V/ e  n& v! \5 ~
  1. /* NOR/SRAM Controller functions **********************************************/  p0 L7 x2 y4 k, ~2 N
  2. void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank);
      s2 y& L5 G% l" L: }# _
  3. void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);+ X1 H% S1 X; g/ _- }( I( T; X
  4. void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);+ t* v' |. F- j5 `+ a
  5. void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState);; I- r. e1 l6 d

  6. , h9 q- w3 k  Q
  7. /* NAND Controller functions **************************************************/
    4 n' y* i6 q: [2 Z5 ^- Z% D: _
  8. void FSMC_NANDDeInit(uint32_t FSMC_Bank);
    9 ^3 G' @/ k. P) C* Q, Q2 ]
  9. void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
    " Z: K) g* ~% z* y
  10. void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
    * s2 ~! B% t( k" P! I4 H2 i
  11. void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState);7 g" }7 P# a- l4 b* K& q. h
  12. void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState);
    & ?" G4 {3 o) G$ F! A# V
  13. uint32_t FSMC_GetECC(uint32_t FSMC_Bank);9 G0 g$ C* P- w4 S: W
  14. 6 s( A2 m8 `2 j5 U' X
  15. /* PCCARD Controller functions ************************************************/
    ' ]# N& X% N, }5 p2 O& g- D, \; L
  16. void FSMC_PCCARDDeInit(void);
    9 g9 L( G1 q/ A1 z* v) U$ B" h6 j
  17. void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
    ! B  i5 q2 i9 H. u# r
  18. void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
    : j; T% W& ]( e/ d
  19. void FSMC_PCCARDCmd(FunctionalState NewState);
    7 P4 o/ A; a9 K- e, E& `
  20. . l* \+ @' R. |
  21. /* Interrupts and flags management functions **********************************/1 R( j" o( @1 u! V: U* w. s1 |/ S2 D7 d" X
  22. void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState);
    3 B8 |# v# b3 c, ^0 U  @
  23. FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);! o, J+ ^+ h& g1 M' l  g
  24. void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);, y' B% \+ u' e* v4 J
  25. ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT);, ^* e2 Q$ l0 g9 k0 Y3 L
  26. void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT);
复制代码
6 V8 [5 g- Z! j1 g/ W- k
04. 结构体封装0 L- W7 r: @: f( C7 o  Q3 m$ l' f
  1. typedef struct
    - q! h5 l  G- q. Q! G
  2. {
    * r* W% w( U6 D1 y. O# R
  3.   __IO uint32_t BTCR[8];    /*!< NOR/PSRAM chip-select control register(BCR) and chip-select timing register(BTR), Address offset: 0x00-1C */   3 ?$ R( s3 a% l6 Y5 r2 G3 T; [. z
  4. } FSMC_Bank1_TypeDef; $ ~( \  ]. f( f) n. J
  5. * q# n  R4 d1 s: [
  6. /** . I  j8 E8 [" d0 }" F
  7.   * @brief Flexible Static Memory Controller Bank1E
    % D4 i* g# M* `* ?
  8.   */; h) A5 G+ c) \- a6 H+ B

  9. . G6 H" B% y$ f& P
  10. typedef struct
    * ~; P  V/ M9 N. E* D
  11. {& B% @. w7 _# ~' T$ P
  12.   __IO uint32_t BWTR[7];    /*!< NOR/PSRAM write timing registers, Address offset: 0x104-0x11C */. b3 Y* K9 I  l& d0 T/ o- p
  13. } FSMC_Bank1E_TypeDef;) x' a7 e$ z! E9 C! L

  14. 5 K/ ?% {  S6 H) a( `1 D* `
  15. /**
    2 e% ^' ]: n+ m+ {& z! v
  16.   * @brief Flexible Static Memory Controller Bank2  D+ r' J4 ~) |  G2 o
  17.   */+ J2 `( K+ y" y5 K" c7 z
  18. / [, e" x6 f. b
  19. typedef struct% h' P8 F' Q) A! m. Y' e1 D
  20. {
    - R$ p& i1 H' V, J/ Z1 z
  21.   __IO uint32_t PCR2;       /*!< NAND Flash control register 2,                       Address offset: 0x60 */$ b( s3 P$ O$ `4 G, l
  22.   __IO uint32_t SR2;        /*!< NAND Flash FIFO status and interrupt register 2,     Address offset: 0x64 */
    ! f7 [5 u8 V( l
  23.   __IO uint32_t PMEM2;      /*!< NAND Flash Common memory space timing register 2,    Address offset: 0x68 */
    $ E6 W4 ^/ r3 X" _' f% [
  24.   __IO uint32_t PATT2;      /*!< NAND Flash Attribute memory space timing register 2, Address offset: 0x6C */# W8 v; a* V5 w3 M2 c3 b
  25.   uint32_t      RESERVED0;  /*!< Reserved, 0x70                                                            */( H. |: J; k3 c9 X' ]
  26.   __IO uint32_t ECCR2;      /*!< NAND Flash ECC result registers 2,                   Address offset: 0x74 */
    ( K+ F/ j! C% T( K2 w0 F- z0 m
  27. } FSMC_Bank2_TypeDef;
    ; P6 R1 D) M% \" K' X. C8 x6 Y

  28. & a& ?: f/ K5 O
  29. /** 0 }5 L; h* [* F6 b* \. h% ], L9 r- n
  30.   * @brief Flexible Static Memory Controller Bank3
    6 G2 m9 ?5 i( {5 Y. U
  31.   */
    . C, c- u8 t& O
  32. , T, m/ m3 f- _' W7 f
  33. typedef struct% N# p; v- W4 h4 H6 S! }' K8 A! |
  34. {
    . {' J. h0 {" g% M. h& a
  35.   __IO uint32_t PCR3;       /*!< NAND Flash control register 3,                       Address offset: 0x80 */& Z! E! Q: z; o2 [- d% X
  36.   __IO uint32_t SR3;        /*!< NAND Flash FIFO status and interrupt register 3,     Address offset: 0x84 *// k7 e# r4 K! w( A) C
  37.   __IO uint32_t PMEM3;      /*!< NAND Flash Common memory space timing register 3,    Address offset: 0x88 */3 x0 i' l2 W8 U6 E& [
  38.   __IO uint32_t PATT3;      /*!< NAND Flash Attribute memory space timing register 3, Address offset: 0x8C */1 ~! u6 |9 M% U1 Z
  39.   uint32_t      RESERVED0;  /*!< Reserved, 0x90                                                            */! h- X3 l- Z) d9 J, \0 ?
  40.   __IO uint32_t ECCR3;      /*!< NAND Flash ECC result registers 3,                   Address offset: 0x94 */( a. |5 f0 ]% L; Z
  41. } FSMC_Bank3_TypeDef;, q8 C% F8 j3 J5 W1 P
  42. + U3 ]* P0 ?3 h* ^+ O6 b0 N
  43. /**   v% z, z# c- F, q3 T
  44.   * @brief Flexible Static Memory Controller Bank4
      ~$ X8 ?+ s- K
  45.   */
    5 V5 J, q! o8 M: X9 p
  46. 4 i( M  S' U3 ]0 \$ U
  47. typedef struct5 n: h# c4 f0 ~* m
  48. {0 U( F- |7 o  p" X( U
  49.   __IO uint32_t PCR4;       /*!< PC Card  control register 4,                       Address offset: 0xA0 */% }$ w+ u: s, [; {! S; ^
  50.   __IO uint32_t SR4;        /*!< PC Card  FIFO status and interrupt register 4,     Address offset: 0xA4 */) ~* E& F$ [, i- ?: }
  51.   __IO uint32_t PMEM4;      /*!< PC Card  Common memory space timing register 4,    Address offset: 0xA8 */8 R1 [2 f% X! L6 a* ^; b
  52.   __IO uint32_t PATT4;      /*!< PC Card  Attribute memory space timing register 4, Address offset: 0xAC */2 f( ]- s% l/ m5 p9 R+ T/ I$ M5 z
  53.   __IO uint32_t PIO4;       /*!< PC Card  I/O space timing register 4,              Address offset: 0xB0 */
    2 i* c- `# z: n0 ~* _  F
  54. } FSMC_Bank4_TypeDef; 3 h4 m) q, }5 k  Y9 w
  55. . B; k; _' y: `
复制代码

/ J& k. E$ t  t* m, i3 N
赞 收藏 评论0 发布时间:2022-3-29 09:52

举报

0个回答

所属标签

相似技术帖

官网相关资源

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