stm32f4xx_ll_fsmc.h 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_ll_fsmc.h
  4. * @author MCD Application Team
  5. * @version V1.3.0
  6. * @date 09-March-2015
  7. * @brief Header file of FSMC HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32F4xx_LL_FSMC_H
  39. #define __STM32F4xx_LL_FSMC_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32f4xx_hal_def.h"
  45. /** @addtogroup STM32F4xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup FSMC_LL
  49. * @{
  50. */
  51. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
  52. /* Private types -------------------------------------------------------------*/
  53. /** @defgroup FSMC_LL_Private_Types FSMC Private Types
  54. * @{
  55. */
  56. /**
  57. * @brief FSMC NORSRAM Configuration Structure definition
  58. */
  59. typedef struct
  60. {
  61. uint32_t NSBank; /*!< Specifies the NORSRAM memory device that will be used.
  62. This parameter can be a value of @ref FSMC_NORSRAM_Bank */
  63. uint32_t DataAddressMux; /*!< Specifies whether the address and data values are
  64. multiplexed on the data bus or not.
  65. This parameter can be a value of @ref FSMC_Data_Address_Bus_Multiplexing */
  66. uint32_t MemoryType; /*!< Specifies the type of external memory attached to
  67. the corresponding memory device.
  68. This parameter can be a value of @ref FSMC_Memory_Type */
  69. uint32_t MemoryDataWidth; /*!< Specifies the external memory device width.
  70. This parameter can be a value of @ref FSMC_NORSRAM_Data_Width */
  71. uint32_t BurstAccessMode; /*!< Enables or disables the burst access mode for Flash memory,
  72. valid only with synchronous burst Flash memories.
  73. This parameter can be a value of @ref FSMC_Burst_Access_Mode */
  74. uint32_t WaitSignalPolarity; /*!< Specifies the wait signal polarity, valid only when accessing
  75. the Flash memory in burst mode.
  76. This parameter can be a value of @ref FSMC_Wait_Signal_Polarity */
  77. uint32_t WrapMode; /*!< Enables or disables the Wrapped burst access mode for Flash
  78. memory, valid only when accessing Flash memories in burst mode.
  79. This parameter can be a value of @ref FSMC_Wrap_Mode */
  80. uint32_t WaitSignalActive; /*!< Specifies if the wait signal is asserted by the memory one
  81. clock cycle before the wait state or during the wait state,
  82. valid only when accessing memories in burst mode.
  83. This parameter can be a value of @ref FSMC_Wait_Timing */
  84. uint32_t WriteOperation; /*!< Enables or disables the write operation in the selected device by the FSMC.
  85. This parameter can be a value of @ref FSMC_Write_Operation */
  86. uint32_t WaitSignal; /*!< Enables or disables the wait state insertion via wait
  87. signal, valid for Flash memory access in burst mode.
  88. This parameter can be a value of @ref FSMC_Wait_Signal */
  89. uint32_t ExtendedMode; /*!< Enables or disables the extended mode.
  90. This parameter can be a value of @ref FSMC_Extended_Mode */
  91. uint32_t 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 WriteBurst; /*!< Enables or disables the write burst operation.
  95. This parameter can be a value of @ref FSMC_Write_Burst */
  96. }FSMC_NORSRAM_InitTypeDef;
  97. /**
  98. * @brief FSMC NORSRAM Timing parameters structure definition
  99. */
  100. typedef struct
  101. {
  102. uint32_t AddressSetupTime; /*!< Defines the number of HCLK cycles to configure
  103. the duration of the address setup time.
  104. This parameter can be a value between Min_Data = 0 and Max_Data = 15.
  105. @note This parameter is not used with synchronous NOR Flash memories. */
  106. uint32_t AddressHoldTime; /*!< Defines the number of HCLK cycles to configure
  107. the duration of the address hold time.
  108. This parameter can be a value between Min_Data = 1 and Max_Data = 15.
  109. @note This parameter is not used with synchronous NOR Flash memories. */
  110. uint32_t DataSetupTime; /*!< Defines the number of HCLK cycles to configure
  111. the duration of the data setup time.
  112. This parameter can be a value between Min_Data = 1 and Max_Data = 255.
  113. @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed
  114. NOR Flash memories. */
  115. uint32_t BusTurnAroundDuration; /*!< Defines the number of HCLK cycles to configure
  116. the duration of the bus turnaround.
  117. This parameter can be a value between Min_Data = 0 and Max_Data = 15.
  118. @note This parameter is only used for multiplexed NOR Flash memories. */
  119. uint32_t CLKDivision; /*!< Defines the period of CLK clock output signal, expressed in number of
  120. HCLK cycles. This parameter can be a value between Min_Data = 2 and Max_Data = 16.
  121. @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM
  122. accesses. */
  123. uint32_t DataLatency; /*!< Defines the number of memory clock cycles to issue
  124. to the memory before getting the first data.
  125. The parameter value depends on the memory type as shown below:
  126. - It must be set to 0 in case of a CRAM
  127. - It is don't care in asynchronous NOR, SRAM or ROM accesses
  128. - It may assume a value between Min_Data = 2 and Max_Data = 17 in NOR Flash memories
  129. with synchronous burst mode enable */
  130. uint32_t AccessMode; /*!< Specifies the asynchronous access mode.
  131. This parameter can be a value of @ref FSMC_Access_Mode */
  132. }FSMC_NORSRAM_TimingTypeDef;
  133. /**
  134. * @brief FSMC NAND Configuration Structure definition
  135. */
  136. typedef struct
  137. {
  138. uint32_t NandBank; /*!< Specifies the NAND memory device that will be used.
  139. This parameter can be a value of @ref FSMC_NAND_Bank */
  140. uint32_t Waitfeature; /*!< Enables or disables the Wait feature for the NAND Memory device.
  141. This parameter can be any value of @ref FSMC_Wait_feature */
  142. uint32_t MemoryDataWidth; /*!< Specifies the external memory device width.
  143. This parameter can be any value of @ref FSMC_NAND_Data_Width */
  144. uint32_t EccComputation; /*!< Enables or disables the ECC computation.
  145. This parameter can be any value of @ref FSMC_ECC */
  146. uint32_t ECCPageSize; /*!< Defines the page size for the extended ECC.
  147. This parameter can be any value of @ref FSMC_ECC_Page_Size */
  148. uint32_t TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
  149. delay between CLE low and RE low.
  150. This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
  151. uint32_t TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
  152. delay between ALE low and RE low.
  153. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  154. }FSMC_NAND_InitTypeDef;
  155. /**
  156. * @brief FSMC NAND/PCCARD Timing parameters structure definition
  157. */
  158. typedef struct
  159. {
  160. uint32_t SetupTime; /*!< Defines the number of HCLK cycles to setup address before
  161. the command assertion for NAND-Flash read or write access
  162. to common/Attribute or I/O memory space (depending on
  163. the memory space timing to be configured).
  164. This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
  165. uint32_t WaitSetupTime; /*!< Defines the minimum number of HCLK cycles to assert the
  166. command for NAND-Flash read or write access to
  167. common/Attribute or I/O memory space (depending on the
  168. memory space timing to be configured).
  169. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  170. uint32_t HoldSetupTime; /*!< Defines the number of HCLK clock cycles to hold address
  171. (and data for write access) after the command de-assertion
  172. for NAND-Flash read or write access to common/Attribute
  173. or I/O memory space (depending on the memory space timing
  174. to be configured).
  175. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  176. uint32_t HiZSetupTime; /*!< Defines the number of HCLK clock cycles during which the
  177. data bus is kept in HiZ after the start of a NAND-Flash
  178. write access to common/Attribute or I/O memory space (depending
  179. on the memory space timing to be configured).
  180. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  181. }FSMC_NAND_PCC_TimingTypeDef;
  182. /**
  183. * @brief FSMC NAND Configuration Structure definition
  184. */
  185. typedef struct
  186. {
  187. uint32_t Waitfeature; /*!< Enables or disables the Wait feature for the PCCARD Memory device.
  188. This parameter can be any value of @ref FSMC_Wait_feature */
  189. uint32_t TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
  190. delay between CLE low and RE low.
  191. This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
  192. uint32_t TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
  193. delay between ALE low and RE low.
  194. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  195. }FSMC_PCCARD_InitTypeDef;
  196. /**
  197. * @}
  198. */
  199. /* Private constants ---------------------------------------------------------*/
  200. /** @defgroup FSMC_LL_Private_Constants FSMC Private Constants
  201. * @{
  202. */
  203. /** @defgroup FSMC_LL_NOR_SRAM_Controller FSMC NOR/SRAM Controller
  204. * @{
  205. */
  206. /** @defgroup FSMC_NORSRAM_Bank FSMC NOR/SRAM Bank
  207. * @{
  208. */
  209. #define FSMC_NORSRAM_BANK1 ((uint32_t)0x00000000)
  210. #define FSMC_NORSRAM_BANK2 ((uint32_t)0x00000002)
  211. #define FSMC_NORSRAM_BANK3 ((uint32_t)0x00000004)
  212. #define FSMC_NORSRAM_BANK4 ((uint32_t)0x00000006)
  213. /**
  214. * @}
  215. */
  216. /** @defgroup FSMC_Data_Address_Bus_Multiplexing FSMC Data Address Bus Multiplexing
  217. * @{
  218. */
  219. #define FSMC_DATA_ADDRESS_MUX_DISABLE ((uint32_t)0x00000000)
  220. #define FSMC_DATA_ADDRESS_MUX_ENABLE ((uint32_t)0x00000002)
  221. /**
  222. * @}
  223. */
  224. /** @defgroup FSMC_Memory_Type FSMC Memory Type
  225. * @{
  226. */
  227. #define FSMC_MEMORY_TYPE_SRAM ((uint32_t)0x00000000)
  228. #define FSMC_MEMORY_TYPE_PSRAM ((uint32_t)0x00000004)
  229. #define FSMC_MEMORY_TYPE_NOR ((uint32_t)0x00000008)
  230. /**
  231. * @}
  232. */
  233. /** @defgroup FSMC_NORSRAM_Data_Width FSMC NOR/SRAM Data Width
  234. * @{
  235. */
  236. #define FSMC_NORSRAM_MEM_BUS_WIDTH_8 ((uint32_t)0x00000000)
  237. #define FSMC_NORSRAM_MEM_BUS_WIDTH_16 ((uint32_t)0x00000010)
  238. #define FSMC_NORSRAM_MEM_BUS_WIDTH_32 ((uint32_t)0x00000020)
  239. /**
  240. * @}
  241. */
  242. /** @defgroup FSMC_NORSRAM_Flash_Access FSMC NOR/SRAM Flash Access
  243. * @{
  244. */
  245. #define FSMC_NORSRAM_FLASH_ACCESS_ENABLE ((uint32_t)0x00000040)
  246. #define FSMC_NORSRAM_FLASH_ACCESS_DISABLE ((uint32_t)0x00000000)
  247. /**
  248. * @}
  249. */
  250. /** @defgroup FSMC_Burst_Access_Mode FSMC Burst Access Mode
  251. * @{
  252. */
  253. #define FSMC_BURST_ACCESS_MODE_DISABLE ((uint32_t)0x00000000)
  254. #define FSMC_BURST_ACCESS_MODE_ENABLE ((uint32_t)0x00000100)
  255. /**
  256. * @}
  257. */
  258. /** @defgroup FSMC_Wait_Signal_Polarity FSMC Wait Signal Polarity
  259. * @{
  260. */
  261. #define FSMC_WAIT_SIGNAL_POLARITY_LOW ((uint32_t)0x00000000)
  262. #define FSMC_WAIT_SIGNAL_POLARITY_HIGH ((uint32_t)0x00000200)
  263. /**
  264. * @}
  265. */
  266. /** @defgroup FSMC_Wrap_Mode FSMC Wrap Mode
  267. * @{
  268. */
  269. #define FSMC_WRAP_MODE_DISABLE ((uint32_t)0x00000000)
  270. #define FSMC_WRAP_MODE_ENABLE ((uint32_t)0x00000400)
  271. /**
  272. * @}
  273. */
  274. /** @defgroup FSMC_Wait_Timing FSMC Wait Timing
  275. * @{
  276. */
  277. #define FSMC_WAIT_TIMING_BEFORE_WS ((uint32_t)0x00000000)
  278. #define FSMC_WAIT_TIMING_DURING_WS ((uint32_t)0x00000800)
  279. /**
  280. * @}
  281. */
  282. /** @defgroup FSMC_Write_Operation FSMC Write Operation
  283. * @{
  284. */
  285. #define FSMC_WRITE_OPERATION_DISABLE ((uint32_t)0x00000000)
  286. #define FSMC_WRITE_OPERATION_ENABLE ((uint32_t)0x00001000)
  287. /**
  288. * @}
  289. */
  290. /** @defgroup FSMC_Wait_Signal FSMC Wait Signal
  291. * @{
  292. */
  293. #define FSMC_WAIT_SIGNAL_DISABLE ((uint32_t)0x00000000)
  294. #define FSMC_WAIT_SIGNAL_ENABLE ((uint32_t)0x00002000)
  295. /**
  296. * @}
  297. */
  298. /** @defgroup FSMC_Extended_Mode FSMC Extended Mode
  299. * @{
  300. */
  301. #define FSMC_EXTENDED_MODE_DISABLE ((uint32_t)0x00000000)
  302. #define FSMC_EXTENDED_MODE_ENABLE ((uint32_t)0x00004000)
  303. /**
  304. * @}
  305. */
  306. /** @defgroup FSMC_AsynchronousWait FSMC Asynchronous Wait
  307. * @{
  308. */
  309. #define FSMC_ASYNCHRONOUS_WAIT_DISABLE ((uint32_t)0x00000000)
  310. #define FSMC_ASYNCHRONOUS_WAIT_ENABLE ((uint32_t)0x00008000)
  311. /**
  312. * @}
  313. */
  314. /** @defgroup FSMC_Write_Burst FSMC Write Burst
  315. * @{
  316. */
  317. #define FSMC_WRITE_BURST_DISABLE ((uint32_t)0x00000000)
  318. #define FSMC_WRITE_BURST_ENABLE ((uint32_t)0x00080000)
  319. /**
  320. * @}
  321. */
  322. /** @defgroup FSMC_Continous_Clock FSMC Continous Clock
  323. * @{
  324. */
  325. #define FSMC_CONTINUOUS_CLOCK_SYNC_ONLY ((uint32_t)0x00000000)
  326. #define FSMC_CONTINUOUS_CLOCK_SYNC_ASYNC ((uint32_t)0x00100000)
  327. /**
  328. * @}
  329. */
  330. /** @defgroup FSMC_Access_Mode FSMC Access Mode
  331. * @{
  332. */
  333. #define FSMC_ACCESS_MODE_A ((uint32_t)0x00000000)
  334. #define FSMC_ACCESS_MODE_B ((uint32_t)0x10000000)
  335. #define FSMC_ACCESS_MODE_C ((uint32_t)0x20000000)
  336. #define FSMC_ACCESS_MODE_D ((uint32_t)0x30000000)
  337. /**
  338. * @}
  339. */
  340. /**
  341. * @}
  342. */
  343. /** @defgroup FSMC_LL_NAND_Controller FSMC NAND and PCCARD Controller
  344. * @{
  345. */
  346. /** @defgroup FSMC_NAND_Bank FSMC NAND Bank
  347. * @{
  348. */
  349. #define FSMC_NAND_BANK2 ((uint32_t)0x00000010)
  350. #define FSMC_NAND_BANK3 ((uint32_t)0x00000100)
  351. /**
  352. * @}
  353. */
  354. /** @defgroup FSMC_Wait_feature FSMC Wait feature
  355. * @{
  356. */
  357. #define FSMC_NAND_PCC_WAIT_FEATURE_DISABLE ((uint32_t)0x00000000)
  358. #define FSMC_NAND_PCC_WAIT_FEATURE_ENABLE ((uint32_t)0x00000002)
  359. /**
  360. * @}
  361. */
  362. /** @defgroup FSMC_PCR_Memory_Type FSMC PCR Memory Type
  363. * @{
  364. */
  365. #define FSMC_PCR_MEMORY_TYPE_PCCARD ((uint32_t)0x00000000)
  366. #define FSMC_PCR_MEMORY_TYPE_NAND ((uint32_t)0x00000008)
  367. /**
  368. * @}
  369. */
  370. /** @defgroup FSMC_NAND_Data_Width FSMC NAND Data Width
  371. * @{
  372. */
  373. #define FSMC_NAND_PCC_MEM_BUS_WIDTH_8 ((uint32_t)0x00000000)
  374. #define FSMC_NAND_PCC_MEM_BUS_WIDTH_16 ((uint32_t)0x00000010)
  375. /**
  376. * @}
  377. */
  378. /** @defgroup FSMC_ECC FSMC ECC
  379. * @{
  380. */
  381. #define FSMC_NAND_ECC_DISABLE ((uint32_t)0x00000000)
  382. #define FSMC_NAND_ECC_ENABLE ((uint32_t)0x00000040)
  383. /**
  384. * @}
  385. */
  386. /** @defgroup FSMC_ECC_Page_Size FSMC ECC Page Size
  387. * @{
  388. */
  389. #define FSMC_NAND_ECC_PAGE_SIZE_256BYTE ((uint32_t)0x00000000)
  390. #define FSMC_NAND_ECC_PAGE_SIZE_512BYTE ((uint32_t)0x00020000)
  391. #define FSMC_NAND_ECC_PAGE_SIZE_1024BYTE ((uint32_t)0x00040000)
  392. #define FSMC_NAND_ECC_PAGE_SIZE_2048BYTE ((uint32_t)0x00060000)
  393. #define FSMC_NAND_ECC_PAGE_SIZE_4096BYTE ((uint32_t)0x00080000)
  394. #define FSMC_NAND_ECC_PAGE_SIZE_8192BYTE ((uint32_t)0x000A0000)
  395. /**
  396. * @}
  397. */
  398. /**
  399. * @}
  400. */
  401. /** @defgroup FSMC_LL_Interrupt_definition FSMC Interrupt definition
  402. * @{
  403. */
  404. #define FSMC_IT_RISING_EDGE ((uint32_t)0x00000008)
  405. #define FSMC_IT_LEVEL ((uint32_t)0x00000010)
  406. #define FSMC_IT_FALLING_EDGE ((uint32_t)0x00000020)
  407. #define FSMC_IT_REFRESH_ERROR ((uint32_t)0x00004000)
  408. /**
  409. * @}
  410. */
  411. /** @defgroup FSMC_LL_Flag_definition FSMC Flag definition
  412. * @{
  413. */
  414. #define FSMC_FLAG_RISING_EDGE ((uint32_t)0x00000001)
  415. #define FSMC_FLAG_LEVEL ((uint32_t)0x00000002)
  416. #define FSMC_FLAG_FALLING_EDGE ((uint32_t)0x00000004)
  417. #define FSMC_FLAG_FEMPT ((uint32_t)0x00000040)
  418. /**
  419. * @}
  420. */
  421. /** @defgroup FSMC_LL_Alias_definition FSMC Alias definition
  422. * @{
  423. */
  424. #define FSMC_NORSRAM_TypeDef FSMC_Bank1_TypeDef
  425. #define FSMC_NORSRAM_EXTENDED_TypeDef FSMC_Bank1E_TypeDef
  426. #define FSMC_NAND_TypeDef FSMC_Bank2_3_TypeDef
  427. #define FSMC_PCCARD_TypeDef FSMC_Bank4_TypeDef
  428. #define FSMC_NORSRAM_DEVICE FSMC_Bank1
  429. #define FSMC_NORSRAM_EXTENDED_DEVICE FSMC_Bank1E
  430. #define FSMC_NAND_DEVICE FSMC_Bank2_3
  431. #define FSMC_PCCARD_DEVICE FSMC_Bank4
  432. #define FMC_NORSRAM_TypeDef FSMC_NORSRAM_TypeDef
  433. #define FMC_NORSRAM_EXTENDED_TypeDef FSMC_NORSRAM_EXTENDED_TypeDef
  434. #define FMC_NORSRAM_InitTypeDef FSMC_NORSRAM_InitTypeDef
  435. #define FMC_NORSRAM_TimingTypeDef FSMC_NORSRAM_TimingTypeDef
  436. #define FMC_NORSRAM_Init FSMC_NORSRAM_Init
  437. #define FMC_NORSRAM_Timing_Init FSMC_NORSRAM_Timing_Init
  438. #define FMC_NORSRAM_Extended_Timing_Init FSMC_NORSRAM_Extended_Timing_Init
  439. #define FMC_NORSRAM_DeInit FSMC_NORSRAM_DeInit
  440. #define FMC_NORSRAM_WriteOperation_Enable FSMC_NORSRAM_WriteOperation_Enable
  441. #define FMC_NORSRAM_WriteOperation_Disable FSMC_NORSRAM_WriteOperation_Disable
  442. #define __FMC_NORSRAM_ENABLE __FSMC_NORSRAM_ENABLE
  443. #define __FMC_NORSRAM_DISABLE __FSMC_NORSRAM_DISABLE
  444. #define FMC_NAND_InitTypeDef FSMC_NAND_InitTypeDef
  445. #define FMC_PCCARD_InitTypeDef FSMC_PCCARD_InitTypeDef
  446. #define FMC_NAND_PCC_TimingTypeDef FSMC_NAND_PCC_TimingTypeDef
  447. #define FMC_NAND_Init FSMC_NAND_Init
  448. #define FMC_NAND_CommonSpace_Timing_Init FSMC_NAND_CommonSpace_Timing_Init
  449. #define FMC_NAND_AttributeSpace_Timing_Init FSMC_NAND_AttributeSpace_Timing_Init
  450. #define FMC_NAND_DeInit FSMC_NAND_DeInit
  451. #define FMC_NAND_ECC_Enable FSMC_NAND_ECC_Enable
  452. #define FMC_NAND_ECC_Disable FSMC_NAND_ECC_Disable
  453. #define FMC_NAND_GetECC FSMC_NAND_GetECC
  454. #define FMC_PCCARD_Init FSMC_PCCARD_Init
  455. #define FMC_PCCARD_CommonSpace_Timing_Init FSMC_PCCARD_CommonSpace_Timing_Init
  456. #define FMC_PCCARD_AttributeSpace_Timing_Init FSMC_PCCARD_AttributeSpace_Timing_Init
  457. #define FMC_PCCARD_IOSpace_Timing_Init FSMC_PCCARD_IOSpace_Timing_Init
  458. #define FMC_PCCARD_DeInit FSMC_PCCARD_DeInit
  459. #define __FMC_NAND_ENABLE __FSMC_NAND_ENABLE
  460. #define __FMC_NAND_DISABLE __FSMC_NAND_DISABLE
  461. #define __FMC_PCCARD_ENABLE __FSMC_PCCARD_ENABLE
  462. #define __FMC_PCCARD_DISABLE __FSMC_PCCARD_DISABLE
  463. #define __FMC_NAND_ENABLE_IT __FSMC_NAND_ENABLE_IT
  464. #define __FMC_NAND_DISABLE_IT __FSMC_NAND_DISABLE_IT
  465. #define __FMC_NAND_GET_FLAG __FSMC_NAND_GET_FLAG
  466. #define __FMC_NAND_CLEAR_FLAG __FSMC_NAND_CLEAR_FLAG
  467. #define __FMC_PCCARD_ENABLE_IT __FSMC_PCCARD_ENABLE_IT
  468. #define __FMC_PCCARD_DISABLE_IT __FSMC_PCCARD_DISABLE_IT
  469. #define __FMC_PCCARD_GET_FLAG __FSMC_PCCARD_GET_FLAG
  470. #define __FMC_PCCARD_CLEAR_FLAG __FSMC_PCCARD_CLEAR_FLAG
  471. #define FMC_NORSRAM_TypeDef FSMC_NORSRAM_TypeDef
  472. #define FMC_NORSRAM_EXTENDED_TypeDef FSMC_NORSRAM_EXTENDED_TypeDef
  473. #define FMC_NAND_TypeDef FSMC_NAND_TypeDef
  474. #define FMC_PCCARD_TypeDef FSMC_PCCARD_TypeDef
  475. #define FMC_NORSRAM_DEVICE FSMC_NORSRAM_DEVICE
  476. #define FMC_NORSRAM_EXTENDED_DEVICE FSMC_NORSRAM_EXTENDED_DEVICE
  477. #define FMC_NAND_DEVICE FSMC_NAND_DEVICE
  478. #define FMC_PCCARD_DEVICE FSMC_PCCARD_DEVICE
  479. #define FMC_NAND_BANK2 FSMC_NAND_BANK2
  480. #define FMC_NORSRAM_BANK1 FSMC_NORSRAM_BANK1
  481. #define FMC_NORSRAM_BANK2 FSMC_NORSRAM_BANK2
  482. #define FMC_NORSRAM_BANK3 FSMC_NORSRAM_BANK3
  483. #define FMC_IT_RISING_EDGE FSMC_IT_RISING_EDGE
  484. #define FMC_IT_LEVEL FSMC_IT_LEVEL
  485. #define FMC_IT_FALLING_EDGE FSMC_IT_FALLING_EDGE
  486. #define FMC_IT_REFRESH_ERROR FSMC_IT_REFRESH_ERROR
  487. #define FMC_FLAG_RISING_EDGE FSMC_FLAG_RISING_EDGE
  488. #define FMC_FLAG_LEVEL FSMC_FLAG_LEVEL
  489. #define FMC_FLAG_FALLING_EDGE FSMC_FLAG_FALLING_EDGE
  490. #define FMC_FLAG_FEMPT FSMC_FLAG_FEMPT
  491. /**
  492. * @}
  493. */
  494. /**
  495. * @}
  496. */
  497. /* Private macro -------------------------------------------------------------*/
  498. /** @defgroup FSMC_LL_Private_Macros FSMC Private Macros
  499. * @{
  500. */
  501. /** @defgroup FSMC_LL_NOR_Macros FSMC NOR/SRAM Exported Macros
  502. * @brief macros to handle NOR device enable/disable and read/write operations
  503. * @{
  504. */
  505. /**
  506. * @brief Enable the NORSRAM device access.
  507. * @param __INSTANCE__: FSMC_NORSRAM Instance
  508. * @param __BANK__: FSMC_NORSRAM Bank
  509. * @retval none
  510. */
  511. #define __FSMC_NORSRAM_ENABLE(__INSTANCE__, __BANK__) ((__INSTANCE__)->BTCR[(__BANK__)] |= FSMC_BCR1_MBKEN)
  512. /**
  513. * @brief Disable the NORSRAM device access.
  514. * @param __INSTANCE__: FSMC_NORSRAM Instance
  515. * @param __BANK__: FSMC_NORSRAM Bank
  516. * @retval none
  517. */
  518. #define __FSMC_NORSRAM_DISABLE(__INSTANCE__, __BANK__) ((__INSTANCE__)->BTCR[(__BANK__)] &= ~FSMC_BCR1_MBKEN)
  519. /**
  520. * @}
  521. */
  522. /** @defgroup FSMC_LL_NAND_Macros FSMC NAND Macros
  523. * @brief macros to handle NAND device enable/disable
  524. * @{
  525. */
  526. /**
  527. * @brief Enable the NAND device access.
  528. * @param __INSTANCE__: FSMC_NAND Instance
  529. * @param __BANK__: FSMC_NAND Bank
  530. * @retval none
  531. */
  532. #define __FSMC_NAND_ENABLE(__INSTANCE__, __BANK__) (((__BANK__) == FSMC_NAND_BANK2)? ((__INSTANCE__)->PCR2 |= FSMC_PCR2_PBKEN): \
  533. ((__INSTANCE__)->PCR3 |= FSMC_PCR3_PBKEN))
  534. /**
  535. * @brief Disable the NAND device access.
  536. * @param __INSTANCE__: FSMC_NAND Instance
  537. * @param __BANK__: FSMC_NAND Bank
  538. * @retval none
  539. */
  540. #define __FSMC_NAND_DISABLE(__INSTANCE__, __BANK__) (((__BANK__) == FSMC_NAND_BANK2)? ((__INSTANCE__)->PCR2 &= ~FSMC_PCR2_PBKEN): \
  541. ((__INSTANCE__)->PCR3 &= ~FSMC_PCR3_PBKEN))
  542. /**
  543. * @}
  544. */
  545. /** @defgroup FSMC_LL_PCCARD_Macros FSMC PCCARD Macros
  546. * @brief macros to handle SRAM read/write operations
  547. * @{
  548. */
  549. /**
  550. * @brief Enable the PCCARD device access.
  551. * @param __INSTANCE__: FSMC_PCCARD Instance
  552. * @retval none
  553. */
  554. #define __FSMC_PCCARD_ENABLE(__INSTANCE__) ((__INSTANCE__)->PCR4 |= FSMC_PCR4_PBKEN)
  555. /**
  556. * @brief Disable the PCCARD device access.
  557. * @param __INSTANCE__: FSMC_PCCARD Instance
  558. * @retval none
  559. */
  560. #define __FSMC_PCCARD_DISABLE(__INSTANCE__) ((__INSTANCE__)->PCR4 &= ~FSMC_PCR4_PBKEN)
  561. /**
  562. * @}
  563. */
  564. /** @defgroup FSMC_LL_Flag_Interrupt_Macros FSMC Flag&Interrupt Macros
  565. * @brief macros to handle FSMC flags and interrupts
  566. * @{
  567. */
  568. /**
  569. * @brief Enable the NAND device interrupt.
  570. * @param __INSTANCE__: FSMC_NAND Instance
  571. * @param __BANK__: FSMC_NAND Bank
  572. * @param __INTERRUPT__: FSMC_NAND interrupt
  573. * This parameter can be any combination of the following values:
  574. * @arg FSMC_IT_RISING_EDGE: Interrupt rising edge.
  575. * @arg FSMC_IT_LEVEL: Interrupt level.
  576. * @arg FSMC_IT_FALLING_EDGE: Interrupt falling edge.
  577. * @retval None
  578. */
  579. #define __FSMC_NAND_ENABLE_IT(__INSTANCE__, __BANK__, __INTERRUPT__) (((__BANK__) == FSMC_NAND_BANK2)? ((__INSTANCE__)->SR2 |= (__INTERRUPT__)): \
  580. ((__INSTANCE__)->SR3 |= (__INTERRUPT__)))
  581. /**
  582. * @brief Disable the NAND device interrupt.
  583. * @param __INSTANCE__: FSMC_NAND Instance
  584. * @param __BANK__: FSMC_NAND Bank
  585. * @param __INTERRUPT__: FSMC_NAND interrupt
  586. * This parameter can be any combination of the following values:
  587. * @arg FSMC_IT_RISING_EDGE: Interrupt rising edge.
  588. * @arg FSMC_IT_LEVEL: Interrupt level.
  589. * @arg FSMC_IT_FALLING_EDGE: Interrupt falling edge.
  590. * @retval None
  591. */
  592. #define __FSMC_NAND_DISABLE_IT(__INSTANCE__, __BANK__, __INTERRUPT__) (((__BANK__) == FSMC_NAND_BANK2)? ((__INSTANCE__)->SR2 &= ~(__INTERRUPT__)): \
  593. ((__INSTANCE__)->SR3 &= ~(__INTERRUPT__)))
  594. /**
  595. * @brief Get flag status of the NAND device.
  596. * @param __INSTANCE__: FSMC_NAND Instance
  597. * @param __BANK__ : FSMC_NAND Bank
  598. * @param __FLAG__ : FSMC_NAND flag
  599. * This parameter can be any combination of the following values:
  600. * @arg FSMC_FLAG_RISING_EDGE: Interrupt rising edge flag.
  601. * @arg FSMC_FLAG_LEVEL: Interrupt level edge flag.
  602. * @arg FSMC_FLAG_FALLING_EDGE: Interrupt falling edge flag.
  603. * @arg FSMC_FLAG_FEMPT: FIFO empty flag.
  604. * @retval The state of FLAG (SET or RESET).
  605. */
  606. #define __FSMC_NAND_GET_FLAG(__INSTANCE__, __BANK__, __FLAG__) (((__BANK__) == FSMC_NAND_BANK2)? (((__INSTANCE__)->SR2 &(__FLAG__)) == (__FLAG__)): \
  607. (((__INSTANCE__)->SR3 &(__FLAG__)) == (__FLAG__)))
  608. /**
  609. * @brief Clear flag status of the NAND device.
  610. * @param __INSTANCE__: FSMC_NAND Instance
  611. * @param __BANK__: FSMC_NAND Bank
  612. * @param __FLAG__: FSMC_NAND flag
  613. * This parameter can be any combination of the following values:
  614. * @arg FSMC_FLAG_RISING_EDGE: Interrupt rising edge flag.
  615. * @arg FSMC_FLAG_LEVEL: Interrupt level edge flag.
  616. * @arg FSMC_FLAG_FALLING_EDGE: Interrupt falling edge flag.
  617. * @arg FSMC_FLAG_FEMPT: FIFO empty flag.
  618. * @retval None
  619. */
  620. #define __FSMC_NAND_CLEAR_FLAG(__INSTANCE__, __BANK__, __FLAG__) (((__BANK__) == FSMC_NAND_BANK2)? ((__INSTANCE__)->SR2 &= ~(__FLAG__)): \
  621. ((__INSTANCE__)->SR3 &= ~(__FLAG__)))
  622. /**
  623. * @brief Enable the PCCARD device interrupt.
  624. * @param __INSTANCE__: FSMC_PCCARD Instance
  625. * @param __INTERRUPT__: FSMC_PCCARD interrupt
  626. * This parameter can be any combination of the following values:
  627. * @arg FSMC_IT_RISING_EDGE: Interrupt rising edge.
  628. * @arg FSMC_IT_LEVEL: Interrupt level.
  629. * @arg FSMC_IT_FALLING_EDGE: Interrupt falling edge.
  630. * @retval None
  631. */
  632. #define __FSMC_PCCARD_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->SR4 |= (__INTERRUPT__))
  633. /**
  634. * @brief Disable the PCCARD device interrupt.
  635. * @param __INSTANCE__: FSMC_PCCARD Instance
  636. * @param __INTERRUPT__: FSMC_PCCARD interrupt
  637. * This parameter can be any combination of the following values:
  638. * @arg FSMC_IT_RISING_EDGE: Interrupt rising edge.
  639. * @arg FSMC_IT_LEVEL: Interrupt level.
  640. * @arg FSMC_IT_FALLING_EDGE: Interrupt falling edge.
  641. * @retval None
  642. */
  643. #define __FSMC_PCCARD_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->SR4 &= ~(__INTERRUPT__))
  644. /**
  645. * @brief Get flag status of the PCCARD device.
  646. * @param __INSTANCE__: FSMC_PCCARD Instance
  647. * @param __FLAG__: FSMC_PCCARD flag
  648. * This parameter can be any combination of the following values:
  649. * @arg FSMC_FLAG_RISING_EDGE: Interrupt rising edge flag.
  650. * @arg FSMC_FLAG_LEVEL: Interrupt level edge flag.
  651. * @arg FSMC_FLAG_FALLING_EDGE: Interrupt falling edge flag.
  652. * @arg FSMC_FLAG_FEMPT: FIFO empty flag.
  653. * @retval The state of FLAG (SET or RESET).
  654. */
  655. #define __FSMC_PCCARD_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->SR4 &(__FLAG__)) == (__FLAG__))
  656. /**
  657. * @brief Clear flag status of the PCCARD device.
  658. * @param __INSTANCE__: FSMC_PCCARD Instance
  659. * @param __FLAG__: FSMC_PCCARD flag
  660. * This parameter can be any combination of the following values:
  661. * @arg FSMC_FLAG_RISING_EDGE: Interrupt rising edge flag.
  662. * @arg FSMC_FLAG_LEVEL: Interrupt level edge flag.
  663. * @arg FSMC_FLAG_FALLING_EDGE: Interrupt falling edge flag.
  664. * @arg FSMC_FLAG_FEMPT: FIFO empty flag.
  665. * @retval None
  666. */
  667. #define __FSMC_PCCARD_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->SR4 &= ~(__FLAG__))
  668. /**
  669. * @}
  670. */
  671. /** @defgroup FSMC_LL_Assert_Macros FSMC Assert Macros
  672. * @{
  673. */
  674. #define IS_FSMC_NORSRAM_BANK(__BANK__) (((__BANK__) == FSMC_NORSRAM_BANK1) || \
  675. ((__BANK__) == FSMC_NORSRAM_BANK2) || \
  676. ((__BANK__) == FSMC_NORSRAM_BANK3) || \
  677. ((__BANK__) == FSMC_NORSRAM_BANK4))
  678. #define IS_FSMC_MUX(__MUX__) (((__MUX__) == FSMC_DATA_ADDRESS_MUX_DISABLE) || \
  679. ((__MUX__) == FSMC_DATA_ADDRESS_MUX_ENABLE))
  680. #define IS_FSMC_MEMORY(__MEMORY__) (((__MEMORY__) == FSMC_MEMORY_TYPE_SRAM) || \
  681. ((__MEMORY__) == FSMC_MEMORY_TYPE_PSRAM)|| \
  682. ((__MEMORY__) == FSMC_MEMORY_TYPE_NOR))
  683. #define IS_FSMC_NORSRAM_MEMORY_WIDTH(__WIDTH__) (((__WIDTH__) == FSMC_NORSRAM_MEM_BUS_WIDTH_8) || \
  684. ((__WIDTH__) == FSMC_NORSRAM_MEM_BUS_WIDTH_16) || \
  685. ((__WIDTH__) == FSMC_NORSRAM_MEM_BUS_WIDTH_32))
  686. #define IS_FSMC_ACCESS_MODE(__MODE__) (((__MODE__) == FSMC_ACCESS_MODE_A) || \
  687. ((__MODE__) == FSMC_ACCESS_MODE_B) || \
  688. ((__MODE__) == FSMC_ACCESS_MODE_C) || \
  689. ((__MODE__) == FSMC_ACCESS_MODE_D))
  690. #define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_NAND_BANK2) || \
  691. ((BANK) == FSMC_NAND_BANK3))
  692. #define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_NAND_PCC_WAIT_FEATURE_DISABLE) || \
  693. ((FEATURE) == FSMC_NAND_PCC_WAIT_FEATURE_ENABLE))
  694. #define IS_FSMC_NAND_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_NAND_PCC_MEM_BUS_WIDTH_8) || \
  695. ((WIDTH) == FSMC_NAND_PCC_MEM_BUS_WIDTH_16))
  696. #define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_NAND_ECC_DISABLE) || \
  697. ((STATE) == FSMC_NAND_ECC_ENABLE))
  698. #define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_NAND_ECC_PAGE_SIZE_256BYTE) || \
  699. ((SIZE) == FSMC_NAND_ECC_PAGE_SIZE_512BYTE) || \
  700. ((SIZE) == FSMC_NAND_ECC_PAGE_SIZE_1024BYTE) || \
  701. ((SIZE) == FSMC_NAND_ECC_PAGE_SIZE_2048BYTE) || \
  702. ((SIZE) == FSMC_NAND_ECC_PAGE_SIZE_4096BYTE) || \
  703. ((SIZE) == FSMC_NAND_ECC_PAGE_SIZE_8192BYTE))
  704. #define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 255)
  705. #define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 255)
  706. #define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 255)
  707. #define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 255)
  708. #define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 255)
  709. #define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 255)
  710. #define IS_FSMC_NORSRAM_DEVICE(__INSTANCE__) ((__INSTANCE__) == FSMC_NORSRAM_DEVICE)
  711. #define IS_FSMC_NORSRAM_EXTENDED_DEVICE(__INSTANCE__) ((__INSTANCE__) == FSMC_NORSRAM_EXTENDED_DEVICE)
  712. #define IS_FSMC_NAND_DEVICE(INSTANCE) ((INSTANCE) == FSMC_NAND_DEVICE)
  713. #define IS_FSMC_PCCARD_DEVICE(INSTANCE) ((INSTANCE) == FSMC_PCCARD_DEVICE)
  714. #define IS_FSMC_BURSTMODE(__STATE__) (((__STATE__) == FSMC_BURST_ACCESS_MODE_DISABLE) || \
  715. ((__STATE__) == FSMC_BURST_ACCESS_MODE_ENABLE))
  716. #define IS_FSMC_WAIT_POLARITY(__POLARITY__) (((__POLARITY__) == FSMC_WAIT_SIGNAL_POLARITY_LOW) || \
  717. ((__POLARITY__) == FSMC_WAIT_SIGNAL_POLARITY_HIGH))
  718. #define IS_FSMC_WRAP_MODE(__MODE__) (((__MODE__) == FSMC_WRAP_MODE_DISABLE) || \
  719. ((__MODE__) == FSMC_WRAP_MODE_ENABLE))
  720. #define IS_FSMC_WAIT_SIGNAL_ACTIVE(__ACTIVE__) (((__ACTIVE__) == FSMC_WAIT_TIMING_BEFORE_WS) || \
  721. ((__ACTIVE__) == FSMC_WAIT_TIMING_DURING_WS))
  722. #define IS_FSMC_WRITE_OPERATION(__OPERATION__) (((__OPERATION__) == FSMC_WRITE_OPERATION_DISABLE) || \
  723. ((__OPERATION__) == FSMC_WRITE_OPERATION_ENABLE))
  724. #define IS_FSMC_WAITE_SIGNAL(__SIGNAL__) (((__SIGNAL__) == FSMC_WAIT_SIGNAL_DISABLE) || \
  725. ((__SIGNAL__) == FSMC_WAIT_SIGNAL_ENABLE))
  726. #define IS_FSMC_EXTENDED_MODE(__MODE__) (((__MODE__) == FSMC_EXTENDED_MODE_DISABLE) || \
  727. ((__MODE__) == FSMC_EXTENDED_MODE_ENABLE))
  728. #define IS_FSMC_ASYNWAIT(__STATE__) (((__STATE__) == FSMC_ASYNCHRONOUS_WAIT_DISABLE) || \
  729. ((__STATE__) == FSMC_ASYNCHRONOUS_WAIT_ENABLE))
  730. #define IS_FSMC_DATA_LATENCY(__LATENCY__) (((__LATENCY__) > 1) && ((__LATENCY__) <= 17))
  731. #define IS_FSMC_WRITE_BURST(__BURST__) (((__BURST__) == FSMC_WRITE_BURST_DISABLE) || \
  732. ((__BURST__) == FSMC_WRITE_BURST_ENABLE))
  733. #define IS_FSMC_ADDRESS_SETUP_TIME(__TIME__) ((__TIME__) <= 15)
  734. #define IS_FSMC_ADDRESS_HOLD_TIME(__TIME__) (((__TIME__) > 0) && ((__TIME__) <= 15))
  735. #define IS_FSMC_DATASETUP_TIME(__TIME__) (((__TIME__) > 0) && ((__TIME__) <= 255))
  736. #define IS_FSMC_TURNAROUND_TIME(__TIME__) ((__TIME__) <= 15)
  737. #define IS_FSMC_CONTINOUS_CLOCK(CCLOCK) (((CCLOCK) == FSMC_CONTINUOUS_CLOCK_SYNC_ONLY) || \
  738. ((CCLOCK) == FSMC_CONTINUOUS_CLOCK_SYNC_ASYNC))
  739. #define IS_FSMC_CLK_DIV(DIV) (((DIV) > 1) && ((DIV) <= 16))
  740. /**
  741. * @}
  742. */
  743. /**
  744. * @}
  745. */
  746. /* Private functions ---------------------------------------------------------*/
  747. /** @defgroup FSMC_LL_Private_Functions FSMC LL Private Functions
  748. * @{
  749. */
  750. /** @defgroup FSMC_LL_NORSRAM NOR SRAM
  751. * @{
  752. */
  753. /** @defgroup FSMC_LL_NORSRAM_Private_Functions_Group1 NOR SRAM Initialization/de-initialization functions
  754. * @{
  755. */
  756. HAL_StatusTypeDef FSMC_NORSRAM_Init(FSMC_NORSRAM_TypeDef *Device, FSMC_NORSRAM_InitTypeDef *Init);
  757. HAL_StatusTypeDef FSMC_NORSRAM_Timing_Init(FSMC_NORSRAM_TypeDef *Device, FSMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank);
  758. HAL_StatusTypeDef FSMC_NORSRAM_Extended_Timing_Init(FSMC_NORSRAM_EXTENDED_TypeDef *Device, FSMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank, uint32_t ExtendedMode);
  759. HAL_StatusTypeDef FSMC_NORSRAM_DeInit(FSMC_NORSRAM_TypeDef *Device, FSMC_NORSRAM_EXTENDED_TypeDef *ExDevice, uint32_t Bank);
  760. /**
  761. * @}
  762. */
  763. /** @defgroup FSMC_LL_NORSRAM_Private_Functions_Group2 NOR SRAM Control functions
  764. * @{
  765. */
  766. HAL_StatusTypeDef FSMC_NORSRAM_WriteOperation_Enable(FSMC_NORSRAM_TypeDef *Device, uint32_t Bank);
  767. HAL_StatusTypeDef FSMC_NORSRAM_WriteOperation_Disable(FSMC_NORSRAM_TypeDef *Device, uint32_t Bank);
  768. /**
  769. * @}
  770. */
  771. /**
  772. * @}
  773. */
  774. /** @defgroup FSMC_LL_NAND NAND
  775. * @{
  776. */
  777. /** @defgroup FSMC_LL_NAND_Private_Functions_Group1 NAND Initialization/de-initialization functions
  778. * @{
  779. */
  780. HAL_StatusTypeDef FSMC_NAND_Init(FSMC_NAND_TypeDef *Device, FSMC_NAND_InitTypeDef *Init);
  781. HAL_StatusTypeDef FSMC_NAND_CommonSpace_Timing_Init(FSMC_NAND_TypeDef *Device, FSMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank);
  782. HAL_StatusTypeDef FSMC_NAND_AttributeSpace_Timing_Init(FSMC_NAND_TypeDef *Device, FSMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank);
  783. HAL_StatusTypeDef FSMC_NAND_DeInit(FSMC_NAND_TypeDef *Device, uint32_t Bank);
  784. /**
  785. * @}
  786. */
  787. /** @defgroup FSMC_LL_NAND_Private_Functions_Group2 NAND Control functions
  788. * @{
  789. */
  790. HAL_StatusTypeDef FSMC_NAND_ECC_Enable(FSMC_NAND_TypeDef *Device, uint32_t Bank);
  791. HAL_StatusTypeDef FSMC_NAND_ECC_Disable(FSMC_NAND_TypeDef *Device, uint32_t Bank);
  792. HAL_StatusTypeDef FSMC_NAND_GetECC(FSMC_NAND_TypeDef *Device, uint32_t *ECCval, uint32_t Bank, uint32_t Timeout);
  793. /**
  794. * @}
  795. */
  796. /**
  797. * @}
  798. */
  799. /** @defgroup FSMC_LL_PCCARD PCCARD
  800. * @{
  801. */
  802. /** @defgroup FSMC_LL_PCCARD_Private_Functions_Group1 PCCARD Initialization/de-initialization functions
  803. * @{
  804. */
  805. HAL_StatusTypeDef FSMC_PCCARD_Init(FSMC_PCCARD_TypeDef *Device, FSMC_PCCARD_InitTypeDef *Init);
  806. HAL_StatusTypeDef FSMC_PCCARD_CommonSpace_Timing_Init(FSMC_PCCARD_TypeDef *Device, FSMC_NAND_PCC_TimingTypeDef *Timing);
  807. HAL_StatusTypeDef FSMC_PCCARD_AttributeSpace_Timing_Init(FSMC_PCCARD_TypeDef *Device, FSMC_NAND_PCC_TimingTypeDef *Timing);
  808. HAL_StatusTypeDef FSMC_PCCARD_IOSpace_Timing_Init(FSMC_PCCARD_TypeDef *Device, FSMC_NAND_PCC_TimingTypeDef *Timing);
  809. HAL_StatusTypeDef FSMC_PCCARD_DeInit(FSMC_PCCARD_TypeDef *Device);
  810. /**
  811. * @}
  812. */
  813. /**
  814. * @}
  815. */
  816. /**
  817. * @}
  818. */
  819. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
  820. /**
  821. * @}
  822. */
  823. /**
  824. * @}
  825. */
  826. #ifdef __cplusplus
  827. }
  828. #endif
  829. #endif /* __STM32F4xx_LL_FSMC_H */
  830. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/