stm32f10x_fsmc.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. /**
  2. ******************************************************************************
  3. * @file stm32f10x_fsmc.h
  4. * @author MCD Application Team
  5. * @version V3.5.0
  6. * @date 11-March-2011
  7. * @brief This file contains all the functions prototypes for the FSMC firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  13. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  14. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  15. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  16. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  17. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  18. *
  19. * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  20. ******************************************************************************
  21. */
  22. /* Define to prevent recursive inclusion -------------------------------------*/
  23. #ifndef __STM32F10x_FSMC_H
  24. #define __STM32F10x_FSMC_H
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* Includes ------------------------------------------------------------------*/
  29. #include "stm32f10x.h"
  30. /** @addtogroup STM32F10x_StdPeriph_Driver
  31. * @{
  32. */
  33. /** @addtogroup FSMC
  34. * @{
  35. */
  36. /** @defgroup FSMC_Exported_Types
  37. * @{
  38. */
  39. /**
  40. * @brief Timing parameters For NOR/SRAM Banks
  41. */
  42. typedef struct
  43. {
  44. uint32_t FSMC_AddressSetupTime; /*!< Defines the number of HCLK cycles to configure
  45. the duration of the address setup time.
  46. This parameter can be a value between 0 and 0xF.
  47. @note: It is not used with synchronous NOR Flash memories. */
  48. uint32_t FSMC_AddressHoldTime; /*!< Defines the number of HCLK cycles to configure
  49. the duration of the address hold time.
  50. This parameter can be a value between 0 and 0xF.
  51. @note: It is not used with synchronous NOR Flash memories.*/
  52. uint32_t FSMC_DataSetupTime; /*!< Defines the number of HCLK cycles to configure
  53. the duration of the data setup time.
  54. This parameter can be a value between 0 and 0xFF.
  55. @note: It is used for SRAMs, ROMs and asynchronous multiplexed NOR Flash memories. */
  56. uint32_t FSMC_BusTurnAroundDuration; /*!< Defines the number of HCLK cycles to configure
  57. the duration of the bus turnaround.
  58. This parameter can be a value between 0 and 0xF.
  59. @note: It is only used for multiplexed NOR Flash memories. */
  60. uint32_t FSMC_CLKDivision; /*!< Defines the period of CLK clock output signal, expressed in number of HCLK cycles.
  61. This parameter can be a value between 1 and 0xF.
  62. @note: This parameter is not used for asynchronous NOR Flash, SRAM or ROM accesses. */
  63. uint32_t FSMC_DataLatency; /*!< Defines the number of memory clock cycles to issue
  64. to the memory before getting the first data.
  65. The value of this parameter depends on the memory type as shown below:
  66. - It must be set to 0 in case of a CRAM
  67. - It is don't care in asynchronous NOR, SRAM or ROM accesses
  68. - It may assume a value between 0 and 0xF in NOR Flash memories
  69. with synchronous burst mode enable */
  70. uint32_t FSMC_AccessMode; /*!< Specifies the asynchronous access mode.
  71. This parameter can be a value of @ref FSMC_Access_Mode */
  72. }FSMC_NORSRAMTimingInitTypeDef;
  73. /**
  74. * @brief FSMC NOR/SRAM Init structure definition
  75. */
  76. typedef struct
  77. {
  78. uint32_t FSMC_Bank; /*!< Specifies the NOR/SRAM memory bank that will be used.
  79. This parameter can be a value of @ref FSMC_NORSRAM_Bank */
  80. uint32_t FSMC_DataAddressMux; /*!< Specifies whether the address and data values are
  81. multiplexed on the databus or not.
  82. This parameter can be a value of @ref FSMC_Data_Address_Bus_Multiplexing */
  83. uint32_t FSMC_MemoryType; /*!< Specifies the type of external memory attached to
  84. the corresponding memory bank.
  85. This parameter can be a value of @ref FSMC_Memory_Type */
  86. uint32_t FSMC_MemoryDataWidth; /*!< Specifies the external memory device width.
  87. This parameter can be a value of @ref FSMC_Data_Width */
  88. uint32_t FSMC_BurstAccessMode; /*!< Enables or disables the burst access mode for Flash memory,
  89. valid only with synchronous burst Flash memories.
  90. This parameter can be a value of @ref FSMC_Burst_Access_Mode */
  91. uint32_t FSMC_AsynchronousWait; /*!< Enables or disables wait signal during asynchronous transfers,
  92. valid only with asynchronous Flash memories.
  93. This parameter can be a value of @ref FSMC_AsynchronousWait */
  94. uint32_t FSMC_WaitSignalPolarity; /*!< Specifies the wait signal polarity, valid only when accessing
  95. the Flash memory in burst mode.
  96. This parameter can be a value of @ref FSMC_Wait_Signal_Polarity */
  97. uint32_t FSMC_WrapMode; /*!< Enables or disables the Wrapped burst access mode for Flash
  98. memory, valid only when accessing Flash memories in burst mode.
  99. This parameter can be a value of @ref FSMC_Wrap_Mode */
  100. uint32_t FSMC_WaitSignalActive; /*!< Specifies if the wait signal is asserted by the memory one
  101. clock cycle before the wait state or during the wait state,
  102. valid only when accessing memories in burst mode.
  103. This parameter can be a value of @ref FSMC_Wait_Timing */
  104. uint32_t FSMC_WriteOperation; /*!< Enables or disables the write operation in the selected bank by the FSMC.
  105. This parameter can be a value of @ref FSMC_Write_Operation */
  106. uint32_t FSMC_WaitSignal; /*!< Enables or disables the wait-state insertion via wait
  107. signal, valid for Flash memory access in burst mode.
  108. This parameter can be a value of @ref FSMC_Wait_Signal */
  109. uint32_t FSMC_ExtendedMode; /*!< Enables or disables the extended mode.
  110. This parameter can be a value of @ref FSMC_Extended_Mode */
  111. uint32_t FSMC_WriteBurst; /*!< Enables or disables the write burst operation.
  112. This parameter can be a value of @ref FSMC_Write_Burst */
  113. FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct; /*!< Timing Parameters for write and read access if the ExtendedMode is not used*/
  114. FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct; /*!< Timing Parameters for write access if the ExtendedMode is used*/
  115. }FSMC_NORSRAMInitTypeDef;
  116. /**
  117. * @brief Timing parameters For FSMC NAND and PCCARD Banks
  118. */
  119. typedef struct
  120. {
  121. uint32_t FSMC_SetupTime; /*!< Defines the number of HCLK cycles to setup address before
  122. the command assertion for NAND-Flash read or write access
  123. to common/Attribute or I/O memory space (depending on
  124. the memory space timing to be configured).
  125. This parameter can be a value between 0 and 0xFF.*/
  126. uint32_t FSMC_WaitSetupTime; /*!< Defines the minimum number of HCLK cycles to assert the
  127. command for NAND-Flash read or write access to
  128. common/Attribute or I/O memory space (depending on the
  129. memory space timing to be configured).
  130. This parameter can be a number between 0x00 and 0xFF */
  131. uint32_t FSMC_HoldSetupTime; /*!< Defines the number of HCLK clock cycles to hold address
  132. (and data for write access) after the command deassertion
  133. for NAND-Flash read or write access to common/Attribute
  134. or I/O memory space (depending on the memory space timing
  135. to be configured).
  136. This parameter can be a number between 0x00 and 0xFF */
  137. uint32_t FSMC_HiZSetupTime; /*!< Defines the number of HCLK clock cycles during which the
  138. databus is kept in HiZ after the start of a NAND-Flash
  139. write access to common/Attribute or I/O memory space (depending
  140. on the memory space timing to be configured).
  141. This parameter can be a number between 0x00 and 0xFF */
  142. }FSMC_NAND_PCCARDTimingInitTypeDef;
  143. /**
  144. * @brief FSMC NAND Init structure definition
  145. */
  146. typedef struct
  147. {
  148. uint32_t FSMC_Bank; /*!< Specifies the NAND memory bank that will be used.
  149. This parameter can be a value of @ref FSMC_NAND_Bank */
  150. uint32_t FSMC_Waitfeature; /*!< Enables or disables the Wait feature for the NAND Memory Bank.
  151. This parameter can be any value of @ref FSMC_Wait_feature */
  152. uint32_t FSMC_MemoryDataWidth; /*!< Specifies the external memory device width.
  153. This parameter can be any value of @ref FSMC_Data_Width */
  154. uint32_t FSMC_ECC; /*!< Enables or disables the ECC computation.
  155. This parameter can be any value of @ref FSMC_ECC */
  156. uint32_t FSMC_ECCPageSize; /*!< Defines the page size for the extended ECC.
  157. This parameter can be any value of @ref FSMC_ECC_Page_Size */
  158. uint32_t FSMC_TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
  159. delay between CLE low and RE low.
  160. This parameter can be a value between 0 and 0xFF. */
  161. uint32_t FSMC_TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
  162. delay between ALE low and RE low.
  163. This parameter can be a number between 0x0 and 0xFF */
  164. FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_CommonSpaceTimingStruct; /*!< FSMC Common Space Timing */
  165. FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_AttributeSpaceTimingStruct; /*!< FSMC Attribute Space Timing */
  166. }FSMC_NANDInitTypeDef;
  167. /**
  168. * @brief FSMC PCCARD Init structure definition
  169. */
  170. typedef struct
  171. {
  172. uint32_t FSMC_Waitfeature; /*!< Enables or disables the Wait feature for the Memory Bank.
  173. This parameter can be any value of @ref FSMC_Wait_feature */
  174. uint32_t FSMC_TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
  175. delay between CLE low and RE low.
  176. This parameter can be a value between 0 and 0xFF. */
  177. uint32_t FSMC_TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
  178. delay between ALE low and RE low.
  179. This parameter can be a number between 0x0 and 0xFF */
  180. FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_CommonSpaceTimingStruct; /*!< FSMC Common Space Timing */
  181. FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_AttributeSpaceTimingStruct; /*!< FSMC Attribute Space Timing */
  182. FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_IOSpaceTimingStruct; /*!< FSMC IO Space Timing */
  183. }FSMC_PCCARDInitTypeDef;
  184. /**
  185. * @}
  186. */
  187. /** @defgroup FSMC_Exported_Constants
  188. * @{
  189. */
  190. /** @defgroup FSMC_NORSRAM_Bank
  191. * @{
  192. */
  193. #define FSMC_Bank1_NORSRAM1 ((uint32_t)0x00000000)
  194. #define FSMC_Bank1_NORSRAM2 ((uint32_t)0x00000002)
  195. #define FSMC_Bank1_NORSRAM3 ((uint32_t)0x00000004)
  196. #define FSMC_Bank1_NORSRAM4 ((uint32_t)0x00000006)
  197. /**
  198. * @}
  199. */
  200. /** @defgroup FSMC_NAND_Bank
  201. * @{
  202. */
  203. #define FSMC_Bank2_NAND ((uint32_t)0x00000010)
  204. #define FSMC_Bank3_NAND ((uint32_t)0x00000100)
  205. /**
  206. * @}
  207. */
  208. /** @defgroup FSMC_PCCARD_Bank
  209. * @{
  210. */
  211. #define FSMC_Bank4_PCCARD ((uint32_t)0x00001000)
  212. /**
  213. * @}
  214. */
  215. #define IS_FSMC_NORSRAM_BANK(BANK) (((BANK) == FSMC_Bank1_NORSRAM1) || \
  216. ((BANK) == FSMC_Bank1_NORSRAM2) || \
  217. ((BANK) == FSMC_Bank1_NORSRAM3) || \
  218. ((BANK) == FSMC_Bank1_NORSRAM4))
  219. #define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
  220. ((BANK) == FSMC_Bank3_NAND))
  221. #define IS_FSMC_GETFLAG_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
  222. ((BANK) == FSMC_Bank3_NAND) || \
  223. ((BANK) == FSMC_Bank4_PCCARD))
  224. #define IS_FSMC_IT_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
  225. ((BANK) == FSMC_Bank3_NAND) || \
  226. ((BANK) == FSMC_Bank4_PCCARD))
  227. /** @defgroup NOR_SRAM_Controller
  228. * @{
  229. */
  230. /** @defgroup FSMC_Data_Address_Bus_Multiplexing
  231. * @{
  232. */
  233. #define FSMC_DataAddressMux_Disable ((uint32_t)0x00000000)
  234. #define FSMC_DataAddressMux_Enable ((uint32_t)0x00000002)
  235. #define IS_FSMC_MUX(MUX) (((MUX) == FSMC_DataAddressMux_Disable) || \
  236. ((MUX) == FSMC_DataAddressMux_Enable))
  237. /**
  238. * @}
  239. */
  240. /** @defgroup FSMC_Memory_Type
  241. * @{
  242. */
  243. #define FSMC_MemoryType_SRAM ((uint32_t)0x00000000)
  244. #define FSMC_MemoryType_PSRAM ((uint32_t)0x00000004)
  245. #define FSMC_MemoryType_NOR ((uint32_t)0x00000008)
  246. #define IS_FSMC_MEMORY(MEMORY) (((MEMORY) == FSMC_MemoryType_SRAM) || \
  247. ((MEMORY) == FSMC_MemoryType_PSRAM)|| \
  248. ((MEMORY) == FSMC_MemoryType_NOR))
  249. /**
  250. * @}
  251. */
  252. /** @defgroup FSMC_Data_Width
  253. * @{
  254. */
  255. #define FSMC_MemoryDataWidth_8b ((uint32_t)0x00000000)
  256. #define FSMC_MemoryDataWidth_16b ((uint32_t)0x00000010)
  257. #define IS_FSMC_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \
  258. ((WIDTH) == FSMC_MemoryDataWidth_16b))
  259. /**
  260. * @}
  261. */
  262. /** @defgroup FSMC_Burst_Access_Mode
  263. * @{
  264. */
  265. #define FSMC_BurstAccessMode_Disable ((uint32_t)0x00000000)
  266. #define FSMC_BurstAccessMode_Enable ((uint32_t)0x00000100)
  267. #define IS_FSMC_BURSTMODE(STATE) (((STATE) == FSMC_BurstAccessMode_Disable) || \
  268. ((STATE) == FSMC_BurstAccessMode_Enable))
  269. /**
  270. * @}
  271. */
  272. /** @defgroup FSMC_AsynchronousWait
  273. * @{
  274. */
  275. #define FSMC_AsynchronousWait_Disable ((uint32_t)0x00000000)
  276. #define FSMC_AsynchronousWait_Enable ((uint32_t)0x00008000)
  277. #define IS_FSMC_ASYNWAIT(STATE) (((STATE) == FSMC_AsynchronousWait_Disable) || \
  278. ((STATE) == FSMC_AsynchronousWait_Enable))
  279. /**
  280. * @}
  281. */
  282. /** @defgroup FSMC_Wait_Signal_Polarity
  283. * @{
  284. */
  285. #define FSMC_WaitSignalPolarity_Low ((uint32_t)0x00000000)
  286. #define FSMC_WaitSignalPolarity_High ((uint32_t)0x00000200)
  287. #define IS_FSMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FSMC_WaitSignalPolarity_Low) || \
  288. ((POLARITY) == FSMC_WaitSignalPolarity_High))
  289. /**
  290. * @}
  291. */
  292. /** @defgroup FSMC_Wrap_Mode
  293. * @{
  294. */
  295. #define FSMC_WrapMode_Disable ((uint32_t)0x00000000)
  296. #define FSMC_WrapMode_Enable ((uint32_t)0x00000400)
  297. #define IS_FSMC_WRAP_MODE(MODE) (((MODE) == FSMC_WrapMode_Disable) || \
  298. ((MODE) == FSMC_WrapMode_Enable))
  299. /**
  300. * @}
  301. */
  302. /** @defgroup FSMC_Wait_Timing
  303. * @{
  304. */
  305. #define FSMC_WaitSignalActive_BeforeWaitState ((uint32_t)0x00000000)
  306. #define FSMC_WaitSignalActive_DuringWaitState ((uint32_t)0x00000800)
  307. #define IS_FSMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FSMC_WaitSignalActive_BeforeWaitState) || \
  308. ((ACTIVE) == FSMC_WaitSignalActive_DuringWaitState))
  309. /**
  310. * @}
  311. */
  312. /** @defgroup FSMC_Write_Operation
  313. * @{
  314. */
  315. #define FSMC_WriteOperation_Disable ((uint32_t)0x00000000)
  316. #define FSMC_WriteOperation_Enable ((uint32_t)0x00001000)
  317. #define IS_FSMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FSMC_WriteOperation_Disable) || \
  318. ((OPERATION) == FSMC_WriteOperation_Enable))
  319. /**
  320. * @}
  321. */
  322. /** @defgroup FSMC_Wait_Signal
  323. * @{
  324. */
  325. #define FSMC_WaitSignal_Disable ((uint32_t)0x00000000)
  326. #define FSMC_WaitSignal_Enable ((uint32_t)0x00002000)
  327. #define IS_FSMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FSMC_WaitSignal_Disable) || \
  328. ((SIGNAL) == FSMC_WaitSignal_Enable))
  329. /**
  330. * @}
  331. */
  332. /** @defgroup FSMC_Extended_Mode
  333. * @{
  334. */
  335. #define FSMC_ExtendedMode_Disable ((uint32_t)0x00000000)
  336. #define FSMC_ExtendedMode_Enable ((uint32_t)0x00004000)
  337. #define IS_FSMC_EXTENDED_MODE(MODE) (((MODE) == FSMC_ExtendedMode_Disable) || \
  338. ((MODE) == FSMC_ExtendedMode_Enable))
  339. /**
  340. * @}
  341. */
  342. /** @defgroup FSMC_Write_Burst
  343. * @{
  344. */
  345. #define FSMC_WriteBurst_Disable ((uint32_t)0x00000000)
  346. #define FSMC_WriteBurst_Enable ((uint32_t)0x00080000)
  347. #define IS_FSMC_WRITE_BURST(BURST) (((BURST) == FSMC_WriteBurst_Disable) || \
  348. ((BURST) == FSMC_WriteBurst_Enable))
  349. /**
  350. * @}
  351. */
  352. /** @defgroup FSMC_Address_Setup_Time
  353. * @{
  354. */
  355. #define IS_FSMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 0xF)
  356. /**
  357. * @}
  358. */
  359. /** @defgroup FSMC_Address_Hold_Time
  360. * @{
  361. */
  362. #define IS_FSMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF)
  363. /**
  364. * @}
  365. */
  366. /** @defgroup FSMC_Data_Setup_Time
  367. * @{
  368. */
  369. #define IS_FSMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF))
  370. /**
  371. * @}
  372. */
  373. /** @defgroup FSMC_Bus_Turn_around_Duration
  374. * @{
  375. */
  376. #define IS_FSMC_TURNAROUND_TIME(TIME) ((TIME) <= 0xF)
  377. /**
  378. * @}
  379. */
  380. /** @defgroup FSMC_CLK_Division
  381. * @{
  382. */
  383. #define IS_FSMC_CLK_DIV(DIV) ((DIV) <= 0xF)
  384. /**
  385. * @}
  386. */
  387. /** @defgroup FSMC_Data_Latency
  388. * @{
  389. */
  390. #define IS_FSMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 0xF)
  391. /**
  392. * @}
  393. */
  394. /** @defgroup FSMC_Access_Mode
  395. * @{
  396. */
  397. #define FSMC_AccessMode_A ((uint32_t)0x00000000)
  398. #define FSMC_AccessMode_B ((uint32_t)0x10000000)
  399. #define FSMC_AccessMode_C ((uint32_t)0x20000000)
  400. #define FSMC_AccessMode_D ((uint32_t)0x30000000)
  401. #define IS_FSMC_ACCESS_MODE(MODE) (((MODE) == FSMC_AccessMode_A) || \
  402. ((MODE) == FSMC_AccessMode_B) || \
  403. ((MODE) == FSMC_AccessMode_C) || \
  404. ((MODE) == FSMC_AccessMode_D))
  405. /**
  406. * @}
  407. */
  408. /**
  409. * @}
  410. */
  411. /** @defgroup NAND_PCCARD_Controller
  412. * @{
  413. */
  414. /** @defgroup FSMC_Wait_feature
  415. * @{
  416. */
  417. #define FSMC_Waitfeature_Disable ((uint32_t)0x00000000)
  418. #define FSMC_Waitfeature_Enable ((uint32_t)0x00000002)
  419. #define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_Waitfeature_Disable) || \
  420. ((FEATURE) == FSMC_Waitfeature_Enable))
  421. /**
  422. * @}
  423. */
  424. /** @defgroup FSMC_ECC
  425. * @{
  426. */
  427. #define FSMC_ECC_Disable ((uint32_t)0x00000000)
  428. #define FSMC_ECC_Enable ((uint32_t)0x00000040)
  429. #define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_ECC_Disable) || \
  430. ((STATE) == FSMC_ECC_Enable))
  431. /**
  432. * @}
  433. */
  434. /** @defgroup FSMC_ECC_Page_Size
  435. * @{
  436. */
  437. #define FSMC_ECCPageSize_256Bytes ((uint32_t)0x00000000)
  438. #define FSMC_ECCPageSize_512Bytes ((uint32_t)0x00020000)
  439. #define FSMC_ECCPageSize_1024Bytes ((uint32_t)0x00040000)
  440. #define FSMC_ECCPageSize_2048Bytes ((uint32_t)0x00060000)
  441. #define FSMC_ECCPageSize_4096Bytes ((uint32_t)0x00080000)
  442. #define FSMC_ECCPageSize_8192Bytes ((uint32_t)0x000A0000)
  443. #define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_ECCPageSize_256Bytes) || \
  444. ((SIZE) == FSMC_ECCPageSize_512Bytes) || \
  445. ((SIZE) == FSMC_ECCPageSize_1024Bytes) || \
  446. ((SIZE) == FSMC_ECCPageSize_2048Bytes) || \
  447. ((SIZE) == FSMC_ECCPageSize_4096Bytes) || \
  448. ((SIZE) == FSMC_ECCPageSize_8192Bytes))
  449. /**
  450. * @}
  451. */
  452. /** @defgroup FSMC_TCLR_Setup_Time
  453. * @{
  454. */
  455. #define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 0xFF)
  456. /**
  457. * @}
  458. */
  459. /** @defgroup FSMC_TAR_Setup_Time
  460. * @{
  461. */
  462. #define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 0xFF)
  463. /**
  464. * @}
  465. */
  466. /** @defgroup FSMC_Setup_Time
  467. * @{
  468. */
  469. #define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 0xFF)
  470. /**
  471. * @}
  472. */
  473. /** @defgroup FSMC_Wait_Setup_Time
  474. * @{
  475. */
  476. #define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 0xFF)
  477. /**
  478. * @}
  479. */
  480. /** @defgroup FSMC_Hold_Setup_Time
  481. * @{
  482. */
  483. #define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 0xFF)
  484. /**
  485. * @}
  486. */
  487. /** @defgroup FSMC_HiZ_Setup_Time
  488. * @{
  489. */
  490. #define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 0xFF)
  491. /**
  492. * @}
  493. */
  494. /** @defgroup FSMC_Interrupt_sources
  495. * @{
  496. */
  497. #define FSMC_IT_RisingEdge ((uint32_t)0x00000008)
  498. #define FSMC_IT_Level ((uint32_t)0x00000010)
  499. #define FSMC_IT_FallingEdge ((uint32_t)0x00000020)
  500. #define IS_FSMC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((IT) != 0x00000000))
  501. #define IS_FSMC_GET_IT(IT) (((IT) == FSMC_IT_RisingEdge) || \
  502. ((IT) == FSMC_IT_Level) || \
  503. ((IT) == FSMC_IT_FallingEdge))
  504. /**
  505. * @}
  506. */
  507. /** @defgroup FSMC_Flags
  508. * @{
  509. */
  510. #define FSMC_FLAG_RisingEdge ((uint32_t)0x00000001)
  511. #define FSMC_FLAG_Level ((uint32_t)0x00000002)
  512. #define FSMC_FLAG_FallingEdge ((uint32_t)0x00000004)
  513. #define FSMC_FLAG_FEMPT ((uint32_t)0x00000040)
  514. #define IS_FSMC_GET_FLAG(FLAG) (((FLAG) == FSMC_FLAG_RisingEdge) || \
  515. ((FLAG) == FSMC_FLAG_Level) || \
  516. ((FLAG) == FSMC_FLAG_FallingEdge) || \
  517. ((FLAG) == FSMC_FLAG_FEMPT))
  518. #define IS_FSMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))
  519. /**
  520. * @}
  521. */
  522. /**
  523. * @}
  524. */
  525. /**
  526. * @}
  527. */
  528. /** @defgroup FSMC_Exported_Macros
  529. * @{
  530. */
  531. /**
  532. * @}
  533. */
  534. /** @defgroup FSMC_Exported_Functions
  535. * @{
  536. */
  537. void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank);
  538. void FSMC_NANDDeInit(uint32_t FSMC_Bank);
  539. void FSMC_PCCARDDeInit(void);
  540. void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
  541. void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
  542. void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
  543. void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
  544. void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
  545. void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
  546. void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState);
  547. void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState);
  548. void FSMC_PCCARDCmd(FunctionalState NewState);
  549. void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState);
  550. uint32_t FSMC_GetECC(uint32_t FSMC_Bank);
  551. void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState);
  552. FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
  553. void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
  554. ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT);
  555. void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT);
  556. #ifdef __cplusplus
  557. }
  558. #endif
  559. #endif /*__STM32F10x_FSMC_H */
  560. /**
  561. * @}
  562. */
  563. /**
  564. * @}
  565. */
  566. /**
  567. * @}
  568. */
  569. /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/