Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

1094 lignes
46 KiB

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