stm32f4xx_ll_fsmc.h 45 KB

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