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