stm32f4xx_ll_fsmc.h 45 KB

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