stm32l1xx_ll_fsmc.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. /**
  2. ******************************************************************************
  3. * @file stm32l1xx_ll_fsmc.h
  4. * @author MCD Application Team
  5. * @version V1.0.0
  6. * @date 5-September-2014
  7. * @brief Header file of FSMC HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2014 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 __STM32L1xx_LL_FSMC_H
  39. #define __STM32L1xx_LL_FSMC_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD)
  44. /* Includes ------------------------------------------------------------------*/
  45. #include "stm32l1xx_hal_def.h"
  46. /** @addtogroup STM32L1xx_HAL_Driver
  47. * @{
  48. */
  49. /** @addtogroup FSMC_LL
  50. * @{
  51. */
  52. /* Exported typedef ----------------------------------------------------------*/
  53. /** @defgroup FSMC_NORSRAM_Exported_typedef FSMC NOR/SRAM Exported typedef
  54. * @{
  55. */
  56. #define FSMC_NORSRAM_TYPEDEF FSMC_Bank1_TypeDef
  57. #define FSMC_NORSRAM_EXTENDED_TYPEDEF FSMC_Bank1E_TypeDef
  58. #define FSMC_NORSRAM_DEVICE FSMC_Bank1
  59. #define FSMC_NORSRAM_EXTENDED_DEVICE FSMC_Bank1E
  60. /**
  61. * @brief FSMC_NORSRAM Configuration Structure definition
  62. */
  63. typedef struct
  64. {
  65. uint32_t NSBank; /*!< Specifies the NORSRAM memory device that will be used.
  66. This parameter can be a value of @ref FSMC_NORSRAM_Bank */
  67. uint32_t DataAddressMux; /*!< Specifies whether the address and data values are
  68. multiplexed on the data bus or not.
  69. This parameter can be a value of @ref FSMC_Data_Address_Bus_Multiplexing */
  70. uint32_t MemoryType; /*!< Specifies the type of external memory attached to
  71. the corresponding memory device.
  72. This parameter can be a value of @ref FSMC_Memory_Type */
  73. uint32_t MemoryDataWidth; /*!< Specifies the external memory device width.
  74. This parameter can be a value of @ref FSMC_NORSRAM_Data_Width */
  75. uint32_t BurstAccessMode; /*!< Enables or disables the burst access mode for Flash memory,
  76. valid only with synchronous burst Flash memories.
  77. This parameter can be a value of @ref FSMC_Burst_Access_Mode */
  78. uint32_t WaitSignalPolarity; /*!< Specifies the wait signal polarity, valid only when accessing
  79. the Flash memory in burst mode.
  80. This parameter can be a value of @ref FSMC_Wait_Signal_Polarity */
  81. uint32_t WrapMode; /*!< Enables or disables the Wrapped burst access mode for Flash
  82. memory, valid only when accessing Flash memories in burst mode.
  83. This parameter can be a value of @ref FSMC_Wrap_Mode */
  84. uint32_t WaitSignalActive; /*!< Specifies if the wait signal is asserted by the memory one
  85. clock cycle before the wait state or during the wait state,
  86. valid only when accessing memories in burst mode.
  87. This parameter can be a value of @ref FSMC_Wait_Timing */
  88. uint32_t WriteOperation; /*!< Enables or disables the write operation in the selected device by the FSMC.
  89. This parameter can be a value of @ref FSMC_Write_Operation */
  90. uint32_t WaitSignal; /*!< Enables or disables the wait state insertion via wait
  91. signal, valid for Flash memory access in burst mode.
  92. This parameter can be a value of @ref FSMC_Wait_Signal */
  93. uint32_t ExtendedMode; /*!< Enables or disables the extended mode.
  94. This parameter can be a value of @ref FSMC_Extended_Mode */
  95. uint32_t AsynchronousWait; /*!< Enables or disables wait signal during asynchronous transfers,
  96. valid only with asynchronous Flash memories.
  97. This parameter can be a value of @ref FSMC_AsynchronousWait */
  98. uint32_t WriteBurst; /*!< Enables or disables the write burst operation.
  99. This parameter can be a value of @ref FSMC_Write_Burst */
  100. }FSMC_NORSRAM_InitTypeDef;
  101. /**
  102. * @brief FSMC_NORSRAM Timing parameters structure definition
  103. */
  104. typedef struct
  105. {
  106. uint32_t AddressSetupTime; /*!< Defines the number of HCLK cycles to configure
  107. the duration of the address setup time.
  108. This parameter can be a value between Min_Data = 0 and Max_Data = 15.
  109. @note This parameter is not used with synchronous NOR Flash memories. */
  110. uint32_t AddressHoldTime; /*!< Defines the number of HCLK cycles to configure
  111. the duration of the address hold time.
  112. This parameter can be a value between Min_Data = 1 and Max_Data = 15.
  113. @note This parameter is not used with synchronous NOR Flash memories. */
  114. uint32_t DataSetupTime; /*!< Defines the number of HCLK cycles to configure
  115. the duration of the data setup time.
  116. This parameter can be a value between Min_Data = 1 and Max_Data = 255.
  117. @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed
  118. NOR Flash memories. */
  119. uint32_t BusTurnAroundDuration; /*!< Defines the number of HCLK cycles to configure
  120. the duration of the bus turnaround.
  121. This parameter can be a value between Min_Data = 0 and Max_Data = 15.
  122. @note This parameter is only used for multiplexed NOR Flash memories. */
  123. uint32_t CLKDivision; /*!< Defines the period of CLK clock output signal, expressed in number of
  124. HCLK cycles. This parameter can be a value between Min_Data = 2 and Max_Data = 16.
  125. @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM
  126. accesses. */
  127. uint32_t DataLatency; /*!< Defines the number of memory clock cycles to issue
  128. to the memory before getting the first data.
  129. The parameter value depends on the memory type as shown below:
  130. - It must be set to 0 in case of a CRAM
  131. - It is don't care in asynchronous NOR, SRAM or ROM accesses
  132. - It may assume a value between Min_Data = 2 and Max_Data = 17 in NOR Flash memories
  133. with synchronous burst mode enable */
  134. uint32_t AccessMode; /*!< Specifies the asynchronous access mode.
  135. This parameter can be a value of @ref FSMC_Access_Mode */
  136. }FSMC_NORSRAM_TimingTypeDef;
  137. /**
  138. * @}
  139. */
  140. /* Exported constants --------------------------------------------------------*/
  141. /** @defgroup FSMC_NORSRAM_Exported_constants FSMC NOR/SRAM Exported constants
  142. * @{
  143. */
  144. /** @defgroup FSMC_NORSRAM_Bank FSMC NOR/SRAM Bank
  145. * @{
  146. */
  147. #define FSMC_BANK1_NORSRAM1 ((uint32_t)0x00000000)
  148. #define FSMC_BANK1_NORSRAM2 ((uint32_t)0x00000002)
  149. #define FSMC_BANK1_NORSRAM3 ((uint32_t)0x00000004)
  150. #define FSMC_BANK1_NORSRAM4 ((uint32_t)0x00000006)
  151. /* To keep compatibility with previous families */
  152. #define FSMC_NORSRAM_BANK1 FSMC_BANK1_NORSRAM1
  153. #define FSMC_NORSRAM_BANK2 FSMC_BANK1_NORSRAM2
  154. #define FSMC_NORSRAM_BANK3 FSMC_BANK1_NORSRAM3
  155. #define FSMC_NORSRAM_BANK4 FSMC_BANK1_NORSRAM4
  156. #define IS_FSMC_NORSRAM_BANK(__BANK__) (((__BANK__) == FSMC_BANK1_NORSRAM1) || \
  157. ((__BANK__) == FSMC_BANK1_NORSRAM2) || \
  158. ((__BANK__) == FSMC_BANK1_NORSRAM3) || \
  159. ((__BANK__) == FSMC_BANK1_NORSRAM4))
  160. /**
  161. * @}
  162. */
  163. /** @defgroup FSMC_Data_Address_Bus_Multiplexing FSMC Data Address Bus Multiplexing
  164. * @{
  165. */
  166. #define FSMC_DATA_ADDRESS_MUX_DISABLE ((uint32_t)0x00000000)
  167. #define FSMC_DATA_ADDRESS_MUX_ENABLE ((uint32_t)FSMC_BCRx_MUXEN)
  168. #define IS_FSMC_MUX(__MUX__) (((__MUX__) == FSMC_DATA_ADDRESS_MUX_DISABLE) || \
  169. ((__MUX__) == FSMC_DATA_ADDRESS_MUX_ENABLE))
  170. /**
  171. * @}
  172. */
  173. /** @defgroup FSMC_Memory_Type FSMC Memory Type
  174. * @{
  175. */
  176. #define FSMC_MEMORY_TYPE_SRAM ((uint32_t)0x00000000)
  177. #define FSMC_MEMORY_TYPE_PSRAM ((uint32_t)FSMC_BCRx_MTYP_0)
  178. #define FSMC_MEMORY_TYPE_NOR ((uint32_t)FSMC_BCRx_MTYP_1)
  179. #define IS_FSMC_MEMORY(__MEMORY__) (((__MEMORY__) == FSMC_MEMORY_TYPE_SRAM) || \
  180. ((__MEMORY__) == FSMC_MEMORY_TYPE_PSRAM)|| \
  181. ((__MEMORY__) == FSMC_MEMORY_TYPE_NOR))
  182. /**
  183. * @}
  184. */
  185. /** @defgroup FSMC_NORSRAM_Data_Width FSMC NOR/SRAM Data Width
  186. * @{
  187. */
  188. #define FSMC_NORSRAM_MEM_BUS_WIDTH_8 ((uint32_t)0x00000000)
  189. #define FSMC_NORSRAM_MEM_BUS_WIDTH_16 ((uint32_t)FSMC_BCRx_MWID_0)
  190. #define FSMC_NORSRAM_MEM_BUS_WIDTH_32 ((uint32_t)FSMC_BCRx_MWID_1)
  191. #define IS_FSMC_NORSRAM_MEMORY_WIDTH(__WIDTH__) (((__WIDTH__) == FSMC_NORSRAM_MEM_BUS_WIDTH_8) || \
  192. ((__WIDTH__) == FSMC_NORSRAM_MEM_BUS_WIDTH_16) || \
  193. ((__WIDTH__) == FSMC_NORSRAM_MEM_BUS_WIDTH_32))
  194. /**
  195. * @}
  196. */
  197. /** @defgroup FSMC_NORSRAM_Flash_Access FSMC NOR/SRAM Flash Access
  198. * @{
  199. */
  200. #define FSMC_NORSRAM_FLASH_ACCESS_ENABLE ((uint32_t)FSMC_BCRx_FACCEN)
  201. #define FSMC_NORSRAM_FLASH_ACCESS_DISABLE ((uint32_t)0x00000000)
  202. /**
  203. * @}
  204. */
  205. /** @defgroup FSMC_Burst_Access_Mode FSMC Burst Access Mode
  206. * @{
  207. */
  208. #define FSMC_BURST_ACCESS_MODE_DISABLE ((uint32_t)0x00000000)
  209. #define FSMC_BURST_ACCESS_MODE_ENABLE ((uint32_t)FSMC_BCRx_BURSTEN)
  210. #define IS_FSMC_BURSTMODE(__STATE__) (((__STATE__) == FSMC_BURST_ACCESS_MODE_DISABLE) || \
  211. ((__STATE__) == FSMC_BURST_ACCESS_MODE_ENABLE))
  212. /**
  213. * @}
  214. */
  215. /** @defgroup FSMC_Wait_Signal_Polarity FSMC Wait Signal Polarity
  216. * @{
  217. */
  218. #define FSMC_WAIT_SIGNAL_POLARITY_LOW ((uint32_t)0x00000000)
  219. #define FSMC_WAIT_SIGNAL_POLARITY_HIGH ((uint32_t)FSMC_BCRx_WAITPOL)
  220. #define IS_FSMC_WAIT_POLARITY(__POLARITY__) (((__POLARITY__) == FSMC_WAIT_SIGNAL_POLARITY_LOW) || \
  221. ((__POLARITY__) == FSMC_WAIT_SIGNAL_POLARITY_HIGH))
  222. /**
  223. * @}
  224. */
  225. /** @defgroup FSMC_Wrap_Mode FSMC Wrap Mode
  226. * @{
  227. */
  228. #define FSMC_WRAP_MODE_DISABLE ((uint32_t)0x00000000)
  229. #define FSMC_WRAP_MODE_ENABLE ((uint32_t)FSMC_BCRx_WRAPMOD)
  230. #define IS_FSMC_WRAP_MODE(__MODE__) (((__MODE__) == FSMC_WRAP_MODE_DISABLE) || \
  231. ((__MODE__) == FSMC_WRAP_MODE_ENABLE))
  232. /**
  233. * @}
  234. */
  235. /** @defgroup FSMC_Wait_Timing FSMC Wait Timing
  236. * @{
  237. */
  238. #define FSMC_WAIT_TIMING_BEFORE_WS ((uint32_t)0x00000000)
  239. #define FSMC_WAIT_TIMING_DURING_WS ((uint32_t)FSMC_BCRx_WAITCFG)
  240. #define IS_FSMC_WAIT_SIGNAL_ACTIVE(__ACTIVE__) (((__ACTIVE__) == FSMC_WAIT_TIMING_BEFORE_WS) || \
  241. ((__ACTIVE__) == FSMC_WAIT_TIMING_DURING_WS))
  242. /**
  243. * @}
  244. */
  245. /** @defgroup FSMC_Write_Operation FSMC Write Operation
  246. * @{
  247. */
  248. #define FSMC_WRITE_OPERATION_DISABLE ((uint32_t)0x00000000)
  249. #define FSMC_WRITE_OPERATION_ENABLE ((uint32_t)FSMC_BCRx_WREN)
  250. #define IS_FSMC_WRITE_OPERATION(__OPERATION__) (((__OPERATION__) == FSMC_WRITE_OPERATION_DISABLE) || \
  251. ((__OPERATION__) == FSMC_WRITE_OPERATION_ENABLE))
  252. /**
  253. * @}
  254. */
  255. /** @defgroup FSMC_Wait_Signal FSMC Wait Signal
  256. * @{
  257. */
  258. #define FSMC_WAIT_SIGNAL_DISABLE ((uint32_t)0x00000000)
  259. #define FSMC_WAIT_SIGNAL_ENABLE ((uint32_t)FSMC_BCRx_WAITEN)
  260. #define IS_FSMC_WAITE_SIGNAL(__SIGNAL__) (((__SIGNAL__) == FSMC_WAIT_SIGNAL_DISABLE) || \
  261. ((__SIGNAL__) == FSMC_WAIT_SIGNAL_ENABLE))
  262. /**
  263. * @}
  264. */
  265. /** @defgroup FSMC_Extended_Mode FSMC Extended Mode
  266. * @{
  267. */
  268. #define FSMC_EXTENDED_MODE_DISABLE ((uint32_t)0x00000000)
  269. #define FSMC_EXTENDED_MODE_ENABLE ((uint32_t)FSMC_BCRx_EXTMOD)
  270. #define IS_FSMC_EXTENDED_MODE(__MODE__) (((__MODE__) == FSMC_EXTENDED_MODE_DISABLE) || \
  271. ((__MODE__) == FSMC_EXTENDED_MODE_ENABLE))
  272. /**
  273. * @}
  274. */
  275. /** @defgroup FSMC_AsynchronousWait FSMC Asynchronous Wait
  276. * @{
  277. */
  278. #define FSMC_ASYNCHRONOUS_WAIT_DISABLE ((uint32_t)0x00000000)
  279. #define FSMC_ASYNCHRONOUS_WAIT_ENABLE ((uint32_t)FSMC_BCRx_ASYNCWAIT)
  280. #define IS_FSMC_ASYNWAIT(__STATE__) (((__STATE__) == FSMC_ASYNCHRONOUS_WAIT_DISABLE) || \
  281. ((__STATE__) == FSMC_ASYNCHRONOUS_WAIT_ENABLE))
  282. /**
  283. * @}
  284. */
  285. /** @defgroup FSMC_Write_Burst FSMC Write Burst
  286. * @{
  287. */
  288. #define FSMC_WRITE_BURST_DISABLE ((uint32_t)0x00000000)
  289. #define FSMC_WRITE_BURST_ENABLE ((uint32_t)FSMC_BCRx_CBURSTRW)
  290. #define IS_FSMC_WRITE_BURST(__BURST__) (((__BURST__) == FSMC_WRITE_BURST_DISABLE) || \
  291. ((__BURST__) == FSMC_WRITE_BURST_ENABLE))
  292. /**
  293. * @}
  294. */
  295. /** @defgroup FSMC_Address_Setup_Time FSMC Address Setup Time
  296. * @{
  297. */
  298. #define IS_FSMC_ADDRESS_SETUP_TIME(__TIME__) ((__TIME__) <= 15)
  299. /**
  300. * @}
  301. */
  302. /** @defgroup FSMC_Address_Hold_Time FSMC Address Hold Time
  303. * @{
  304. */
  305. #define IS_FSMC_ADDRESS_HOLD_TIME(__TIME__) (((__TIME__) > 0) && ((__TIME__) <= 15))
  306. /**
  307. * @}
  308. */
  309. /** @defgroup FSMC_Data_Setup_Time FSMC Data Setup Time
  310. * @{
  311. */
  312. #define IS_FSMC_DATASETUP_TIME(__TIME__) (((__TIME__) > 0) && ((__TIME__) <= 255))
  313. /**
  314. * @}
  315. */
  316. /** @defgroup FSMC_Bus_Turn_around_Duration FSMC Bus Turn around Duration
  317. * @{
  318. */
  319. #define IS_FSMC_TURNAROUND_TIME(__TIME__) ((__TIME__) <= 15)
  320. /**
  321. * @}
  322. */
  323. /** @defgroup FSMC_CLK_Division FSMC CLK Division
  324. * @{
  325. */
  326. #define FSMC_CLK_DIV2 ((uint32_t)0x00000002)
  327. #define FSMC_CLK_DIV3 ((uint32_t)0x00000003)
  328. #define FSMC_CLK_DIV4 ((uint32_t)0x00000004)
  329. #define FSMC_CLK_DIV5 ((uint32_t)0x00000005)
  330. #define FSMC_CLK_DIV6 ((uint32_t)0x00000006)
  331. #define FSMC_CLK_DIV7 ((uint32_t)0x00000007)
  332. #define FSMC_CLK_DIV8 ((uint32_t)0x00000008)
  333. #define FSMC_CLK_DIV9 ((uint32_t)0x00000009)
  334. #define FSMC_CLK_DIV10 ((uint32_t)0x0000000A)
  335. #define FSMC_CLK_DIV11 ((uint32_t)0x0000000B)
  336. #define FSMC_CLK_DIV12 ((uint32_t)0x0000000C)
  337. #define FSMC_CLK_DIV13 ((uint32_t)0x0000000D)
  338. #define FSMC_CLK_DIV14 ((uint32_t)0x0000000E)
  339. #define FSMC_CLK_DIV15 ((uint32_t)0x0000000F)
  340. #define FSMC_CLK_DIV16 ((uint32_t)0x00000010)
  341. #define IS_FSMC_CLK_DIV(__DIV__) (((__DIV__) > 1) && ((__DIV__) <= 16))
  342. /**
  343. * @}
  344. */
  345. /** @defgroup FSMC_Data_Latency FSMC Data Latency
  346. * @{
  347. */
  348. #define IS_FSMC_DATA_LATENCY(__LATENCY__) (((__LATENCY__) > 1) && ((__LATENCY__) <= 17))
  349. /**
  350. * @}
  351. */
  352. /** @defgroup FSMC_Access_Mode FSMC Access Mode
  353. * @{
  354. */
  355. #define FSMC_ACCESS_MODE_A ((uint32_t)0x00000000)
  356. #define FSMC_ACCESS_MODE_B ((uint32_t)FSMC_BTRx_ACCMOD_0)
  357. #define FSMC_ACCESS_MODE_C ((uint32_t)FSMC_BTRx_ACCMOD_1)
  358. #define FSMC_ACCESS_MODE_D ((uint32_t)(FSMC_BTRx_ACCMOD_0 | FSMC_BTRx_ACCMOD_1))
  359. #define IS_FSMC_ACCESS_MODE(__MODE__) (((__MODE__) == FSMC_ACCESS_MODE_A) || \
  360. ((__MODE__) == FSMC_ACCESS_MODE_B) || \
  361. ((__MODE__) == FSMC_ACCESS_MODE_C) || \
  362. ((__MODE__) == FSMC_ACCESS_MODE_D))
  363. /**
  364. * @}
  365. */
  366. /** @defgroup FSMC_NORSRAM_Device_Instance FSMC NOR/SRAM Device Instance
  367. * @{
  368. */
  369. #define IS_FSMC_NORSRAM_DEVICE(__INSTANCE__) ((__INSTANCE__) == FSMC_NORSRAM_DEVICE)
  370. /**
  371. * @}
  372. */
  373. /** @defgroup FSMC_NORSRAM_EXTENDED_Device_Instance FSMC NOR/SRAM EXTENDED Device Instance
  374. * @{
  375. */
  376. #define IS_FSMC_NORSRAM_EXTENDED_DEVICE(__INSTANCE__) ((__INSTANCE__) == FSMC_NORSRAM_EXTENDED_DEVICE)
  377. /**
  378. * @}
  379. */
  380. /**
  381. * @}
  382. */
  383. /* Exported macro ------------------------------------------------------------*/
  384. /** @defgroup FSMC_NOR_Macros FSMC NOR/SRAM Exported Macros
  385. * @brief macros to handle NOR device enable/disable and read/write operations
  386. * @{
  387. */
  388. /**
  389. * @brief Enable the NORSRAM device access.
  390. * @param __INSTANCE__: FSMC_NORSRAM Instance
  391. * @param __BANK__: FSMC_NORSRAM Bank
  392. * @retval none
  393. */
  394. #define __FSMC_NORSRAM_ENABLE(__INSTANCE__, __BANK__) ((__INSTANCE__)->BTCR[(__BANK__)] |= FSMC_BCRx_MBKEN)
  395. /**
  396. * @brief Disable the NORSRAM device access.
  397. * @param __INSTANCE__: FSMC_NORSRAM Instance
  398. * @param __BANK__: FSMC_NORSRAM Bank
  399. * @retval none
  400. */
  401. #define __FSMC_NORSRAM_DISABLE(__INSTANCE__, __BANK__) ((__INSTANCE__)->BTCR[(__BANK__)] &= ~FSMC_BCRx_MBKEN)
  402. /**
  403. * @}
  404. */
  405. /* Exported functions --------------------------------------------------------*/
  406. /** @addtogroup FSMC_Exported_Functions
  407. * @{
  408. */
  409. /** @addtogroup HAL_FSMC_NORSRAM_Group1
  410. * @{
  411. */
  412. /* FSMC_NORSRAM Controller functions ******************************************/
  413. /* Initialization/de-initialization functions */
  414. HAL_StatusTypeDef FSMC_NORSRAM_Init(FSMC_NORSRAM_TYPEDEF *Device, FSMC_NORSRAM_InitTypeDef *Init);
  415. HAL_StatusTypeDef FSMC_NORSRAM_Timing_Init(FSMC_NORSRAM_TYPEDEF *Device, FSMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank);
  416. HAL_StatusTypeDef FSMC_NORSRAM_Extended_Timing_Init(FSMC_NORSRAM_EXTENDED_TYPEDEF *Device, FSMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank, uint32_t ExtendedMode);
  417. HAL_StatusTypeDef FSMC_NORSRAM_DeInit(FSMC_NORSRAM_TYPEDEF *Device, FSMC_NORSRAM_EXTENDED_TYPEDEF *ExDevice, uint32_t Bank);
  418. /**
  419. * @}
  420. */
  421. /** @addtogroup HAL_FSMC_NORSRAM_Group2
  422. * @{
  423. */
  424. /* FSMC_NORSRAM Control functions */
  425. HAL_StatusTypeDef FSMC_NORSRAM_WriteOperation_Enable(FSMC_NORSRAM_TYPEDEF *Device, uint32_t Bank);
  426. HAL_StatusTypeDef FSMC_NORSRAM_WriteOperation_Disable(FSMC_NORSRAM_TYPEDEF *Device, uint32_t Bank);
  427. /**
  428. * @}
  429. */
  430. #endif /* STM32L151xD || STM32L152xD || STM32L162xD */
  431. /**
  432. * @}
  433. */
  434. /**
  435. * @}
  436. */
  437. /**
  438. * @}
  439. */
  440. #ifdef __cplusplus
  441. }
  442. #endif
  443. #endif /* __STM32L1xx_LL_FSMC_H */
  444. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/