stm32l4xx_hal_gfxmmu.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_hal_gfxmmu.c
  4. * @author MCD Application Team
  5. * @brief This file provides firmware functions to manage the following
  6. * functionalities of the Graphic MMU (GFXMMU) peripheral:
  7. * + Initialization and De-initialization.
  8. * + LUT configuration.
  9. * + Modify physical buffer adresses.
  10. * + Error management.
  11. *
  12. @verbatim
  13. ==============================================================================
  14. ##### How to use this driver #####
  15. ==============================================================================
  16. [..]
  17. *** Initialization ***
  18. ======================
  19. [..]
  20. (#) As prerequisite, fill in the HAL_GFXMMU_MspInit() :
  21. (++) Enable GFXMMU clock interface with __HAL_RCC_GFXMMU_CLK_ENABLE().
  22. (++) If interrupts are used, enable and configure GFXMMU global
  23. interrupt with HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ().
  24. (#) Configure the number of blocks per line, default value, physical
  25. buffer addresses and interrupts using the HAL_GFXMMU_Init() function.
  26. *** LUT configuration ***
  27. =========================
  28. [..]
  29. (#) Use HAL_GFXMMU_DisableLutLines() to deactivate all LUT lines (or a
  30. range of lines).
  31. (#) Use HAL_GFXMMU_ConfigLut() to copy LUT from flash to look up RAM.
  32. (#) Use HAL_GFXMMU_ConfigLutLine() to configure one line of LUT.
  33. *** Modify physical buffer adresses ***
  34. =======================================
  35. [..]
  36. (#) Use HAL_GFXMMU_ModifyBuffers() to modify physical buffer addresses.
  37. *** Error management ***
  38. ========================
  39. [..]
  40. (#) If interrupts are used, HAL_GFXMMU_IRQHandler() will be called when
  41. an error occurs. This function will call HAL_GFXMMU_ErrorCallback().
  42. Use HAL_GFXMMU_GetError() to get the error code.
  43. *** De-initialization ***
  44. =========================
  45. [..]
  46. (#) As prerequisite, fill in the HAL_GFXMMU_MspDeInit() :
  47. (++) Disable GFXMMU clock interface with __HAL_RCC_GFXMMU_CLK_ENABLE().
  48. (++) If interrupts has been used, disable GFXMMU global interrupt with
  49. HAL_NVIC_DisableIRQ().
  50. (#) De-initialize GFXMMU using the HAL_GFXMMU_DeInit() function.
  51. @endverbatim
  52. ******************************************************************************
  53. * @attention
  54. *
  55. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  56. *
  57. * Redistribution and use in source and binary forms, with or without modification,
  58. * are permitted provided that the following conditions are met:
  59. * 1. Redistributions of source code must retain the above copyright notice,
  60. * this list of conditions and the following disclaimer.
  61. * 2. Redistributions in binary form must reproduce the above copyright notice,
  62. * this list of conditions and the following disclaimer in the documentation
  63. * and/or other materials provided with the distribution.
  64. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  65. * may be used to endorse or promote products derived from this software
  66. * without specific prior written permission.
  67. *
  68. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  69. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  70. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  71. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  72. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  73. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  74. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  75. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  76. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  77. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  78. *
  79. ******************************************************************************
  80. */
  81. /* Includes ------------------------------------------------------------------*/
  82. #include "stm32l4xx_hal.h"
  83. /** @addtogroup STM32L4xx_HAL_Driver
  84. * @{
  85. */
  86. #ifdef HAL_GFXMMU_MODULE_ENABLED
  87. #if defined(GFXMMU)
  88. /** @defgroup GFXMMU GFXMMU
  89. * @brief GFXMMU HAL driver module
  90. * @{
  91. */
  92. /* Private typedef -----------------------------------------------------------*/
  93. /* Private define ------------------------------------------------------------*/
  94. #define GFXMMU_LUTXL_FVB_OFFSET 8U
  95. #define GFXMMU_LUTXL_LVB_OFFSET 16U
  96. #define GFXMMU_CR_ITS_MASK 0x1FU
  97. /* Private macro -------------------------------------------------------------*/
  98. /* Private variables ---------------------------------------------------------*/
  99. /* Private function prototypes -----------------------------------------------*/
  100. /* Exported functions --------------------------------------------------------*/
  101. /** @defgroup GFXMMU_Exported_Functions GFXMMU Exported Functions
  102. * @{
  103. */
  104. /** @defgroup GFXMMU_Exported_Functions_Group1 Initialization and de-initialization functions
  105. * @brief Initialization and de-initialization functions
  106. *
  107. @verbatim
  108. ==============================================================================
  109. ##### Initialization and de-initialization functions #####
  110. ==============================================================================
  111. [..] This section provides functions allowing to:
  112. (+) Initialize the GFXMMU.
  113. (+) De-initialize the GFXMMU.
  114. @endverbatim
  115. * @{
  116. */
  117. /**
  118. * @brief Initialize the GFXMMU according to the specified parameters in the
  119. * GFXMMU_InitTypeDef structure and initialize the associated handle.
  120. * @param hgfxmmu GFXMMU handle.
  121. * @retval HAL status.
  122. */
  123. HAL_StatusTypeDef HAL_GFXMMU_Init(GFXMMU_HandleTypeDef *hgfxmmu)
  124. {
  125. HAL_StatusTypeDef status = HAL_OK;
  126. /* Check GFXMMU handle */
  127. if(hgfxmmu == NULL)
  128. {
  129. status = HAL_ERROR;
  130. }
  131. else
  132. {
  133. /* Check parameters */
  134. assert_param(IS_GFXMMU_ALL_INSTANCE(hgfxmmu->Instance));
  135. assert_param(IS_GFXMMU_BLOCKS_PER_LINE(hgfxmmu->Init.BlocksPerLine));
  136. assert_param(IS_GFXMMU_BUFFER_ADDRESS(hgfxmmu->Init.Buffers.Buf0Address));
  137. assert_param(IS_GFXMMU_BUFFER_ADDRESS(hgfxmmu->Init.Buffers.Buf1Address));
  138. assert_param(IS_GFXMMU_BUFFER_ADDRESS(hgfxmmu->Init.Buffers.Buf2Address));
  139. assert_param(IS_GFXMMU_BUFFER_ADDRESS(hgfxmmu->Init.Buffers.Buf3Address));
  140. assert_param(IS_FUNCTIONAL_STATE(hgfxmmu->Init.Interrupts.Activation));
  141. /* Call GFXMMU MSP init function */
  142. HAL_GFXMMU_MspInit(hgfxmmu);
  143. /* Configure blocks per line and interrupts parameters on GFXMMU_CR register */
  144. hgfxmmu->Instance->CR &= ~(GFXMMU_CR_B0OIE | GFXMMU_CR_B1OIE | GFXMMU_CR_B2OIE | GFXMMU_CR_B3OIE |
  145. GFXMMU_CR_AMEIE | GFXMMU_CR_192BM);
  146. hgfxmmu->Instance->CR |= (hgfxmmu->Init.BlocksPerLine);
  147. if(hgfxmmu->Init.Interrupts.Activation == ENABLE)
  148. {
  149. assert_param(IS_GFXMMU_INTERRUPTS(hgfxmmu->Init.Interrupts.UsedInterrupts));
  150. hgfxmmu->Instance->CR |= hgfxmmu->Init.Interrupts.UsedInterrupts;
  151. }
  152. /* Configure default value on GFXMMU_DVR register */
  153. hgfxmmu->Instance->DVR = hgfxmmu->Init.DefaultValue;
  154. /* Configure physical buffer adresses on GFXMMU_BxCR registers */
  155. hgfxmmu->Instance->B0CR = hgfxmmu->Init.Buffers.Buf0Address;
  156. hgfxmmu->Instance->B1CR = hgfxmmu->Init.Buffers.Buf1Address;
  157. hgfxmmu->Instance->B2CR = hgfxmmu->Init.Buffers.Buf2Address;
  158. hgfxmmu->Instance->B3CR = hgfxmmu->Init.Buffers.Buf3Address;
  159. /* Reset GFXMMU error code */
  160. hgfxmmu->ErrorCode = GFXMMU_ERROR_NONE;
  161. /* Set GFXMMU to ready state */
  162. hgfxmmu->State = HAL_GFXMMU_STATE_READY;
  163. }
  164. /* Return function status */
  165. return status;
  166. }
  167. /**
  168. * @brief De-initialize the GFXMMU.
  169. * @param hgfxmmu GFXMMU handle.
  170. * @retval HAL status.
  171. */
  172. HAL_StatusTypeDef HAL_GFXMMU_DeInit(GFXMMU_HandleTypeDef *hgfxmmu)
  173. {
  174. HAL_StatusTypeDef status = HAL_OK;
  175. /* Check GFXMMU handle */
  176. if(hgfxmmu == NULL)
  177. {
  178. status = HAL_ERROR;
  179. }
  180. else
  181. {
  182. /* Check parameters */
  183. assert_param(IS_GFXMMU_ALL_INSTANCE(hgfxmmu->Instance));
  184. /* Disable all interrupts on GFXMMU_CR register */
  185. hgfxmmu->Instance->CR &= ~(GFXMMU_CR_B0OIE | GFXMMU_CR_B1OIE | GFXMMU_CR_B2OIE | GFXMMU_CR_B3OIE |
  186. GFXMMU_CR_AMEIE);
  187. /* Call GFXMMU MSP de-init function */
  188. HAL_GFXMMU_MspDeInit(hgfxmmu);
  189. /* Set GFXMMU to reset state */
  190. hgfxmmu->State = HAL_GFXMMU_STATE_RESET;
  191. }
  192. /* Return function status */
  193. return status;
  194. }
  195. /**
  196. * @brief Initialize the GFXMMU MSP.
  197. * @param hgfxmmu GFXMMU handle.
  198. * @retval None.
  199. */
  200. __weak void HAL_GFXMMU_MspInit(GFXMMU_HandleTypeDef *hgfxmmu)
  201. {
  202. /* Prevent unused argument(s) compilation warning */
  203. UNUSED(hgfxmmu);
  204. /* NOTE : This function should not be modified, when the function is needed,
  205. the HAL_GFXMMU_MspInit could be implemented in the user file.
  206. */
  207. }
  208. /**
  209. * @brief De-initialize the GFXMMU MSP.
  210. * @param hgfxmmu GFXMMU handle.
  211. * @retval None.
  212. */
  213. __weak void HAL_GFXMMU_MspDeInit(GFXMMU_HandleTypeDef *hgfxmmu)
  214. {
  215. /* Prevent unused argument(s) compilation warning */
  216. UNUSED(hgfxmmu);
  217. /* NOTE : This function should not be modified, when the function is needed,
  218. the HAL_GFXMMU_MspDeInit could be implemented in the user file.
  219. */
  220. }
  221. /**
  222. * @}
  223. */
  224. /** @defgroup GFXMMU_Exported_Functions_Group2 Operations functions
  225. * @brief GFXMMU operation functions
  226. *
  227. @verbatim
  228. ==============================================================================
  229. ##### Operation functions #####
  230. ==============================================================================
  231. [..] This section provides functions allowing to:
  232. (+) Configure LUT.
  233. (+) Modify physical buffer adresses.
  234. (+) Manage error.
  235. @endverbatim
  236. * @{
  237. */
  238. /**
  239. * @brief This function allows to copy LUT from flash to look up RAM.
  240. * @param hgfxmmu GFXMMU handle.
  241. * @param FirstLine First line enabled on LUT.
  242. * This parameter must be a number between Min_Data = 0 and Max_Data = 1023.
  243. * @param LinesNumber Number of lines enabled on LUT.
  244. * This parameter must be a number between Min_Data = 1 and Max_Data = 1024.
  245. * @param Address Start address of LUT in flash.
  246. * @retval HAL status.
  247. */
  248. HAL_StatusTypeDef HAL_GFXMMU_ConfigLut(GFXMMU_HandleTypeDef *hgfxmmu,
  249. uint32_t FirstLine,
  250. uint32_t LinesNumber,
  251. uint32_t Address)
  252. {
  253. HAL_StatusTypeDef status = HAL_OK;
  254. /* Check parameters */
  255. assert_param(IS_GFXMMU_ALL_INSTANCE(hgfxmmu->Instance));
  256. assert_param(IS_GFXMMU_LUT_LINE(FirstLine));
  257. assert_param(IS_GFXMMU_LUT_LINES_NUMBER(LinesNumber));
  258. /* Check GFXMMU state and coherent parameters */
  259. if((hgfxmmu->State != HAL_GFXMMU_STATE_READY) || ((FirstLine + LinesNumber) > 1024U))
  260. {
  261. status = HAL_ERROR;
  262. }
  263. else
  264. {
  265. uint32_t current_address, current_line, lutxl_address, lutxh_address;
  266. /* Initialize local variables */
  267. current_address = Address;
  268. current_line = 0U;
  269. lutxl_address = (uint32_t) &(hgfxmmu->Instance->LUT[2U * FirstLine]);
  270. lutxh_address = (uint32_t) &(hgfxmmu->Instance->LUT[(2U * FirstLine) + 1U]);
  271. /* Copy LUT from flash to look up RAM */
  272. while(current_line < LinesNumber)
  273. {
  274. *((uint32_t *)lutxl_address) = *((uint32_t *)current_address);
  275. current_address += 4U;
  276. *((uint32_t *)lutxh_address) = *((uint32_t *)current_address);
  277. current_address += 4U;
  278. lutxl_address += 8U;
  279. lutxh_address += 8U;
  280. current_line++;
  281. }
  282. }
  283. /* Return function status */
  284. return status;
  285. }
  286. /**
  287. * @brief This function allows to disable a range of LUT lines.
  288. * @param hgfxmmu GFXMMU handle.
  289. * @param FirstLine First line to disable on LUT.
  290. * This parameter must be a number between Min_Data = 0 and Max_Data = 1023.
  291. * @param LinesNumber Number of lines to disable on LUT.
  292. * This parameter must be a number between Min_Data = 1 and Max_Data = 1024.
  293. * @retval HAL status.
  294. */
  295. HAL_StatusTypeDef HAL_GFXMMU_DisableLutLines(GFXMMU_HandleTypeDef *hgfxmmu,
  296. uint32_t FirstLine,
  297. uint32_t LinesNumber)
  298. {
  299. HAL_StatusTypeDef status = HAL_OK;
  300. /* Check parameters */
  301. assert_param(IS_GFXMMU_ALL_INSTANCE(hgfxmmu->Instance));
  302. assert_param(IS_GFXMMU_LUT_LINE(FirstLine));
  303. assert_param(IS_GFXMMU_LUT_LINES_NUMBER(LinesNumber));
  304. /* Check GFXMMU state and coherent parameters */
  305. if((hgfxmmu->State != HAL_GFXMMU_STATE_READY) || ((FirstLine + LinesNumber) > 1024U))
  306. {
  307. status = HAL_ERROR;
  308. }
  309. else
  310. {
  311. uint32_t current_line, lutxl_address, lutxh_address;
  312. /* Initialize local variables */
  313. current_line = 0U;
  314. lutxl_address = (uint32_t) &(hgfxmmu->Instance->LUT[2U * FirstLine]);
  315. lutxh_address = (uint32_t) &(hgfxmmu->Instance->LUT[(2U * FirstLine) + 1U]);
  316. /* Disable LUT lines */
  317. while(current_line < LinesNumber)
  318. {
  319. *((uint32_t *)lutxl_address) = 0U;
  320. *((uint32_t *)lutxh_address) = 0U;
  321. lutxl_address += 8U;
  322. lutxh_address += 8U;
  323. current_line++;
  324. }
  325. }
  326. /* Return function status */
  327. return status;
  328. }
  329. /**
  330. * @brief This function allows to configure one line of LUT.
  331. * @param hgfxmmu GFXMMU handle.
  332. * @param lutLine LUT line parameters.
  333. * @retval HAL status.
  334. */
  335. HAL_StatusTypeDef HAL_GFXMMU_ConfigLutLine(GFXMMU_HandleTypeDef *hgfxmmu, GFXMMU_LutLineTypeDef *lutLine)
  336. {
  337. HAL_StatusTypeDef status = HAL_OK;
  338. /* Check parameters */
  339. assert_param(IS_GFXMMU_ALL_INSTANCE(hgfxmmu->Instance));
  340. assert_param(IS_GFXMMU_LUT_LINE(lutLine->LineNumber));
  341. assert_param(IS_GFXMMU_LUT_LINE_STATUS(lutLine->LineStatus));
  342. assert_param(IS_GFXMMU_LUT_BLOCK(lutLine->FirstVisibleBlock));
  343. assert_param(IS_GFXMMU_LUT_BLOCK(lutLine->LastVisibleBlock));
  344. assert_param(IS_GFXMMU_LUT_LINE_OFFSET(lutLine->LineOffset));
  345. /* Check GFXMMU state */
  346. if(hgfxmmu->State != HAL_GFXMMU_STATE_READY)
  347. {
  348. status = HAL_ERROR;
  349. }
  350. else
  351. {
  352. uint32_t lutxl_address, lutxh_address;
  353. /* Initialize local variables */
  354. lutxl_address = (uint32_t) &(hgfxmmu->Instance->LUT[2U * lutLine->LineNumber]);
  355. lutxh_address = (uint32_t) &(hgfxmmu->Instance->LUT[(2U * lutLine->LineNumber) + 1U]);
  356. /* Configure LUT line */
  357. if(lutLine->LineStatus == GFXMMU_LUT_LINE_ENABLE)
  358. {
  359. /* Enable and configure LUT line */
  360. *((uint32_t *)lutxl_address) = (lutLine->LineStatus |
  361. (lutLine->FirstVisibleBlock << GFXMMU_LUTXL_FVB_OFFSET) |
  362. (lutLine->LastVisibleBlock << GFXMMU_LUTXL_LVB_OFFSET));
  363. *((uint32_t *)lutxh_address) = lutLine->LineOffset;
  364. }
  365. else
  366. {
  367. /* Disable LUT line */
  368. *((uint32_t *)lutxl_address) = 0U;
  369. *((uint32_t *)lutxh_address) = 0U;
  370. }
  371. }
  372. /* Return function status */
  373. return status;
  374. }
  375. /**
  376. * @brief This function allows to modify physical buffer addresses.
  377. * @param hgfxmmu GFXMMU handle.
  378. * @param Buffers Buffers parameters.
  379. * @retval HAL status.
  380. */
  381. HAL_StatusTypeDef HAL_GFXMMU_ModifyBuffers(GFXMMU_HandleTypeDef *hgfxmmu, GFXMMU_BuffersTypeDef *Buffers)
  382. {
  383. HAL_StatusTypeDef status = HAL_OK;
  384. /* Check parameters */
  385. assert_param(IS_GFXMMU_ALL_INSTANCE(hgfxmmu->Instance));
  386. assert_param(IS_GFXMMU_BUFFER_ADDRESS(Buffers->Buf0Address));
  387. assert_param(IS_GFXMMU_BUFFER_ADDRESS(Buffers->Buf1Address));
  388. assert_param(IS_GFXMMU_BUFFER_ADDRESS(Buffers->Buf2Address));
  389. assert_param(IS_GFXMMU_BUFFER_ADDRESS(Buffers->Buf3Address));
  390. /* Check GFXMMU state */
  391. if(hgfxmmu->State != HAL_GFXMMU_STATE_READY)
  392. {
  393. status = HAL_ERROR;
  394. }
  395. else
  396. {
  397. /* Modify physical buffer adresses on GFXMMU_BxCR registers */
  398. hgfxmmu->Instance->B0CR = Buffers->Buf0Address;
  399. hgfxmmu->Instance->B1CR = Buffers->Buf1Address;
  400. hgfxmmu->Instance->B2CR = Buffers->Buf2Address;
  401. hgfxmmu->Instance->B3CR = Buffers->Buf3Address;
  402. }
  403. /* Return function status */
  404. return status;
  405. }
  406. /**
  407. * @brief This function handles the GFXMMU interrupts.
  408. * @param hgfxmmu GFXMMU handle.
  409. * @retval None.
  410. */
  411. void HAL_GFXMMU_IRQHandler(GFXMMU_HandleTypeDef *hgfxmmu)
  412. {
  413. uint32_t flags, interrupts, error;
  414. /* Read current flags and interrupts and determine which error occurs */
  415. flags = hgfxmmu->Instance->SR;
  416. interrupts = (hgfxmmu->Instance->CR & GFXMMU_CR_ITS_MASK);
  417. error = (flags & interrupts);
  418. if(error != 0U)
  419. {
  420. /* Clear flags on GFXMMU_FCR register */
  421. hgfxmmu->Instance->FCR = error;
  422. /* Update GFXMMU error code */
  423. hgfxmmu->ErrorCode |= error;
  424. /* Call GFXMMU error callback */
  425. HAL_GFXMMU_ErrorCallback(hgfxmmu);
  426. }
  427. }
  428. /**
  429. * @brief Error callback.
  430. * @param hgfxmmu GFXMMU handle.
  431. * @retval None.
  432. */
  433. __weak void HAL_GFXMMU_ErrorCallback(GFXMMU_HandleTypeDef *hgfxmmu)
  434. {
  435. /* Prevent unused argument(s) compilation warning */
  436. UNUSED(hgfxmmu);
  437. /* NOTE : This function should not be modified, when the callback is needed,
  438. the HAL_GFXMMU_ErrorCallback could be implemented in the user file.
  439. */
  440. }
  441. /**
  442. * @}
  443. */
  444. /** @defgroup GFXMMU_Exported_Functions_Group3 State functions
  445. * @brief GFXMMU state functions
  446. *
  447. @verbatim
  448. ==============================================================================
  449. ##### State functions #####
  450. ==============================================================================
  451. [..] This section provides functions allowing to:
  452. (+) Get GFXMMU handle state.
  453. (+) Get GFXMMU error code.
  454. @endverbatim
  455. * @{
  456. */
  457. /**
  458. * @brief This function allows to get the current GFXMMU handle state.
  459. * @param hgfxmmu GFXMMU handle.
  460. * @retval GFXMMU state.
  461. */
  462. HAL_GFXMMU_StateTypeDef HAL_GFXMMU_GetState(GFXMMU_HandleTypeDef *hgfxmmu)
  463. {
  464. /* Return GFXMMU handle state */
  465. return hgfxmmu->State;
  466. }
  467. /**
  468. * @brief This function allows to get the current GFXMMU error code.
  469. * @param hgfxmmu GFXMMU handle.
  470. * @retval GFXMMU error code.
  471. */
  472. uint32_t HAL_GFXMMU_GetError(GFXMMU_HandleTypeDef *hgfxmmu)
  473. {
  474. uint32_t error_code;
  475. /* Enter in critical section */
  476. __disable_irq();
  477. /* Store and reset GFXMMU error code */
  478. error_code = hgfxmmu->ErrorCode;
  479. hgfxmmu->ErrorCode = GFXMMU_ERROR_NONE;
  480. /* Exit from critical section */
  481. __enable_irq();
  482. /* Return GFXMMU error code */
  483. return error_code;
  484. }
  485. /**
  486. * @}
  487. */
  488. /**
  489. * @}
  490. */
  491. /* End of exported functions -------------------------------------------------*/
  492. /* Private functions ---------------------------------------------------------*/
  493. /* End of private functions --------------------------------------------------*/
  494. /**
  495. * @}
  496. */
  497. #endif /* GFXMMU */
  498. #endif /* HAL_GFXMMU_MODULE_ENABLED */
  499. /**
  500. * @}
  501. */
  502. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/