You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1340 lines
52 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_ll_fmc.h
  4. * @author MCD Application Team
  5. * @version V1.1.2
  6. * @date 23-September-2016
  7. * @brief Header file of FMC HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32F7xx_LL_FMC_H
  39. #define __STM32F7xx_LL_FMC_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32f7xx_hal_def.h"
  45. /** @addtogroup STM32F7xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup FMC_LL
  49. * @{
  50. */
  51. /** @addtogroup FMC_LL_Private_Macros
  52. * @{
  53. */
  54. #define IS_FMC_NORSRAM_BANK(BANK) (((BANK) == FMC_NORSRAM_BANK1) || \
  55. ((BANK) == FMC_NORSRAM_BANK2) || \
  56. ((BANK) == FMC_NORSRAM_BANK3) || \
  57. ((BANK) == FMC_NORSRAM_BANK4))
  58. #define IS_FMC_MUX(__MUX__) (((__MUX__) == FMC_DATA_ADDRESS_MUX_DISABLE) || \
  59. ((__MUX__) == FMC_DATA_ADDRESS_MUX_ENABLE))
  60. #define IS_FMC_MEMORY(__MEMORY__) (((__MEMORY__) == FMC_MEMORY_TYPE_SRAM) || \
  61. ((__MEMORY__) == FMC_MEMORY_TYPE_PSRAM)|| \
  62. ((__MEMORY__) == FMC_MEMORY_TYPE_NOR))
  63. #define IS_FMC_NORSRAM_MEMORY_WIDTH(__WIDTH__) (((__WIDTH__) == FMC_NORSRAM_MEM_BUS_WIDTH_8) || \
  64. ((__WIDTH__) == FMC_NORSRAM_MEM_BUS_WIDTH_16) || \
  65. ((__WIDTH__) == FMC_NORSRAM_MEM_BUS_WIDTH_32))
  66. #define IS_FMC_ACCESS_MODE(__MODE__) (((__MODE__) == FMC_ACCESS_MODE_A) || \
  67. ((__MODE__) == FMC_ACCESS_MODE_B) || \
  68. ((__MODE__) == FMC_ACCESS_MODE_C) || \
  69. ((__MODE__) == FMC_ACCESS_MODE_D))
  70. #define IS_FMC_NAND_BANK(BANK) ((BANK) == FMC_NAND_BANK3)
  71. #define IS_FMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FMC_NAND_WAIT_FEATURE_DISABLE) || \
  72. ((FEATURE) == FMC_NAND_WAIT_FEATURE_ENABLE))
  73. #define IS_FMC_NAND_MEMORY_WIDTH(WIDTH) (((WIDTH) == FMC_NAND_MEM_BUS_WIDTH_8) || \
  74. ((WIDTH) == FMC_NAND_MEM_BUS_WIDTH_16))
  75. #define IS_FMC_ECC_STATE(STATE) (((STATE) == FMC_NAND_ECC_DISABLE) || \
  76. ((STATE) == FMC_NAND_ECC_ENABLE))
  77. #define IS_FMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FMC_NAND_ECC_PAGE_SIZE_256BYTE) || \
  78. ((SIZE) == FMC_NAND_ECC_PAGE_SIZE_512BYTE) || \
  79. ((SIZE) == FMC_NAND_ECC_PAGE_SIZE_1024BYTE) || \
  80. ((SIZE) == FMC_NAND_ECC_PAGE_SIZE_2048BYTE) || \
  81. ((SIZE) == FMC_NAND_ECC_PAGE_SIZE_4096BYTE) || \
  82. ((SIZE) == FMC_NAND_ECC_PAGE_SIZE_8192BYTE))
  83. #define IS_FMC_SDMEMORY_WIDTH(WIDTH) (((WIDTH) == FMC_SDRAM_MEM_BUS_WIDTH_8) || \
  84. ((WIDTH) == FMC_SDRAM_MEM_BUS_WIDTH_16) || \
  85. ((WIDTH) == FMC_SDRAM_MEM_BUS_WIDTH_32))
  86. #define IS_FMC_WRITE_PROTECTION(__WRITE__) (((__WRITE__) == FMC_SDRAM_WRITE_PROTECTION_DISABLE) || \
  87. ((__WRITE__) == FMC_SDRAM_WRITE_PROTECTION_ENABLE))
  88. #define IS_FMC_SDCLOCK_PERIOD(__PERIOD__) (((__PERIOD__) == FMC_SDRAM_CLOCK_DISABLE) || \
  89. ((__PERIOD__) == FMC_SDRAM_CLOCK_PERIOD_2) || \
  90. ((__PERIOD__) == FMC_SDRAM_CLOCK_PERIOD_3))
  91. #define IS_FMC_READ_BURST(__RBURST__) (((__RBURST__) == FMC_SDRAM_RBURST_DISABLE) || \
  92. ((__RBURST__) == FMC_SDRAM_RBURST_ENABLE))
  93. #define IS_FMC_READPIPE_DELAY(__DELAY__) (((__DELAY__) == FMC_SDRAM_RPIPE_DELAY_0) || \
  94. ((__DELAY__) == FMC_SDRAM_RPIPE_DELAY_1) || \
  95. ((__DELAY__) == FMC_SDRAM_RPIPE_DELAY_2))
  96. #define IS_FMC_COMMAND_MODE(__COMMAND__) (((__COMMAND__) == FMC_SDRAM_CMD_NORMAL_MODE) || \
  97. ((__COMMAND__) == FMC_SDRAM_CMD_CLK_ENABLE) || \
  98. ((__COMMAND__) == FMC_SDRAM_CMD_PALL) || \
  99. ((__COMMAND__) == FMC_SDRAM_CMD_AUTOREFRESH_MODE) || \
  100. ((__COMMAND__) == FMC_SDRAM_CMD_LOAD_MODE) || \
  101. ((__COMMAND__) == FMC_SDRAM_CMD_SELFREFRESH_MODE) || \
  102. ((__COMMAND__) == FMC_SDRAM_CMD_POWERDOWN_MODE))
  103. #define IS_FMC_COMMAND_TARGET(__TARGET__) (((__TARGET__) == FMC_SDRAM_CMD_TARGET_BANK1) || \
  104. ((__TARGET__) == FMC_SDRAM_CMD_TARGET_BANK2) || \
  105. ((__TARGET__) == FMC_SDRAM_CMD_TARGET_BANK1_2))
  106. /** @defgroup FMC_TCLR_Setup_Time FMC TCLR Setup Time
  107. * @{
  108. */
  109. #define IS_FMC_TCLR_TIME(__TIME__) ((__TIME__) <= 255)
  110. /**
  111. * @}
  112. */
  113. /** @defgroup FMC_TAR_Setup_Time FMC TAR Setup Time
  114. * @{
  115. */
  116. #define IS_FMC_TAR_TIME(TIME) ((TIME) <= 255)
  117. /**
  118. * @}
  119. */
  120. /** @defgroup FMC_Setup_Time FMC Setup Time
  121. * @{
  122. */
  123. #define IS_FMC_SETUP_TIME(TIME) ((TIME) <= 254)
  124. /**
  125. * @}
  126. */
  127. /** @defgroup FMC_Wait_Setup_Time FMC Wait Setup Time
  128. * @{
  129. */
  130. #define IS_FMC_WAIT_TIME(TIME) ((TIME) <= 254)
  131. /**
  132. * @}
  133. */
  134. /** @defgroup FMC_Hold_Setup_Time FMC Hold Setup Time
  135. * @{
  136. */
  137. #define IS_FMC_HOLD_TIME(TIME) ((TIME) <= 254)
  138. /**
  139. * @}
  140. */
  141. /** @defgroup FMC_HiZ_Setup_Time FMC HiZ Setup Time
  142. * @{
  143. */
  144. #define IS_FMC_HIZ_TIME(TIME) ((TIME) <= 254)
  145. /**
  146. * @}
  147. */
  148. #define IS_FMC_BURSTMODE(__STATE__) (((__STATE__) == FMC_BURST_ACCESS_MODE_DISABLE) || \
  149. ((__STATE__) == FMC_BURST_ACCESS_MODE_ENABLE))
  150. #define IS_FMC_WAIT_POLARITY(__POLARITY__) (((__POLARITY__) == FMC_WAIT_SIGNAL_POLARITY_LOW) || \
  151. ((__POLARITY__) == FMC_WAIT_SIGNAL_POLARITY_HIGH))
  152. #define IS_FMC_WAIT_SIGNAL_ACTIVE(__ACTIVE__) (((__ACTIVE__) == FMC_WAIT_TIMING_BEFORE_WS) || \
  153. ((__ACTIVE__) == FMC_WAIT_TIMING_DURING_WS))
  154. #define IS_FMC_WRITE_OPERATION(__OPERATION__) (((__OPERATION__) == FMC_WRITE_OPERATION_DISABLE) || \
  155. ((__OPERATION__) == FMC_WRITE_OPERATION_ENABLE))
  156. #define IS_FMC_WAITE_SIGNAL(__SIGNAL__) (((__SIGNAL__) == FMC_WAIT_SIGNAL_DISABLE) || \
  157. ((__SIGNAL__) == FMC_WAIT_SIGNAL_ENABLE))
  158. #define IS_FMC_EXTENDED_MODE(__MODE__) (((__MODE__) == FMC_EXTENDED_MODE_DISABLE) || \
  159. ((__MODE__) == FMC_EXTENDED_MODE_ENABLE))
  160. #define IS_FMC_ASYNWAIT(__STATE__) (((__STATE__) == FMC_ASYNCHRONOUS_WAIT_DISABLE) || \
  161. ((__STATE__) == FMC_ASYNCHRONOUS_WAIT_ENABLE))
  162. /** @defgroup FMC_Data_Latency FMC Data Latency
  163. * @{
  164. */
  165. #define IS_FMC_DATA_LATENCY(__LATENCY__) (((__LATENCY__) > 1) && ((__LATENCY__) <= 17))
  166. /**
  167. * @}
  168. */
  169. #define IS_FMC_WRITE_BURST(__BURST__) (((__BURST__) == FMC_WRITE_BURST_DISABLE) || \
  170. ((__BURST__) == FMC_WRITE_BURST_ENABLE))
  171. #define IS_FMC_CONTINOUS_CLOCK(CCLOCK) (((CCLOCK) == FMC_CONTINUOUS_CLOCK_SYNC_ONLY) || \
  172. ((CCLOCK) == FMC_CONTINUOUS_CLOCK_SYNC_ASYNC))
  173. /** @defgroup FMC_Address_Setup_Time FMC Address Setup Time
  174. * @{
  175. */
  176. #define IS_FMC_ADDRESS_SETUP_TIME(__TIME__) ((__TIME__) <= 15)
  177. /**
  178. * @}
  179. */
  180. /** @defgroup FMC_Address_Hold_Time FMC Address Hold Time
  181. * @{
  182. */
  183. #define IS_FMC_ADDRESS_HOLD_TIME(__TIME__) (((__TIME__) > 0) && ((__TIME__) <= 15))
  184. /**
  185. * @}
  186. */
  187. /** @defgroup FMC_Data_Setup_Time FMC Data Setup Time
  188. * @{
  189. */
  190. #define IS_FMC_DATASETUP_TIME(__TIME__) (((__TIME__) > 0) && ((__TIME__) <= 255))
  191. /**
  192. * @}
  193. */
  194. /** @defgroup FMC_Bus_Turn_around_Duration FMC Bus Turn around Duration
  195. * @{
  196. */
  197. #define IS_FMC_TURNAROUND_TIME(__TIME__) ((__TIME__) <= 15)
  198. /**
  199. * @}
  200. */
  201. /** @defgroup FMC_CLK_Division FMC CLK Division
  202. * @{
  203. */
  204. #define IS_FMC_CLK_DIV(DIV) (((DIV) > 1) && ((DIV) <= 16))
  205. /**
  206. * @}
  207. */
  208. /** @defgroup FMC_SDRAM_LoadToActive_Delay FMC SDRAM LoadToActive Delay
  209. * @{
  210. */
  211. #define IS_FMC_LOADTOACTIVE_DELAY(__DELAY__) (((__DELAY__) > 0) && ((__DELAY__) <= 16))
  212. /**
  213. * @}
  214. */
  215. /** @defgroup FMC_SDRAM_ExitSelfRefresh_Delay FMC SDRAM ExitSelfRefresh Delay
  216. * @{
  217. */
  218. #define IS_FMC_EXITSELFREFRESH_DELAY(__DELAY__) (((__DELAY__) > 0) && ((__DELAY__) <= 16))
  219. /**
  220. * @}
  221. */
  222. /** @defgroup FMC_SDRAM_SelfRefresh_Time FMC SDRAM SelfRefresh Time
  223. * @{
  224. */
  225. #define IS_FMC_SELFREFRESH_TIME(__TIME__) (((__TIME__) > 0) && ((__TIME__) <= 16))
  226. /**
  227. * @}
  228. */
  229. /** @defgroup FMC_SDRAM_RowCycle_Delay FMC SDRAM RowCycle Delay
  230. * @{
  231. */
  232. #define IS_FMC_ROWCYCLE_DELAY(__DELAY__) (((__DELAY__) > 0) && ((__DELAY__) <= 16))
  233. /**
  234. * @}
  235. */
  236. /** @defgroup FMC_SDRAM_Write_Recovery_Time FMC SDRAM Write Recovery Time
  237. * @{
  238. */
  239. #define IS_FMC_WRITE_RECOVERY_TIME(__TIME__) (((__TIME__) > 0) && ((__TIME__) <= 16))
  240. /**
  241. * @}
  242. */
  243. /** @defgroup FMC_SDRAM_RP_Delay FMC SDRAM RP Delay
  244. * @{
  245. */
  246. #define IS_FMC_RP_DELAY(__DELAY__) (((__DELAY__) > 0) && ((__DELAY__) <= 16))
  247. /**
  248. * @}
  249. */
  250. /** @defgroup FMC_SDRAM_RCD_Delay FMC SDRAM RCD Delay
  251. * @{
  252. */
  253. #define IS_FMC_RCD_DELAY(__DELAY__) (((__DELAY__) > 0) && ((__DELAY__) <= 16))
  254. /**
  255. * @}
  256. */
  257. /** @defgroup FMC_SDRAM_AutoRefresh_Number FMC SDRAM AutoRefresh Number
  258. * @{
  259. */
  260. #define IS_FMC_AUTOREFRESH_NUMBER(__NUMBER__) (((__NUMBER__) > 0) && ((__NUMBER__) <= 16))
  261. /**
  262. * @}
  263. */
  264. /** @defgroup FMC_SDRAM_ModeRegister_Definition FMC SDRAM ModeRegister Definition
  265. * @{
  266. */
  267. #define IS_FMC_MODE_REGISTER(__CONTENT__) ((__CONTENT__) <= 8191)
  268. /**
  269. * @}
  270. */
  271. /** @defgroup FMC_SDRAM_Refresh_rate FMC SDRAM Refresh rate
  272. * @{
  273. */
  274. #define IS_FMC_REFRESH_RATE(__RATE__) ((__RATE__) <= 8191)
  275. /**
  276. * @}
  277. */
  278. /** @defgroup FMC_NORSRAM_Device_Instance FMC NORSRAM Device Instance
  279. * @{
  280. */
  281. #define IS_FMC_NORSRAM_DEVICE(__INSTANCE__) ((__INSTANCE__) == FMC_NORSRAM_DEVICE)
  282. /**
  283. * @}
  284. */
  285. /** @defgroup FMC_NORSRAM_EXTENDED_Device_Instance FMC NORSRAM EXTENDED Device Instance
  286. * @{
  287. */
  288. #define IS_FMC_NORSRAM_EXTENDED_DEVICE(__INSTANCE__) ((__INSTANCE__) == FMC_NORSRAM_EXTENDED_DEVICE)
  289. /**
  290. * @}
  291. */
  292. /** @defgroup FMC_NAND_Device_Instance FMC NAND Device Instance
  293. * @{
  294. */
  295. #define IS_FMC_NAND_DEVICE(__INSTANCE__) ((__INSTANCE__) == FMC_NAND_DEVICE)
  296. /**
  297. * @}
  298. */
  299. /** @defgroup FMC_SDRAM_Device_Instance FMC SDRAM Device Instance
  300. * @{
  301. */
  302. #define IS_FMC_SDRAM_DEVICE(__INSTANCE__) ((__INSTANCE__) == FMC_SDRAM_DEVICE)
  303. /**
  304. * @}
  305. */
  306. #define IS_FMC_SDRAM_BANK(BANK) (((BANK) == FMC_SDRAM_BANK1) || \
  307. ((BANK) == FMC_SDRAM_BANK2))
  308. #define IS_FMC_COLUMNBITS_NUMBER(COLUMN) (((COLUMN) == FMC_SDRAM_COLUMN_BITS_NUM_8) || \
  309. ((COLUMN) == FMC_SDRAM_COLUMN_BITS_NUM_9) || \
  310. ((COLUMN) == FMC_SDRAM_COLUMN_BITS_NUM_10) || \
  311. ((COLUMN) == FMC_SDRAM_COLUMN_BITS_NUM_11))
  312. #define IS_FMC_ROWBITS_NUMBER(ROW) (((ROW) == FMC_SDRAM_ROW_BITS_NUM_11) || \
  313. ((ROW) == FMC_SDRAM_ROW_BITS_NUM_12) || \
  314. ((ROW) == FMC_SDRAM_ROW_BITS_NUM_13))
  315. #define IS_FMC_INTERNALBANK_NUMBER(NUMBER) (((NUMBER) == FMC_SDRAM_INTERN_BANKS_NUM_2) || \
  316. ((NUMBER) == FMC_SDRAM_INTERN_BANKS_NUM_4))
  317. #define IS_FMC_CAS_LATENCY(LATENCY) (((LATENCY) == FMC_SDRAM_CAS_LATENCY_1) || \
  318. ((LATENCY) == FMC_SDRAM_CAS_LATENCY_2) || \
  319. ((LATENCY) == FMC_SDRAM_CAS_LATENCY_3))
  320. #define IS_FMC_PAGESIZE(__SIZE__) (((__SIZE__) == FMC_PAGE_SIZE_NONE) || \
  321. ((__SIZE__) == FMC_PAGE_SIZE_128) || \
  322. ((__SIZE__) == FMC_PAGE_SIZE_256) || \
  323. ((__SIZE__) == FMC_PAGE_SIZE_512) || \
  324. ((__SIZE__) == FMC_PAGE_SIZE_1024))
  325. #define IS_FMC_WRITE_FIFO(__FIFO__) (((__FIFO__) == FMC_WRITE_FIFO_DISABLE) || \
  326. ((__FIFO__) == FMC_WRITE_FIFO_ENABLE))
  327. /**
  328. * @}
  329. */
  330. /* Exported typedef ----------------------------------------------------------*/
  331. /** @defgroup FMC_Exported_typedef FMC Low Layer Exported Types
  332. * @{
  333. */
  334. #define FMC_NORSRAM_TypeDef FMC_Bank1_TypeDef
  335. #define FMC_NORSRAM_EXTENDED_TypeDef FMC_Bank1E_TypeDef
  336. #define FMC_NAND_TypeDef FMC_Bank3_TypeDef
  337. #define FMC_SDRAM_TypeDef FMC_Bank5_6_TypeDef
  338. #define FMC_NORSRAM_DEVICE FMC_Bank1
  339. #define FMC_NORSRAM_EXTENDED_DEVICE FMC_Bank1E
  340. #define FMC_NAND_DEVICE FMC_Bank3
  341. #define FMC_SDRAM_DEVICE FMC_Bank5_6
  342. /**
  343. * @brief FMC NORSRAM Configuration Structure definition
  344. */
  345. typedef struct
  346. {
  347. uint32_t NSBank; /*!< Specifies the NORSRAM memory device that will be used.
  348. This parameter can be a value of @ref FMC_NORSRAM_Bank */
  349. uint32_t DataAddressMux; /*!< Specifies whether the address and data values are
  350. multiplexed on the data bus or not.
  351. This parameter can be a value of @ref FMC_Data_Address_Bus_Multiplexing */
  352. uint32_t MemoryType; /*!< Specifies the type of external memory attached to
  353. the corresponding memory device.
  354. This parameter can be a value of @ref FMC_Memory_Type */
  355. uint32_t MemoryDataWidth; /*!< Specifies the external memory device width.
  356. This parameter can be a value of @ref FMC_NORSRAM_Data_Width */
  357. uint32_t BurstAccessMode; /*!< Enables or disables the burst access mode for Flash memory,
  358. valid only with synchronous burst Flash memories.
  359. This parameter can be a value of @ref FMC_Burst_Access_Mode */
  360. uint32_t WaitSignalPolarity; /*!< Specifies the wait signal polarity, valid only when accessing
  361. the Flash memory in burst mode.
  362. This parameter can be a value of @ref FMC_Wait_Signal_Polarity */
  363. uint32_t WaitSignalActive; /*!< Specifies if the wait signal is asserted by the memory one
  364. clock cycle before the wait state or during the wait state,
  365. valid only when accessing memories in burst mode.
  366. This parameter can be a value of @ref FMC_Wait_Timing */
  367. uint32_t WriteOperation; /*!< Enables or disables the write operation in the selected device by the FMC.
  368. This parameter can be a value of @ref FMC_Write_Operation */
  369. uint32_t WaitSignal; /*!< Enables or disables the wait state insertion via wait
  370. signal, valid for Flash memory access in burst mode.
  371. This parameter can be a value of @ref FMC_Wait_Signal */
  372. uint32_t ExtendedMode; /*!< Enables or disables the extended mode.
  373. This parameter can be a value of @ref FMC_Extended_Mode */
  374. uint32_t AsynchronousWait; /*!< Enables or disables wait signal during asynchronous transfers,
  375. valid only with asynchronous Flash memories.
  376. This parameter can be a value of @ref FMC_AsynchronousWait */
  377. uint32_t WriteBurst; /*!< Enables or disables the write burst operation.
  378. This parameter can be a value of @ref FMC_Write_Burst */
  379. uint32_t ContinuousClock; /*!< Enables or disables the FMC clock output to external memory devices.
  380. This parameter is only enabled through the FMC_BCR1 register, and don't care
  381. through FMC_BCR2..4 registers.
  382. This parameter can be a value of @ref FMC_Continous_Clock */
  383. uint32_t WriteFifo; /*!< Enables or disables the write FIFO used by the FMC controller.
  384. This parameter is only enabled through the FMC_BCR1 register, and don't care
  385. through FMC_BCR2..4 registers.
  386. This parameter can be a value of @ref FMC_Write_FIFO */
  387. uint32_t PageSize; /*!< Specifies the memory page size.
  388. This parameter can be a value of @ref FMC_Page_Size */
  389. }FMC_NORSRAM_InitTypeDef;
  390. /**
  391. * @brief FMC NORSRAM Timing parameters structure definition
  392. */
  393. typedef struct
  394. {
  395. uint32_t AddressSetupTime; /*!< Defines the number of HCLK cycles to configure
  396. the duration of the address setup time.
  397. This parameter can be a value between Min_Data = 0 and Max_Data = 15.
  398. @note This parameter is not used with synchronous NOR Flash memories. */
  399. uint32_t AddressHoldTime; /*!< Defines the number of HCLK cycles to configure
  400. the duration of the address hold time.
  401. This parameter can be a value between Min_Data = 1 and Max_Data = 15.
  402. @note This parameter is not used with synchronous NOR Flash memories. */
  403. uint32_t DataSetupTime; /*!< Defines the number of HCLK cycles to configure
  404. the duration of the data setup time.
  405. This parameter can be a value between Min_Data = 1 and Max_Data = 255.
  406. @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed
  407. NOR Flash memories. */
  408. uint32_t BusTurnAroundDuration; /*!< Defines the number of HCLK cycles to configure
  409. the duration of the bus turnaround.
  410. This parameter can be a value between Min_Data = 0 and Max_Data = 15.
  411. @note This parameter is only used for multiplexed NOR Flash memories. */
  412. uint32_t CLKDivision; /*!< Defines the period of CLK clock output signal, expressed in number of
  413. HCLK cycles. This parameter can be a value between Min_Data = 2 and Max_Data = 16.
  414. @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM
  415. accesses. */
  416. uint32_t DataLatency; /*!< Defines the number of memory clock cycles to issue
  417. to the memory before getting the first data.
  418. The parameter value depends on the memory type as shown below:
  419. - It must be set to 0 in case of a CRAM
  420. - It is don't care in asynchronous NOR, SRAM or ROM accesses
  421. - It may assume a value between Min_Data = 2 and Max_Data = 17 in NOR Flash memories
  422. with synchronous burst mode enable */
  423. uint32_t AccessMode; /*!< Specifies the asynchronous access mode.
  424. This parameter can be a value of @ref FMC_Access_Mode */
  425. }FMC_NORSRAM_TimingTypeDef;
  426. /**
  427. * @brief FMC NAND Configuration Structure definition
  428. */
  429. typedef struct
  430. {
  431. uint32_t NandBank; /*!< Specifies the NAND memory device that will be used.
  432. This parameter can be a value of @ref FMC_NAND_Bank */
  433. uint32_t Waitfeature; /*!< Enables or disables the Wait feature for the NAND Memory device.
  434. This parameter can be any value of @ref FMC_Wait_feature */
  435. uint32_t MemoryDataWidth; /*!< Specifies the external memory device width.
  436. This parameter can be any value of @ref FMC_NAND_Data_Width */
  437. uint32_t EccComputation; /*!< Enables or disables the ECC computation.
  438. This parameter can be any value of @ref FMC_ECC */
  439. uint32_t ECCPageSize; /*!< Defines the page size for the extended ECC.
  440. This parameter can be any value of @ref FMC_ECC_Page_Size */
  441. uint32_t TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
  442. delay between CLE low and RE low.
  443. This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
  444. uint32_t TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
  445. delay between ALE low and RE low.
  446. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  447. }FMC_NAND_InitTypeDef;
  448. /**
  449. * @brief FMC NAND Timing parameters structure definition
  450. */
  451. typedef struct
  452. {
  453. uint32_t SetupTime; /*!< Defines the number of HCLK cycles to setup address before
  454. the command assertion for NAND-Flash read or write access
  455. to common/Attribute or I/O memory space (depending on
  456. the memory space timing to be configured).
  457. This parameter can be a value between Min_Data = 0 and Max_Data = 254 */
  458. uint32_t WaitSetupTime; /*!< Defines the minimum number of HCLK cycles to assert the
  459. command for NAND-Flash read or write access to
  460. common/Attribute or I/O memory space (depending on the
  461. memory space timing to be configured).
  462. This parameter can be a number between Min_Data = 0 and Max_Data = 254 */
  463. uint32_t HoldSetupTime; /*!< Defines the number of HCLK clock cycles to hold address
  464. (and data for write access) after the command de-assertion
  465. for NAND-Flash read or write access to common/Attribute
  466. or I/O memory space (depending on the memory space timing
  467. to be configured).
  468. This parameter can be a number between Min_Data = 0 and Max_Data = 254 */
  469. uint32_t HiZSetupTime; /*!< Defines the number of HCLK clock cycles during which the
  470. data bus is kept in HiZ after the start of a NAND-Flash
  471. write access to common/Attribute or I/O memory space (depending
  472. on the memory space timing to be configured).
  473. This parameter can be a number between Min_Data = 0 and Max_Data = 254 */
  474. }FMC_NAND_PCC_TimingTypeDef;
  475. /**
  476. * @brief FMC SDRAM Configuration Structure definition
  477. */
  478. typedef struct
  479. {
  480. uint32_t SDBank; /*!< Specifies the SDRAM memory device that will be used.
  481. This parameter can be a value of @ref FMC_SDRAM_Bank */
  482. uint32_t ColumnBitsNumber; /*!< Defines the number of bits of column address.
  483. This parameter can be a value of @ref FMC_SDRAM_Column_Bits_number. */
  484. uint32_t RowBitsNumber; /*!< Defines the number of bits of column address.
  485. This parameter can be a value of @ref FMC_SDRAM_Row_Bits_number. */
  486. uint32_t MemoryDataWidth; /*!< Defines the memory device width.
  487. This parameter can be a value of @ref FMC_SDRAM_Memory_Bus_Width. */
  488. uint32_t InternalBankNumber; /*!< Defines the number of the device's internal banks.
  489. This parameter can be of @ref FMC_SDRAM_Internal_Banks_Number. */
  490. uint32_t CASLatency; /*!< Defines the SDRAM CAS latency in number of memory clock cycles.
  491. This parameter can be a value of @ref FMC_SDRAM_CAS_Latency. */
  492. uint32_t WriteProtection; /*!< Enables the SDRAM device to be accessed in write mode.
  493. This parameter can be a value of @ref FMC_SDRAM_Write_Protection. */
  494. uint32_t SDClockPeriod; /*!< Define the SDRAM Clock Period for both SDRAM devices and they allow
  495. to disable the clock before changing frequency.
  496. This parameter can be a value of @ref FMC_SDRAM_Clock_Period. */
  497. uint32_t ReadBurst; /*!< This bit enable the SDRAM controller to anticipate the next read
  498. commands during the CAS latency and stores data in the Read FIFO.
  499. This parameter can be a value of @ref FMC_SDRAM_Read_Burst. */
  500. uint32_t ReadPipeDelay; /*!< Define the delay in system clock cycles on read data path.
  501. This parameter can be a value of @ref FMC_SDRAM_Read_Pipe_Delay. */
  502. }FMC_SDRAM_InitTypeDef;
  503. /**
  504. * @brief FMC SDRAM Timing parameters structure definition
  505. */
  506. typedef struct
  507. {
  508. uint32_t LoadToActiveDelay; /*!< Defines the delay between a Load Mode Register command and
  509. an active or Refresh command in number of memory clock cycles.
  510. This parameter can be a value between Min_Data = 1 and Max_Data = 16 */
  511. uint32_t ExitSelfRefreshDelay; /*!< Defines the delay from releasing the self refresh command to
  512. issuing the Activate command in number of memory clock cycles.
  513. This parameter can be a value between Min_Data = 1 and Max_Data = 16 */
  514. uint32_t SelfRefreshTime; /*!< Defines the minimum Self Refresh period in number of memory clock
  515. cycles.
  516. This parameter can be a value between Min_Data = 1 and Max_Data = 16 */
  517. uint32_t RowCycleDelay; /*!< Defines the delay between the Refresh command and the Activate command
  518. and the delay between two consecutive Refresh commands in number of
  519. memory clock cycles.
  520. This parameter can be a value between Min_Data = 1 and Max_Data = 16 */
  521. uint32_t WriteRecoveryTime; /*!< Defines the Write recovery Time in number of memory clock cycles.
  522. This parameter can be a value between Min_Data = 1 and Max_Data = 16 */
  523. uint32_t RPDelay; /*!< Defines the delay between a Precharge Command and an other command
  524. in number of memory clock cycles.
  525. This parameter can be a value between Min_Data = 1 and Max_Data = 16 */
  526. uint32_t RCDDelay; /*!< Defines the delay between the Activate Command and a Read/Write
  527. command in number of memory clock cycles.
  528. This parameter can be a value between Min_Data = 1 and Max_Data = 16 */
  529. }FMC_SDRAM_TimingTypeDef;
  530. /**
  531. * @brief SDRAM command parameters structure definition
  532. */
  533. typedef struct
  534. {
  535. uint32_t CommandMode; /*!< Defines the command issued to the SDRAM device.
  536. This parameter can be a value of @ref FMC_SDRAM_Command_Mode. */
  537. uint32_t CommandTarget; /*!< Defines which device (1 or 2) the command will be issued to.
  538. This parameter can be a value of @ref FMC_SDRAM_Command_Target. */
  539. uint32_t AutoRefreshNumber; /*!< Defines the number of consecutive auto refresh command issued
  540. in auto refresh mode.
  541. This parameter can be a value between Min_Data = 1 and Max_Data = 16 */
  542. uint32_t ModeRegisterDefinition; /*!< Defines the SDRAM Mode register content */
  543. }FMC_SDRAM_CommandTypeDef;
  544. /**
  545. * @}
  546. */
  547. /* Exported constants --------------------------------------------------------*/
  548. /** @addtogroup FMC_LL_Exported_Constants FMC Low Layer Exported Constants
  549. * @{
  550. */
  551. /** @defgroup FMC_LL_NOR_SRAM_Controller FMC NOR/SRAM Controller
  552. * @{
  553. */
  554. /** @defgroup FMC_NORSRAM_Bank FMC NOR/SRAM Bank
  555. * @{
  556. */
  557. #define FMC_NORSRAM_BANK1 ((uint32_t)0x00000000U)
  558. #define FMC_NORSRAM_BANK2 ((uint32_t)0x00000002U)
  559. #define FMC_NORSRAM_BANK3 ((uint32_t)0x00000004U)
  560. #define FMC_NORSRAM_BANK4 ((uint32_t)0x00000006U)
  561. /**
  562. * @}
  563. */
  564. /** @defgroup FMC_Data_Address_Bus_Multiplexing FMC Data Address Bus Multiplexing
  565. * @{
  566. */
  567. #define FMC_DATA_ADDRESS_MUX_DISABLE ((uint32_t)0x00000000U)
  568. #define FMC_DATA_ADDRESS_MUX_ENABLE ((uint32_t)0x00000002U)
  569. /**
  570. * @}
  571. */
  572. /** @defgroup FMC_Memory_Type FMC Memory Type
  573. * @{
  574. */
  575. #define FMC_MEMORY_TYPE_SRAM ((uint32_t)0x00000000U)
  576. #define FMC_MEMORY_TYPE_PSRAM ((uint32_t)0x00000004U)
  577. #define FMC_MEMORY_TYPE_NOR ((uint32_t)0x00000008U)
  578. /**
  579. * @}
  580. */
  581. /** @defgroup FMC_NORSRAM_Data_Width FMC NORSRAM Data Width
  582. * @{
  583. */
  584. #define FMC_NORSRAM_MEM_BUS_WIDTH_8 ((uint32_t)0x00000000U)
  585. #define FMC_NORSRAM_MEM_BUS_WIDTH_16 ((uint32_t)0x00000010U)
  586. #define FMC_NORSRAM_MEM_BUS_WIDTH_32 ((uint32_t)0x00000020U)
  587. /**
  588. * @}
  589. */
  590. /** @defgroup FMC_NORSRAM_Flash_Access FMC NOR/SRAM Flash Access
  591. * @{
  592. */
  593. #define FMC_NORSRAM_FLASH_ACCESS_ENABLE ((uint32_t)0x00000040U)
  594. #define FMC_NORSRAM_FLASH_ACCESS_DISABLE ((uint32_t)0x00000000U)
  595. /**
  596. * @}
  597. */
  598. /** @defgroup FMC_Burst_Access_Mode FMC Burst Access Mode
  599. * @{
  600. */
  601. #define FMC_BURST_ACCESS_MODE_DISABLE ((uint32_t)0x00000000U)
  602. #define FMC_BURST_ACCESS_MODE_ENABLE ((uint32_t)0x00000100U)
  603. /**
  604. * @}
  605. */
  606. /** @defgroup FMC_Wait_Signal_Polarity FMC Wait Signal Polarity
  607. * @{
  608. */
  609. #define FMC_WAIT_SIGNAL_POLARITY_LOW ((uint32_t)0x00000000U)
  610. #define FMC_WAIT_SIGNAL_POLARITY_HIGH ((uint32_t)0x00000200U)
  611. /**
  612. * @}
  613. */
  614. /** @defgroup FMC_Wait_Timing FMC Wait Timing
  615. * @{
  616. */
  617. #define FMC_WAIT_TIMING_BEFORE_WS ((uint32_t)0x00000000U)
  618. #define FMC_WAIT_TIMING_DURING_WS ((uint32_t)0x00000800U)
  619. /**
  620. * @}
  621. */
  622. /** @defgroup FMC_Write_Operation FMC Write Operation
  623. * @{
  624. */
  625. #define FMC_WRITE_OPERATION_DISABLE ((uint32_t)0x00000000U)
  626. #define FMC_WRITE_OPERATION_ENABLE ((uint32_t)0x00001000U)
  627. /**
  628. * @}
  629. */
  630. /** @defgroup FMC_Wait_Signal FMC Wait Signal
  631. * @{
  632. */
  633. #define FMC_WAIT_SIGNAL_DISABLE ((uint32_t)0x00000000U)
  634. #define FMC_WAIT_SIGNAL_ENABLE ((uint32_t)0x00002000U)
  635. /**
  636. * @}
  637. */
  638. /** @defgroup FMC_Extended_Mode FMC Extended Mode
  639. * @{
  640. */
  641. #define FMC_EXTENDED_MODE_DISABLE ((uint32_t)0x00000000U)
  642. #define FMC_EXTENDED_MODE_ENABLE ((uint32_t)0x00004000U)
  643. /**
  644. * @}
  645. */
  646. /** @defgroup FMC_AsynchronousWait FMC Asynchronous Wait
  647. * @{
  648. */
  649. #define FMC_ASYNCHRONOUS_WAIT_DISABLE ((uint32_t)0x00000000U)
  650. #define FMC_ASYNCHRONOUS_WAIT_ENABLE ((uint32_t)0x00008000U)
  651. /**
  652. * @}
  653. */
  654. /** @defgroup FMC_Page_Size FMC Page Size
  655. * @{
  656. */
  657. #define FMC_PAGE_SIZE_NONE ((uint32_t)0x00000000U)
  658. #define FMC_PAGE_SIZE_128 ((uint32_t)FMC_BCR1_CPSIZE_0)
  659. #define FMC_PAGE_SIZE_256 ((uint32_t)FMC_BCR1_CPSIZE_1)
  660. #define FMC_PAGE_SIZE_512 ((uint32_t)(FMC_BCR1_CPSIZE_0 | FMC_BCR1_CPSIZE_1))
  661. #define FMC_PAGE_SIZE_1024 ((uint32_t)FMC_BCR1_CPSIZE_2)
  662. /**
  663. * @}
  664. */
  665. /** @defgroup FMC_Write_Burst FMC Write Burst
  666. * @{
  667. */
  668. #define FMC_WRITE_BURST_DISABLE ((uint32_t)0x00000000U)
  669. #define FMC_WRITE_BURST_ENABLE ((uint32_t)0x00080000U)
  670. /**
  671. * @}
  672. */
  673. /** @defgroup FMC_Continous_Clock FMC Continuous Clock
  674. * @{
  675. */
  676. #define FMC_CONTINUOUS_CLOCK_SYNC_ONLY ((uint32_t)0x00000000U)
  677. #define FMC_CONTINUOUS_CLOCK_SYNC_ASYNC ((uint32_t)0x00100000U)
  678. /**
  679. * @}
  680. */
  681. /** @defgroup FMC_Write_FIFO FMC Write FIFO
  682. * @{
  683. */
  684. #define FMC_WRITE_FIFO_DISABLE ((uint32_t)FMC_BCR1_WFDIS)
  685. #define FMC_WRITE_FIFO_ENABLE ((uint32_t)0x00000000U)
  686. /**
  687. * @}
  688. */
  689. /** @defgroup FMC_Access_Mode FMC Access Mode
  690. * @{
  691. */
  692. #define FMC_ACCESS_MODE_A ((uint32_t)0x00000000U)
  693. #define FMC_ACCESS_MODE_B ((uint32_t)0x10000000U)
  694. #define FMC_ACCESS_MODE_C ((uint32_t)0x20000000U)
  695. #define FMC_ACCESS_MODE_D ((uint32_t)0x30000000)
  696. /**
  697. * @}
  698. */
  699. /**
  700. * @}
  701. */
  702. /** @defgroup FMC_LL_NAND_Controller FMC NAND Controller
  703. * @{
  704. */
  705. /** @defgroup FMC_NAND_Bank FMC NAND Bank
  706. * @{
  707. */
  708. #define FMC_NAND_BANK3 ((uint32_t)0x00000100U)
  709. /**
  710. * @}
  711. */
  712. /** @defgroup FMC_Wait_feature FMC Wait feature
  713. * @{
  714. */
  715. #define FMC_NAND_WAIT_FEATURE_DISABLE ((uint32_t)0x00000000U)
  716. #define FMC_NAND_WAIT_FEATURE_ENABLE ((uint32_t)0x00000002U)
  717. /**
  718. * @}
  719. */
  720. /** @defgroup FMC_PCR_Memory_Type FMC PCR Memory Type
  721. * @{
  722. */
  723. #define FMC_PCR_MEMORY_TYPE_NAND ((uint32_t)0x00000008U)
  724. /**
  725. * @}
  726. */
  727. /** @defgroup FMC_NAND_Data_Width FMC NAND Data Width
  728. * @{
  729. */
  730. #define FMC_NAND_MEM_BUS_WIDTH_8 ((uint32_t)0x00000000U)
  731. #define FMC_NAND_MEM_BUS_WIDTH_16 ((uint32_t)0x00000010U)
  732. /**
  733. * @}
  734. */
  735. /** @defgroup FMC_ECC FMC ECC
  736. * @{
  737. */
  738. #define FMC_NAND_ECC_DISABLE ((uint32_t)0x00000000U)
  739. #define FMC_NAND_ECC_ENABLE ((uint32_t)0x00000040U)
  740. /**
  741. * @}
  742. */
  743. /** @defgroup FMC_ECC_Page_Size FMC ECC Page Size
  744. * @{
  745. */
  746. #define FMC_NAND_ECC_PAGE_SIZE_256BYTE ((uint32_t)0x00000000U)
  747. #define FMC_NAND_ECC_PAGE_SIZE_512BYTE ((uint32_t)0x00020000U)
  748. #define FMC_NAND_ECC_PAGE_SIZE_1024BYTE ((uint32_t)0x00040000U)
  749. #define FMC_NAND_ECC_PAGE_SIZE_2048BYTE ((uint32_t)0x00060000U)
  750. #define FMC_NAND_ECC_PAGE_SIZE_4096BYTE ((uint32_t)0x00080000U)
  751. #define FMC_NAND_ECC_PAGE_SIZE_8192BYTE ((uint32_t)0x000A0000U)
  752. /**
  753. * @}
  754. */
  755. /**
  756. * @}
  757. */
  758. /** @defgroup FMC_LL_SDRAM_Controller FMC SDRAM Controller
  759. * @{
  760. */
  761. /** @defgroup FMC_SDRAM_Bank FMC SDRAM Bank
  762. * @{
  763. */
  764. #define FMC_SDRAM_BANK1 ((uint32_t)0x00000000U)
  765. #define FMC_SDRAM_BANK2 ((uint32_t)0x00000001U)
  766. /**
  767. * @}
  768. */
  769. /** @defgroup FMC_SDRAM_Column_Bits_number FMC SDRAM Column Bits number
  770. * @{
  771. */
  772. #define FMC_SDRAM_COLUMN_BITS_NUM_8 ((uint32_t)0x00000000U)
  773. #define FMC_SDRAM_COLUMN_BITS_NUM_9 ((uint32_t)0x00000001U)
  774. #define FMC_SDRAM_COLUMN_BITS_NUM_10 ((uint32_t)0x00000002U)
  775. #define FMC_SDRAM_COLUMN_BITS_NUM_11 ((uint32_t)0x00000003U)
  776. /**
  777. * @}
  778. */
  779. /** @defgroup FMC_SDRAM_Row_Bits_number FMC SDRAM Row Bits number
  780. * @{
  781. */
  782. #define FMC_SDRAM_ROW_BITS_NUM_11 ((uint32_t)0x00000000U)
  783. #define FMC_SDRAM_ROW_BITS_NUM_12 ((uint32_t)0x00000004U)
  784. #define FMC_SDRAM_ROW_BITS_NUM_13 ((uint32_t)0x00000008U)
  785. /**
  786. * @}
  787. */
  788. /** @defgroup FMC_SDRAM_Memory_Bus_Width FMC SDRAM Memory Bus Width
  789. * @{
  790. */
  791. #define FMC_SDRAM_MEM_BUS_WIDTH_8 ((uint32_t)0x00000000U)
  792. #define FMC_SDRAM_MEM_BUS_WIDTH_16 ((uint32_t)0x00000010U)
  793. #define FMC_SDRAM_MEM_BUS_WIDTH_32 ((uint32_t)0x00000020U)
  794. /**
  795. * @}
  796. */
  797. /** @defgroup FMC_SDRAM_Internal_Banks_Number FMC SDRAM Internal Banks Number
  798. * @{
  799. */
  800. #define FMC_SDRAM_INTERN_BANKS_NUM_2 ((uint32_t)0x00000000U)
  801. #define FMC_SDRAM_INTERN_BANKS_NUM_4 ((uint32_t)0x00000040U)
  802. /**
  803. * @}
  804. */
  805. /** @defgroup FMC_SDRAM_CAS_Latency FMC SDRAM CAS Latency
  806. * @{
  807. */
  808. #define FMC_SDRAM_CAS_LATENCY_1 ((uint32_t)0x00000080U)
  809. #define FMC_SDRAM_CAS_LATENCY_2 ((uint32_t)0x00000100U)
  810. #define FMC_SDRAM_CAS_LATENCY_3 ((uint32_t)0x00000180)
  811. /**
  812. * @}
  813. */
  814. /** @defgroup FMC_SDRAM_Write_Protection FMC SDRAM Write Protection
  815. * @{
  816. */
  817. #define FMC_SDRAM_WRITE_PROTECTION_DISABLE ((uint32_t)0x00000000U)
  818. #define FMC_SDRAM_WRITE_PROTECTION_ENABLE ((uint32_t)0x00000200U)
  819. /**
  820. * @}
  821. */
  822. /** @defgroup FMC_SDRAM_Clock_Period FMC SDRAM Clock Period
  823. * @{
  824. */
  825. #define FMC_SDRAM_CLOCK_DISABLE ((uint32_t)0x00000000U)
  826. #define FMC_SDRAM_CLOCK_PERIOD_2 ((uint32_t)0x00000800U)
  827. #define FMC_SDRAM_CLOCK_PERIOD_3 ((uint32_t)0x00000C00)
  828. /**
  829. * @}
  830. */
  831. /** @defgroup FMC_SDRAM_Read_Burst FMC SDRAM Read Burst
  832. * @{
  833. */
  834. #define FMC_SDRAM_RBURST_DISABLE ((uint32_t)0x00000000U)
  835. #define FMC_SDRAM_RBURST_ENABLE ((uint32_t)0x00001000U)
  836. /**
  837. * @}
  838. */
  839. /** @defgroup FMC_SDRAM_Read_Pipe_Delay FMC SDRAM Read Pipe Delay
  840. * @{
  841. */
  842. #define FMC_SDRAM_RPIPE_DELAY_0 ((uint32_t)0x00000000U)
  843. #define FMC_SDRAM_RPIPE_DELAY_1 ((uint32_t)0x00002000U)
  844. #define FMC_SDRAM_RPIPE_DELAY_2 ((uint32_t)0x00004000U)
  845. /**
  846. * @}
  847. */
  848. /** @defgroup FMC_SDRAM_Command_Mode FMC SDRAM Command Mode
  849. * @{
  850. */
  851. #define FMC_SDRAM_CMD_NORMAL_MODE ((uint32_t)0x00000000U)
  852. #define FMC_SDRAM_CMD_CLK_ENABLE ((uint32_t)0x00000001U)
  853. #define FMC_SDRAM_CMD_PALL ((uint32_t)0x00000002U)
  854. #define FMC_SDRAM_CMD_AUTOREFRESH_MODE ((uint32_t)0x00000003U)
  855. #define FMC_SDRAM_CMD_LOAD_MODE ((uint32_t)0x00000004U)
  856. #define FMC_SDRAM_CMD_SELFREFRESH_MODE ((uint32_t)0x00000005U)
  857. #define FMC_SDRAM_CMD_POWERDOWN_MODE ((uint32_t)0x00000006U)
  858. /**
  859. * @}
  860. */
  861. /** @defgroup FMC_SDRAM_Command_Target FMC SDRAM Command Target
  862. * @{
  863. */
  864. #define FMC_SDRAM_CMD_TARGET_BANK2 FMC_SDCMR_CTB2
  865. #define FMC_SDRAM_CMD_TARGET_BANK1 FMC_SDCMR_CTB1
  866. #define FMC_SDRAM_CMD_TARGET_BANK1_2 ((uint32_t)0x00000018U)
  867. /**
  868. * @}
  869. */
  870. /** @defgroup FMC_SDRAM_Mode_Status FMC SDRAM Mode Status
  871. * @{
  872. */
  873. #define FMC_SDRAM_NORMAL_MODE ((uint32_t)0x00000000U)
  874. #define FMC_SDRAM_SELF_REFRESH_MODE FMC_SDSR_MODES1_0
  875. #define FMC_SDRAM_POWER_DOWN_MODE FMC_SDSR_MODES1_1
  876. /**
  877. * @}
  878. */
  879. /**
  880. * @}
  881. */
  882. /** @defgroup FMC_LL_Interrupt_definition FMC Low Layer Interrupt definition
  883. * @{
  884. */
  885. #define FMC_IT_RISING_EDGE ((uint32_t)0x00000008U)
  886. #define FMC_IT_LEVEL ((uint32_t)0x00000010U)
  887. #define FMC_IT_FALLING_EDGE ((uint32_t)0x00000020U)
  888. #define FMC_IT_REFRESH_ERROR ((uint32_t)0x00004000U)
  889. /**
  890. * @}
  891. */
  892. /** @defgroup FMC_LL_Flag_definition FMC Low Layer Flag definition
  893. * @{
  894. */
  895. #define FMC_FLAG_RISING_EDGE ((uint32_t)0x00000001U)
  896. #define FMC_FLAG_LEVEL ((uint32_t)0x00000002U)
  897. #define FMC_FLAG_FALLING_EDGE ((uint32_t)0x00000004U)
  898. #define FMC_FLAG_FEMPT ((uint32_t)0x00000040U)
  899. #define FMC_SDRAM_FLAG_REFRESH_IT FMC_SDSR_RE
  900. #define FMC_SDRAM_FLAG_BUSY FMC_SDSR_BUSY
  901. #define FMC_SDRAM_FLAG_REFRESH_ERROR FMC_SDRTR_CRE
  902. /**
  903. * @}
  904. */
  905. /**
  906. * @}
  907. */
  908. /**
  909. * @}
  910. */
  911. /* Private macro -------------------------------------------------------------*/
  912. /** @defgroup FMC_LL_Private_Macros FMC_LL Private Macros
  913. * @{
  914. */
  915. /** @defgroup FMC_LL_NOR_Macros FMC NOR/SRAM Macros
  916. * @brief macros to handle NOR device enable/disable and read/write operations
  917. * @{
  918. */
  919. /**
  920. * @brief Enable the NORSRAM device access.
  921. * @param __INSTANCE__: FMC_NORSRAM Instance
  922. * @param __BANK__: FMC_NORSRAM Bank
  923. * @retval None
  924. */
  925. #define __FMC_NORSRAM_ENABLE(__INSTANCE__, __BANK__) ((__INSTANCE__)->BTCR[(__BANK__)] |= FMC_BCR1_MBKEN)
  926. /**
  927. * @brief Disable the NORSRAM device access.
  928. * @param __INSTANCE__: FMC_NORSRAM Instance
  929. * @param __BANK__: FMC_NORSRAM Bank
  930. * @retval None
  931. */
  932. #define __FMC_NORSRAM_DISABLE(__INSTANCE__, __BANK__) ((__INSTANCE__)->BTCR[(__BANK__)] &= ~FMC_BCR1_MBKEN)
  933. /**
  934. * @}
  935. */
  936. /** @defgroup FMC_LL_NAND_Macros FMC NAND Macros
  937. * @brief macros to handle NAND device enable/disable
  938. * @{
  939. */
  940. /**
  941. * @brief Enable the NAND device access.
  942. * @param __INSTANCE__: FMC_NAND Instance
  943. * @retval None
  944. */
  945. #define __FMC_NAND_ENABLE(__INSTANCE__) ((__INSTANCE__)->PCR |= FMC_PCR_PBKEN)
  946. /**
  947. * @brief Disable the NAND device access.
  948. * @param __INSTANCE__: FMC_NAND Instance
  949. * @retval None
  950. */
  951. #define __FMC_NAND_DISABLE(__INSTANCE__) ((__INSTANCE__)->PCR &= ~FMC_PCR_PBKEN)
  952. /**
  953. * @}
  954. */
  955. /** @defgroup FMC_Interrupt FMC Interrupt
  956. * @brief macros to handle FMC interrupts
  957. * @{
  958. */
  959. /**
  960. * @brief Enable the NAND device interrupt.
  961. * @param __INSTANCE__: FMC_NAND instance
  962. * @param __INTERRUPT__: FMC_NAND interrupt
  963. * This parameter can be any combination of the following values:
  964. * @arg FMC_IT_RISING_EDGE: Interrupt rising edge.
  965. * @arg FMC_IT_LEVEL: Interrupt level.
  966. * @arg FMC_IT_FALLING_EDGE: Interrupt falling edge.
  967. * @retval None
  968. */
  969. #define __FMC_NAND_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->SR |= (__INTERRUPT__))
  970. /**
  971. * @brief Disable the NAND device interrupt.
  972. * @param __INSTANCE__: FMC_NAND Instance
  973. * @param __INTERRUPT__: FMC_NAND interrupt
  974. * This parameter can be any combination of the following values:
  975. * @arg FMC_IT_RISING_EDGE: Interrupt rising edge.
  976. * @arg FMC_IT_LEVEL: Interrupt level.
  977. * @arg FMC_IT_FALLING_EDGE: Interrupt falling edge.
  978. * @retval None
  979. */
  980. #define __FMC_NAND_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->SR &= ~(__INTERRUPT__))
  981. /**
  982. * @brief Get flag status of the NAND device.
  983. * @param __INSTANCE__: FMC_NAND Instance
  984. * @param __BANK__: FMC_NAND Bank
  985. * @param __FLAG__: FMC_NAND flag
  986. * This parameter can be any combination of the following values:
  987. * @arg FMC_FLAG_RISING_EDGE: Interrupt rising edge flag.
  988. * @arg FMC_FLAG_LEVEL: Interrupt level edge flag.
  989. * @arg FMC_FLAG_FALLING_EDGE: Interrupt falling edge flag.
  990. * @arg FMC_FLAG_FEMPT: FIFO empty flag.
  991. * @retval The state of FLAG (SET or RESET).
  992. */
  993. #define __FMC_NAND_GET_FLAG(__INSTANCE__, __BANK__, __FLAG__) (((__INSTANCE__)->SR &(__FLAG__)) == (__FLAG__))
  994. /**
  995. * @brief Clear flag status of the NAND device.
  996. * @param __INSTANCE__: FMC_NAND Instance
  997. * @param __FLAG__: FMC_NAND flag
  998. * This parameter can be any combination of the following values:
  999. * @arg FMC_FLAG_RISING_EDGE: Interrupt rising edge flag.
  1000. * @arg FMC_FLAG_LEVEL: Interrupt level edge flag.
  1001. * @arg FMC_FLAG_FALLING_EDGE: Interrupt falling edge flag.
  1002. * @arg FMC_FLAG_FEMPT: FIFO empty flag.
  1003. * @retval None
  1004. */
  1005. #define __FMC_NAND_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->SR &= ~(__FLAG__))
  1006. /**
  1007. * @brief Enable the SDRAM device interrupt.
  1008. * @param __INSTANCE__: FMC_SDRAM instance
  1009. * @param __INTERRUPT__: FMC_SDRAM interrupt
  1010. * This parameter can be any combination of the following values:
  1011. * @arg FMC_IT_REFRESH_ERROR: Interrupt refresh error
  1012. * @retval None
  1013. */
  1014. #define __FMC_SDRAM_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->SDRTR |= (__INTERRUPT__))
  1015. /**
  1016. * @brief Disable the SDRAM device interrupt.
  1017. * @param __INSTANCE__: FMC_SDRAM instance
  1018. * @param __INTERRUPT__: FMC_SDRAM interrupt
  1019. * This parameter can be any combination of the following values:
  1020. * @arg FMC_IT_REFRESH_ERROR: Interrupt refresh error
  1021. * @retval None
  1022. */
  1023. #define __FMC_SDRAM_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->SDRTR &= ~(__INTERRUPT__))
  1024. /**
  1025. * @brief Get flag status of the SDRAM device.
  1026. * @param __INSTANCE__: FMC_SDRAM instance
  1027. * @param __FLAG__: FMC_SDRAM flag
  1028. * This parameter can be any combination of the following values:
  1029. * @arg FMC_SDRAM_FLAG_REFRESH_IT: Interrupt refresh error.
  1030. * @arg FMC_SDRAM_FLAG_BUSY: SDRAM busy flag.
  1031. * @arg FMC_SDRAM_FLAG_REFRESH_ERROR: Refresh error flag.
  1032. * @retval The state of FLAG (SET or RESET).
  1033. */
  1034. #define __FMC_SDRAM_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->SDSR &(__FLAG__)) == (__FLAG__))
  1035. /**
  1036. * @brief Clear flag status of the SDRAM device.
  1037. * @param __INSTANCE__: FMC_SDRAM instance
  1038. * @param __FLAG__: FMC_SDRAM flag
  1039. * This parameter can be any combination of the following values:
  1040. * @arg FMC_SDRAM_FLAG_REFRESH_ERROR
  1041. * @retval None
  1042. */
  1043. #define __FMC_SDRAM_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->SDRTR |= (__FLAG__))
  1044. /**
  1045. * @}
  1046. */
  1047. /**
  1048. * @}
  1049. */
  1050. /* Private functions ---------------------------------------------------------*/
  1051. /** @defgroup FMC_LL_Private_Functions FMC LL Private Functions
  1052. * @{
  1053. */
  1054. /** @defgroup FMC_LL_NORSRAM NOR SRAM
  1055. * @{
  1056. */
  1057. /** @defgroup FMC_LL_NORSRAM_Private_Functions_Group1 NOR SRAM Initialization/de-initialization functions
  1058. * @{
  1059. */
  1060. HAL_StatusTypeDef FMC_NORSRAM_Init(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_InitTypeDef *Init);
  1061. HAL_StatusTypeDef FMC_NORSRAM_Timing_Init(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank);
  1062. HAL_StatusTypeDef FMC_NORSRAM_Extended_Timing_Init(FMC_NORSRAM_EXTENDED_TypeDef *Device, FMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank, uint32_t ExtendedMode);
  1063. HAL_StatusTypeDef FMC_NORSRAM_DeInit(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_EXTENDED_TypeDef *ExDevice, uint32_t Bank);
  1064. /**
  1065. * @}
  1066. */
  1067. /** @defgroup FMC_LL_NORSRAM_Private_Functions_Group2 NOR SRAM Control functions
  1068. * @{
  1069. */
  1070. HAL_StatusTypeDef FMC_NORSRAM_WriteOperation_Enable(FMC_NORSRAM_TypeDef *Device, uint32_t Bank);
  1071. HAL_StatusTypeDef FMC_NORSRAM_WriteOperation_Disable(FMC_NORSRAM_TypeDef *Device, uint32_t Bank);
  1072. /**
  1073. * @}
  1074. */
  1075. /**
  1076. * @}
  1077. */
  1078. /** @defgroup FMC_LL_NAND NAND
  1079. * @{
  1080. */
  1081. /** @defgroup FMC_LL_NAND_Private_Functions_Group1 NAND Initialization/de-initialization functions
  1082. * @{
  1083. */
  1084. HAL_StatusTypeDef FMC_NAND_Init(FMC_NAND_TypeDef *Device, FMC_NAND_InitTypeDef *Init);
  1085. HAL_StatusTypeDef FMC_NAND_CommonSpace_Timing_Init(FMC_NAND_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank);
  1086. HAL_StatusTypeDef FMC_NAND_AttributeSpace_Timing_Init(FMC_NAND_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank);
  1087. HAL_StatusTypeDef FMC_NAND_DeInit(FMC_NAND_TypeDef *Device, uint32_t Bank);
  1088. /**
  1089. * @}
  1090. */
  1091. /** @defgroup FMC_LL_NAND_Private_Functions_Group2 NAND Control functions
  1092. * @{
  1093. */
  1094. HAL_StatusTypeDef FMC_NAND_ECC_Enable(FMC_NAND_TypeDef *Device, uint32_t Bank);
  1095. HAL_StatusTypeDef FMC_NAND_ECC_Disable(FMC_NAND_TypeDef *Device, uint32_t Bank);
  1096. HAL_StatusTypeDef FMC_NAND_GetECC(FMC_NAND_TypeDef *Device, uint32_t *ECCval, uint32_t Bank, uint32_t Timeout);
  1097. /**
  1098. * @}
  1099. */
  1100. /** @defgroup FMC_LL_SDRAM SDRAM
  1101. * @{
  1102. */
  1103. /** @defgroup FMC_LL_SDRAM_Private_Functions_Group1 SDRAM Initialization/de-initialization functions
  1104. * @{
  1105. */
  1106. HAL_StatusTypeDef FMC_SDRAM_Init(FMC_SDRAM_TypeDef *Device, FMC_SDRAM_InitTypeDef *Init);
  1107. HAL_StatusTypeDef FMC_SDRAM_Timing_Init(FMC_SDRAM_TypeDef *Device, FMC_SDRAM_TimingTypeDef *Timing, uint32_t Bank);
  1108. HAL_StatusTypeDef FMC_SDRAM_DeInit(FMC_SDRAM_TypeDef *Device, uint32_t Bank);
  1109. /**
  1110. * @}
  1111. */
  1112. /** @defgroup FMC_LL_SDRAM_Private_Functions_Group2 SDRAM Control functions
  1113. * @{
  1114. */
  1115. HAL_StatusTypeDef FMC_SDRAM_WriteProtection_Enable(FMC_SDRAM_TypeDef *Device, uint32_t Bank);
  1116. HAL_StatusTypeDef FMC_SDRAM_WriteProtection_Disable(FMC_SDRAM_TypeDef *Device, uint32_t Bank);
  1117. HAL_StatusTypeDef FMC_SDRAM_SendCommand(FMC_SDRAM_TypeDef *Device, FMC_SDRAM_CommandTypeDef *Command, uint32_t Timeout);
  1118. HAL_StatusTypeDef FMC_SDRAM_ProgramRefreshRate(FMC_SDRAM_TypeDef *Device, uint32_t RefreshRate);
  1119. HAL_StatusTypeDef FMC_SDRAM_SetAutoRefreshNumber(FMC_SDRAM_TypeDef *Device, uint32_t AutoRefreshNumber);
  1120. uint32_t FMC_SDRAM_GetModeStatus(FMC_SDRAM_TypeDef *Device, uint32_t Bank);
  1121. /**
  1122. * @}
  1123. */
  1124. /**
  1125. * @}
  1126. */
  1127. /**
  1128. * @}
  1129. */
  1130. /**
  1131. * @}
  1132. */
  1133. /**
  1134. * @}
  1135. */
  1136. #ifdef __cplusplus
  1137. }
  1138. #endif
  1139. #endif /* __STM32F7xx_LL_FMC_H */
  1140. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/