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