stm32f1xx_ll_fsmc.h 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_ll_fsmc.h
  4. * @author MCD Application Team
  5. * @brief Header file of FSMC HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F1xx_LL_FSMC_H
  37. #define __STM32F1xx_LL_FSMC_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f1xx_hal_def.h"
  43. /** @addtogroup STM32F1xx_HAL_Driver
  44. * @{
  45. */
  46. #if defined(FSMC_BANK1)
  47. /** @addtogroup FSMC_LL
  48. * @{
  49. */
  50. /* Exported typedef ----------------------------------------------------------*/
  51. /** @defgroup FSMC_NORSRAM_Exported_typedef FSMC Low Layer Exported Types
  52. * @{
  53. */
  54. /**
  55. * @brief FSMC NORSRAM Configuration Structure definition
  56. */
  57. typedef struct
  58. {
  59. uint32_t NSBank; /*!< Specifies the NORSRAM memory device that will be used.
  60. This parameter can be a value of @ref FSMC_NORSRAM_Bank */
  61. uint32_t DataAddressMux; /*!< Specifies whether the address and data values are
  62. multiplexed on the data bus or not.
  63. This parameter can be a value of @ref FSMC_Data_Address_Bus_Multiplexing */
  64. uint32_t MemoryType; /*!< Specifies the type of external memory attached to
  65. the corresponding memory device.
  66. This parameter can be a value of @ref FSMC_Memory_Type */
  67. uint32_t MemoryDataWidth; /*!< Specifies the external memory device width.
  68. This parameter can be a value of @ref FSMC_NORSRAM_Data_Width */
  69. uint32_t BurstAccessMode; /*!< Enables or disables the burst access mode for Flash memory,
  70. valid only with synchronous burst Flash memories.
  71. This parameter can be a value of @ref FSMC_Burst_Access_Mode */
  72. uint32_t WaitSignalPolarity; /*!< Specifies the wait signal polarity, valid only when accessing
  73. the Flash memory in burst mode.
  74. This parameter can be a value of @ref FSMC_Wait_Signal_Polarity */
  75. uint32_t WrapMode; /*!< Enables or disables the Wrapped burst access mode for Flash
  76. memory, valid only when accessing Flash memories in burst mode.
  77. This parameter can be a value of @ref FSMC_Wrap_Mode */
  78. uint32_t WaitSignalActive; /*!< Specifies if the wait signal is asserted by the memory one
  79. clock cycle before the wait state or during the wait state,
  80. valid only when accessing memories in burst mode.
  81. This parameter can be a value of @ref FSMC_Wait_Timing */
  82. uint32_t WriteOperation; /*!< Enables or disables the write operation in the selected device by the FSMC.
  83. This parameter can be a value of @ref FSMC_Write_Operation */
  84. uint32_t WaitSignal; /*!< Enables or disables the wait state insertion via wait
  85. signal, valid for Flash memory access in burst mode.
  86. This parameter can be a value of @ref FSMC_Wait_Signal */
  87. uint32_t ExtendedMode; /*!< Enables or disables the extended mode.
  88. This parameter can be a value of @ref FSMC_Extended_Mode */
  89. uint32_t AsynchronousWait; /*!< Enables or disables wait signal during asynchronous transfers,
  90. valid only with asynchronous Flash memories.
  91. This parameter can be a value of @ref FSMC_AsynchronousWait */
  92. uint32_t WriteBurst; /*!< Enables or disables the write burst operation.
  93. This parameter can be a value of @ref FSMC_Write_Burst */
  94. }FSMC_NORSRAM_InitTypeDef;
  95. /**
  96. * @brief FSMC NORSRAM Timing parameters structure definition
  97. */
  98. typedef struct
  99. {
  100. uint32_t AddressSetupTime; /*!< Defines the number of HCLK cycles to configure
  101. the duration of the address setup time.
  102. This parameter can be a value between Min_Data = 0 and Max_Data = 15.
  103. @note This parameter is not used with synchronous NOR Flash memories. */
  104. uint32_t AddressHoldTime; /*!< Defines the number of HCLK cycles to configure
  105. the duration of the address hold time.
  106. This parameter can be a value between Min_Data = 1 and Max_Data = 15.
  107. @note This parameter is not used with synchronous NOR Flash memories. */
  108. uint32_t DataSetupTime; /*!< Defines the number of HCLK cycles to configure
  109. the duration of the data setup time.
  110. This parameter can be a value between Min_Data = 1 and Max_Data = 255.
  111. @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed
  112. NOR Flash memories. */
  113. uint32_t BusTurnAroundDuration; /*!< Defines the number of HCLK cycles to configure
  114. the duration of the bus turnaround.
  115. This parameter can be a value between Min_Data = 0 and Max_Data = 15.
  116. @note This parameter is only used for multiplexed NOR Flash memories. */
  117. uint32_t CLKDivision; /*!< Defines the period of CLK clock output signal, expressed in number of
  118. HCLK cycles. This parameter can be a value between Min_Data = 2 and Max_Data = 16.
  119. @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM
  120. accesses. */
  121. uint32_t DataLatency; /*!< Defines the number of memory clock cycles to issue
  122. to the memory before getting the first data.
  123. The parameter value depends on the memory type as shown below:
  124. - It must be set to 0 in case of a CRAM
  125. - It is don't care in asynchronous NOR, SRAM or ROM accesses
  126. - It may assume a value between Min_Data = 2 and Max_Data = 17 in NOR Flash memories
  127. with synchronous burst mode enable */
  128. uint32_t AccessMode; /*!< Specifies the asynchronous access mode.
  129. This parameter can be a value of @ref FSMC_Access_Mode */
  130. }FSMC_NORSRAM_TimingTypeDef;
  131. #if (defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG) || defined(STM32F103xG))
  132. /**
  133. * @brief FSMC NAND Configuration Structure definition
  134. */
  135. typedef struct
  136. {
  137. uint32_t NandBank; /*!< Specifies the NAND memory device that will be used.
  138. This parameter can be a value of @ref FSMC_NAND_Bank */
  139. uint32_t Waitfeature; /*!< Enables or disables the Wait feature for the NAND Memory device.
  140. This parameter can be any value of @ref FSMC_Wait_feature */
  141. uint32_t MemoryDataWidth; /*!< Specifies the external memory device width.
  142. This parameter can be any value of @ref FSMC_NAND_Data_Width */
  143. uint32_t EccComputation; /*!< Enables or disables the ECC computation.
  144. This parameter can be any value of @ref FSMC_ECC */
  145. uint32_t ECCPageSize; /*!< Defines the page size for the extended ECC.
  146. This parameter can be any value of @ref FSMC_ECC_Page_Size */
  147. uint32_t TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
  148. delay between CLE low and RE low.
  149. This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
  150. uint32_t TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
  151. delay between ALE low and RE low.
  152. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  153. }FSMC_NAND_InitTypeDef;
  154. /**
  155. * @brief FSMC NAND/PCCARD Timing parameters structure definition
  156. */
  157. typedef struct
  158. {
  159. uint32_t SetupTime; /*!< Defines the number of HCLK cycles to setup address before
  160. the command assertion for NAND-Flash read or write access
  161. to common/Attribute or I/O memory space (depending on
  162. the memory space timing to be configured).
  163. This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
  164. uint32_t WaitSetupTime; /*!< Defines the minimum number of HCLK cycles to assert the
  165. command for NAND-Flash read or write access to
  166. common/Attribute or I/O memory space (depending on the
  167. memory space timing to be configured).
  168. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  169. uint32_t HoldSetupTime; /*!< Defines the number of HCLK clock cycles to hold address
  170. (and data for write access) after the command de-assertion
  171. for NAND-Flash read or write access to common/Attribute
  172. or I/O memory space (depending on the memory space timing
  173. to be configured).
  174. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  175. uint32_t HiZSetupTime; /*!< Defines the number of HCLK clock cycles during which the
  176. data bus is kept in HiZ after the start of a NAND-Flash
  177. write access to common/Attribute or I/O memory space (depending
  178. on the memory space timing to be configured).
  179. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  180. }FSMC_NAND_PCC_TimingTypeDef;
  181. /**
  182. * @brief FSMC NAND Configuration Structure definition
  183. */
  184. typedef struct
  185. {
  186. uint32_t Waitfeature; /*!< Enables or disables the Wait feature for the PCCARD Memory device.
  187. This parameter can be any value of @ref FSMC_Wait_feature */
  188. uint32_t TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
  189. delay between CLE low and RE low.
  190. This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
  191. uint32_t TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
  192. delay between ALE low and RE low.
  193. This parameter can be a number between Min_Data = 0 and Max_Data = 255 */
  194. }FSMC_PCCARD_InitTypeDef;
  195. #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG */
  196. /**
  197. * @}
  198. */
  199. /* Exported constants --------------------------------------------------------*/
  200. /** @defgroup FSMC_Exported_Constants FSMC Low Layer Exported Constants
  201. * @{
  202. */
  203. /** @defgroup FSMC_NORSRAM_Exported_constants FSMC NOR/SRAM Exported constants
  204. * @{
  205. */
  206. /** @defgroup FSMC_NORSRAM_Bank FSMC NOR/SRAM Bank
  207. * @{
  208. */
  209. #define FSMC_NORSRAM_BANK1 0x00000000U
  210. #define FSMC_NORSRAM_BANK2 0x00000002U
  211. #define FSMC_NORSRAM_BANK3 0x00000004U
  212. #define FSMC_NORSRAM_BANK4 0x00000006U
  213. /**
  214. * @}
  215. */
  216. /** @defgroup FSMC_Data_Address_Bus_Multiplexing FSMC Data Address Bus Multiplexing
  217. * @{
  218. */
  219. #define FSMC_DATA_ADDRESS_MUX_DISABLE 0x00000000U
  220. #define FSMC_DATA_ADDRESS_MUX_ENABLE ((uint32_t)FSMC_BCRx_MUXEN)
  221. /**
  222. * @}
  223. */
  224. /** @defgroup FSMC_Memory_Type FSMC Memory Type
  225. * @{
  226. */
  227. #define FSMC_MEMORY_TYPE_SRAM 0x00000000U
  228. #define FSMC_MEMORY_TYPE_PSRAM ((uint32_t)FSMC_BCRx_MTYP_0)
  229. #define FSMC_MEMORY_TYPE_NOR ((uint32_t)FSMC_BCRx_MTYP_1)
  230. /**
  231. * @}
  232. */
  233. /** @defgroup FSMC_NORSRAM_Data_Width FSMC NOR/SRAM Data Width
  234. * @{
  235. */
  236. #define FSMC_NORSRAM_MEM_BUS_WIDTH_8 0x00000000U
  237. #define FSMC_NORSRAM_MEM_BUS_WIDTH_16 ((uint32_t)FSMC_BCRx_MWID_0)
  238. #define FSMC_NORSRAM_MEM_BUS_WIDTH_32 ((uint32_t)FSMC_BCRx_MWID_1)
  239. /**
  240. * @}
  241. */
  242. /** @defgroup FSMC_NORSRAM_Flash_Access FSMC NOR/SRAM Flash Access
  243. * @{
  244. */
  245. #define FSMC_NORSRAM_FLASH_ACCESS_ENABLE ((uint32_t)FSMC_BCRx_FACCEN)
  246. #define FSMC_NORSRAM_FLASH_ACCESS_DISABLE 0x00000000U
  247. /**
  248. * @}
  249. */
  250. /** @defgroup FSMC_Burst_Access_Mode FSMC Burst Access Mode
  251. * @{
  252. */
  253. #define FSMC_BURST_ACCESS_MODE_DISABLE 0x00000000U
  254. #define FSMC_BURST_ACCESS_MODE_ENABLE ((uint32_t)FSMC_BCRx_BURSTEN)
  255. /**
  256. * @}
  257. */
  258. /** @defgroup FSMC_Wait_Signal_Polarity FSMC Wait Signal Polarity
  259. * @{
  260. */
  261. #define FSMC_WAIT_SIGNAL_POLARITY_LOW 0x00000000U
  262. #define FSMC_WAIT_SIGNAL_POLARITY_HIGH ((uint32_t)FSMC_BCRx_WAITPOL)
  263. /**
  264. * @}
  265. */
  266. /** @defgroup FSMC_Wrap_Mode FSMC Wrap Mode
  267. * @{
  268. */
  269. #define FSMC_WRAP_MODE_DISABLE 0x00000000U
  270. #define FSMC_WRAP_MODE_ENABLE ((uint32_t)FSMC_BCRx_WRAPMOD)
  271. /**
  272. * @}
  273. */
  274. /** @defgroup FSMC_Wait_Timing FSMC Wait Timing
  275. * @{
  276. */
  277. #define FSMC_WAIT_TIMING_BEFORE_WS 0x00000000U
  278. #define FSMC_WAIT_TIMING_DURING_WS ((uint32_t)FSMC_BCRx_WAITCFG)
  279. /**
  280. * @}
  281. */
  282. /** @defgroup FSMC_Write_Operation FSMC Write Operation
  283. * @{
  284. */
  285. #define FSMC_WRITE_OPERATION_DISABLE 0x00000000U
  286. #define FSMC_WRITE_OPERATION_ENABLE ((uint32_t)FSMC_BCRx_WREN)
  287. /**
  288. * @}
  289. */
  290. /** @defgroup FSMC_Wait_Signal FSMC Wait Signal
  291. * @{
  292. */
  293. #define FSMC_WAIT_SIGNAL_DISABLE 0x00000000U
  294. #define FSMC_WAIT_SIGNAL_ENABLE ((uint32_t)FSMC_BCRx_WAITEN)
  295. /**
  296. * @}
  297. */
  298. /** @defgroup FSMC_Extended_Mode FSMC Extended Mode
  299. * @{
  300. */
  301. #define FSMC_EXTENDED_MODE_DISABLE 0x00000000U
  302. #define FSMC_EXTENDED_MODE_ENABLE ((uint32_t)FSMC_BCRx_EXTMOD)
  303. /**
  304. * @}
  305. */
  306. /** @defgroup FSMC_AsynchronousWait FSMC Asynchronous Wait
  307. * @{
  308. */
  309. #define FSMC_ASYNCHRONOUS_WAIT_DISABLE 0x00000000U
  310. #define FSMC_ASYNCHRONOUS_WAIT_ENABLE ((uint32_t)FSMC_BCRx_ASYNCWAIT)
  311. /**
  312. * @}
  313. */
  314. /** @defgroup FSMC_Write_Burst FSMC Write Burst
  315. * @{
  316. */
  317. #define FSMC_WRITE_BURST_DISABLE 0x00000000U
  318. #define FSMC_WRITE_BURST_ENABLE ((uint32_t)FSMC_BCRx_CBURSTRW)
  319. /**
  320. * @}
  321. */
  322. /** @defgroup FSMC_Access_Mode FSMC Access Mode
  323. * @{
  324. */
  325. #define FSMC_ACCESS_MODE_A 0x00000000U
  326. #define FSMC_ACCESS_MODE_B ((uint32_t)FSMC_BTRx_ACCMOD_0)
  327. #define FSMC_ACCESS_MODE_C ((uint32_t)FSMC_BTRx_ACCMOD_1)
  328. #define FSMC_ACCESS_MODE_D ((uint32_t)(FSMC_BTRx_ACCMOD_0 | FSMC_BTRx_ACCMOD_1))
  329. /**
  330. * @}
  331. */
  332. /**
  333. * @}
  334. */
  335. #if (defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG) || defined(STM32F103xG))
  336. /** @defgroup FSMC_NAND_Controller FSMC NAND and PCCARD Controller
  337. * @{
  338. */
  339. /** @defgroup FSMC_NAND_Bank FSMC NAND Bank
  340. * @{
  341. */
  342. #define FSMC_NAND_BANK2 0x00000010U
  343. #define FSMC_NAND_BANK3 0x00000100U
  344. /**
  345. * @}
  346. */
  347. /** @defgroup FSMC_Wait_feature FSMC Wait feature
  348. * @{
  349. */
  350. #define FSMC_NAND_PCC_WAIT_FEATURE_DISABLE 0x00000000U
  351. #define FSMC_NAND_PCC_WAIT_FEATURE_ENABLE ((uint32_t)FSMC_PCRx_PWAITEN)
  352. /**
  353. * @}
  354. */
  355. /** @defgroup FSMC_PCR_Memory_Type FSMC PCR Memory Type
  356. * @{
  357. */
  358. #define FSMC_PCR_MEMORY_TYPE_PCCARD 0x00000000U
  359. #define FSMC_PCR_MEMORY_TYPE_NAND ((uint32_t)FSMC_PCRx_PTYP)
  360. /**
  361. * @}
  362. */
  363. /** @defgroup FSMC_NAND_Data_Width FSMC NAND Data Width
  364. * @{
  365. */
  366. #define FSMC_NAND_PCC_MEM_BUS_WIDTH_8 0x00000000U
  367. #define FSMC_NAND_PCC_MEM_BUS_WIDTH_16 ((uint32_t)FSMC_PCRx_PWID_0)
  368. /**
  369. * @}
  370. */
  371. /** @defgroup FSMC_ECC FSMC NAND ECC
  372. * @{
  373. */
  374. #define FSMC_NAND_ECC_DISABLE 0x00000000U
  375. #define FSMC_NAND_ECC_ENABLE ((uint32_t)FSMC_PCRx_ECCEN)
  376. /**
  377. * @}
  378. */
  379. /** @defgroup FSMC_ECC_Page_Size FSMC ECC Page Size
  380. * @{
  381. */
  382. #define FSMC_NAND_ECC_PAGE_SIZE_256BYTE 0x00000000U
  383. #define FSMC_NAND_ECC_PAGE_SIZE_512BYTE ((uint32_t)FSMC_PCRx_ECCPS_0)
  384. #define FSMC_NAND_ECC_PAGE_SIZE_1024BYTE ((uint32_t)FSMC_PCRx_ECCPS_1)
  385. #define FSMC_NAND_ECC_PAGE_SIZE_2048BYTE ((uint32_t)FSMC_PCRx_ECCPS_0|FSMC_PCRx_ECCPS_1)
  386. #define FSMC_NAND_ECC_PAGE_SIZE_4096BYTE ((uint32_t)FSMC_PCRx_ECCPS_2)
  387. #define FSMC_NAND_ECC_PAGE_SIZE_8192BYTE ((uint32_t)FSMC_PCRx_ECCPS_0|FSMC_PCRx_ECCPS_2)
  388. /**
  389. * @}
  390. */
  391. /**
  392. * @}
  393. */
  394. #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG */
  395. /** @defgroup FSMC_LL_Interrupt_definition FSMC Interrupt definition
  396. * @brief FSMC Interrupt definition
  397. * @{
  398. */
  399. #define FSMC_IT_RISING_EDGE ((uint32_t)FSMC_SRx_IREN)
  400. #define FSMC_IT_LEVEL ((uint32_t)FSMC_SRx_ILEN)
  401. #define FSMC_IT_FALLING_EDGE ((uint32_t)FSMC_SRx_IFEN)
  402. /**
  403. * @}
  404. */
  405. /** @defgroup FSMC_LL_Flag_definition FSMC Flag definition
  406. * @brief FSMC Flag definition
  407. * @{
  408. */
  409. #define FSMC_FLAG_RISING_EDGE ((uint32_t)FSMC_SRx_IRS)
  410. #define FSMC_FLAG_LEVEL ((uint32_t)FSMC_SRx_ILS)
  411. #define FSMC_FLAG_FALLING_EDGE ((uint32_t)FSMC_SRx_IFS)
  412. #define FSMC_FLAG_FEMPT ((uint32_t)FSMC_SRx_FEMPT)
  413. /**
  414. * @}
  415. */
  416. /** @defgroup FSMC_LL_Alias_definition FSMC Alias definition
  417. * @{
  418. */
  419. #define FSMC_NORSRAM_TypeDef FSMC_Bank1_TypeDef
  420. #define FSMC_NORSRAM_EXTENDED_TypeDef FSMC_Bank1E_TypeDef
  421. #define FSMC_NAND_TypeDef FSMC_Bank2_3_TypeDef
  422. #define FSMC_PCCARD_TypeDef FSMC_Bank4_TypeDef
  423. #define FSMC_NORSRAM_DEVICE FSMC_Bank1
  424. #define FSMC_NORSRAM_EXTENDED_DEVICE FSMC_Bank1E
  425. #define FSMC_NAND_DEVICE FSMC_Bank2_3
  426. #define FSMC_PCCARD_DEVICE FSMC_Bank4
  427. /**
  428. * @}
  429. */
  430. /**
  431. * @}
  432. */
  433. /* Exported macro ------------------------------------------------------------*/
  434. /** @defgroup FSMC_Exported_Macros FSMC Low Layer Exported Macros
  435. * @{
  436. */
  437. /** @defgroup FSMC_LL_NOR_Macros FSMC NOR/SRAM Exported Macros
  438. * @brief macros to handle NOR device enable/disable and read/write operations
  439. * @{
  440. */
  441. /**
  442. * @brief Enable the NORSRAM device access.
  443. * @param __INSTANCE__: FSMC_NORSRAM Instance
  444. * @param __BANK__: FSMC_NORSRAM Bank
  445. * @retval none
  446. */
  447. #define __FSMC_NORSRAM_ENABLE(__INSTANCE__, __BANK__) SET_BIT((__INSTANCE__)->BTCR[(__BANK__)], FSMC_BCRx_MBKEN)
  448. /**
  449. * @brief Disable the NORSRAM device access.
  450. * @param __INSTANCE__: FSMC_NORSRAM Instance
  451. * @param __BANK__: FSMC_NORSRAM Bank
  452. * @retval none
  453. */
  454. #define __FSMC_NORSRAM_DISABLE(__INSTANCE__, __BANK__) CLEAR_BIT((__INSTANCE__)->BTCR[(__BANK__)], FSMC_BCRx_MBKEN)
  455. /**
  456. * @}
  457. */
  458. #if (defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG) || defined(STM32F103xG))
  459. /** @defgroup FSMC_LL_NAND_Macros FSMC NAND Macros
  460. * @brief macros to handle NAND device enable/disable
  461. * @{
  462. */
  463. /**
  464. * @brief Enable the NAND device access.
  465. * @param __INSTANCE__: FSMC_NAND Instance
  466. * @param __BANK__: FSMC_NAND Bank
  467. * @retval None
  468. */
  469. #define __FSMC_NAND_ENABLE(__INSTANCE__, __BANK__) (((__BANK__) == FSMC_NAND_BANK2)? SET_BIT((__INSTANCE__)->PCR2, FSMC_PCRx_PBKEN): \
  470. SET_BIT((__INSTANCE__)->PCR3, FSMC_PCRx_PBKEN))
  471. /**
  472. * @brief Disable the NAND device access.
  473. * @param __INSTANCE__: FSMC_NAND Instance
  474. * @param __BANK__: FSMC_NAND Bank
  475. * @retval None
  476. */
  477. #define __FSMC_NAND_DISABLE(__INSTANCE__, __BANK__) (((__BANK__) == FSMC_NAND_BANK2)? CLEAR_BIT((__INSTANCE__)->PCR2, FSMC_PCRx_PBKEN): \
  478. CLEAR_BIT((__INSTANCE__)->PCR3, FSMC_PCRx_PBKEN))
  479. /**
  480. * @}
  481. */
  482. /** @defgroup FSMC_LL_PCCARD_Macros FSMC PCCARD Macros
  483. * @brief macros to handle PCCARD read/write operations
  484. * @{
  485. */
  486. /**
  487. * @brief Enable the PCCARD device access.
  488. * @param __INSTANCE__: FSMC_PCCARD Instance
  489. * @retval None
  490. */
  491. #define __FSMC_PCCARD_ENABLE(__INSTANCE__) SET_BIT((__INSTANCE__)->PCR4, FSMC_PCRx_PBKEN)
  492. /**
  493. * @brief Disable the PCCARD device access.
  494. * @param __INSTANCE__: FSMC_PCCARD Instance
  495. * @retval None
  496. */
  497. #define __FSMC_PCCARD_DISABLE(__INSTANCE__) CLEAR_BIT((__INSTANCE__)->PCR4, FSMC_PCRx_PBKEN)
  498. /**
  499. * @}
  500. */
  501. /** @defgroup FSMC_LL_Flag_Interrupt_Macros FSMC Flag&Interrupt Macros
  502. * @brief macros to handle FSMC flags and interrupts
  503. * @{
  504. */
  505. /**
  506. * @brief Enable the NAND device interrupt.
  507. * @param __INSTANCE__: FSMC_NAND Instance
  508. * @param __BANK__: FSMC_NAND Bank
  509. * @param __INTERRUPT__: FSMC_NAND interrupt
  510. * This parameter can be any combination of the following values:
  511. * @arg FSMC_IT_RISING_EDGE: Interrupt rising edge.
  512. * @arg FSMC_IT_LEVEL: Interrupt level.
  513. * @arg FSMC_IT_FALLING_EDGE: Interrupt falling edge.
  514. * @retval None
  515. */
  516. #define __FSMC_NAND_ENABLE_IT(__INSTANCE__, __BANK__, __INTERRUPT__) (((__BANK__) == FSMC_NAND_BANK2)? SET_BIT((__INSTANCE__)->SR2, (__INTERRUPT__)): \
  517. SET_BIT((__INSTANCE__)->SR3, (__INTERRUPT__)))
  518. /**
  519. * @brief Disable the NAND device interrupt.
  520. * @param __INSTANCE__: FSMC_NAND Instance
  521. * @param __BANK__: FSMC_NAND Bank
  522. * @param __INTERRUPT__: FSMC_NAND interrupt
  523. * This parameter can be any combination of the following values:
  524. * @arg FSMC_IT_RISING_EDGE: Interrupt rising edge.
  525. * @arg FSMC_IT_LEVEL: Interrupt level.
  526. * @arg FSMC_IT_FALLING_EDGE: Interrupt falling edge.
  527. * @retval None
  528. */
  529. #define __FSMC_NAND_DISABLE_IT(__INSTANCE__, __BANK__, __INTERRUPT__) (((__BANK__) == FSMC_NAND_BANK2)? CLEAR_BIT((__INSTANCE__)->SR2, (__INTERRUPT__)): \
  530. CLEAR_BIT((__INSTANCE__)->SR3, (__INTERRUPT__)))
  531. /**
  532. * @brief Get flag status of the NAND device.
  533. * @param __INSTANCE__: FSMC_NAND Instance
  534. * @param __BANK__ : FSMC_NAND Bank
  535. * @param __FLAG__ : FSMC_NAND flag
  536. * This parameter can be any combination of the following values:
  537. * @arg FSMC_FLAG_RISING_EDGE: Interrupt rising edge flag.
  538. * @arg FSMC_FLAG_LEVEL: Interrupt level edge flag.
  539. * @arg FSMC_FLAG_FALLING_EDGE: Interrupt falling edge flag.
  540. * @arg FSMC_FLAG_FEMPT: FIFO empty flag.
  541. * @retval The state of FLAG (SET or RESET).
  542. */
  543. #define __FSMC_NAND_GET_FLAG(__INSTANCE__, __BANK__, __FLAG__) (((__BANK__) == FSMC_NAND_BANK2)? (((__INSTANCE__)->SR2 &(__FLAG__)) == (__FLAG__)): \
  544. (((__INSTANCE__)->SR3 &(__FLAG__)) == (__FLAG__)))
  545. /**
  546. * @brief Clear flag status of the NAND device.
  547. * @param __INSTANCE__: FSMC_NAND Instance
  548. * @param __BANK__: FSMC_NAND Bank
  549. * @param __FLAG__: FSMC_NAND flag
  550. * This parameter can be any combination of the following values:
  551. * @arg FSMC_FLAG_RISING_EDGE: Interrupt rising edge flag.
  552. * @arg FSMC_FLAG_LEVEL: Interrupt level edge flag.
  553. * @arg FSMC_FLAG_FALLING_EDGE: Interrupt falling edge flag.
  554. * @arg FSMC_FLAG_FEMPT: FIFO empty flag.
  555. * @retval None
  556. */
  557. #define __FSMC_NAND_CLEAR_FLAG(__INSTANCE__, __BANK__, __FLAG__) (((__BANK__) == FSMC_NAND_BANK2)? CLEAR_BIT((__INSTANCE__)->SR2, (__FLAG__)): \
  558. CLEAR_BIT((__INSTANCE__)->SR3, (__FLAG__)))
  559. /**
  560. * @brief Enable the PCCARD device interrupt.
  561. * @param __INSTANCE__: FSMC_PCCARD Instance
  562. * @param __INTERRUPT__: FSMC_PCCARD interrupt
  563. * This parameter can be any combination of the following values:
  564. * @arg FSMC_IT_RISING_EDGE: Interrupt rising edge.
  565. * @arg FSMC_IT_LEVEL: Interrupt level.
  566. * @arg FSMC_IT_FALLING_EDGE: Interrupt falling edge.
  567. * @retval None
  568. */
  569. #define __FSMC_PCCARD_ENABLE_IT(__INSTANCE__, __INTERRUPT__) SET_BIT((__INSTANCE__)->SR4, (__INTERRUPT__))
  570. /**
  571. * @brief Disable the PCCARD device interrupt.
  572. * @param __INSTANCE__: FSMC_PCCARD Instance
  573. * @param __INTERRUPT__: FSMC_PCCARD interrupt
  574. * This parameter can be any combination of the following values:
  575. * @arg FSMC_IT_RISING_EDGE: Interrupt rising edge.
  576. * @arg FSMC_IT_LEVEL: Interrupt level.
  577. * @arg FSMC_IT_FALLING_EDGE: Interrupt falling edge.
  578. * @retval None
  579. */
  580. #define __FSMC_PCCARD_DISABLE_IT(__INSTANCE__, __INTERRUPT__) CLEAR_BIT((__INSTANCE__)->SR4, (__INTERRUPT__))
  581. /**
  582. * @brief Get flag status of the PCCARD device.
  583. * @param __INSTANCE__: FSMC_PCCARD Instance
  584. * @param __FLAG__: FSMC_PCCARD flag
  585. * This parameter can be any combination of the following values:
  586. * @arg FSMC_FLAG_RISING_EDGE: Interrupt rising edge flag.
  587. * @arg FSMC_FLAG_LEVEL: Interrupt level edge flag.
  588. * @arg FSMC_FLAG_FALLING_EDGE: Interrupt falling edge flag.
  589. * @arg FSMC_FLAG_FEMPT: FIFO empty flag.
  590. * @retval The state of FLAG (SET or RESET).
  591. */
  592. #define __FSMC_PCCARD_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->SR4 &(__FLAG__)) == (__FLAG__))
  593. /**
  594. * @brief Clear flag status of the PCCARD device.
  595. * @param __INSTANCE__: FSMC_PCCARD Instance
  596. * @param __FLAG__: FSMC_PCCARD flag
  597. * This parameter can be any combination of the following values:
  598. * @arg FSMC_FLAG_RISING_EDGE: Interrupt rising edge flag.
  599. * @arg FSMC_FLAG_LEVEL: Interrupt level edge flag.
  600. * @arg FSMC_FLAG_FALLING_EDGE: Interrupt falling edge flag.
  601. * @arg FSMC_FLAG_FEMPT: FIFO empty flag.
  602. * @retval None
  603. */
  604. #define __FSMC_PCCARD_CLEAR_FLAG(__INSTANCE__, __FLAG__) CLEAR_BIT((__INSTANCE__)->SR4, (__FLAG__))
  605. /**
  606. * @}
  607. */
  608. #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG */
  609. /**
  610. * @}
  611. */
  612. /** @defgroup FSMC_LL_Private_Macros FSMC Low Layer Private Macros
  613. * @{
  614. */
  615. #define IS_FSMC_NORSRAM_BANK(__BANK__) (((__BANK__) == FSMC_NORSRAM_BANK1) || \
  616. ((__BANK__) == FSMC_NORSRAM_BANK2) || \
  617. ((__BANK__) == FSMC_NORSRAM_BANK3) || \
  618. ((__BANK__) == FSMC_NORSRAM_BANK4))
  619. #define IS_FSMC_MUX(__MUX__) (((__MUX__) == FSMC_DATA_ADDRESS_MUX_DISABLE) || \
  620. ((__MUX__) == FSMC_DATA_ADDRESS_MUX_ENABLE))
  621. #define IS_FSMC_MEMORY(__MEMORY__) (((__MEMORY__) == FSMC_MEMORY_TYPE_SRAM) || \
  622. ((__MEMORY__) == FSMC_MEMORY_TYPE_PSRAM)|| \
  623. ((__MEMORY__) == FSMC_MEMORY_TYPE_NOR))
  624. #define IS_FSMC_NORSRAM_MEMORY_WIDTH(__WIDTH__) (((__WIDTH__) == FSMC_NORSRAM_MEM_BUS_WIDTH_8) || \
  625. ((__WIDTH__) == FSMC_NORSRAM_MEM_BUS_WIDTH_16) || \
  626. ((__WIDTH__) == FSMC_NORSRAM_MEM_BUS_WIDTH_32))
  627. #define IS_FSMC_WRITE_BURST(__BURST__) (((__BURST__) == FSMC_WRITE_BURST_DISABLE) || \
  628. ((__BURST__) == FSMC_WRITE_BURST_ENABLE))
  629. #define IS_FSMC_ACCESS_MODE(__MODE__) (((__MODE__) == FSMC_ACCESS_MODE_A) || \
  630. ((__MODE__) == FSMC_ACCESS_MODE_B) || \
  631. ((__MODE__) == FSMC_ACCESS_MODE_C) || \
  632. ((__MODE__) == FSMC_ACCESS_MODE_D))
  633. #define IS_FSMC_NAND_BANK(__BANK__) (((__BANK__) == FSMC_NAND_BANK2) || \
  634. ((__BANK__) == FSMC_NAND_BANK3))
  635. #define IS_FSMC_WAIT_FEATURE(__FEATURE__) (((__FEATURE__) == FSMC_NAND_PCC_WAIT_FEATURE_DISABLE) || \
  636. ((__FEATURE__) == FSMC_NAND_PCC_WAIT_FEATURE_ENABLE))
  637. #define IS_FSMC_NAND_MEMORY_WIDTH(__WIDTH__) (((__WIDTH__) == FSMC_NAND_PCC_MEM_BUS_WIDTH_8) || \
  638. ((__WIDTH__) == FSMC_NAND_PCC_MEM_BUS_WIDTH_16))
  639. #define IS_FSMC_ECC_STATE(__STATE__) (((__STATE__) == FSMC_NAND_ECC_DISABLE) || \
  640. ((__STATE__) == FSMC_NAND_ECC_ENABLE))
  641. #define IS_FSMC_ECCPAGE_SIZE(__SIZE__) (((__SIZE__) == FSMC_NAND_ECC_PAGE_SIZE_256BYTE) || \
  642. ((__SIZE__) == FSMC_NAND_ECC_PAGE_SIZE_512BYTE) || \
  643. ((__SIZE__) == FSMC_NAND_ECC_PAGE_SIZE_1024BYTE) || \
  644. ((__SIZE__) == FSMC_NAND_ECC_PAGE_SIZE_2048BYTE) || \
  645. ((__SIZE__) == FSMC_NAND_ECC_PAGE_SIZE_4096BYTE) || \
  646. ((__SIZE__) == FSMC_NAND_ECC_PAGE_SIZE_8192BYTE))
  647. /** @defgroup FSMC_TCLR_Setup_Time FSMC_TCLR_Setup_Time
  648. * @{
  649. */
  650. #define IS_FSMC_TCLR_TIME(__TIME__) ((__TIME__) <= 255U)
  651. /**
  652. * @}
  653. */
  654. /** @defgroup FSMC_TAR_Setup_Time FSMC_TAR_Setup_Time
  655. * @{
  656. */
  657. #define IS_FSMC_TAR_TIME(__TIME__) ((__TIME__) <= 255U)
  658. /**
  659. * @}
  660. */
  661. /** @defgroup FSMC_Setup_Time FSMC_Setup_Time
  662. * @{
  663. */
  664. #define IS_FSMC_SETUP_TIME(__TIME__) ((__TIME__) <= 255U)
  665. /**
  666. * @}
  667. */
  668. /** @defgroup FSMC_Wait_Setup_Time FSMC_Wait_Setup_Time
  669. * @{
  670. */
  671. #define IS_FSMC_WAIT_TIME(__TIME__) ((__TIME__) <= 255U)
  672. /**
  673. * @}
  674. */
  675. /** @defgroup FSMC_Hold_Setup_Time FSMC_Hold_Setup_Time
  676. * @{
  677. */
  678. #define IS_FSMC_HOLD_TIME(__TIME__) ((__TIME__) <= 255U)
  679. /**
  680. * @}
  681. */
  682. /** @defgroup FSMC_HiZ_Setup_Time FSMC_HiZ_Setup_Time
  683. * @{
  684. */
  685. #define IS_FSMC_HIZ_TIME(__TIME__) ((__TIME__) <= 255U)
  686. /**
  687. * @}
  688. */
  689. /** @defgroup FSMC_NORSRAM_Device_Instance FSMC NOR/SRAM Device Instance
  690. * @{
  691. */
  692. #define IS_FSMC_NORSRAM_DEVICE(__INSTANCE__) ((__INSTANCE__) == FSMC_NORSRAM_DEVICE)
  693. /**
  694. * @}
  695. */
  696. /** @defgroup FSMC_NORSRAM_EXTENDED_Device_Instance FSMC NOR/SRAM EXTENDED Device Instance
  697. * @{
  698. */
  699. #define IS_FSMC_NORSRAM_EXTENDED_DEVICE(__INSTANCE__) ((__INSTANCE__) == FSMC_NORSRAM_EXTENDED_DEVICE)
  700. /**
  701. * @}
  702. */
  703. /** @defgroup FSMC_NAND_Device_Instance FSMC NAND Device Instance
  704. * @{
  705. */
  706. #define IS_FSMC_NAND_DEVICE(__INSTANCE__) ((__INSTANCE__) == FSMC_NAND_DEVICE)
  707. /**
  708. * @}
  709. */
  710. /** @defgroup FSMC_PCCARD_Device_Instance FSMC PCCARD Device Instance
  711. * @{
  712. */
  713. #define IS_FSMC_PCCARD_DEVICE(__INSTANCE__) ((__INSTANCE__) == FSMC_PCCARD_DEVICE)
  714. /**
  715. * @}
  716. */
  717. #define IS_FSMC_BURSTMODE(__STATE__) (((__STATE__) == FSMC_BURST_ACCESS_MODE_DISABLE) || \
  718. ((__STATE__) == FSMC_BURST_ACCESS_MODE_ENABLE))
  719. #define IS_FSMC_WAIT_POLARITY(__POLARITY__) (((__POLARITY__) == FSMC_WAIT_SIGNAL_POLARITY_LOW) || \
  720. ((__POLARITY__) == FSMC_WAIT_SIGNAL_POLARITY_HIGH))
  721. #define IS_FSMC_WRAP_MODE(__MODE__) (((__MODE__) == FSMC_WRAP_MODE_DISABLE) || \
  722. ((__MODE__) == FSMC_WRAP_MODE_ENABLE))
  723. #define IS_FSMC_WAIT_SIGNAL_ACTIVE(__ACTIVE__) (((__ACTIVE__) == FSMC_WAIT_TIMING_BEFORE_WS) || \
  724. ((__ACTIVE__) == FSMC_WAIT_TIMING_DURING_WS))
  725. #define IS_FSMC_WRITE_OPERATION(__OPERATION__) (((__OPERATION__) == FSMC_WRITE_OPERATION_DISABLE) || \
  726. ((__OPERATION__) == FSMC_WRITE_OPERATION_ENABLE))
  727. #define IS_FSMC_WAITE_SIGNAL(__SIGNAL__) (((__SIGNAL__) == FSMC_WAIT_SIGNAL_DISABLE) || \
  728. ((__SIGNAL__) == FSMC_WAIT_SIGNAL_ENABLE))
  729. #define IS_FSMC_EXTENDED_MODE(__MODE__) (((__MODE__) == FSMC_EXTENDED_MODE_DISABLE) || \
  730. ((__MODE__) == FSMC_EXTENDED_MODE_ENABLE))
  731. #define IS_FSMC_ASYNWAIT(__STATE__) (((__STATE__) == FSMC_ASYNCHRONOUS_WAIT_DISABLE) || \
  732. ((__STATE__) == FSMC_ASYNCHRONOUS_WAIT_ENABLE))
  733. #define IS_FSMC_CLK_DIV(__DIV__) (((__DIV__) > 1U) && ((__DIV__) <= 16U))
  734. /** @defgroup FSMC_Data_Latency FSMC Data Latency
  735. * @{
  736. */
  737. #define IS_FSMC_DATA_LATENCY(__LATENCY__) (((__LATENCY__) > 1U) && ((__LATENCY__) <= 17U))
  738. /**
  739. * @}
  740. */
  741. /** @defgroup FSMC_Address_Setup_Time FSMC Address Setup Time
  742. * @{
  743. */
  744. #define IS_FSMC_ADDRESS_SETUP_TIME(__TIME__) ((__TIME__) <= 15U)
  745. /**
  746. * @}
  747. */
  748. /** @defgroup FSMC_Address_Hold_Time FSMC Address Hold Time
  749. * @{
  750. */
  751. #define IS_FSMC_ADDRESS_HOLD_TIME(__TIME__) (((__TIME__) > 0U) && ((__TIME__) <= 15U))
  752. /**
  753. * @}
  754. */
  755. /** @defgroup FSMC_Data_Setup_Time FSMC Data Setup Time
  756. * @{
  757. */
  758. #define IS_FSMC_DATASETUP_TIME(__TIME__) (((__TIME__) > 0U) && ((__TIME__) <= 255U))
  759. /**
  760. * @}
  761. */
  762. /** @defgroup FSMC_Bus_Turn_around_Duration FSMC Bus Turn around Duration
  763. * @{
  764. */
  765. #define IS_FSMC_TURNAROUND_TIME(__TIME__) ((__TIME__) <= 15U)
  766. /**
  767. * @}
  768. */
  769. /**
  770. * @}
  771. */
  772. /** @defgroup FSMC_LL_Private_Constants FSMC Low Layer Private Constants
  773. * @{
  774. */
  775. /* ----------------------- FSMC registers bit mask --------------------------- */
  776. #if (defined (STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG) || defined(STM32F103xG))
  777. /* --- PCR Register ---*/
  778. /* PCR register clear mask */
  779. #define PCR_CLEAR_MASK ((uint32_t)(FSMC_PCRx_PWAITEN | FSMC_PCRx_PBKEN | \
  780. FSMC_PCRx_PTYP | FSMC_PCRx_PWID | \
  781. FSMC_PCRx_ECCEN | FSMC_PCRx_TCLR | \
  782. FSMC_PCRx_TAR | FSMC_PCRx_ECCPS))
  783. /* --- PMEM Register ---*/
  784. /* PMEM register clear mask */
  785. #define PMEM_CLEAR_MASK ((uint32_t)(FSMC_PMEMx_MEMSETx | FSMC_PMEMx_MEMWAITx |\
  786. FSMC_PMEMx_MEMHOLDx | FSMC_PMEMx_MEMHIZx))
  787. /* --- PATT Register ---*/
  788. /* PATT register clear mask */
  789. #define PATT_CLEAR_MASK ((uint32_t)(FSMC_PATTx_ATTSETx | FSMC_PATTx_ATTWAITx |\
  790. FSMC_PATTx_ATTHOLDx | FSMC_PATTx_ATTHIZx))
  791. #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG */
  792. /* --- BCR Register ---*/
  793. /* BCR register clear mask */
  794. #define BCR_CLEAR_MASK ((uint32_t)(FSMC_BCRx_FACCEN | FSMC_BCRx_MUXEN | \
  795. FSMC_BCRx_MTYP | FSMC_BCRx_MWID | \
  796. FSMC_BCRx_BURSTEN | FSMC_BCRx_WAITPOL | \
  797. FSMC_BCRx_WRAPMOD | FSMC_BCRx_WAITCFG | \
  798. FSMC_BCRx_WREN | FSMC_BCRx_WAITEN | \
  799. FSMC_BCRx_EXTMOD | FSMC_BCRx_ASYNCWAIT | \
  800. FSMC_BCRx_CBURSTRW))
  801. /* --- BTR Register ---*/
  802. /* BTR register clear mask */
  803. #define BTR_CLEAR_MASK ((uint32_t)(FSMC_BTRx_ADDSET | FSMC_BTRx_ADDHLD |\
  804. FSMC_BTRx_DATAST | FSMC_BTRx_BUSTURN |\
  805. FSMC_BTRx_CLKDIV | FSMC_BTRx_DATLAT |\
  806. FSMC_BTRx_ACCMOD))
  807. /* --- BWTR Register ---*/
  808. /* BWTR register clear mask */
  809. #if (defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG) || defined(STM32F103xG))
  810. #define BWTR_CLEAR_MASK ((uint32_t)(FSMC_BWTRx_ADDSET | FSMC_BWTRx_ADDHLD | \
  811. FSMC_BWTRx_DATAST | FSMC_BWTRx_ACCMOD | \
  812. FSMC_BWTRx_BUSTURN))
  813. #else
  814. #define BWTR_CLEAR_MASK ((uint32_t)(FSMC_BWTRx_ADDSET | FSMC_BWTRx_ADDHLD | \
  815. FSMC_BWTRx_DATAST | FSMC_BWTRx_ACCMOD | \
  816. FSMC_BWTRx_CLKDIV | FSMC_BWTRx_DATLAT))
  817. #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG */
  818. /* --- PIO4 Register ---*/
  819. /* PIO4 register clear mask */
  820. #define PIO4_CLEAR_MASK ((uint32_t)(FSMC_PIO4_IOSET4 | FSMC_PIO4_IOWAIT4 | \
  821. FSMC_PIO4_IOHOLD4 | FSMC_PIO4_IOHIZ4))
  822. /**
  823. * @}
  824. */
  825. /* Exported functions --------------------------------------------------------*/
  826. /** @addtogroup FSMC_LL_Exported_Functions
  827. * @{
  828. */
  829. /** @addtogroup FSMC_NORSRAM
  830. * @{
  831. */
  832. /** @addtogroup FSMC_NORSRAM_Group1
  833. * @{
  834. */
  835. /* FSMC_NORSRAM Controller functions ******************************************/
  836. /* Initialization/de-initialization functions */
  837. HAL_StatusTypeDef FSMC_NORSRAM_Init(FSMC_NORSRAM_TypeDef *Device, FSMC_NORSRAM_InitTypeDef *Init);
  838. HAL_StatusTypeDef FSMC_NORSRAM_Timing_Init(FSMC_NORSRAM_TypeDef *Device, FSMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank);
  839. HAL_StatusTypeDef FSMC_NORSRAM_Extended_Timing_Init(FSMC_NORSRAM_EXTENDED_TypeDef *Device, FSMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank, uint32_t ExtendedMode);
  840. HAL_StatusTypeDef FSMC_NORSRAM_DeInit(FSMC_NORSRAM_TypeDef *Device, FSMC_NORSRAM_EXTENDED_TypeDef *ExDevice, uint32_t Bank);
  841. /**
  842. * @}
  843. */
  844. /** @addtogroup FSMC_NORSRAM_Group2
  845. * @{
  846. */
  847. /* FSMC_NORSRAM Control functions */
  848. HAL_StatusTypeDef FSMC_NORSRAM_WriteOperation_Enable(FSMC_NORSRAM_TypeDef *Device, uint32_t Bank);
  849. HAL_StatusTypeDef FSMC_NORSRAM_WriteOperation_Disable(FSMC_NORSRAM_TypeDef *Device, uint32_t Bank);
  850. /**
  851. * @}
  852. */
  853. /**
  854. * @}
  855. */
  856. #if (defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG) || defined(STM32F103xG))
  857. /** @addtogroup FSMC_NAND
  858. * @{
  859. */
  860. /* FSMC_NAND Controller functions **********************************************/
  861. /* Initialization/de-initialization functions */
  862. /** @addtogroup FSMC_NAND_Exported_Functions_Group1
  863. * @{
  864. */
  865. HAL_StatusTypeDef FSMC_NAND_Init(FSMC_NAND_TypeDef *Device, FSMC_NAND_InitTypeDef *Init);
  866. HAL_StatusTypeDef FSMC_NAND_CommonSpace_Timing_Init(FSMC_NAND_TypeDef *Device, FSMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank);
  867. HAL_StatusTypeDef FSMC_NAND_AttributeSpace_Timing_Init(FSMC_NAND_TypeDef *Device, FSMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank);
  868. HAL_StatusTypeDef FSMC_NAND_DeInit(FSMC_NAND_TypeDef *Device, uint32_t Bank);
  869. /**
  870. * @}
  871. */
  872. /* FSMC_NAND Control functions */
  873. /** @addtogroup FSMC_NAND_Exported_Functions_Group2
  874. * @{
  875. */
  876. HAL_StatusTypeDef FSMC_NAND_ECC_Enable(FSMC_NAND_TypeDef *Device, uint32_t Bank);
  877. HAL_StatusTypeDef FSMC_NAND_ECC_Disable(FSMC_NAND_TypeDef *Device, uint32_t Bank);
  878. HAL_StatusTypeDef FSMC_NAND_GetECC(FSMC_NAND_TypeDef *Device, uint32_t *ECCval, uint32_t Bank, uint32_t Timeout);
  879. /**
  880. * @}
  881. */
  882. /**
  883. * @}
  884. */
  885. /** @addtogroup FSMC_PCCARD
  886. * @{
  887. */
  888. /* FSMC_PCCARD Controller functions ********************************************/
  889. /* Initialization/de-initialization functions */
  890. /** @addtogroup FSMC_PCCARD_Exported_Functions_Group1
  891. * @{
  892. */
  893. HAL_StatusTypeDef FSMC_PCCARD_Init(FSMC_PCCARD_TypeDef *Device, FSMC_PCCARD_InitTypeDef *Init);
  894. HAL_StatusTypeDef FSMC_PCCARD_CommonSpace_Timing_Init(FSMC_PCCARD_TypeDef *Device, FSMC_NAND_PCC_TimingTypeDef *Timing);
  895. HAL_StatusTypeDef FSMC_PCCARD_AttributeSpace_Timing_Init(FSMC_PCCARD_TypeDef *Device, FSMC_NAND_PCC_TimingTypeDef *Timing);
  896. HAL_StatusTypeDef FSMC_PCCARD_IOSpace_Timing_Init(FSMC_PCCARD_TypeDef *Device, FSMC_NAND_PCC_TimingTypeDef *Timing);
  897. HAL_StatusTypeDef FSMC_PCCARD_DeInit(FSMC_PCCARD_TypeDef *Device);
  898. /**
  899. * @}
  900. */
  901. /**
  902. * @}
  903. */
  904. #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG */
  905. /**
  906. * @}
  907. */
  908. /**
  909. * @}
  910. */
  911. #endif /* FSMC_BANK1 */
  912. /**
  913. * @}
  914. */
  915. #ifdef __cplusplus
  916. }
  917. #endif
  918. #endif /* __STM32F1xx_LL_FSMC_H */
  919. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/