01. 概述% y' w! p. F& V5 P
FSMC 相关的库函数分布在 stm32f4xx_fsmc.c 文件和头文件 stm32f4xx_fsmc.h 中。
' k) y$ [2 p. `+ r/ Q& i, z
( H7 k+ c; W; f! `+ ?7 g02. 相关类型) S3 |+ q, ?* e
FSMC_NORSRAMTimingInitTypeDef类型
; g3 B! P! {; [: G4 Y; R, i
! U" q# H7 p1 ]' U/ d. h- . o5 n$ J' }5 i/ q( ]# j/ e
- /** - s( b; J$ v% w2 `/ H' r) s6 ^
- * @brief Timing parameters For NOR/SRAM Banks , A/ E2 I6 u j h
- *// ^9 B. f/ {& w& m* A+ T
- typedef struct
% _. H5 H- Y% v* V - {
5 R5 b' D# W% c" z5 v7 T1 A - uint32_t FSMC_AddressSetupTime; /*!< Defines the number of HCLK cycles to configure
# O$ z; g2 H: n) I+ d) S - the duration of the address setup time. ( |% C9 Y( Z2 j. e! V7 y' k
- This parameter can be a value between 0 and 0xF.
* m) H$ E2 z) y, K - @note This parameter is not used with synchronous NOR Flash memories. */
5 T' o# B, |' s7 k0 E - ) M7 E" r3 J5 F; k( W
- uint32_t FSMC_AddressHoldTime; /*!< Defines the number of HCLK cycles to configure" v9 ?* Q- ~ Q: B
- the duration of the address hold time.$ {" |5 x0 u; [) K% z) `
- This parameter can be a value between 0 and 0xF. ( ~6 E# K- ]2 A
- @note This parameter is not used with synchronous NOR Flash memories.*/
" x0 r; s: \$ H$ h5 p- T1 q' { - 4 C T$ V. h N
- uint32_t FSMC_DataSetupTime; /*!< Defines the number of HCLK cycles to configure
2 |* W2 D) ?, G - the duration of the data setup time.
9 R/ o: p, N9 v" ~ - This parameter can be a value between 0 and 0xFF.. u* e$ l9 a0 q+ k9 p$ Z
- @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed NOR Flash memories. */( H ]# |: K# K, k. a' L
& z! d1 `& L7 M/ z4 l- uint32_t FSMC_BusTurnAroundDuration; /*!< Defines the number of HCLK cycles to configure
$ o1 v- F+ g% W - the duration of the bus turnaround.
; J. I4 ~7 N1 z5 t - This parameter can be a value between 0 and 0xF.+ q" L, k; M+ h" a( e5 E# P% R2 A
- @note This parameter is only used for multiplexed NOR Flash memories. */+ ^/ Q5 n/ P* K
8 F' T7 J( Q# d! C- uint32_t FSMC_CLKDivision; /*!< Defines the period of CLK clock output signal, expressed in number of HCLK cycles.# P. w7 {0 j9 s
- This parameter can be a value between 1 and 0xF.
7 j- U: z, v7 `1 k% {- i. ^ - @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM accesses. */
5 Q! C3 b# g6 x+ p
4 Q. C: s( y# Z% B. s( l- uint32_t FSMC_DataLatency; /*!< Defines the number of memory clock cycles to issue: S4 v g% k# n) s- n9 |9 O0 d
- to the memory before getting the first data.0 b, \. H/ o0 r
- The parameter value depends on the memory type as shown below:
+ t3 M5 B L" |' H5 `- F4 b - - It must be set to 0 in case of a CRAM+ o! U5 f( N3 @5 ^
- - It is don't care in asynchronous NOR, SRAM or ROM accesses+ G; D4 C0 P6 o; ~5 w U- v
- - It may assume a value between 0 and 0xF in NOR Flash memories
( F2 ~1 x* u% W h( @. ]9 m - with synchronous burst mode enable */8 q. N$ s* t C9 |
- - [$ x) r, s# x* r
- uint32_t FSMC_AccessMode; /*!< Specifies the asynchronous access mode.
% z. p: c$ f. s) L7 q( s5 u3 \ - This parameter can be a value of @ref FSMC_Access_Mode */
@% |6 F- Z0 s4 A9 _ - }FSMC_NORSRAMTimingInitTypeDef;
复制代码
% |; i$ S4 x9 C3 DFSMC_NORSRAMInitTypeDef类型2 j2 N3 g. N8 p. X: [$ |( K! y8 V* b
V" B9 N3 d1 ^, k8 C: }" {
- /**
# u' j& M0 p W# V2 u - * @brief FSMC NOR/SRAM Init structure definition; ?* X9 z, L3 z; [( F
- */! g, `4 G: r$ W5 i9 k
- typedef struct( R2 Q( Y' ^/ ^$ U2 R7 `
- {
) w# K+ f3 p3 U' n9 n$ E1 y9 g% ? - uint32_t FSMC_Bank; /*!< Specifies the NOR/SRAM memory bank that will be used.0 O6 P+ o! F _9 f( E
- This parameter can be a value of @ref FSMC_NORSRAM_Bank */! s3 n* Y5 I S6 Z& l" `: K
# ]; A/ n& X7 I. c" I5 O0 r# _- uint32_t FSMC_DataAddressMux; /*!< Specifies whether the address and data values are/ R, @; ~% @, _7 @2 n( ~
- multiplexed on the data bus or not.
7 d2 i4 d7 _! t( u4 |- r% U+ H# B - This parameter can be a value of @ref FSMC_Data_Address_Bus_Multiplexing */
7 Y; z6 [$ H0 G+ x5 ]6 K; _' X - 3 {. V- h6 o/ Q- ^8 _3 ~
- uint32_t FSMC_MemoryType; /*!< Specifies the type of external memory attached to `4 _9 u6 L: q: f
- the corresponding memory bank.2 O7 r* m$ `* N5 Z' ?
- This parameter can be a value of @ref FSMC_Memory_Type */" A/ }( z5 Y! V
- 9 g3 M0 l/ U( w# d3 ~
- uint32_t FSMC_MemoryDataWidth; /*!< Specifies the external memory device width.
4 i; L- `8 ]0 K4 |! w: { - This parameter can be a value of @ref FSMC_Data_Width */
$ P; f, i. ]% ^+ G( e
( W- v* s/ E) ^; q& l3 _- uint32_t FSMC_BurstAccessMode; /*!< Enables or disables the burst access mode for Flash memory,* N: g9 D5 `& a$ V# l
- valid only with synchronous burst Flash memories.
6 n) J% `# M F. j* `* ? s+ V - This parameter can be a value of @ref FSMC_Burst_Access_Mode */
8 `, D4 N# z, o+ M- G- Q) [ - ; p" ?5 v4 F3 G8 \+ B* K& a, V
- uint32_t FSMC_AsynchronousWait; /*!< Enables or disables wait signal during asynchronous transfers,- Y6 s: v0 p8 ^% r5 S# y8 o
- valid only with asynchronous Flash memories.2 H* c2 B) I) ^% W. y2 p S3 x2 j
- This parameter can be a value of @ref FSMC_AsynchronousWait */ 2 i) _! @2 h4 ` d& Q
% G4 W' `: }" d, i; F- uint32_t FSMC_WaitSignalPolarity; /*!< Specifies the wait signal polarity, valid only when accessing; C1 G* K7 g$ l5 t/ K$ J0 Q/ A- h P
- the Flash memory in burst mode." d# v9 R$ ^) U) Y% V
- This parameter can be a value of @ref FSMC_Wait_Signal_Polarity */& i# a* ^' {+ f' T
' U5 M: |) l, A8 a$ }- uint32_t FSMC_WrapMode; /*!< Enables or disables the Wrapped burst access mode for Flash) f( o% t' ]8 ]4 H9 T8 f. z
- memory, valid only when accessing Flash memories in burst mode. W; \9 W3 O' Q/ z
- This parameter can be a value of @ref FSMC_Wrap_Mode */
2 X# U+ S/ j$ t, @2 y
% g/ V$ p* q# c) S( S' ^/ B6 }- uint32_t FSMC_WaitSignalActive; /*!< Specifies if the wait signal is asserted by the memory one
- {$ z2 C) C0 w" F- v6 E( i - clock cycle before the wait state or during the wait state,+ B/ {- E; p! w# {2 f
- valid only when accessing memories in burst mode.
3 B g. K2 ]$ ~7 Y! B' g% }6 N - This parameter can be a value of @ref FSMC_Wait_Timing */
$ L" ~$ F) r# ^: Z' l
! N4 s1 x8 D1 e( b0 _" Y- uint32_t FSMC_WriteOperation; /*!< Enables or disables the write operation in the selected bank by the FSMC.
9 S7 l' ]: q8 a3 L) ^( R ~ - This parameter can be a value of @ref FSMC_Write_Operation */
! \. N* \; x( k! u" y) p1 i& \
& H' Q! i0 f" d v% }5 }- [6 U- uint32_t FSMC_WaitSignal; /*!< Enables or disables the wait state insertion via wait
2 N2 O) C; V4 |$ j8 N2 s- a - signal, valid for Flash memory access in burst mode.
0 m1 [9 G- \2 q% b4 B; Y - This parameter can be a value of @ref FSMC_Wait_Signal */! `8 J+ n8 A; M3 E5 `% T
- 9 J4 H/ Y) l& T! N' ^
- uint32_t FSMC_ExtendedMode; /*!< Enables or disables the extended mode.+ Q* E" N0 \, S6 u4 t0 g
- This parameter can be a value of @ref FSMC_Extended_Mode */
, ~/ f% Z0 G2 Y8 `5 o
/ I, _; i, @- K% o2 n" P. K' _$ J- uint32_t FSMC_WriteBurst; /*!< Enables or disables the write burst operation.
# S5 E# A+ Y& m/ \% o4 }0 G - This parameter can be a value of @ref FSMC_Write_Burst */ , G* w3 p: [. B- Z
- , \8 z1 s& c- ?
- FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct; /*!< Timing Parameters for write and read access if the Extended Mode is not used*/
- d& ?8 {( g1 q! P( @& T - 0 p2 A% ^& u& F9 r8 S9 P6 | |3 Z1 O0 |2 h
- FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct; /*!< Timing Parameters for write access if the Extended Mode is used*/
% W0 w& M# z4 Y7 F+ w - }FSMC_NORSRAMInitTypeDef;
复制代码 & a0 w; @* E) L* c; Z; ~
FSMC_NAND_PCCARDTimingInitTypeDef类型
- O* D0 M; R% w* F |2 O
+ Q5 X: h/ T/ m( a! w( b3 P- /**
* l4 O# {4 _9 e' T - * @brief Timing parameters For FSMC NAND and PCCARD Banks0 O. B* n u. L& X
- */! T3 C. _ O! k4 R! }
- typedef struct
. \. l# ?: Z# g0 G, y - {( N+ B- q9 ~- U3 u" `+ H# G8 U1 b
- uint32_t FSMC_SetupTime; /*!< Defines the number of HCLK cycles to setup address before
' h" T7 l7 Q1 u4 p- h4 R& U& e - the command assertion for NAND Flash read or write access
8 E9 y7 Z8 D n8 q4 ~/ w4 ]( ?1 q - to common/Attribute or I/O memory space (depending on* Y$ ^& f, Y/ F4 y( }; {3 a# y
- the memory space timing to be configured).& I% a" y2 S+ T$ Z
- This parameter can be a value between 0 and 0xFF.*/
: Z: M* k* [; }, z2 X2 v
3 G$ \" F- m2 m+ n- uint32_t FSMC_WaitSetupTime; /*!< Defines the minimum number of HCLK cycles to assert the+ [1 A$ ^' F; @, D
- command for NAND Flash read or write access to/ S4 `% K5 E7 u Z; `7 q# e
- common/Attribute or I/O memory space (depending on the0 c- ~+ O8 }# Z- X+ J. {
- memory space timing to be configured).
6 R/ ~: g T! _ - This parameter can be a number between 0x00 and 0xFF */" G$ U! l3 D: \7 z8 ~. f+ B& o
- i. g+ J3 W" c0 ?. }8 q+ n, D. l
- uint32_t FSMC_HoldSetupTime; /*!< Defines the number of HCLK clock cycles to hold address, ^) T1 e; w- {$ K3 z- T
- (and data for write access) after the command de-assertion
( m* ~' D* q& q1 M0 Z - for NAND Flash read or write access to common/Attribute3 q! A' w# z! h q; p
- or I/O memory space (depending on the memory space timing
( I- A5 `( O; j+ p+ m2 u - to be configured).. U+ [5 \$ G$ k
- This parameter can be a number between 0x00 and 0xFF */$ W& g4 W* M+ `% a' P
& }2 ^# q0 D' O. |- uint32_t FSMC_HiZSetupTime; /*!< Defines the number of HCLK clock cycles during which the: `) `! p4 p1 |. j) N4 z! w
- data bus is kept in HiZ after the start of a NAND Flash
2 p; ]9 A- U1 z* E4 x# z7 M9 s - write access to common/Attribute or I/O memory space (depending# Z m& q7 h, V5 _ K# B$ G+ \1 |6 n
- on the memory space timing to be configured).
+ n: k- ^$ r Y* p - This parameter can be a number between 0x00 and 0xFF */
$ b3 K$ r2 ^: V$ F5 r" s; p2 I - }FSMC_NAND_PCCARDTimingInitTypeDef;
复制代码
% g" b) T# B% n) D; }# b6 @FSMC_NANDInitTypeDef类型3 J+ f& W" `5 u- ~7 [) a
1 R' O! ?+ H* ^0 w
- /**
$ A, u' E0 h: t/ b' }4 \. R - * @brief FSMC NAND Init structure definition
, w3 o1 E" O% w; r - */
" Z3 g0 x& \# O" Y' A - typedef struct
( d$ o1 D: _: j; G1 W. m' Y2 F - {
( U9 X8 m; P* j5 h9 ], Y2 u$ D - uint32_t FSMC_Bank; /*!< Specifies the NAND memory bank that will be used.) z, L0 _& T& O9 d5 N
- This parameter can be a value of @ref FSMC_NAND_Bank */
1 y( }2 y+ T/ i8 T& i* O: i - ' g7 `! ~; S [) s" N
- uint32_t FSMC_Waitfeature; /*!< Enables or disables the Wait feature for the NAND Memory Bank./ K( Y2 ^& W% @# x8 t- F
- This parameter can be any value of @ref FSMC_Wait_feature */
( r- e \7 I; D5 d L* T
* p2 q/ N2 ?4 P4 l- uint32_t FSMC_MemoryDataWidth; /*!< Specifies the external memory device width.3 W$ Z) A' S6 X& A; v
- This parameter can be any value of @ref FSMC_Data_Width */
% @5 X' h. }" J - 5 X& @5 t1 p3 d2 {% W1 [
- uint32_t FSMC_ECC; /*!< Enables or disables the ECC computation.
+ I$ C; E* { N - This parameter can be any value of @ref FSMC_ECC */
# ?$ L7 ~) B1 h - ) Z; ^. o1 u- ~2 J0 V
- uint32_t FSMC_ECCPageSize; /*!< Defines the page size for the extended ECC.
& }9 A: H- s7 C! _* ` - This parameter can be any value of @ref FSMC_ECC_Page_Size */
3 ?# ^& U$ K$ Y" E - ; d, q8 z8 V1 {0 d0 X8 I- w3 V! r& j
- uint32_t FSMC_TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
3 z. O0 U- b7 i. t* l - delay between CLE low and RE low.4 R# h* n" p6 H6 |8 |9 O5 t
- This parameter can be a value between 0 and 0xFF. */
: N* k1 o. \ c! ? - * [5 P3 N- R8 I& R" _/ g
- uint32_t FSMC_TARSetupTime; /*!< Defines the number of HCLK cycles to configure the \: U, ?6 l: D
- delay between ALE low and RE low.' D# v4 a+ S1 R
- This parameter can be a number between 0x0 and 0xFF */ / m0 A! W/ O x0 p( [" r
1 @& u0 V. a: M& M% v1 S I- FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_CommonSpaceTimingStruct; /*!< FSMC Common Space Timing */ & d6 `/ P( x0 H: W
( f2 |( v: k$ s: o# E- FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_AttributeSpaceTimingStruct; /*!< FSMC Attribute Space Timing */
% u7 S: b6 d( C2 A - }FSMC_NANDInitTypeDef;
复制代码
[% z% E9 u$ Z+ X: C: S+ FFSMC_PCCARDInitTypeDef类型
8 ~0 e, E% z0 z/ Y
( ^" y7 u5 A2 j$ j2 i, {6 v- /**
$ O# ~# o4 B* d) G& c4 |: s - * @brief FSMC PCCARD Init structure definition
& L% |' T# i2 |, Q, s/ x0 o - */0 f8 p0 @/ ?% q
2 ?) v) }5 p7 j! |* B2 G" R- typedef struct3 T1 C/ Y; e; g6 z# O$ C
- {! E3 R- c2 B+ G! I7 Q
- uint32_t FSMC_Waitfeature; /*!< Enables or disables the Wait feature for the Memory Bank.& Y4 a& @+ T- h3 p, X2 N0 c
- This parameter can be any value of @ref FSMC_Wait_feature */
$ n8 b# j4 C4 V! I8 x5 l) T l2 K) T+ i
% Q2 Q& z0 q' @9 Q3 H7 z! I- uint32_t FSMC_TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
$ t) u: k4 E( F# Q! W3 v# L: z - delay between CLE low and RE low.
! B8 f3 N+ ^' {) C& ?' ? B - This parameter can be a value between 0 and 0xFF. */
" ~2 _, ~9 l h# m$ q( l - 6 d# N- v- d' v5 h$ O) P% v
- uint32_t FSMC_TARSetupTime; /*!< Defines the number of HCLK cycles to configure the; O& U. L1 E5 B. ~# L/ W
- delay between ALE low and RE low.* v* R- Z4 G; y
- This parameter can be a number between 0x0 and 0xFF */ / ^ |1 p, O" O" f6 g- h) I
- 7 d, x! h9 t# D4 |# F, u/ F. i/ N. J
- # ]- }4 S M8 v* T; ?. q2 ^
- FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_CommonSpaceTimingStruct; /*!< FSMC Common Space Timing */& u7 J1 [# N; Y3 m" E
- & y& z% o. _) t
- FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_AttributeSpaceTimingStruct; /*!< FSMC Attribute Space Timing */
; g* q) \, u* }+ H - 3 K E, e4 n" N) d7 t, Y
- FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_IOSpaceTimingStruct; /*!< FSMC IO Space Timing */
0 V# Q% \4 _( z/ |- A- t - }FSMC_PCCARDInitTypeDef;2 f" M6 ?# A/ U( I6 y5 r5 R
复制代码
* m" d* n- ~7 y4 v' \4 v6 J相关宏定义: d: Z6 ]9 S# _6 p7 V0 U5 J
+ ~8 l* X" s/ k4 f4 w* D- /** @defgroup FSMC_Exported_Constants6 W0 q+ T7 g2 E( o+ j
- * @{7 ?- ]: Q/ _" d
- */
9 o3 d( s. i- J+ U8 B' }5 M
" K* ]9 x: V' Q5 }; q8 g2 p- /** @defgroup FSMC_NORSRAM_Bank
" W4 R/ B c3 w* W! R0 ` - * @{
+ w' _( Q, c6 j" ^. L- `! n - */
, p( ?6 d7 Q" w+ |# \# g2 S% h - #define FSMC_Bank1_NORSRAM1 ((uint32_t)0x00000000)
) J+ r4 N0 C$ m9 N. X( b* a$ i - #define FSMC_Bank1_NORSRAM2 ((uint32_t)0x00000002)
; X) r( d% l, }% G% l( T - #define FSMC_Bank1_NORSRAM3 ((uint32_t)0x00000004)$ P* O3 M2 H8 t% ?
- #define FSMC_Bank1_NORSRAM4 ((uint32_t)0x00000006)- t7 y W. {* a$ y, _/ `: T( p% ^
- /**4 p& \" j- B- f- I% F' F# q
- * @}
4 M& `/ x) F" R - */
1 I6 m/ \5 F. h) R/ E6 j0 k
: [ e5 g9 e. R4 m8 V- /** @defgroup FSMC_NAND_Bank / n* H, f+ e; f9 k& b# N( G
- * @{5 n% i/ x9 t% ]8 W% ~0 }7 D
- */
. B1 N, p7 \- `, i - #define FSMC_Bank2_NAND ((uint32_t)0x00000010)4 H! @' N8 [! `* E F: d4 S3 ^
- #define FSMC_Bank3_NAND ((uint32_t)0x00000100)
" _' z; z! e0 K: k - /**" I, i& `( g% z' L
- * @}
2 n8 X1 s9 ^9 g, R; C$ g! D; p - */
0 i d+ N: }5 H; ^& c+ h6 P: D: s
" g" k! l3 x6 {9 E. ~6 E g) m- /** @defgroup FSMC_PCCARD_Bank
8 _+ K4 [* v+ r6 v6 m7 `6 D7 T, U% s - * @{: \+ D- ~; a5 s/ Q
- */
4 u* N8 u* k4 D- B7 N* [4 T6 n8 S# H# g - #define FSMC_Bank4_PCCARD ((uint32_t)0x00001000)3 t; h" T7 @- J. \ o0 \% a
- /**
5 m; v9 e! g) \5 D }/ a& Z0 u5 p( x - * @}. ^/ y5 a, P0 @: R
- */1 Y1 Q/ X' L/ |6 \7 x! \' y/ n
- . ^! g7 |1 g) H
- #define IS_FSMC_NORSRAM_BANK(BANK) (((BANK) == FSMC_Bank1_NORSRAM1) || \
( k7 o ~$ Q/ C; E) a5 l: { - ((BANK) == FSMC_Bank1_NORSRAM2) || \$ K' c: j0 V6 e/ C3 r1 j# i0 m
- ((BANK) == FSMC_Bank1_NORSRAM3) || \$ N& o7 H: Y9 a
- ((BANK) == FSMC_Bank1_NORSRAM4))
% M$ ?" i: Q3 F
}/ n9 M5 u6 z$ e% c, `) J- #define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \6 y% i( j$ d' p
- ((BANK) == FSMC_Bank3_NAND))
8 P- `$ U! W- v. s. o - 6 X3 V6 ^0 {4 z6 F
- #define IS_FSMC_GETFLAG_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \% |1 R/ I& }" ]5 S/ _$ u
- ((BANK) == FSMC_Bank3_NAND) || \
2 T3 q8 H( B3 c. p - ((BANK) == FSMC_Bank4_PCCARD))
1 O' @0 j2 P8 V& z2 `; Y* C - , J3 c- K5 g5 N, a8 k
- #define IS_FSMC_IT_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
% x- X7 E0 ^2 o! J4 `/ _" M - ((BANK) == FSMC_Bank3_NAND) || \# J6 y+ R/ _3 ~% A% F5 }
- ((BANK) == FSMC_Bank4_PCCARD))
# M8 {7 t8 D1 C5 m4 Y- u
% S/ W! s" a! ?6 o- /** @defgroup FSMC_NOR_SRAM_Controller " k; O8 A2 e0 j4 q( U: c0 [& e
- * @{' u3 H) r* [4 J5 n* i' K8 Y+ Q
- */5 W: b5 @% t: l B" O- K/ G
- ! ?) J' |" R6 M' A) ]
- /** @defgroup FSMC_Data_Address_Bus_Multiplexing
* S& a4 t! s( P8 R. p6 \ - * @{
. O) _8 s3 }# F) s - */
6 F$ Z0 U! L0 n6 e- X - * o1 g; A( i% Q8 N5 ]5 D# V
- #define FSMC_DataAddressMux_Disable ((uint32_t)0x00000000)
* C( @; b8 L8 l3 {& O' ^ - #define FSMC_DataAddressMux_Enable ((uint32_t)0x00000002)' G y ]% U/ S
- #define IS_FSMC_MUX(MUX) (((MUX) == FSMC_DataAddressMux_Disable) || \6 O& C4 j7 c6 @* I& w; r5 Y" x
- ((MUX) == FSMC_DataAddressMux_Enable))
. ]! {, W. t# b) U - /**$ b) t% G5 Y# ^# X7 \$ j7 l
- * @}. C) J. R6 H) \
- */5 [& X, E/ A7 h( V
- D; w6 n) J: U, d* y8 ?+ @- /** @defgroup FSMC_Memory_Type
7 \- I3 x, z. q) c4 X$ \- _. M - * @{
$ A7 Y3 w* V$ Z! U6 }6 k5 q5 S - *// D/ @) T9 }3 }
- l7 E3 d8 S! T2 x- #define FSMC_MemoryType_SRAM ((uint32_t)0x00000000)
2 {) b) W- a$ Y$ L5 |, n5 f - #define FSMC_MemoryType_PSRAM ((uint32_t)0x00000004)
0 B& j1 R* a7 t2 y' T - #define FSMC_MemoryType_NOR ((uint32_t)0x00000008)5 t! f' i8 F* N3 |9 G
- #define IS_FSMC_MEMORY(MEMORY) (((MEMORY) == FSMC_MemoryType_SRAM) || \
) x$ q; M5 f9 |4 L9 X; y2 { - ((MEMORY) == FSMC_MemoryType_PSRAM)|| \" p4 J a# s) e' h2 T
- ((MEMORY) == FSMC_MemoryType_NOR))
8 h9 I! b, K8 ]9 L; Z - /**
- I1 b9 [) f7 M5 I' S' ` - * @}" R' p* C. h( l6 U$ [" Q+ j- H9 G
- */$ S9 F6 e# q6 x: i" t$ H2 t* J
% | i+ y s: ^/ U+ x4 a Z- /** @defgroup FSMC_Data_Width * R2 U! @, M% g g1 W
- * @{
1 M2 L# v. h1 |" \5 n* c) G - */( V/ j5 y5 \5 ?" ?' |! N9 Z8 M, H
" D2 r0 O; u* ~# V- #define FSMC_MemoryDataWidth_8b ((uint32_t)0x00000000)
; P$ e+ E+ f! ?' {& t - #define FSMC_MemoryDataWidth_16b ((uint32_t)0x00000010)3 [8 {3 t; P( O- ^( _$ r; Y
- #define IS_FSMC_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \/ M$ k- }$ r6 A& w4 `! Y
- ((WIDTH) == FSMC_MemoryDataWidth_16b))
0 R& ?% m7 o" A# y8 x4 U - /**
: }' h$ X* f4 |9 R, u - * @}7 E0 s0 n3 D1 g; U, m
- */
3 |, O7 r) t! ?- m$ K+ k - 3 y9 X; k3 y+ L; @8 ?5 E6 w
- /** @defgroup FSMC_Burst_Access_Mode
9 K U# n5 O' F7 S) Z" @ - * @{
; U8 e4 b4 j8 X$ q# p - */# O+ g2 C. F6 D! h& h- V! I! V# C
% f4 K( L/ @5 `, ~% o3 F- #define FSMC_BurstAccessMode_Disable ((uint32_t)0x00000000) 8 R4 H3 u6 Q. |$ G2 W( p
- #define FSMC_BurstAccessMode_Enable ((uint32_t)0x00000100)# J+ F. A: c& L! Y$ o2 S* h6 e
- #define IS_FSMC_BURSTMODE(STATE) (((STATE) == FSMC_BurstAccessMode_Disable) || \3 n9 A1 Z. h9 }$ X% Z
- ((STATE) == FSMC_BurstAccessMode_Enable))
$ l1 J9 A7 x( u0 Q% @) P2 X. [ - /**
$ P6 z9 a/ E4 e. N Z6 |5 U% H - * @}
: m# Z6 ^% H" ~7 b: ?/ b - */
, U4 f# W* s$ g9 b3 x1 n
+ o9 n$ N% @1 |9 b9 Z; {1 X' P! ]- /** @defgroup FSMC_AsynchronousWait
, Y/ _! [" v- y! c4 v - * @{
+ W7 D0 Z5 }. G+ M$ ~ - */6 Y3 o8 d. }: n: h- [4 z, w6 v. C
- #define FSMC_AsynchronousWait_Disable ((uint32_t)0x00000000)- g, O* n' S. c' ?8 B$ p: Z
- #define FSMC_AsynchronousWait_Enable ((uint32_t)0x00008000)1 L9 _( N( A% o
- #define IS_FSMC_ASYNWAIT(STATE) (((STATE) == FSMC_AsynchronousWait_Disable) || \
, x4 o# g* n) y - ((STATE) == FSMC_AsynchronousWait_Enable))
/ I. a( w3 g( H0 a* N2 j1 A& w - /**
) q" e* ?0 ^% s, A4 G; ? - * @}
, R9 I3 o3 o9 F/ J. S3 \. x - */5 W- z% D( i9 o7 N, t$ r& e& _( u
& Z, _4 F+ r8 _" P# b' n( E9 V- /** @defgroup FSMC_Wait_Signal_Polarity 6 V$ L6 o2 P& E7 D5 E& h
- * @{* M. ]$ D1 z, c
- */# `8 S3 ~! |& j( o W) I8 K
- #define FSMC_WaitSignalPolarity_Low ((uint32_t)0x00000000)
' @& G& {( _4 m6 i3 f/ ` - #define FSMC_WaitSignalPolarity_High ((uint32_t)0x00000200)1 |) s: T1 k0 D2 n
- #define IS_FSMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FSMC_WaitSignalPolarity_Low) || \' I7 M( d2 e( u9 c& @
- ((POLARITY) == FSMC_WaitSignalPolarity_High))
3 b! ]7 S: b" h# c: T# l - /**
* R+ g9 A; u; h, D6 ~9 d. S& l - * @}
# y8 z. J* Z, t3 I - *// v& E2 g# T) V; F" N7 c. a* g
- + v* W2 D1 ?2 L3 ?
- /** @defgroup FSMC_Wrap_Mode . p. V- D$ p0 W2 N9 p
- * @{$ e# K4 `+ X7 n! B, r( O I
- */
5 H- I) `, {8 ~6 D' p+ x/ z P H - #define FSMC_WrapMode_Disable ((uint32_t)0x00000000)+ R' u# a0 Y6 g; \1 c! \
- #define FSMC_WrapMode_Enable ((uint32_t)0x00000400) 7 }4 \2 y6 R# U4 Y. e
- #define IS_FSMC_WRAP_MODE(MODE) (((MODE) == FSMC_WrapMode_Disable) || \/ Y+ h& @6 A! W! F- |
- ((MODE) == FSMC_WrapMode_Enable))7 o ?7 a, ^+ Y* b8 m5 D- x
- /**
' J, w' C: v$ U, ]6 P9 x - * @}& o7 s0 }' |- ^$ |: ]
- */, `1 x- Y+ _' u3 c
( q0 a, F$ X I: a- /** @defgroup FSMC_Wait_Timing
& C% e8 m* g: k( q, p - * @{% {4 W2 Q" b- I) M1 g
- */
3 R# h( p1 h8 s+ j2 d - #define FSMC_WaitSignalActive_BeforeWaitState ((uint32_t)0x00000000)
- U, D% r! j/ b `. V4 e - #define FSMC_WaitSignalActive_DuringWaitState ((uint32_t)0x00000800) 4 U8 m- r; s4 D
- #define IS_FSMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FSMC_WaitSignalActive_BeforeWaitState) || \
8 W& \5 H3 S3 ] - ((ACTIVE) == FSMC_WaitSignalActive_DuringWaitState))
, E! h+ ]; n* n" Q$ o - /**
4 g* u& C# L9 q5 L6 w$ N% R+ l - * @}
. i) f* o: F: Z - */
" m+ c* E5 `) k/ G6 j% M. U7 u$ W
9 ~; F" B$ h) V& Q$ G) q- /** @defgroup FSMC_Write_Operation + W0 V2 d, D" x+ c, s0 Q
- * @{8 f0 f4 j6 J I
- */
- y" J' [: t/ O9 B - #define FSMC_WriteOperation_Disable ((uint32_t)0x00000000)) k5 b) P, p- t. N; O
- #define FSMC_WriteOperation_Enable ((uint32_t)0x00001000)
_. G; R# U, V9 E& C - #define IS_FSMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FSMC_WriteOperation_Disable) || \
. ^! f0 S. O2 j - ((OPERATION) == FSMC_WriteOperation_Enable))
" w) K+ \4 S6 B9 {& y - /**+ D/ j/ b6 \* V* [& {
- * @}& @; P: U7 l3 k# M
- */" T% X: m% R/ W0 x6 r
7 b1 M1 D0 \# a4 Q i- /** @defgroup FSMC_Wait_Signal
" ^6 v, \: H7 ~ - * @{7 `$ V6 @ D' b$ v
- */0 q6 @* e% T( {# h' Q$ N
- #define FSMC_WaitSignal_Disable ((uint32_t)0x00000000)* T% m; T5 [4 x/ ? O9 H
- #define FSMC_WaitSignal_Enable ((uint32_t)0x00002000) 3 ~9 T8 V/ o; w: F6 q( X% w5 a
- #define IS_FSMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FSMC_WaitSignal_Disable) || \
/ {, b2 l) ^1 _( s! x/ _% h& I - ((SIGNAL) == FSMC_WaitSignal_Enable))
4 V7 ]5 T v5 e - /**5 O5 Z+ d) K/ v, p+ m/ F$ t& Y
- * @}
5 p0 s- g# d5 w6 T8 C - */
2 r" R; {$ N! Z
( ^ I& h/ {2 j( M3 \6 z* b- /** @defgroup FSMC_Extended_Mode $ d) G6 q2 ?, C w* g& B
- * @{% `4 @! Y/ c' f1 i* w' F
- */
% {& G/ A" K& W - #define FSMC_ExtendedMode_Disable ((uint32_t)0x00000000)& J1 @& l. w) l" P& w
- #define FSMC_ExtendedMode_Enable ((uint32_t)0x00004000)
+ E. A6 O8 S6 L; e: N% g7 n - ! {; o7 ~3 W$ z5 g
- #define IS_FSMC_EXTENDED_MODE(MODE) (((MODE) == FSMC_ExtendedMode_Disable) || \# j( y2 ^2 ?, y" m" |, G1 d N& m
- ((MODE) == FSMC_ExtendedMode_Enable)) 4 K; g# J, Z3 K
- /**+ c4 V! I% I" c- k( M5 y
- * @}
. o% g% s+ Y! a - */. T! O7 @! l% d, A6 \
. F- U/ W! B' F# ^1 g( Q& X8 g- /** @defgroup FSMC_Write_Burst : L) Z/ x0 J9 C$ T& a
- * @{" T7 Y2 O* z4 K) g v7 \
- */
( ^5 f8 I2 K s" Y+ h5 v0 @" g
9 w! K. R9 X9 ?6 V1 a9 R3 b- #define FSMC_WriteBurst_Disable ((uint32_t)0x00000000)
7 R# r4 ^) D& f5 A - #define FSMC_WriteBurst_Enable ((uint32_t)0x00080000)
- v+ r A$ T5 @: R* Z - #define IS_FSMC_WRITE_BURST(BURST) (((BURST) == FSMC_WriteBurst_Disable) || \2 z9 p6 P: E* ~ x/ T3 q ]8 I) a
- ((BURST) == FSMC_WriteBurst_Enable))
( M* o# F7 ~) g9 L! {6 I" } - /**2 }5 D& j2 g& `7 R6 \
- * @}
2 i: C: G+ t' p8 q9 F, [7 V - */
' g: Z4 D$ t8 a3 f: k4 Q - 5 ?3 ~9 S' a4 D0 E( p$ ]
- /** @defgroup FSMC_Address_Setup_Time - C( u. p0 j/ G' B3 @
- * @{
0 b0 S; n$ `! d& \# ? - */* u, ~# ?2 L# L; U( A
- #define IS_FSMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 0xF)
; V7 U! B" q7 l7 f( x - /**
0 E2 b5 e+ J& }0 p: @' C6 K - * @}
) X- X! B5 F1 O5 X7 o - */; X* @3 h1 `- a8 c( w* O' l- \ J
- % X6 `, {+ c! c% X
- /** @defgroup FSMC_Address_Hold_Time
, @3 N2 \& b# Q% \! L/ p - * @{
8 ~4 z" X* e8 c* U+ \# R - */% ~8 x3 p0 p! l/ K4 h
- #define IS_FSMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF)* f0 R% c/ W3 C$ k3 S$ n- r
- /**
2 U: }0 W/ ~, U7 l - * @}2 e4 J6 g2 D5 T* O
- */
3 t" u0 z, D* I6 K
8 F" F: } J9 |; {3 M- /** @defgroup FSMC_Data_Setup_Time & b9 D8 K ]" d7 Q5 t
- * @{! g) ?- x6 \2 a1 z& Z0 P3 f7 j
- */! h) g0 D( O' c+ _/ {
- #define IS_FSMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF))4 }+ `0 C/ q, }! P, e
- /**
6 k$ B3 {3 D& t4 G5 S- W - * @}3 }8 K3 N" y1 U0 F+ A0 C( h# k
- */6 i/ m8 M* V' I, v9 l- z! i9 }
- , A% _. ~3 l- @: m7 f+ y2 \
- /** @defgroup FSMC_Bus_Turn_around_Duration
. Q2 H: o$ D: ?+ } L - * @{% U+ u/ G# E/ t" b
- */
3 W9 ~% t4 \5 A4 X4 w3 X8 B - #define IS_FSMC_TURNAROUND_TIME(TIME) ((TIME) <= 0xF)8 t. U$ n: [7 e8 q$ B
- /**% H8 `( P; w. C4 ~2 k: p
- * @}
/ V7 B8 {0 r ^$ v9 V - */
/ @$ X1 u! k X7 i - : J8 D z' g! i1 B" g4 q8 h0 L
- /** @defgroup FSMC_CLK_Division
$ a& n9 G! b5 o! R9 e6 f - * @{
m7 ?! \2 O4 M0 J( ? - */
! v( V: p! n# C |( ` - #define IS_FSMC_CLK_DIV(DIV) ((DIV) <= 0xF)
5 c& u" U4 p& \1 ?/ \& I - /**
6 P/ T+ e# I6 |7 ]" G: o1 ? - * @}$ {3 l5 e0 M+ W) A1 T& i* @
- */2 G+ k5 g# m+ u1 A" A
( }/ O6 `, {+ G8 Q- /** @defgroup FSMC_Data_Latency
% j0 ~, x* w3 F q' A% g* v1 A+ P - * @{
" ?1 J0 o+ ?$ D c5 Z% D - */
+ v" e/ m$ J$ ?8 L - #define IS_FSMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 0xF)- V( g" z1 J. h, B! J
- /**9 ]( N: `4 e5 t; H8 @4 c
- * @}# ]/ s. D' `3 Y2 V6 J
- */. i% j; N$ v- Q9 p! F$ h7 \
3 T3 D6 M. z. S7 i% E- ^- /** @defgroup FSMC_Access_Mode 1 ?: ?% ?! A5 _% a$ q0 D
- * @{
4 I, F h1 e7 y - */# M: x- @7 ~$ k$ T; ~! J; p: m2 o
- #define FSMC_AccessMode_A ((uint32_t)0x00000000)6 N% M% y( ]% v! ~+ X" t6 |1 Q4 D+ E! ]
- #define FSMC_AccessMode_B ((uint32_t)0x10000000) & c5 Y* X4 l1 z, v, a, F& l* w
- #define FSMC_AccessMode_C ((uint32_t)0x20000000)
- \9 S5 R0 h" l+ k- w, q i - #define FSMC_AccessMode_D ((uint32_t)0x30000000)4 \" ~3 D, X, u% i) @1 r) N' U
- #define IS_FSMC_ACCESS_MODE(MODE) (((MODE) == FSMC_AccessMode_A) || \; J! g/ `1 {0 N8 [
- ((MODE) == FSMC_AccessMode_B) || \9 I4 S- [: m* B5 ?
- ((MODE) == FSMC_AccessMode_C) || \
# Z6 A" |7 U: k - ((MODE) == FSMC_AccessMode_D))+ p" |( J5 e" ^. C
- /**# W4 Y6 q5 z- ]5 w8 F1 M8 Z
- * @}8 U+ ?, L0 V; B+ X: T1 H6 x) v
- */" p$ D, H% J* Z- K: j$ K
4 B. A, E% u8 j+ Y9 B+ }2 j* |- /**
1 G- M/ D; \+ A5 t/ \ - * @}4 h% S6 Y3 q9 ~. {
- */& `0 N' G1 c. G6 a
- 4 E' J! `- g0 q/ k* F( M) L$ b
- /** @defgroup FSMC_NAND_PCCARD_Controller ( `8 r8 P9 O6 p; f$ {) ]
- * @{: O: d( i# \0 l/ V; ]* I5 H- x. z
- */# O& l% Q9 S q% ~* ]
" h! R( K* {2 Z5 Z9 ?( A: m6 R- /** @defgroup FSMC_Wait_feature 4 I" B* E/ U! w% k% Y/ ~
- * @{$ ?7 F# e- z' A& X2 ~
- */
2 T! c& ]% X! b, @ - #define FSMC_Waitfeature_Disable ((uint32_t)0x00000000)" L0 l& G3 |$ {& B w- I
- #define FSMC_Waitfeature_Enable ((uint32_t)0x00000002)# f7 Z; S3 a; c
- #define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_Waitfeature_Disable) || \6 m" M; h3 R) r. }% p. a
- ((FEATURE) == FSMC_Waitfeature_Enable))& I1 _' _' t( A
- /** M9 x) F: x9 h8 o& [- R9 q5 R
- * @}
6 s# M ~* g5 l) |/ w) l ] - */1 Q7 d E$ \8 d! B+ Z
4 g! l& q2 Y1 @* N5 G( j6 {# x- , {, p/ u+ o( m7 v9 i: h$ D
- /** @defgroup FSMC_ECC
: V) k. C* R8 J - * @{/ ^3 y2 Q5 {) W7 W- o
- */8 k/ v6 e2 V( h$ w# |' m3 k4 \
- #define FSMC_ECC_Disable ((uint32_t)0x00000000)
7 F! _3 e s) }. G8 W9 k - #define FSMC_ECC_Enable ((uint32_t)0x00000040)* ?4 c5 W) A# ^
- #define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_ECC_Disable) || \9 M2 r' h8 U5 |4 L
- ((STATE) == FSMC_ECC_Enable))
. S7 y P% D% M - /** |" ]2 c( }- X0 i: W4 f2 L
- * @}
7 e) j# E4 d. ?% h5 T: h Z - */
; T5 Z0 R5 j- _2 [# E4 Q' O6 g
8 G6 c' O# i1 N. m+ V" q6 z- /** @defgroup FSMC_ECC_Page_Size % n: A! m5 E: E+ i3 g* y( L
- * @{" p u0 J. Y( K4 o; J
- */
2 B9 ~# T D" k3 W* p& a - #define FSMC_ECCPageSize_256Bytes ((uint32_t)0x00000000), B' e% O; @% y6 e9 a
- #define FSMC_ECCPageSize_512Bytes ((uint32_t)0x00020000)
; [9 \7 D8 C# G - #define FSMC_ECCPageSize_1024Bytes ((uint32_t)0x00040000)
9 ^5 r8 a7 m. O0 h: P0 b9 I - #define FSMC_ECCPageSize_2048Bytes ((uint32_t)0x00060000)% \: x+ p7 {: Q, C- v! J7 @
- #define FSMC_ECCPageSize_4096Bytes ((uint32_t)0x00080000)$ Q' @5 u2 ?: o' C% c) j
- #define FSMC_ECCPageSize_8192Bytes ((uint32_t)0x000A0000)7 p7 t9 X" I8 W/ N# W1 R5 k8 D
- #define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_ECCPageSize_256Bytes) || \
2 T6 Q8 \: i" c2 c) G - ((SIZE) == FSMC_ECCPageSize_512Bytes) || \
' Q$ ?" d( P3 s7 K! q - ((SIZE) == FSMC_ECCPageSize_1024Bytes) || \* H0 g. J4 u6 f% |# X
- ((SIZE) == FSMC_ECCPageSize_2048Bytes) || \' E7 G! r9 q5 }$ `5 c$ g
- ((SIZE) == FSMC_ECCPageSize_4096Bytes) || \+ O9 N1 K5 ~( w5 o
- ((SIZE) == FSMC_ECCPageSize_8192Bytes))
: h+ q+ i3 H# l! Y: m - /**
# \% E; [& V6 o( a: @( q - * @}
# X3 C. @/ C& B7 | - */6 C6 z! c$ Y1 q+ S! J
- 2 ]$ X! e: s' E% ?. W
- /** @defgroup FSMC_TCLR_Setup_Time
{1 c8 H2 d3 v) t# ^) d0 p' b; O - * @{
- q8 O7 X; N( A+ J# [, @; w1 Y - *// o' v% l) C& i; p; j( v, T+ L1 z5 L
- #define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 0xFF)
; A* A1 X! y1 m, N: N - /**+ T8 N. S4 {6 q# x) d+ H
- * @}' r2 A3 q+ K' R5 u
- */% U) J. f- l. r
- , U4 k* Q& b3 R* k
- /** @defgroup FSMC_TAR_Setup_Time ; o: O# l: [9 o6 q2 G
- * @{
5 O2 u/ K o1 I - */1 ]( X3 t- N5 T5 E2 ]9 u
- #define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 0xFF)
3 Z* J) ]( l7 ^, } - /**3 L/ A/ w# k% G5 c
- * @}
S. m2 R, [ Y9 c - */4 g5 j4 G3 C( ^; C# Y) D; I
7 p" K) \# W7 V$ p8 v8 i# Y- /** @defgroup FSMC_Setup_Time 2 u" W* q( m3 p8 i" g. R- v* o
- * @{9 K6 @$ I' n. O# u
- */
0 i7 Z, e' M6 C7 z* i; O - #define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 0xFF)
, C' Q& g2 ]; X; Z( V - /**
4 T( j# G5 w. c$ }& B) ` - * @}4 l9 I+ n% a' s ]
- */4 R# r+ w. o3 X2 g8 H! E% l
- . v5 m0 h, Y4 k
- /** @defgroup FSMC_Wait_Setup_Time ! z' P( [' n* _8 G
- * @{
8 n1 g1 P# s, F `* L: V - */
+ k) Z/ K' j5 e* g0 k* s, w - #define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 0xFF)
7 g" s6 }. M' C+ l( B' V - /**9 t/ D* a7 J, K9 O# N$ u, C
- * @}8 t/ q' k8 ~3 T6 V
- */$ j8 g/ E" v! ?+ X+ \9 N: a
# e0 K3 B) k1 D ~3 Z+ h- /** @defgroup FSMC_Hold_Setup_Time $ _3 E+ r& t/ ]- K, ?- z7 ?2 A9 J
- * @{' k; q* p* U# ]
- */
9 U1 Q% D! R( P, f; d - #define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 0xFF)
/ a* ], E5 v- g - /**3 `- A' q; O1 t; s0 y) r( d* j
- * @}6 L& C" a: ?6 S) a" M
- */
0 A. ]1 r2 Y9 B
8 n+ l v/ B. w: \( O7 _7 X% m- /** @defgroup FSMC_HiZ_Setup_Time
* Q! k; f! x$ D& Y& \ - * @{
. C* Y$ e1 m8 _! W/ G5 J - */( [; F: Y( \, L6 X
- #define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 0xFF)$ y1 V# S- B+ ~. m& K
- /**
P0 C* ?9 l, Y6 ? a3 x. W& I2 ^ - * @}, X0 ^7 Z2 e4 A. b) y% h
- */
' o: h7 s( i) {/ D" ]
" O: z9 W& g* V) a! W- /** @defgroup FSMC_Interrupt_sources
' ]8 N, c% {9 F+ _* w - * @{
( }# d1 C9 K _ - */
; N: n0 X; a, T1 N7 j4 B - #define FSMC_IT_RisingEdge ((uint32_t)0x00000008)
4 t. r/ b+ s! L0 ~0 n" j" Q - #define FSMC_IT_Level ((uint32_t)0x00000010)
- z1 T! D1 ]5 g7 ?$ z7 m - #define FSMC_IT_FallingEdge ((uint32_t)0x00000020)
1 ? G' ^) H0 F$ J, d5 L - #define IS_FSMC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((IT) != 0x00000000))
6 z" U# M5 L5 D0 e' U4 k' X; ?' }( } - #define IS_FSMC_GET_IT(IT) (((IT) == FSMC_IT_RisingEdge) || \
+ X2 o7 n) g; P8 P# M* q9 M$ N - ((IT) == FSMC_IT_Level) || \, V v( v, M+ v/ H
- ((IT) == FSMC_IT_FallingEdge))
' \/ {; j1 Q; l2 F - /**
$ N6 A4 U& y) F$ F - * @}) G& E8 F2 L; A1 f1 h- w) W, z! }( {; O
- */
/ S9 O6 B! Q: [& j0 j
' h+ K0 Q. d$ \- /** @defgroup FSMC_Flags
U2 D: Q% N v - * @{
4 `% o2 d8 u& O; ] - */6 S6 r% l' r. }( ~* m& t% L8 V: T. a
- #define FSMC_FLAG_RisingEdge ((uint32_t)0x00000001)! j0 Q1 L7 T/ ^- ~
- #define FSMC_FLAG_Level ((uint32_t)0x00000002)9 R# A1 ~" \( q5 X6 c; q
- #define FSMC_FLAG_FallingEdge ((uint32_t)0x00000004). `- t2 J( l: v5 h8 O7 T! x5 a
- #define FSMC_FLAG_FEMPT ((uint32_t)0x00000040); }2 S' V" E* l& k; f1 g. f
- #define IS_FSMC_GET_FLAG(FLAG) (((FLAG) == FSMC_FLAG_RisingEdge) || \0 l# m( r; a% O( v1 a: \6 U
- ((FLAG) == FSMC_FLAG_Level) || \
: X+ d% Y; ?" C, ]" h, \0 Q - ((FLAG) == FSMC_FLAG_FallingEdge) || \ D( X4 A6 G* E( i2 m$ R, ~3 f+ b
- ((FLAG) == FSMC_FLAG_FEMPT))
$ W& n0 a( } Z) ~1 i' _8 ] - # ^1 T5 [/ l5 r, H3 i8 `/ r
- #define IS_FSMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))+ A% k. R4 Y* H" ^* y$ P7 a
复制代码 ' n# i4 ?: l8 Q% D. o7 ^
03. 相关函数
! ]: F$ y8 C+ l, x2 V, k1 N! p! H- /* NOR/SRAM Controller functions **********************************************/
$ [0 j3 V- O/ m) q, E7 Z0 x0 O$ [ - void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank);
7 B9 S& U& Z5 I N2 s - void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);( t# L/ X) _# y" s
- void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);7 @" g6 f1 m6 A) x( v- d& k
- void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState);( k( S+ W) x e# }7 M( G% |: `' J' j
" D% k6 C& _. R. [; G+ h Q- /* NAND Controller functions **************************************************/
$ B2 h* ^8 M" z3 B; l/ x$ | z1 _8 W - void FSMC_NANDDeInit(uint32_t FSMC_Bank);% O: z% X1 f% y) \& \
- void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);7 q3 p3 V/ y0 E/ { @1 s
- void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
! F9 w3 f4 U* l0 G/ T6 _1 M! ?9 F J - void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState);& `6 C; D' H5 a
- void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState);0 ]+ x. R$ P6 G3 ?( e& w: }, R
- uint32_t FSMC_GetECC(uint32_t FSMC_Bank);# |' c5 U+ Y8 ?) a/ W8 w/ w. G
! ~5 x4 A* N' Y+ U/ |- /* PCCARD Controller functions ************************************************/9 A; s" t" o N. V' j, H
- void FSMC_PCCARDDeInit(void);
% ]9 K2 D1 X! T* x2 k5 I3 Q3 z - void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
) O8 q: F( ~$ z. [7 L) J. m* F' D - void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
' t1 T' ?4 x2 m5 s" r+ c: ` - void FSMC_PCCARDCmd(FunctionalState NewState);. H/ m7 Q& Z8 p& L
! d9 X4 }8 K! u2 x7 @3 ^/ f2 [- /* Interrupts and flags management functions **********************************/
9 E3 e& X0 j7 O5 e/ A2 ` - void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState);
$ \6 A- ?( n" g! A5 k - FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);6 r' o7 } P5 O9 C3 u l1 i
- void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);3 d6 s, Q6 D9 K, Q" P g) |
- ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT);
9 h. z6 }3 z$ u! O/ @ - void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT);
复制代码
* C) {/ M0 H/ L: p* Y% o% o6 o04. 结构体封装
0 D& q$ B$ `! P# d. h- typedef struct! n0 [' M& B! z+ W- g3 @
- {" S$ F' Y# Y$ b! j/ H6 w
- __IO uint32_t BTCR[8]; /*!< NOR/PSRAM chip-select control register(BCR) and chip-select timing register(BTR), Address offset: 0x00-1C */ d4 Z* ^' r6 V& e0 c# }0 j7 j
- } FSMC_Bank1_TypeDef;
' N! t8 T" P& M+ z; {2 g. L* q$ V
2 y+ T- a6 g! b- /**
2 M( l% j8 K# B9 U0 r u - * @brief Flexible Static Memory Controller Bank1E4 G( E5 P% u1 h5 I+ ?4 _
- */0 w* @7 G/ U: a. g6 E; ]
- . C2 Q7 Q4 O7 C6 m( ]; G1 w6 L6 o' @0 u
- typedef struct# ]: v7 u7 v: e0 g( T' ?& z0 q' o
- {
& ]; O1 Y$ M0 M/ L( k+ M - __IO uint32_t BWTR[7]; /*!< NOR/PSRAM write timing registers, Address offset: 0x104-0x11C */2 [6 v) F% l: x- \+ K" \" c
- } FSMC_Bank1E_TypeDef;
4 I& m0 h$ Z9 M% m G8 I5 Z - 6 R2 o( a+ p d/ @
- /**
9 M5 b: W9 k/ ?1 n7 S - * @brief Flexible Static Memory Controller Bank2" ^* ^7 ^. L4 l$ R. _: t
- *// L$ W0 \/ |) Z4 S& d+ y
" g' {$ F4 E: V2 ~4 p+ ]! N- typedef struct
: E1 O. z0 p/ ^4 O4 g% ^ - {
+ Q2 c7 D9 A* Q$ ^8 o; x - __IO uint32_t PCR2; /*!< NAND Flash control register 2, Address offset: 0x60 */
/ n& b* c% R, [ - __IO uint32_t SR2; /*!< NAND Flash FIFO status and interrupt register 2, Address offset: 0x64 */
6 y9 [7 i7 m9 n+ ~ - __IO uint32_t PMEM2; /*!< NAND Flash Common memory space timing register 2, Address offset: 0x68 */
* N& t4 P: ]! Q$ |; d( I+ n - __IO uint32_t PATT2; /*!< NAND Flash Attribute memory space timing register 2, Address offset: 0x6C */5 U& H0 N B/ O+ y7 {
- uint32_t RESERVED0; /*!< Reserved, 0x70 */: @/ Z5 O5 D; f1 g
- __IO uint32_t ECCR2; /*!< NAND Flash ECC result registers 2, Address offset: 0x74 */
% _0 l3 |3 N6 R - } FSMC_Bank2_TypeDef;
+ v) i9 e# V! X* ~8 S& C' `
& T3 j- f1 p# Q5 U- /**
Q: G, u1 v8 |6 U5 w - * @brief Flexible Static Memory Controller Bank3# m& \" p7 u5 s# b
- */. m- |) I9 b0 y/ z, \
$ S# H3 J( S# _& o- typedef struct* q* |# \3 i$ N6 J5 W4 P# W8 q
- {- S% w3 g' r7 k( y) }: k; Q7 ]
- __IO uint32_t PCR3; /*!< NAND Flash control register 3, Address offset: 0x80 */! G( p$ ?* L) D1 g2 {
- __IO uint32_t SR3; /*!< NAND Flash FIFO status and interrupt register 3, Address offset: 0x84 */
* L- D C- W- \$ i1 q y - __IO uint32_t PMEM3; /*!< NAND Flash Common memory space timing register 3, Address offset: 0x88 */5 y, O v+ B% q# _5 v6 T
- __IO uint32_t PATT3; /*!< NAND Flash Attribute memory space timing register 3, Address offset: 0x8C */
# N% S3 {% ]! l) s - uint32_t RESERVED0; /*!< Reserved, 0x90 */
( U, N. [1 \" ]8 P - __IO uint32_t ECCR3; /*!< NAND Flash ECC result registers 3, Address offset: 0x94 */
- h4 X6 k/ f* ^* h+ Q - } FSMC_Bank3_TypeDef;
7 }6 I/ N. p4 f% b) G. r* D
* {( A. d2 ^0 l1 x. N) ^4 K3 J- /**
) g8 ]0 f" A/ q: s; ~3 D* c - * @brief Flexible Static Memory Controller Bank4
! L2 r; J" S- M" |1 m - */
' z4 |+ H5 F3 B. n8 n8 x& V - / y- v6 S! I, y4 U9 N. z( ~
- typedef struct
- C- ~& ]/ M' G - {* E9 K9 @; i, s2 ^$ r2 g
- __IO uint32_t PCR4; /*!< PC Card control register 4, Address offset: 0xA0 */6 S; w7 p$ J# l9 ^
- __IO uint32_t SR4; /*!< PC Card FIFO status and interrupt register 4, Address offset: 0xA4 */" C4 ? }* { i. I: ?
- __IO uint32_t PMEM4; /*!< PC Card Common memory space timing register 4, Address offset: 0xA8 */
) W* S. u8 r6 ^$ r( u - __IO uint32_t PATT4; /*!< PC Card Attribute memory space timing register 4, Address offset: 0xAC */
# Q1 U; z: j) ?, @0 u# b - __IO uint32_t PIO4; /*!< PC Card I/O space timing register 4, Address offset: 0xB0 */
; Y% l4 V" x5 I/ V6 T3 E) s - } FSMC_Bank4_TypeDef;
; C) m/ @ q! h: X - + j9 O4 P5 i: L
复制代码
1 v, I! J7 W- r0 V+ X2 t |