Merge pull request #11189 from klutvott123/move-telemetry-displayport-init
[betaflight.git] / lib / main / STM32G4 / Drivers / STM32G4xx_HAL_Driver / Src / stm32g4xx_hal_flash.c
blobeb088c0ebe31a8e16020eef71816a88074a52cca
1 /**
2 ******************************************************************************
3 * @file stm32g4xx_hal_flash.c
4 * @author MCD Application Team
5 * @brief FLASH HAL module driver.
6 * This file provides firmware functions to manage the following
7 * functionalities of the internal FLASH memory:
8 * + Program operations functions
9 * + Memory Control functions
10 * + Peripheral Errors functions
12 @verbatim
13 ==============================================================================
14 ##### FLASH peripheral features #####
15 ==============================================================================
17 [..] The Flash memory interface manages CPU AHB I-Code and D-Code accesses
18 to the Flash memory. It implements the erase and program Flash memory operations
19 and the read and write protection mechanisms.
21 [..] The Flash memory interface accelerates code execution with a system of instruction
22 prefetch and cache lines.
24 [..] The FLASH main features are:
25 (+) Flash memory read operations
26 (+) Flash memory program/erase operations
27 (+) Read / write protections
28 (+) Option bytes programming
29 (+) Prefetch on I-Code
30 (+) 32 cache lines of 4*64 or 2*128 bits on I-Code
31 (+) 8 cache lines of 4*64 or 2*128 bits on D-Code
32 (+) Error code correction (ECC) : Data in flash are 72-bits word
33 (8 bits added per double word)
36 ##### How to use this driver #####
37 ==============================================================================
38 [..]
39 This driver provides functions and macros to configure and program the FLASH
40 memory of all STM32G4xx devices.
42 (#) Flash Memory IO Programming functions:
43 (++) Lock and Unlock the FLASH interface using HAL_FLASH_Unlock() and
44 HAL_FLASH_Lock() functions
45 (++) Program functions: double word and fast program (full row programming)
46 (++) There are two modes of programming :
47 (+++) Polling mode using HAL_FLASH_Program() function
48 (+++) Interrupt mode using HAL_FLASH_Program_IT() function
50 (#) Interrupts and flags management functions:
51 (++) Handle FLASH interrupts by calling HAL_FLASH_IRQHandler()
52 (++) Callback functions are called when the flash operations are finished :
53 HAL_FLASH_EndOfOperationCallback() when everything is ok, otherwise
54 HAL_FLASH_OperationErrorCallback()
55 (++) Get error flag status by calling HAL_GetError()
57 (#) Option bytes management functions:
58 (++) Lock and Unlock the option bytes using HAL_FLASH_OB_Unlock() and
59 HAL_FLASH_OB_Lock() functions
60 (++) Launch the reload of the option bytes using HAL_FLASH_Launch() function.
61 In this case, a reset is generated
63 [..]
64 In addition to these functions, this driver includes a set of macros allowing
65 to handle the following operations:
66 (+) Set the latency
67 (+) Enable/Disable the prefetch buffer
68 (+) Enable/Disable the Instruction cache and the Data cache
69 (+) Reset the Instruction cache and the Data cache
70 (+) Enable/Disable the Flash power-down during low-power run and sleep modes
71 (+) Enable/Disable the Flash interrupts
72 (+) Monitor the Flash flags status
74 @endverbatim
75 ******************************************************************************
76 * @attention
78 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
80 * This software component is licensed by ST under BSD 3-Clause license,
81 * the "License"; You may not use this file except in compliance with the
82 * License. You may obtain a copy of the License at:
83 * opensource.org/licenses/BSD-3-Clause
85 ******************************************************************************
88 /* Includes ------------------------------------------------------------------*/
89 #include "stm32g4xx_hal.h"
91 /** @addtogroup STM32G4xx_HAL_Driver
92 * @{
95 /** @defgroup FLASH FLASH
96 * @brief FLASH HAL module driver
97 * @{
100 #ifdef HAL_FLASH_MODULE_ENABLED
102 /* Private typedef -----------------------------------------------------------*/
103 /* Private defines -----------------------------------------------------------*/
104 /** @defgroup FLASH_Private_Constants FLASH Private Constants
105 * @{
107 #define FLASH_NB_DOUBLE_WORDS_IN_ROW 32
109 * @}
112 /* Private macros ------------------------------------------------------------*/
113 /* Private variables ---------------------------------------------------------*/
114 /** @defgroup FLASH_Private_Variables FLASH Private Variables
115 * @{
119 * @brief Variable used for Program/Erase sectors under interruption
121 FLASH_ProcessTypeDef pFlash = {.Lock = HAL_UNLOCKED,
122 .ErrorCode = HAL_FLASH_ERROR_NONE,
123 .ProcedureOnGoing = FLASH_PROC_NONE,
124 .Address = 0U,
125 .Bank = FLASH_BANK_1,
126 .Page = 0U,
127 .NbPagesToErase = 0U,
128 .CacheToReactivate = FLASH_CACHE_DISABLED};
130 * @}
133 /* Private function prototypes -----------------------------------------------*/
134 /** @defgroup FLASH_Private_Functions FLASH Private Functions
135 * @{
137 static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data);
138 static void FLASH_Program_Fast(uint32_t Address, uint32_t DataAddress);
140 * @}
143 /* Exported functions --------------------------------------------------------*/
144 /** @defgroup FLASH_Exported_Functions FLASH Exported Functions
145 * @{
148 /** @defgroup FLASH_Exported_Functions_Group1 Programming operation functions
149 * @brief Programming operation functions
151 @verbatim
152 ===============================================================================
153 ##### Programming operation functions #####
154 ===============================================================================
155 [..]
156 This subsection provides a set of functions allowing to manage the FLASH
157 program operations.
159 @endverbatim
160 * @{
164 * @brief Program double word or fast program of a row at a specified address.
165 * @param TypeProgram Indicate the way to program at a specified address.
166 * This parameter can be a value of @ref FLASH_Type_Program.
167 * @param Address specifies the address to be programmed.
168 * @param Data specifies the data to be programmed.
169 * This parameter is the data for the double word program and the address where
170 * are stored the data for the row fast program.
172 * @retval HAL_Status
174 HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
176 HAL_StatusTypeDef status;
177 uint32_t prog_bit = 0;
179 /* Check the parameters */
180 assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram));
182 /* Process Locked */
183 __HAL_LOCK(&pFlash);
185 /* Wait for last operation to be completed */
186 status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE);
188 if (status == HAL_OK)
190 pFlash.ErrorCode = HAL_FLASH_ERROR_NONE;
192 if (TypeProgram == FLASH_TYPEPROGRAM_DOUBLEWORD)
194 /* Program double-word (64-bit) at a specified address */
195 FLASH_Program_DoubleWord(Address, Data);
196 prog_bit = FLASH_CR_PG;
198 else if ((TypeProgram == FLASH_TYPEPROGRAM_FAST) || (TypeProgram == FLASH_TYPEPROGRAM_FAST_AND_LAST))
200 /* Fast program a 32 row double-word (64-bit) at a specified address */
201 FLASH_Program_Fast(Address, (uint32_t)Data);
203 /* If it is the last row, the bit will be cleared at the end of the operation */
204 if (TypeProgram == FLASH_TYPEPROGRAM_FAST_AND_LAST)
206 prog_bit = FLASH_CR_FSTPG;
209 else
211 /* Nothing to do */
214 /* Wait for last operation to be completed */
215 status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE);
217 /* If the program operation is completed, disable the PG or FSTPG Bit */
218 if (prog_bit != 0U)
220 CLEAR_BIT(FLASH->CR, prog_bit);
224 /* Process Unlocked */
225 __HAL_UNLOCK(&pFlash);
227 /* return status */
228 return status;
232 * @brief Program double word or fast program of a row at a specified address with interrupt enabled.
233 * @param TypeProgram Indicate the way to program at a specified address.
234 * This parameter can be a value of @ref FLASH_Type_Program.
235 * @param Address specifies the address to be programmed.
236 * @param Data specifies the data to be programmed.
237 * This parameter is the data for the double word program and the address where
238 * are stored the data for the row fast program.
240 * @retval HAL_Status
242 HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
244 HAL_StatusTypeDef status;
246 /* Check the parameters */
247 assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram));
249 /* Process Locked */
250 __HAL_LOCK(&pFlash);
252 /* Reset error code */
253 pFlash.ErrorCode = HAL_FLASH_ERROR_NONE;
255 /* Wait for last operation to be completed */
256 status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
258 if (status != HAL_OK)
260 /* Process Unlocked */
261 __HAL_UNLOCK(&pFlash);
263 else
265 /* Set internal variables used by the IRQ handler */
266 if (TypeProgram == FLASH_TYPEPROGRAM_FAST_AND_LAST)
268 pFlash.ProcedureOnGoing = FLASH_PROC_PROGRAM_LAST;
270 else
272 pFlash.ProcedureOnGoing = FLASH_PROC_PROGRAM;
274 pFlash.Address = Address;
276 /* Enable End of Operation and Error interrupts */
277 __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP | FLASH_IT_OPERR);
279 if (TypeProgram == FLASH_TYPEPROGRAM_DOUBLEWORD)
281 /* Program double-word (64-bit) at a specified address */
282 FLASH_Program_DoubleWord(Address, Data);
284 else if ((TypeProgram == FLASH_TYPEPROGRAM_FAST) || (TypeProgram == FLASH_TYPEPROGRAM_FAST_AND_LAST))
286 /* Fast program a 32 row double-word (64-bit) at a specified address */
287 FLASH_Program_Fast(Address, (uint32_t)Data);
289 else
291 /* Nothing to do */
295 return status;
299 * @brief Handle FLASH interrupt request.
300 * @retval None
302 void HAL_FLASH_IRQHandler(void)
304 uint32_t tmp_page;
305 uint32_t error;
306 FLASH_ProcedureTypeDef procedure;
308 /* If the operation is completed, disable the PG, PNB, MER1, MER2 and PER Bit */
309 CLEAR_BIT(FLASH->CR, (FLASH_CR_PG | FLASH_CR_MER1 | FLASH_CR_PER | FLASH_CR_PNB));
310 #if defined (FLASH_OPTR_DBANK)
311 CLEAR_BIT(FLASH->CR, FLASH_CR_MER2);
312 #endif
314 /* Disable the FSTPG Bit only if it is the last row programmed */
315 if (pFlash.ProcedureOnGoing == FLASH_PROC_PROGRAM_LAST)
317 CLEAR_BIT(FLASH->CR, FLASH_CR_FSTPG);
320 /* Check FLASH operation error flags */
321 error = (FLASH->SR & FLASH_FLAG_SR_ERRORS);
323 if (error != 0U)
325 /* Save the error code */
326 pFlash.ErrorCode |= error;
328 /* Clear error programming flags */
329 __HAL_FLASH_CLEAR_FLAG(error);
331 /* Flush the caches to be sure of the data consistency */
332 FLASH_FlushCaches() ;
334 /* FLASH error interrupt user callback */
335 procedure = pFlash.ProcedureOnGoing;
336 if (procedure == FLASH_PROC_PAGE_ERASE)
338 HAL_FLASH_OperationErrorCallback(pFlash.Page);
340 else if (procedure == FLASH_PROC_MASS_ERASE)
342 HAL_FLASH_OperationErrorCallback(pFlash.Bank);
344 else if ((procedure == FLASH_PROC_PROGRAM) ||
345 (procedure == FLASH_PROC_PROGRAM_LAST))
347 HAL_FLASH_OperationErrorCallback(pFlash.Address);
349 else
351 /* Nothing to do */
354 /*Stop the procedure ongoing*/
355 pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
358 /* Check FLASH End of Operation flag */
359 if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP))
361 /* Clear FLASH End of Operation pending bit */
362 __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
364 if (pFlash.ProcedureOnGoing == FLASH_PROC_PAGE_ERASE)
366 /* Nb of pages to erased can be decreased */
367 pFlash.NbPagesToErase--;
369 /* Check if there are still pages to erase*/
370 if (pFlash.NbPagesToErase != 0U)
372 /* Indicate user which page has been erased*/
373 HAL_FLASH_EndOfOperationCallback(pFlash.Page);
375 /* Increment page number */
376 pFlash.Page++;
377 tmp_page = pFlash.Page;
378 FLASH_PageErase(tmp_page, pFlash.Bank);
380 else
382 /* No more pages to Erase */
383 /* Reset Address and stop Erase pages procedure */
384 pFlash.Page = 0xFFFFFFFFU;
385 pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
387 /* Flush the caches to be sure of the data consistency */
388 FLASH_FlushCaches() ;
390 /* FLASH EOP interrupt user callback */
391 HAL_FLASH_EndOfOperationCallback(pFlash.Page);
394 else
396 /* Flush the caches to be sure of the data consistency */
397 FLASH_FlushCaches() ;
399 procedure = pFlash.ProcedureOnGoing;
400 if (procedure == FLASH_PROC_MASS_ERASE)
402 /* MassErase ended. Return the selected bank */
403 /* FLASH EOP interrupt user callback */
404 HAL_FLASH_EndOfOperationCallback(pFlash.Bank);
406 else if ((procedure == FLASH_PROC_PROGRAM) ||
407 (procedure == FLASH_PROC_PROGRAM_LAST))
409 /* Program ended. Return the selected address */
410 /* FLASH EOP interrupt user callback */
411 HAL_FLASH_EndOfOperationCallback(pFlash.Address);
413 else
415 /* Nothing to do */
418 /*Clear the procedure ongoing*/
419 pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
423 if (pFlash.ProcedureOnGoing == FLASH_PROC_NONE)
425 /* Disable End of Operation and Error interrupts */
426 __HAL_FLASH_DISABLE_IT(FLASH_IT_EOP | FLASH_IT_OPERR);
428 /* Process Unlocked */
429 __HAL_UNLOCK(&pFlash);
434 * @brief FLASH end of operation interrupt callback.
435 * @param ReturnValue The value saved in this parameter depends on the ongoing procedure:
436 * @arg Mass Erase: Bank number which has been requested to erase
437 * @arg Page Erase: Page which has been erased
438 * (if 0xFFFFFFFF, it means that all the selected pages have been erased)
439 * @arg Program: Address which was selected for data program
440 * @retval None
442 __weak void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue)
444 /* Prevent unused argument(s) compilation warning */
445 UNUSED(ReturnValue);
447 /* NOTE : This function should not be modified, when the callback is needed,
448 the HAL_FLASH_EndOfOperationCallback could be implemented in the user file
453 * @brief FLASH operation error interrupt callback.
454 * @param ReturnValue The value saved in this parameter depends on the ongoing procedure:
455 * @arg Mass Erase: Bank number which has been requested to erase
456 * @arg Page Erase: Page number which returned an error
457 * @arg Program: Address which was selected for data program
458 * @retval None
460 __weak void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue)
462 /* Prevent unused argument(s) compilation warning */
463 UNUSED(ReturnValue);
465 /* NOTE : This function should not be modified, when the callback is needed,
466 the HAL_FLASH_OperationErrorCallback could be implemented in the user file
471 * @}
474 /** @defgroup FLASH_Exported_Functions_Group2 Peripheral Control functions
475 * @brief Management functions
477 @verbatim
478 ===============================================================================
479 ##### Peripheral Control functions #####
480 ===============================================================================
481 [..]
482 This subsection provides a set of functions allowing to control the FLASH
483 memory operations.
485 @endverbatim
486 * @{
490 * @brief Unlock the FLASH control register access.
491 * @retval HAL_Status
493 HAL_StatusTypeDef HAL_FLASH_Unlock(void)
495 HAL_StatusTypeDef status = HAL_OK;
497 if (READ_BIT(FLASH->CR, FLASH_CR_LOCK) != 0U)
499 /* Authorize the FLASH Registers access */
500 WRITE_REG(FLASH->KEYR, FLASH_KEY1);
501 WRITE_REG(FLASH->KEYR, FLASH_KEY2);
503 /* verify Flash is unlocked */
504 if (READ_BIT(FLASH->CR, FLASH_CR_LOCK) != 0U)
506 status = HAL_ERROR;
510 return status;
514 * @brief Lock the FLASH control register access.
515 * @retval HAL_Status
517 HAL_StatusTypeDef HAL_FLASH_Lock(void)
519 HAL_StatusTypeDef status = HAL_ERROR;
521 /* Set the LOCK Bit to lock the FLASH Registers access */
522 SET_BIT(FLASH->CR, FLASH_CR_LOCK);
524 /* verify Flash is locked */
525 if (READ_BIT(FLASH->CR, FLASH_CR_LOCK) != 0U)
527 status = HAL_OK;
530 return status;
534 * @brief Unlock the FLASH Option Bytes Registers access.
535 * @retval HAL_Status
537 HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void)
539 HAL_StatusTypeDef status = HAL_OK;
541 if (READ_BIT(FLASH->CR, FLASH_CR_OPTLOCK) != 0U)
543 /* Authorizes the Option Byte register programming */
544 WRITE_REG(FLASH->OPTKEYR, FLASH_OPTKEY1);
545 WRITE_REG(FLASH->OPTKEYR, FLASH_OPTKEY2);
547 /* verify option bytes are unlocked */
548 if (READ_BIT(FLASH->CR, FLASH_CR_OPTLOCK) != 0U)
550 status = HAL_ERROR;
554 return status;
558 * @brief Lock the FLASH Option Bytes Registers access.
559 * @retval HAL_Status
561 HAL_StatusTypeDef HAL_FLASH_OB_Lock(void)
563 HAL_StatusTypeDef status = HAL_ERROR;
565 /* Set the OPTLOCK Bit to lock the FLASH Option Byte Registers access */
566 SET_BIT(FLASH->CR, FLASH_CR_OPTLOCK);
568 /* Verify option bytes are locked */
569 if (READ_BIT(FLASH->CR, FLASH_CR_OPTLOCK) != 0U)
571 status = HAL_OK;
574 return status;
578 * @brief Launch the option byte loading.
579 * @retval HAL_Status
581 HAL_StatusTypeDef HAL_FLASH_OB_Launch(void)
583 /* Set the bit to force the option byte reloading */
584 SET_BIT(FLASH->CR, FLASH_CR_OBL_LAUNCH);
586 /* Wait for last operation to be completed */
587 return (FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE));
591 * @}
594 /** @defgroup FLASH_Exported_Functions_Group3 Peripheral State and Errors functions
595 * @brief Peripheral Errors functions
597 @verbatim
598 ===============================================================================
599 ##### Peripheral Errors functions #####
600 ===============================================================================
601 [..]
602 This subsection permits to get in run-time Errors of the FLASH peripheral.
604 @endverbatim
605 * @{
609 * @brief Get the specific FLASH error flag.
610 * @retval FLASH_ErrorCode. The returned value can be:
611 * @arg HAL_FLASH_ERROR_RD: FLASH Read Protection error flag (PCROP)
612 * @arg HAL_FLASH_ERROR_PGS: FLASH Programming Sequence error flag
613 * @arg HAL_FLASH_ERROR_PGP: FLASH Programming Parallelism error flag
614 * @arg HAL_FLASH_ERROR_PGA: FLASH Programming Alignment error flag
615 * @arg HAL_FLASH_ERROR_WRP: FLASH Write protected error flag
616 * @arg HAL_FLASH_ERROR_OPERATION: FLASH operation Error flag
617 * @arg HAL_FLASH_ERROR_NONE: No error set
618 * @arg HAL_FLASH_ERROR_OP: FLASH Operation error
619 * @arg HAL_FLASH_ERROR_PROG: FLASH Programming error
620 * @arg HAL_FLASH_ERROR_WRP: FLASH Write protection error
621 * @arg HAL_FLASH_ERROR_PGA: FLASH Programming alignment error
622 * @arg HAL_FLASH_ERROR_SIZ: FLASH Size error
623 * @arg HAL_FLASH_ERROR_PGS: FLASH Programming sequence error
624 * @arg HAL_FLASH_ERROR_MIS: FLASH Fast programming data miss error
625 * @arg HAL_FLASH_ERROR_FAST: FLASH Fast programming error
626 * @arg HAL_FLASH_ERROR_RD: FLASH PCROP read error
627 * @arg HAL_FLASH_ERROR_OPTV: FLASH Option validity error
629 uint32_t HAL_FLASH_GetError(void)
631 return pFlash.ErrorCode;
635 * @}
639 * @}
642 /* Private functions ---------------------------------------------------------*/
644 /** @addtogroup FLASH_Private_Functions
645 * @{
649 * @brief Wait for a FLASH operation to complete.
650 * @param Timeout maximum flash operation timeout.
651 * @retval HAL_Status
653 HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
655 /* Wait for the FLASH operation to complete by polling on BUSY flag to be reset.
656 Even if the FLASH operation fails, the BUSY flag will be reset and an error
657 flag will be set */
659 uint32_t tickstart = HAL_GetTick();
660 uint32_t error;
662 while (__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY))
664 if ((HAL_GetTick() - tickstart) > Timeout)
666 return HAL_TIMEOUT;
670 /* Check FLASH operation error flags */
671 error = (FLASH->SR & FLASH_FLAG_SR_ERRORS);
672 if (error != 0u)
674 /* Save the error code */
675 pFlash.ErrorCode |= error;
677 /* Clear error programming flags */
678 __HAL_FLASH_CLEAR_FLAG(error);
680 return HAL_ERROR;
683 /* Check FLASH End of Operation flag */
684 if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP))
686 /* Clear FLASH End of Operation pending bit */
687 __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
690 /* If there is an error flag set */
691 return HAL_OK;
695 * @brief Program double-word (64-bit) at a specified address.
696 * @param Address specifies the address to be programmed.
697 * @param Data specifies the data to be programmed.
698 * @retval None
700 static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data)
702 /* Check the parameters */
703 assert_param(IS_FLASH_PROGRAM_ADDRESS(Address));
705 /* Set PG bit */
706 SET_BIT(FLASH->CR, FLASH_CR_PG);
708 /* Program first word */
709 *(uint32_t *)Address = (uint32_t)Data;
711 /* Barrier to ensure programming is performed in 2 steps, in right order
712 (independently of compiler optimization behavior) */
713 __ISB();
715 /* Program second word */
716 *(uint32_t *)(Address + 4U) = (uint32_t)(Data >> 32U);
720 * @brief Fast program a row double-word (64-bit) at a specified address.
721 * @param Address specifies the address to be programmed.
722 * @param DataAddress specifies the address where the data are stored.
723 * @retval None
725 static void FLASH_Program_Fast(uint32_t Address, uint32_t DataAddress)
727 uint8_t row_index = (2 * FLASH_NB_DOUBLE_WORDS_IN_ROW);
728 uint32_t *dest_addr = (uint32_t *)Address;
729 uint32_t *src_addr = (uint32_t *)DataAddress;
730 uint32_t primask_bit;
732 /* Check the parameters */
733 assert_param(IS_FLASH_MAIN_MEM_ADDRESS(Address));
735 /* Set FSTPG bit */
736 SET_BIT(FLASH->CR, FLASH_CR_FSTPG);
738 /* Enter critical section: Disable interrupts to avoid any interruption during the loop */
739 primask_bit = __get_PRIMASK();
740 __disable_irq();
742 /* Program the double words of the row */
745 *dest_addr = *src_addr;
746 dest_addr++;
747 src_addr++;
748 row_index--;
750 while (row_index != 0U);
752 /* Exit critical section: restore previous priority mask */
753 __set_PRIMASK(primask_bit);
757 * @}
760 #endif /* HAL_FLASH_MODULE_ENABLED */
763 * @}
767 * @}
770 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/