stm32f4xx_ll_fsmc.h 47 KB

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