stm32f3xx_ll_fmc.c 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997
  1. /**
  2. ******************************************************************************
  3. * @file stm32f3xx_ll_fmc.c
  4. * @author MCD Application Team
  5. * @brief FMC Low Layer HAL module driver.
  6. *
  7. * This file provides firmware functions to manage the following
  8. * functionalities of the Flexible Memory Controller (FMC) peripheral memories:
  9. * + Initialization/de-initialization functions
  10. * + Peripheral Control functions
  11. * + Peripheral State functions
  12. *
  13. @verbatim
  14. =============================================================================
  15. ##### FMC peripheral features #####
  16. =============================================================================
  17. [..] The Flexible memory controller (FMC) includes following memory controllers:
  18. (+) The NOR/PSRAM memory controller
  19. (+) The PC Card memory controller
  20. (+) The NAND memory controller
  21. [..] The FMC functional block makes the interface with synchronous and asynchronous static
  22. memories and 16-bit PC memory cards. Its main purposes are:
  23. (+) to translate AHB transactions into the appropriate external device protocol.
  24. (+) to meet the access time requirements of the external memory devices.
  25. [..] All external memories share the addresses, data and control signals with the controller.
  26. Each external device is accessed by means of a unique Chip Select. The FMC performs
  27. only one access at a time to an external device.
  28. The main features of the FMC controller are the following:
  29. (+) Interface with static-memory mapped devices including:
  30. (++) Static random access memory (SRAM).
  31. (++) NOR Flash memory.
  32. (++) PSRAM (4 memory banks).
  33. (++) 16-bit PC Card compatible devices
  34. (++) Two banks of NAND Flash memory with ECC hardware to check up to 8 Kbytes of
  35. data
  36. (+) Independent Chip Select control for each memory bank
  37. (+) Independent configuration for each memory bank
  38. @endverbatim
  39. ******************************************************************************
  40. * @attention
  41. *
  42. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  43. *
  44. * Redistribution and use in source and binary forms, with or without modification,
  45. * are permitted provided that the following conditions are met:
  46. * 1. Redistributions of source code must retain the above copyright notice,
  47. * this list of conditions and the following disclaimer.
  48. * 2. Redistributions in binary form must reproduce the above copyright notice,
  49. * this list of conditions and the following disclaimer in the documentation
  50. * and/or other materials provided with the distribution.
  51. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  52. * may be used to endorse or promote products derived from this software
  53. * without specific prior written permission.
  54. *
  55. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  56. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  57. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  58. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  59. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  60. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  61. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  62. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  63. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  64. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  65. *
  66. ******************************************************************************
  67. */
  68. /* Includes ------------------------------------------------------------------*/
  69. #include "stm32f3xx_hal.h"
  70. /** @addtogroup STM32F3xx_HAL_Driver
  71. * @{
  72. */
  73. #if defined(FMC_BANK1)
  74. #if defined(HAL_SRAM_MODULE_ENABLED) || defined(HAL_NOR_MODULE_ENABLED) || defined(HAL_PCCARD_MODULE_ENABLED) || defined(HAL_NAND_MODULE_ENABLED)
  75. /** @defgroup FMC_LL FMC Low Layer
  76. * @brief FMC driver modules
  77. * @{
  78. */
  79. /* Private typedef -----------------------------------------------------------*/
  80. /* Private define ------------------------------------------------------------*/
  81. /** @defgroup FMC_LL_Private_Constants FMC Low Layer Private Constants
  82. * @{
  83. */
  84. /* ----------------------- FMC registers bit mask --------------------------- */
  85. /* --- PCR Register ---*/
  86. /* PCR register clear mask */
  87. #define PCR_CLEAR_MASK ((uint32_t)(FMC_PCRx_PWAITEN | FMC_PCRx_PBKEN | \
  88. FMC_PCRx_PTYP | FMC_PCRx_PWID | \
  89. FMC_PCRx_ECCEN | FMC_PCRx_TCLR | \
  90. FMC_PCRx_TAR | FMC_PCRx_ECCPS))
  91. /* --- PMEM Register ---*/
  92. /* PMEM register clear mask */
  93. #define PMEM_CLEAR_MASK ((uint32_t)(FMC_PMEMx_MEMSETx | FMC_PMEMx_MEMWAITx |\
  94. FMC_PMEMx_MEMHOLDx | FMC_PMEMx_MEMHIZx))
  95. /* --- PATT Register ---*/
  96. /* PATT register clear mask */
  97. #define PATT_CLEAR_MASK ((uint32_t)(FMC_PATTx_ATTSETx | FMC_PATTx_ATTWAITx |\
  98. FMC_PATTx_ATTHOLDx | FMC_PATTx_ATTHIZx))
  99. /* --- BCR Register ---*/
  100. /* BCR register clear mask */
  101. #define BCR_CLEAR_MASK ((uint32_t)(FMC_BCRx_MBKEN | FMC_BCRx_MUXEN |\
  102. FMC_BCRx_MTYP | FMC_BCRx_MWID |\
  103. FMC_BCRx_FACCEN | FMC_BCRx_BURSTEN |\
  104. FMC_BCRx_WAITPOL | FMC_BCRx_WRAPMOD |\
  105. FMC_BCRx_WAITCFG | FMC_BCRx_WREN |\
  106. FMC_BCRx_WAITEN | FMC_BCRx_EXTMOD |\
  107. FMC_BCRx_ASYNCWAIT | FMC_BCRx_CBURSTRW |\
  108. FMC_BCR1_CCLKEN))
  109. /* --- BTR Register ---*/
  110. /* BTR register clear mask */
  111. #define BTR_CLEAR_MASK ((uint32_t)(FMC_BTRx_ADDSET | FMC_BTRx_ADDHLD |\
  112. FMC_BTRx_DATAST | FMC_BTRx_BUSTURN |\
  113. FMC_BTRx_CLKDIV | FMC_BTRx_DATLAT |\
  114. FMC_BTRx_ACCMOD))
  115. /* --- BWTR Register ---*/
  116. /* BWTR register clear mask */
  117. #define BWTR_CLEAR_MASK ((uint32_t)(FMC_BWTRx_ADDSET | FMC_BWTRx_ADDHLD |\
  118. FMC_BWTRx_DATAST | FMC_BWTRx_ACCMOD))
  119. /* --- PIO4 Register ---*/
  120. /* PIO4 register clear mask */
  121. #define PIO4_CLEAR_MASK ((uint32_t)(FMC_PIO4_IOSET4 | FMC_PIO4_IOWAIT4 | \
  122. FMC_PIO4_IOHOLD4 | FMC_PIO4_IOHIZ4))
  123. /**
  124. * @}
  125. */
  126. /* Private macro -------------------------------------------------------------*/
  127. /** @defgroup FMC_LL_Private_Macros FMC Low Layer Private Macros
  128. * @{
  129. */
  130. /**
  131. * @}
  132. */
  133. /* Private variables ---------------------------------------------------------*/
  134. /* Private function prototypes -----------------------------------------------*/
  135. /* Exported functions --------------------------------------------------------*/
  136. /** @defgroup FMC_LL_Exported_Functions FMC Low Layer Exported Functions
  137. * @{
  138. */
  139. /** @defgroup FMC_NORSRAM FMC NORSRAM Controller functions
  140. * @brief NORSRAM Controller functions
  141. *
  142. @verbatim
  143. ==============================================================================
  144. ##### How to use NORSRAM device driver #####
  145. ==============================================================================
  146. [..]
  147. This driver contains a set of APIs to interface with the FMC NORSRAM banks in order
  148. to run the NORSRAM external devices.
  149. (+) FMC NORSRAM bank reset using the function FMC_NORSRAM_DeInit()
  150. (+) FMC NORSRAM bank control configuration using the function FMC_NORSRAM_Init()
  151. (+) FMC NORSRAM bank timing configuration using the function FMC_NORSRAM_Timing_Init()
  152. (+) FMC NORSRAM bank extended timing configuration using the function
  153. FMC_NORSRAM_Extended_Timing_Init()
  154. (+) FMC NORSRAM bank enable/disable write operation using the functions
  155. FMC_NORSRAM_WriteOperation_Enable()/FMC_NORSRAM_WriteOperation_Disable()
  156. @endverbatim
  157. * @{
  158. */
  159. /** @defgroup FMC_NORSRAM_Group1 Initialization/de-initialization functions
  160. * @brief Initialization and Configuration functions
  161. *
  162. @verbatim
  163. ==============================================================================
  164. ##### Initialization and de_initialization functions #####
  165. ==============================================================================
  166. [..]
  167. This section provides functions allowing to:
  168. (+) Initialize and configure the FMC NORSRAM interface
  169. (+) De-initialize the FMC NORSRAM interface
  170. (+) Configure the FMC clock and associated GPIOs
  171. @endverbatim
  172. * @{
  173. */
  174. /**
  175. * @brief Initialize the FMC_NORSRAM device according to the specified
  176. * control parameters in the FMC_NORSRAM_InitTypeDef
  177. * @param Device Pointer to NORSRAM device instance
  178. * @param Init Pointer to NORSRAM Initialization structure
  179. * @retval HAL status
  180. */
  181. HAL_StatusTypeDef FMC_NORSRAM_Init(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_InitTypeDef *Init)
  182. {
  183. /* Check the parameters */
  184. assert_param(IS_FMC_NORSRAM_DEVICE(Device));
  185. assert_param(IS_FMC_NORSRAM_BANK(Init->NSBank));
  186. assert_param(IS_FMC_MUX(Init->DataAddressMux));
  187. assert_param(IS_FMC_MEMORY(Init->MemoryType));
  188. assert_param(IS_FMC_NORSRAM_MEMORY_WIDTH(Init->MemoryDataWidth));
  189. assert_param(IS_FMC_BURSTMODE(Init->BurstAccessMode));
  190. assert_param(IS_FMC_WAIT_POLARITY(Init->WaitSignalPolarity));
  191. assert_param(IS_FMC_WRAP_MODE(Init->WrapMode));
  192. assert_param(IS_FMC_WAIT_SIGNAL_ACTIVE(Init->WaitSignalActive));
  193. assert_param(IS_FMC_WRITE_OPERATION(Init->WriteOperation));
  194. assert_param(IS_FMC_WAITE_SIGNAL(Init->WaitSignal));
  195. assert_param(IS_FMC_EXTENDED_MODE(Init->ExtendedMode));
  196. assert_param(IS_FMC_ASYNWAIT(Init->AsynchronousWait));
  197. assert_param(IS_FMC_WRITE_BURST(Init->WriteBurst));
  198. assert_param(IS_FMC_CONTINOUS_CLOCK(Init->ContinuousClock));
  199. /* Disable NORSRAM Device */
  200. __FMC_NORSRAM_DISABLE(Device, Init->NSBank);
  201. /* Set NORSRAM device control parameters */
  202. if (Init->MemoryType == FMC_MEMORY_TYPE_NOR)
  203. {
  204. MODIFY_REG(Device->BTCR[Init->NSBank], BCR_CLEAR_MASK, (uint32_t)(FMC_NORSRAM_FLASH_ACCESS_ENABLE
  205. | Init->DataAddressMux
  206. | Init->MemoryType
  207. | Init->MemoryDataWidth
  208. | Init->BurstAccessMode
  209. | Init->WaitSignalPolarity
  210. | Init->WrapMode
  211. | Init->WaitSignalActive
  212. | Init->WriteOperation
  213. | Init->WaitSignal
  214. | Init->ExtendedMode
  215. | Init->AsynchronousWait
  216. | Init->WriteBurst
  217. | Init->ContinuousClock
  218. )
  219. );
  220. }
  221. else
  222. {
  223. MODIFY_REG(Device->BTCR[Init->NSBank], BCR_CLEAR_MASK, (uint32_t)(FMC_NORSRAM_FLASH_ACCESS_DISABLE
  224. | Init->DataAddressMux
  225. | Init->MemoryType
  226. | Init->MemoryDataWidth
  227. | Init->BurstAccessMode
  228. | Init->WaitSignalPolarity
  229. | Init->WrapMode
  230. | Init->WaitSignalActive
  231. | Init->WriteOperation
  232. | Init->WaitSignal
  233. | Init->ExtendedMode
  234. | Init->AsynchronousWait
  235. | Init->WriteBurst
  236. | Init->ContinuousClock
  237. )
  238. );
  239. }
  240. /* Configure synchronous mode when Continuous clock is enabled for bank2..4 */
  241. if ((Init->ContinuousClock == FMC_CONTINUOUS_CLOCK_SYNC_ASYNC) && (Init->NSBank != FMC_NORSRAM_BANK1))
  242. {
  243. MODIFY_REG(Device->BTCR[FMC_NORSRAM_BANK1], FMC_BCR1_CCLKEN, Init->ContinuousClock);
  244. }
  245. return HAL_OK;
  246. }
  247. /**
  248. * @brief DeInitialize the FMC_NORSRAM peripheral
  249. * @param Device Pointer to NORSRAM device instance
  250. * @param ExDevice Pointer to NORSRAM extended mode device instance
  251. * @param Bank NORSRAM bank number
  252. * @retval HAL status
  253. */
  254. HAL_StatusTypeDef FMC_NORSRAM_DeInit(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_EXTENDED_TypeDef *ExDevice, uint32_t Bank)
  255. {
  256. /* Check the parameters */
  257. assert_param(IS_FMC_NORSRAM_DEVICE(Device));
  258. assert_param(IS_FMC_NORSRAM_EXTENDED_DEVICE(ExDevice));
  259. assert_param(IS_FMC_NORSRAM_BANK(Bank));
  260. /* Disable the FMC_NORSRAM device */
  261. __FMC_NORSRAM_DISABLE(Device, Bank);
  262. /* De-initialize the FMC_NORSRAM device */
  263. /* FMC_NORSRAM_BANK1 */
  264. if (Bank == FMC_NORSRAM_BANK1)
  265. {
  266. Device->BTCR[Bank] = 0x000030DB;
  267. }
  268. /* FMC_NORSRAM_BANK2, FMC_NORSRAM_BANK3 or FMC_NORSRAM_BANK4 */
  269. else
  270. {
  271. Device->BTCR[Bank] = 0x000030D2;
  272. }
  273. Device->BTCR[Bank + 1] = 0x0FFFFFFF;
  274. ExDevice->BWTR[Bank] = 0x0FFFFFFF;
  275. return HAL_OK;
  276. }
  277. /**
  278. * @brief Initialize the FMC_NORSRAM Timing according to the specified
  279. * parameters in the FMC_NORSRAM_TimingTypeDef
  280. * @param Device Pointer to NORSRAM device instance
  281. * @param Timing Pointer to NORSRAM Timing structure
  282. * @param Bank NORSRAM bank number
  283. * @retval HAL status
  284. */
  285. HAL_StatusTypeDef FMC_NORSRAM_Timing_Init(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank)
  286. {
  287. uint32_t tmpr = 0;
  288. /* Check the parameters */
  289. assert_param(IS_FMC_NORSRAM_DEVICE(Device));
  290. assert_param(IS_FMC_ADDRESS_SETUP_TIME(Timing->AddressSetupTime));
  291. assert_param(IS_FMC_ADDRESS_HOLD_TIME(Timing->AddressHoldTime));
  292. assert_param(IS_FMC_DATASETUP_TIME(Timing->DataSetupTime));
  293. assert_param(IS_FMC_TURNAROUND_TIME(Timing->BusTurnAroundDuration));
  294. assert_param(IS_FMC_CLK_DIV(Timing->CLKDivision));
  295. assert_param(IS_FMC_DATA_LATENCY(Timing->DataLatency));
  296. assert_param(IS_FMC_ACCESS_MODE(Timing->AccessMode));
  297. assert_param(IS_FMC_NORSRAM_BANK(Bank));
  298. /* Set FMC_NORSRAM device timing parameters */
  299. MODIFY_REG(Device->BTCR[Bank + 1], \
  300. BTR_CLEAR_MASK, \
  301. (uint32_t)(Timing->AddressSetupTime | \
  302. ((Timing->AddressHoldTime) << POSITION_VAL(FMC_BTRx_ADDHLD)) | \
  303. ((Timing->DataSetupTime) << POSITION_VAL(FMC_BTRx_DATAST)) | \
  304. ((Timing->BusTurnAroundDuration) << POSITION_VAL(FMC_BTRx_BUSTURN)) | \
  305. (((Timing->CLKDivision) - 1) << POSITION_VAL(FMC_BTRx_CLKDIV)) | \
  306. (((Timing->DataLatency) - 2) << POSITION_VAL(FMC_BTRx_DATLAT)) | \
  307. (Timing->AccessMode)));
  308. /* Configure Clock division value (in NORSRAM bank 1) when continuous clock is enabled */
  309. if (HAL_IS_BIT_SET(Device->BTCR[FMC_NORSRAM_BANK1], FMC_BCR1_CCLKEN))
  310. {
  311. tmpr = (uint32_t)(Device->BTCR[FMC_NORSRAM_BANK1 + 1] & ~(((uint32_t)0x0F) << POSITION_VAL(FMC_BTRx_CLKDIV)));
  312. tmpr |= (uint32_t)(((Timing->CLKDivision) - 1) << POSITION_VAL(FMC_BTRx_CLKDIV));
  313. MODIFY_REG(Device->BTCR[FMC_NORSRAM_BANK1 + 1], FMC_BTRx_CLKDIV, tmpr);
  314. }
  315. return HAL_OK;
  316. }
  317. /**
  318. * @brief Initialize the FMC_NORSRAM Extended mode Timing according to the specified
  319. * parameters in the FMC_NORSRAM_TimingTypeDef
  320. * @param Device Pointer to NORSRAM device instance
  321. * @param Timing Pointer to NORSRAM Timing structure
  322. * @param Bank NORSRAM bank number
  323. * @param ExtendedMode FMC Extended Mode
  324. * This parameter can be one of the following values:
  325. * @arg FMC_EXTENDED_MODE_DISABLE
  326. * @arg FMC_EXTENDED_MODE_ENABLE
  327. * @retval HAL status
  328. */
  329. HAL_StatusTypeDef FMC_NORSRAM_Extended_Timing_Init(FMC_NORSRAM_EXTENDED_TypeDef *Device, FMC_NORSRAM_TimingTypeDef *Timing, uint32_t Bank, uint32_t ExtendedMode)
  330. {
  331. /* Check the parameters */
  332. assert_param(IS_FMC_EXTENDED_MODE(ExtendedMode));
  333. /* Set NORSRAM device timing register for write configuration, if extended mode is used */
  334. if (ExtendedMode == FMC_EXTENDED_MODE_ENABLE)
  335. {
  336. /* Check the parameters */
  337. assert_param(IS_FMC_NORSRAM_EXTENDED_DEVICE(Device));
  338. assert_param(IS_FMC_ADDRESS_SETUP_TIME(Timing->AddressSetupTime));
  339. assert_param(IS_FMC_ADDRESS_HOLD_TIME(Timing->AddressHoldTime));
  340. assert_param(IS_FMC_DATASETUP_TIME(Timing->DataSetupTime));
  341. assert_param(IS_FMC_ACCESS_MODE(Timing->AccessMode));
  342. assert_param(IS_FMC_NORSRAM_BANK(Bank));
  343. /* Set NORSRAM device timing register for write configuration, if extended mode is used */
  344. MODIFY_REG(Device->BWTR[Bank], \
  345. BWTR_CLEAR_MASK, \
  346. (uint32_t)(Timing->AddressSetupTime | \
  347. ((Timing->AddressHoldTime) << POSITION_VAL(FMC_BWTRx_ADDHLD)) | \
  348. ((Timing->DataSetupTime) << POSITION_VAL(FMC_BWTRx_DATAST)) | \
  349. (Timing->AccessMode)));
  350. }
  351. else
  352. {
  353. Device->BWTR[Bank] = 0x0FFFFFFF;
  354. }
  355. return HAL_OK;
  356. }
  357. /**
  358. * @}
  359. */
  360. /** @defgroup FMC_NORSRAM_Group2 Control functions
  361. * @brief management functions
  362. *
  363. @verbatim
  364. ==============================================================================
  365. ##### FMC_NORSRAM Control functions #####
  366. ==============================================================================
  367. [..]
  368. This subsection provides a set of functions allowing to control dynamically
  369. the FMC NORSRAM interface.
  370. @endverbatim
  371. * @{
  372. */
  373. /**
  374. * @brief Enables dynamically FMC_NORSRAM write operation.
  375. * @param Device Pointer to NORSRAM device instance
  376. * @param Bank NORSRAM bank number
  377. * @retval HAL status
  378. */
  379. HAL_StatusTypeDef FMC_NORSRAM_WriteOperation_Enable(FMC_NORSRAM_TypeDef *Device, uint32_t Bank)
  380. {
  381. /* Check the parameters */
  382. assert_param(IS_FMC_NORSRAM_DEVICE(Device));
  383. assert_param(IS_FMC_NORSRAM_BANK(Bank));
  384. /* Enable write operation */
  385. SET_BIT(Device->BTCR[Bank], FMC_WRITE_OPERATION_ENABLE);
  386. return HAL_OK;
  387. }
  388. /**
  389. * @brief Disables dynamically FMC_NORSRAM write operation.
  390. * @param Device Pointer to NORSRAM device instance
  391. * @param Bank NORSRAM bank number
  392. * @retval HAL status
  393. */
  394. HAL_StatusTypeDef FMC_NORSRAM_WriteOperation_Disable(FMC_NORSRAM_TypeDef *Device, uint32_t Bank)
  395. {
  396. /* Check the parameters */
  397. assert_param(IS_FMC_NORSRAM_DEVICE(Device));
  398. assert_param(IS_FMC_NORSRAM_BANK(Bank));
  399. /* Disable write operation */
  400. CLEAR_BIT(Device->BTCR[Bank], FMC_WRITE_OPERATION_ENABLE);
  401. return HAL_OK;
  402. }
  403. /**
  404. * @}
  405. */
  406. /**
  407. * @}
  408. */
  409. /** @defgroup FMC_NAND FMC NAND Controller functions
  410. * @brief NAND Controller functions
  411. *
  412. @verbatim
  413. ==============================================================================
  414. ##### How to use NAND device driver #####
  415. ==============================================================================
  416. [..]
  417. This driver contains a set of APIs to interface with the FMC NAND banks in order
  418. to run the NAND external devices.
  419. (+) FMC NAND bank reset using the function FMC_NAND_DeInit()
  420. (+) FMC NAND bank control configuration using the function FMC_NAND_Init()
  421. (+) FMC NAND bank common space timing configuration using the function
  422. FMC_NAND_CommonSpace_Timing_Init()
  423. (+) FMC NAND bank attribute space timing configuration using the function
  424. FMC_NAND_AttributeSpace_Timing_Init()
  425. (+) FMC NAND bank enable/disable ECC correction feature using the functions
  426. FMC_NAND_ECC_Enable()/FMC_NAND_ECC_Disable()
  427. (+) FMC NAND bank get ECC correction code using the function FMC_NAND_GetECC()
  428. @endverbatim
  429. * @{
  430. */
  431. /** @defgroup FMC_NAND_Exported_Functions_Group1 Initialization and de-initialization functions
  432. * @brief Initialization and Configuration functions
  433. *
  434. @verbatim
  435. ==============================================================================
  436. ##### Initialization and de_initialization functions #####
  437. ==============================================================================
  438. [..]
  439. This section provides functions allowing to:
  440. (+) Initialize and configure the FMC NAND interface
  441. (+) De-initialize the FMC NAND interface
  442. (+) Configure the FMC clock and associated GPIOs
  443. @endverbatim
  444. * @{
  445. */
  446. /**
  447. * @brief Initializes the FMC_NAND device according to the specified
  448. * control parameters in the FMC_NAND_HandleTypeDef
  449. * @param Device Pointer to NAND device instance
  450. * @param Init Pointer to NAND Initialization structure
  451. * @retval HAL status
  452. */
  453. HAL_StatusTypeDef FMC_NAND_Init(FMC_NAND_TypeDef *Device, FMC_NAND_InitTypeDef *Init)
  454. {
  455. /* Check the parameters */
  456. assert_param(IS_FMC_NAND_DEVICE(Device));
  457. assert_param(IS_FMC_NAND_BANK(Init->NandBank));
  458. assert_param(IS_FMC_WAIT_FEATURE(Init->Waitfeature));
  459. assert_param(IS_FMC_NAND_MEMORY_WIDTH(Init->MemoryDataWidth));
  460. assert_param(IS_FMC_ECC_STATE(Init->EccComputation));
  461. assert_param(IS_FMC_ECCPAGE_SIZE(Init->ECCPageSize));
  462. assert_param(IS_FMC_TCLR_TIME(Init->TCLRSetupTime));
  463. assert_param(IS_FMC_TAR_TIME(Init->TARSetupTime));
  464. /* Set NAND device control parameters */
  465. if (Init->NandBank == FMC_NAND_BANK2)
  466. {
  467. /* NAND bank 2 registers configuration */
  468. MODIFY_REG(Device->PCR2, PCR_CLEAR_MASK, (Init->Waitfeature |
  469. FMC_PCR_MEMORY_TYPE_NAND |
  470. Init->MemoryDataWidth |
  471. Init->EccComputation |
  472. Init->ECCPageSize |
  473. ((Init->TCLRSetupTime) << POSITION_VAL(FMC_PCRx_TCLR)) |
  474. ((Init->TARSetupTime) << POSITION_VAL(FMC_PCRx_TAR))));
  475. }
  476. else
  477. {
  478. /* NAND bank 3 registers configuration */
  479. MODIFY_REG(Device->PCR3, PCR_CLEAR_MASK, (Init->Waitfeature |
  480. FMC_PCR_MEMORY_TYPE_NAND |
  481. Init->MemoryDataWidth |
  482. Init->EccComputation |
  483. Init->ECCPageSize |
  484. ((Init->TCLRSetupTime) << POSITION_VAL(FMC_PCRx_TCLR)) |
  485. ((Init->TARSetupTime) << POSITION_VAL(FMC_PCRx_TAR))));
  486. }
  487. return HAL_OK;
  488. }
  489. /**
  490. * @brief Initializes the FMC_NAND Common space Timing according to the specified
  491. * parameters in the FMC_NAND_PCC_TimingTypeDef
  492. * @param Device Pointer to NAND device instance
  493. * @param Timing Pointer to NAND timing structure
  494. * @param Bank NAND bank number
  495. * @retval HAL status
  496. */
  497. HAL_StatusTypeDef FMC_NAND_CommonSpace_Timing_Init(FMC_NAND_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank)
  498. {
  499. /* Check the parameters */
  500. assert_param(IS_FMC_NAND_DEVICE(Device));
  501. assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime));
  502. assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime));
  503. assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime));
  504. assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime));
  505. assert_param(IS_FMC_NAND_BANK(Bank));
  506. /* Set FMC_NAND device timing parameters */
  507. if (Bank == FMC_NAND_BANK2)
  508. {
  509. /* NAND bank 2 registers configuration */
  510. MODIFY_REG(Device->PMEM2, PMEM_CLEAR_MASK, (Timing->SetupTime | \
  511. ((Timing->WaitSetupTime) << POSITION_VAL(FMC_PMEMx_MEMWAITx)) | \
  512. ((Timing->HoldSetupTime) << POSITION_VAL(FMC_PMEMx_MEMHOLDx)) | \
  513. ((Timing->HiZSetupTime) << POSITION_VAL(FMC_PMEMx_MEMHIZx))));
  514. }
  515. else
  516. {
  517. /* NAND bank 3 registers configuration */
  518. MODIFY_REG(Device->PMEM3, PMEM_CLEAR_MASK, (Timing->SetupTime | \
  519. ((Timing->WaitSetupTime) << POSITION_VAL(FMC_PMEMx_MEMWAITx)) | \
  520. ((Timing->HoldSetupTime) << POSITION_VAL(FMC_PMEMx_MEMHOLDx)) | \
  521. ((Timing->HiZSetupTime) << POSITION_VAL(FMC_PMEMx_MEMHIZx))));
  522. }
  523. return HAL_OK;
  524. }
  525. /**
  526. * @brief Initializes the FMC_NAND Attribute space Timing according to the specified
  527. * parameters in the FMC_NAND_PCC_TimingTypeDef
  528. * @param Device Pointer to NAND device instance
  529. * @param Timing Pointer to NAND timing structure
  530. * @param Bank NAND bank number
  531. * @retval HAL status
  532. */
  533. HAL_StatusTypeDef FMC_NAND_AttributeSpace_Timing_Init(FMC_NAND_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing, uint32_t Bank)
  534. {
  535. /* Check the parameters */
  536. assert_param(IS_FMC_NAND_DEVICE(Device));
  537. assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime));
  538. assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime));
  539. assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime));
  540. assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime));
  541. assert_param(IS_FMC_NAND_BANK(Bank));
  542. /* Set FMC_NAND device timing parameters */
  543. if (Bank == FMC_NAND_BANK2)
  544. {
  545. /* NAND bank 2 registers configuration */
  546. MODIFY_REG(Device->PATT2, PATT_CLEAR_MASK, (Timing->SetupTime | \
  547. ((Timing->WaitSetupTime) << POSITION_VAL(FMC_PATTx_ATTWAITx)) | \
  548. ((Timing->HoldSetupTime) << POSITION_VAL(FMC_PATTx_ATTHOLDx)) | \
  549. ((Timing->HiZSetupTime) << POSITION_VAL(FMC_PATTx_ATTHIZx))));
  550. }
  551. else
  552. {
  553. /* NAND bank 3 registers configuration */
  554. MODIFY_REG(Device->PATT3, PATT_CLEAR_MASK, (Timing->SetupTime | \
  555. ((Timing->WaitSetupTime) << POSITION_VAL(FMC_PATTx_ATTWAITx)) | \
  556. ((Timing->HoldSetupTime) << POSITION_VAL(FMC_PATTx_ATTHOLDx)) | \
  557. ((Timing->HiZSetupTime) << POSITION_VAL(FMC_PATTx_ATTHIZx))));
  558. }
  559. return HAL_OK;
  560. }
  561. /**
  562. * @brief DeInitialize the FMC_NAND device
  563. * @param Device Pointer to NAND device instance
  564. * @param Bank NAND bank number
  565. * @retval HAL status
  566. */
  567. HAL_StatusTypeDef FMC_NAND_DeInit(FMC_NAND_TypeDef *Device, uint32_t Bank)
  568. {
  569. /* Check the parameters */
  570. assert_param(IS_FMC_NAND_DEVICE(Device));
  571. assert_param(IS_FMC_NAND_BANK(Bank));
  572. /* Disable the NAND Bank */
  573. __FMC_NAND_DISABLE(Device, Bank);
  574. /* De-initialize the NAND Bank */
  575. if (Bank == FMC_NAND_BANK2)
  576. {
  577. /* Set the FMC_NAND_BANK2 registers to their reset values */
  578. WRITE_REG(Device->PCR2, 0x00000018);
  579. WRITE_REG(Device->SR2, 0x00000040);
  580. WRITE_REG(Device->PMEM2, 0xFCFCFCFC);
  581. WRITE_REG(Device->PATT2, 0xFCFCFCFC);
  582. }
  583. /* FMC_Bank3_NAND */
  584. else
  585. {
  586. /* Set the FMC_NAND_BANK3 registers to their reset values */
  587. WRITE_REG(Device->PCR3, 0x00000018);
  588. WRITE_REG(Device->SR3, 0x00000040);
  589. WRITE_REG(Device->PMEM3, 0xFCFCFCFC);
  590. WRITE_REG(Device->PATT3, 0xFCFCFCFC);
  591. }
  592. return HAL_OK;
  593. }
  594. /**
  595. * @}
  596. */
  597. /** @defgroup FMC_NAND_Exported_Functions_Group2 Peripheral Control functions
  598. * @brief management functions
  599. *
  600. @verbatim
  601. ==============================================================================
  602. ##### FMC_NAND Control functions #####
  603. ==============================================================================
  604. [..]
  605. This subsection provides a set of functions allowing to control dynamically
  606. the FMC NAND interface.
  607. @endverbatim
  608. * @{
  609. */
  610. /**
  611. * @brief Enables dynamically FMC_NAND ECC feature.
  612. * @param Device Pointer to NAND device instance
  613. * @param Bank NAND bank number
  614. * @retval HAL status
  615. */
  616. HAL_StatusTypeDef FMC_NAND_ECC_Enable(FMC_NAND_TypeDef *Device, uint32_t Bank)
  617. {
  618. /* Check the parameters */
  619. assert_param(IS_FMC_NAND_DEVICE(Device));
  620. assert_param(IS_FMC_NAND_BANK(Bank));
  621. /* Enable ECC feature */
  622. if (Bank == FMC_NAND_BANK2)
  623. {
  624. SET_BIT(Device->PCR2, FMC_PCRx_ECCEN);
  625. }
  626. else
  627. {
  628. SET_BIT(Device->PCR3, FMC_PCRx_ECCEN);
  629. }
  630. return HAL_OK;
  631. }
  632. /**
  633. * @brief Disables dynamically FMC_NAND ECC feature.
  634. * @param Device Pointer to NAND device instance
  635. * @param Bank NAND bank number
  636. * @retval HAL status
  637. */
  638. HAL_StatusTypeDef FMC_NAND_ECC_Disable(FMC_NAND_TypeDef *Device, uint32_t Bank)
  639. {
  640. /* Check the parameters */
  641. assert_param(IS_FMC_NAND_DEVICE(Device));
  642. assert_param(IS_FMC_NAND_BANK(Bank));
  643. /* Disable ECC feature */
  644. if (Bank == FMC_NAND_BANK2)
  645. {
  646. CLEAR_BIT(Device->PCR2, FMC_PCRx_ECCEN);
  647. }
  648. else
  649. {
  650. CLEAR_BIT(Device->PCR3, FMC_PCRx_ECCEN);
  651. }
  652. return HAL_OK;
  653. }
  654. /**
  655. * @brief Disables dynamically FMC_NAND ECC feature.
  656. * @param Device Pointer to NAND device instance
  657. * @param ECCval Pointer to ECC value
  658. * @param Bank NAND bank number
  659. * @param Timeout Timeout wait value
  660. * @retval HAL status
  661. */
  662. HAL_StatusTypeDef FMC_NAND_GetECC(FMC_NAND_TypeDef *Device, uint32_t *ECCval, uint32_t Bank, uint32_t Timeout)
  663. {
  664. uint32_t tickstart = 0;
  665. /* Check the parameters */
  666. assert_param(IS_FMC_NAND_DEVICE(Device));
  667. assert_param(IS_FMC_NAND_BANK(Bank));
  668. /* Get tick */
  669. tickstart = HAL_GetTick();
  670. /* Wait until FIFO is empty */
  671. while (__FMC_NAND_GET_FLAG(Device, Bank, FMC_FLAG_FEMPT) == RESET)
  672. {
  673. /* Check for the Timeout */
  674. if (Timeout != HAL_MAX_DELAY)
  675. {
  676. if ((Timeout == 0) || ((HAL_GetTick() - tickstart) > Timeout))
  677. {
  678. return HAL_TIMEOUT;
  679. }
  680. }
  681. }
  682. if (Bank == FMC_NAND_BANK2)
  683. {
  684. /* Get the ECCR2 register value */
  685. *ECCval = (uint32_t)Device->ECCR2;
  686. }
  687. else
  688. {
  689. /* Get the ECCR3 register value */
  690. *ECCval = (uint32_t)Device->ECCR3;
  691. }
  692. return HAL_OK;
  693. }
  694. /**
  695. * @}
  696. */
  697. /**
  698. * @}
  699. */
  700. /** @defgroup FMC_PCCARD FMC PCCARD Controller functions
  701. * @brief PCCARD Controller functions
  702. *
  703. @verbatim
  704. ==============================================================================
  705. ##### How to use PCCARD device driver #####
  706. ==============================================================================
  707. [..]
  708. This driver contains a set of APIs to interface with the FMC PCCARD bank in order
  709. to run the PCCARD/compact flash external devices.
  710. (+) FMC PCCARD bank reset using the function FMC_PCCARD_DeInit()
  711. (+) FMC PCCARD bank control configuration using the function FMC_PCCARD_Init()
  712. (+) FMC PCCARD bank common space timing configuration using the function
  713. FMC_PCCARD_CommonSpace_Timing_Init()
  714. (+) FMC PCCARD bank attribute space timing configuration using the function
  715. FMC_PCCARD_AttributeSpace_Timing_Init()
  716. (+) FMC PCCARD bank IO space timing configuration using the function
  717. FMC_PCCARD_IOSpace_Timing_Init()
  718. @endverbatim
  719. * @{
  720. */
  721. /** @defgroup FMC_PCCARD_Exported_Functions_Group1 Initialization and de-initialization functions
  722. * @brief Initialization and Configuration functions
  723. *
  724. @verbatim
  725. ==============================================================================
  726. ##### Initialization and de_initialization functions #####
  727. ==============================================================================
  728. [..]
  729. This section provides functions allowing to:
  730. (+) Initialize and configure the FMC PCCARD interface
  731. (+) De-initialize the FMC PCCARD interface
  732. (+) Configure the FMC clock and associated GPIOs
  733. @endverbatim
  734. * @{
  735. */
  736. /**
  737. * @brief Initializes the FMC_PCCARD device according to the specified
  738. * control parameters in the FMC_PCCARD_HandleTypeDef
  739. * @param Device Pointer to PCCARD device instance
  740. * @param Init Pointer to PCCARD Initialization structure
  741. * @retval HAL status
  742. */
  743. HAL_StatusTypeDef FMC_PCCARD_Init(FMC_PCCARD_TypeDef *Device, FMC_PCCARD_InitTypeDef *Init)
  744. {
  745. /* Check the parameters */
  746. assert_param(IS_FMC_PCCARD_DEVICE(Device));
  747. assert_param(IS_FMC_WAIT_FEATURE(Init->Waitfeature));
  748. assert_param(IS_FMC_TCLR_TIME(Init->TCLRSetupTime));
  749. assert_param(IS_FMC_TAR_TIME(Init->TARSetupTime));
  750. /* Set FMC_PCCARD device control parameters */
  751. MODIFY_REG(Device->PCR4,
  752. (FMC_PCRx_PTYP | FMC_PCRx_PWAITEN | FMC_PCRx_PWID |
  753. FMC_PCRx_TCLR | FMC_PCRx_TAR),
  754. (FMC_PCR_MEMORY_TYPE_PCCARD |
  755. Init->Waitfeature |
  756. FMC_NAND_PCC_MEM_BUS_WIDTH_16 |
  757. (Init->TCLRSetupTime << POSITION_VAL(FMC_PCRx_TCLR)) |
  758. (Init->TARSetupTime << POSITION_VAL(FMC_PCRx_TAR))));
  759. return HAL_OK;
  760. }
  761. /**
  762. * @brief Initializes the FMC_PCCARD Common space Timing according to the specified
  763. * parameters in the FMC_NAND_PCC_TimingTypeDef
  764. * @param Device Pointer to PCCARD device instance
  765. * @param Timing Pointer to PCCARD timing structure
  766. * @retval HAL status
  767. */
  768. HAL_StatusTypeDef FMC_PCCARD_CommonSpace_Timing_Init(FMC_PCCARD_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing)
  769. {
  770. /* Check the parameters */
  771. assert_param(IS_FMC_PCCARD_DEVICE(Device));
  772. assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime));
  773. assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime));
  774. assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime));
  775. assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime));
  776. /* Set PCCARD timing parameters */
  777. MODIFY_REG(Device->PMEM4, PMEM_CLEAR_MASK,
  778. (Timing->SetupTime |
  779. ((Timing->WaitSetupTime) << POSITION_VAL(FMC_PMEMx_MEMWAITx)) |
  780. ((Timing->HoldSetupTime) << POSITION_VAL(FMC_PMEMx_MEMHOLDx)) |
  781. ((Timing->HiZSetupTime) << POSITION_VAL(FMC_PMEMx_MEMHIZx))));
  782. return HAL_OK;
  783. }
  784. /**
  785. * @brief Initializes the FMC_PCCARD Attribute space Timing according to the specified
  786. * parameters in the FMC_NAND_PCC_TimingTypeDef
  787. * @param Device Pointer to PCCARD device instance
  788. * @param Timing Pointer to PCCARD timing structure
  789. * @retval HAL status
  790. */
  791. HAL_StatusTypeDef FMC_PCCARD_AttributeSpace_Timing_Init(FMC_PCCARD_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing)
  792. {
  793. /* Check the parameters */
  794. assert_param(IS_FMC_PCCARD_DEVICE(Device));
  795. assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime));
  796. assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime));
  797. assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime));
  798. assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime));
  799. /* Set PCCARD timing parameters */
  800. MODIFY_REG(Device->PATT4, PATT_CLEAR_MASK, \
  801. (Timing->SetupTime | \
  802. ((Timing->WaitSetupTime) << POSITION_VAL(FMC_PATTx_ATTWAITx)) | \
  803. ((Timing->HoldSetupTime) << POSITION_VAL(FMC_PATTx_ATTHOLDx)) | \
  804. ((Timing->HiZSetupTime) << POSITION_VAL(FMC_PATTx_ATTHIZx))));
  805. return HAL_OK;
  806. }
  807. /**
  808. * @brief Initializes the FMC_PCCARD IO space Timing according to the specified
  809. * parameters in the FMC_NAND_PCC_TimingTypeDef
  810. * @param Device Pointer to PCCARD device instance
  811. * @param Timing Pointer to PCCARD timing structure
  812. * @retval HAL status
  813. */
  814. HAL_StatusTypeDef FMC_PCCARD_IOSpace_Timing_Init(FMC_PCCARD_TypeDef *Device, FMC_NAND_PCC_TimingTypeDef *Timing)
  815. {
  816. /* Check the parameters */
  817. assert_param(IS_FMC_PCCARD_DEVICE(Device));
  818. assert_param(IS_FMC_SETUP_TIME(Timing->SetupTime));
  819. assert_param(IS_FMC_WAIT_TIME(Timing->WaitSetupTime));
  820. assert_param(IS_FMC_HOLD_TIME(Timing->HoldSetupTime));
  821. assert_param(IS_FMC_HIZ_TIME(Timing->HiZSetupTime));
  822. /* Set FMC_PCCARD device timing parameters */
  823. MODIFY_REG(Device->PIO4, PIO4_CLEAR_MASK, \
  824. (Timing->SetupTime | \
  825. (Timing->WaitSetupTime << POSITION_VAL(FMC_PIO4_IOWAIT4)) | \
  826. (Timing->HoldSetupTime << POSITION_VAL(FMC_PIO4_IOHOLD4)) | \
  827. (Timing->HiZSetupTime << POSITION_VAL(FMC_PIO4_IOHIZ4))));
  828. return HAL_OK;
  829. }
  830. /**
  831. * @brief DeInitialize the FMC_PCCARD device
  832. * @param Device Pointer to PCCARD device instance
  833. * @retval HAL status
  834. */
  835. HAL_StatusTypeDef FMC_PCCARD_DeInit(FMC_PCCARD_TypeDef *Device)
  836. {
  837. /* Check the parameters */
  838. assert_param(IS_FMC_PCCARD_DEVICE(Device));
  839. /* Disable the FMC_PCCARD device */
  840. __FMC_PCCARD_DISABLE(Device);
  841. /* De-initialize the FMC_PCCARD device */
  842. WRITE_REG(Device->PCR4, 0x00000018);
  843. WRITE_REG(Device->SR4, 0x00000040);
  844. WRITE_REG(Device->PMEM4, 0xFCFCFCFC);
  845. WRITE_REG(Device->PATT4, 0xFCFCFCFC);
  846. WRITE_REG(Device->PIO4, 0xFCFCFCFC);
  847. return HAL_OK;
  848. }
  849. /**
  850. * @}
  851. */
  852. /**
  853. * @}
  854. */
  855. /**
  856. * @}
  857. */
  858. /**
  859. * @}
  860. */
  861. #endif /* defined(HAL_SRAM_MODULE_ENABLED) || defined(HAL_NOR_MODULE_ENABLED) || defined(HAL_PCCARD_MODULE_ENABLED) || defined(HAL_NAND_MODULE_ENABLED) */
  862. #endif /* FMC_BANK1 */
  863. /**
  864. * @}
  865. */
  866. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/