73 #ifdef HAL_FLASH_MODULE_ENABLED
80 #define FLASH_TIMEOUT_VALUE 50000U
100 static void FLASH_MassErase(uint8_t VoltageRange, uint32_t Banks);
101 static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WRPSector, uint32_t Banks);
102 static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WRPSector, uint32_t Banks);
103 static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig(uint8_t Level);
104 static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t Iwdg, uint8_t Stop, uint8_t Stdby);
105 static HAL_StatusTypeDef FLASH_OB_BOR_LevelConfig(uint8_t Level);
106 static uint8_t FLASH_OB_GetUser(
void);
107 static uint16_t FLASH_OB_GetWRP(
void);
108 static uint8_t FLASH_OB_GetRDP(
void);
109 static uint8_t FLASH_OB_GetBOR(
void);
111 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) ||\
112 defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
114 static HAL_StatusTypeDef FLASH_OB_EnablePCROP(uint32_t Sector);
115 static HAL_StatusTypeDef FLASH_OB_DisablePCROP(uint32_t Sector);
119 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
120 static HAL_StatusTypeDef FLASH_OB_EnablePCROP(uint32_t SectorBank1, uint32_t SectorBank2, uint32_t Banks);
121 static HAL_StatusTypeDef FLASH_OB_DisablePCROP(uint32_t SectorBank1, uint32_t SectorBank2, uint32_t Banks);
122 static HAL_StatusTypeDef FLASH_OB_BootConfig(uint8_t BootConfig);
162 HAL_StatusTypeDef status = HAL_ERROR;
169 assert_param(IS_FLASH_TYPEERASE(pEraseInit->
TypeErase));
174 if (status == HAL_OK)
177 *SectorError = 0xFFFFFFFFU;
179 if (pEraseInit->
TypeErase == FLASH_TYPEERASE_MASSERASE)
188 FLASH->CR &= (~FLASH_MER_BIT);
193 assert_param(IS_FLASH_NBSECTORS(pEraseInit->
NbSectors + pEraseInit->
Sector));
204 CLEAR_BIT(FLASH->CR, (FLASH_CR_SER | FLASH_CR_SNB));
206 if (status != HAL_OK)
209 *SectorError = index;
219 __HAL_UNLOCK(&pFlash);
233 HAL_StatusTypeDef status = HAL_OK;
236 assert_param(IS_FLASH_TYPEERASE(pEraseInit->
TypeErase));
239 __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP);
242 __HAL_FLASH_ENABLE_IT(FLASH_IT_ERR);
245 __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | \
246 FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR);
248 if (pEraseInit->
TypeErase == FLASH_TYPEERASE_MASSERASE)
251 pFlash.ProcedureOnGoing = FLASH_PROC_MASSERASE;
252 pFlash.Bank = pEraseInit->
Banks;
260 assert_param(IS_FLASH_NBSECTORS(pEraseInit->
NbSectors + pEraseInit->
Sector));
262 pFlash.ProcedureOnGoing = FLASH_PROC_SECTERASE;
263 pFlash.NbSectorsToErase = pEraseInit->
NbSectors;
264 pFlash.Sector = pEraseInit->
Sector;
265 pFlash.VoltageForErase = (uint8_t)pEraseInit->
VoltageRange;
283 HAL_StatusTypeDef status = HAL_ERROR;
289 assert_param(IS_OPTIONBYTE(pOBInit->
OptionType));
292 if ((pOBInit->
OptionType & OPTIONBYTE_WRP) == OPTIONBYTE_WRP)
294 assert_param(IS_WRPSTATE(pOBInit->
WRPState));
295 if (pOBInit->
WRPState == OB_WRPSTATE_ENABLE)
308 if ((pOBInit->
OptionType & OPTIONBYTE_RDP) == OPTIONBYTE_RDP)
310 status = FLASH_OB_RDP_LevelConfig(pOBInit->
RDPLevel);
314 if ((pOBInit->
OptionType & OPTIONBYTE_USER) == OPTIONBYTE_USER)
316 status = FLASH_OB_UserConfig(pOBInit->
USERConfig & OB_IWDG_SW,
322 if ((pOBInit->
OptionType & OPTIONBYTE_BOR) == OPTIONBYTE_BOR)
324 status = FLASH_OB_BOR_LevelConfig(pOBInit->
BORLevel);
328 __HAL_UNLOCK(&pFlash);
342 pOBInit->
OptionType = OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_BOR;
345 pOBInit->
WRPSector = (uint32_t)FLASH_OB_GetWRP();
348 pOBInit->
RDPLevel = (uint32_t)FLASH_OB_GetRDP();
351 pOBInit->
USERConfig = (uint8_t)FLASH_OB_GetUser();
354 pOBInit->
BORLevel = (uint32_t)FLASH_OB_GetBOR();
357 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
358 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
359 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
360 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
361 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
371 HAL_StatusTypeDef status = HAL_ERROR;
374 assert_param(IS_OBEX(pAdvOBInit->
OptionType));
377 if (((pAdvOBInit->
OptionType) & OPTIONBYTE_PCROP) == OPTIONBYTE_PCROP)
380 assert_param(IS_PCROPSTATE(pAdvOBInit->
PCROPState));
381 if ((pAdvOBInit->
PCROPState) == OB_PCROP_STATE_ENABLE)
384 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) ||\
385 defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
386 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
387 status = FLASH_OB_EnablePCROP(pAdvOBInit->
Sectors);
396 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) ||\
397 defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
398 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
399 status = FLASH_OB_DisablePCROP(pAdvOBInit->
Sectors);
407 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
409 if (((pAdvOBInit->
OptionType) & OPTIONBYTE_BOOTCONFIG) == OPTIONBYTE_BOOTCONFIG)
411 status = FLASH_OB_BootConfig(pAdvOBInit->
BootConfig);
427 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) ||\
428 defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
429 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
431 pAdvOBInit->
Sectors = (*(__IO uint16_t *)(OPTCR_BYTE2_ADDRESS));
434 pAdvOBInit->
SectorsBank1 = (*(__IO uint16_t *)(OPTCR_BYTE2_ADDRESS));
437 pAdvOBInit->
SectorsBank2 = (*(__IO uint16_t *)(OPTCR1_BYTE2_ADDRESS));
440 pAdvOBInit->
BootConfig = *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS;
459 uint8_t optiontmp = 0xFF;
462 optiontmp = (uint8_t)((*(__IO uint8_t *)OPTCR_BYTE3_ADDRESS) & (uint8_t)0x7F);
465 *(__IO uint8_t *)OPTCR_BYTE3_ADDRESS = (uint8_t)(OB_PCROP_SELECTED | optiontmp);
484 uint8_t optiontmp = 0xFF;
487 optiontmp = (uint8_t)((*(__IO uint8_t *)OPTCR_BYTE3_ADDRESS) & (uint8_t)0x7F);
490 *(__IO uint8_t *)OPTCR_BYTE3_ADDRESS = (uint8_t)(OB_PCROP_DESELECTED | optiontmp);
498 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
507 return (*(__IO uint16_t *)(OPTCR1_BYTE2_ADDRESS));
515 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
537 static void FLASH_MassErase(uint8_t VoltageRange, uint32_t Banks)
540 assert_param(IS_VOLTAGERANGE(VoltageRange));
541 assert_param(IS_FLASH_BANK(Banks));
544 CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
546 if (Banks == FLASH_BANK_BOTH)
549 FLASH->CR |= FLASH_MER_BIT;
551 else if (Banks == FLASH_BANK_1)
554 FLASH->CR |= FLASH_CR_MER1;
559 FLASH->CR |= FLASH_CR_MER2;
561 FLASH->CR |= FLASH_CR_STRT | ((uint32_t)VoltageRange << 8U);
583 uint32_t tmp_psize = 0U;
586 assert_param(IS_FLASH_SECTOR(Sector));
587 assert_param(IS_VOLTAGERANGE(VoltageRange));
589 if (VoltageRange == FLASH_VOLTAGE_RANGE_1)
591 tmp_psize = FLASH_PSIZE_BYTE;
593 else if (VoltageRange == FLASH_VOLTAGE_RANGE_2)
595 tmp_psize = FLASH_PSIZE_HALF_WORD;
597 else if (VoltageRange == FLASH_VOLTAGE_RANGE_3)
599 tmp_psize = FLASH_PSIZE_WORD;
603 tmp_psize = FLASH_PSIZE_DOUBLE_WORD;
607 if (Sector > FLASH_SECTOR_11)
612 CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
613 FLASH->CR |= tmp_psize;
614 CLEAR_BIT(FLASH->CR, FLASH_CR_SNB);
615 FLASH->CR |= FLASH_CR_SER | (Sector << FLASH_CR_SNB_Pos);
616 FLASH->CR |= FLASH_CR_STRT;
641 static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WRPSector, uint32_t Banks)
643 HAL_StatusTypeDef status = HAL_OK;
646 assert_param(IS_OB_WRP_SECTOR(WRPSector));
647 assert_param(IS_FLASH_BANK(Banks));
652 if (status == HAL_OK)
654 if (((WRPSector == OB_WRP_SECTOR_All) && ((Banks == FLASH_BANK_1) || (Banks == FLASH_BANK_BOTH))) ||
655 (WRPSector < OB_WRP_SECTOR_12))
657 if (WRPSector == OB_WRP_SECTOR_All)
660 *(__IO uint16_t *)OPTCR_BYTE2_ADDRESS &= (~(WRPSector >> 12));
665 *(__IO uint16_t *)OPTCR_BYTE2_ADDRESS &= (~WRPSector);
671 *(__IO uint16_t *)OPTCR1_BYTE2_ADDRESS &= (~(WRPSector >> 12));
675 if ((WRPSector == OB_WRP_SECTOR_All) && (Banks == FLASH_BANK_BOTH))
680 if (status == HAL_OK)
682 *(__IO uint16_t *)OPTCR1_BYTE2_ADDRESS &= (~(WRPSector >> 12));
712 static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WRPSector, uint32_t Banks)
714 HAL_StatusTypeDef status = HAL_OK;
717 assert_param(IS_OB_WRP_SECTOR(WRPSector));
718 assert_param(IS_FLASH_BANK(Banks));
723 if (status == HAL_OK)
725 if (((WRPSector == OB_WRP_SECTOR_All) && ((Banks == FLASH_BANK_1) || (Banks == FLASH_BANK_BOTH))) ||
726 (WRPSector < OB_WRP_SECTOR_12))
728 if (WRPSector == OB_WRP_SECTOR_All)
731 *(__IO uint16_t *)OPTCR_BYTE2_ADDRESS |= (uint16_t)(WRPSector >> 12);
736 *(__IO uint16_t *)OPTCR_BYTE2_ADDRESS |= (uint16_t)WRPSector;
742 *(__IO uint16_t *)OPTCR1_BYTE2_ADDRESS |= (uint16_t)(WRPSector >> 12);
746 if ((WRPSector == OB_WRP_SECTOR_All) && (Banks == FLASH_BANK_BOTH))
751 if (status == HAL_OK)
753 *(__IO uint16_t *)OPTCR1_BYTE2_ADDRESS |= (uint16_t)(WRPSector >> 12);
773 static HAL_StatusTypeDef FLASH_OB_BootConfig(uint8_t BootConfig)
775 HAL_StatusTypeDef status = HAL_OK;
778 assert_param(IS_OB_BOOT(BootConfig));
783 if (status == HAL_OK)
786 *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS &= (~FLASH_OPTCR_BFB2);
787 *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS |= BootConfig;
813 static HAL_StatusTypeDef FLASH_OB_EnablePCROP(uint32_t SectorBank1, uint32_t SectorBank2, uint32_t Banks)
815 HAL_StatusTypeDef status = HAL_OK;
817 assert_param(IS_FLASH_BANK(Banks));
822 if (status == HAL_OK)
824 if ((Banks == FLASH_BANK_1) || (Banks == FLASH_BANK_BOTH))
826 assert_param(IS_OB_PCROP(SectorBank1));
828 *(__IO uint16_t *)OPTCR_BYTE2_ADDRESS |= (uint16_t)SectorBank1;
832 assert_param(IS_OB_PCROP(SectorBank2));
834 *(__IO uint16_t *)OPTCR1_BYTE2_ADDRESS |= (uint16_t)SectorBank2;
838 if (Banks == FLASH_BANK_BOTH)
840 assert_param(IS_OB_PCROP(SectorBank2));
844 if (status == HAL_OK)
847 *(__IO uint16_t *)OPTCR1_BYTE2_ADDRESS |= (uint16_t)SectorBank2;
877 static HAL_StatusTypeDef FLASH_OB_DisablePCROP(uint32_t SectorBank1, uint32_t SectorBank2, uint32_t Banks)
879 HAL_StatusTypeDef status = HAL_OK;
882 assert_param(IS_FLASH_BANK(Banks));
887 if (status == HAL_OK)
889 if ((Banks == FLASH_BANK_1) || (Banks == FLASH_BANK_BOTH))
891 assert_param(IS_OB_PCROP(SectorBank1));
893 *(__IO uint16_t *)OPTCR_BYTE2_ADDRESS &= (~SectorBank1);
898 assert_param(IS_OB_PCROP(SectorBank2));
899 *(__IO uint16_t *)OPTCR1_BYTE2_ADDRESS &= (~SectorBank2);
903 if (Banks == FLASH_BANK_BOTH)
905 assert_param(IS_OB_PCROP(SectorBank2));
909 if (status == HAL_OK)
912 *(__IO uint16_t *)OPTCR1_BYTE2_ADDRESS &= (~SectorBank2);
924 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
925 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
926 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
927 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
948 static void FLASH_MassErase(uint8_t VoltageRange, uint32_t Banks)
951 assert_param(IS_VOLTAGERANGE(VoltageRange));
952 assert_param(IS_FLASH_BANK(Banks));
955 CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
956 FLASH->CR |= FLASH_CR_MER;
957 FLASH->CR |= FLASH_CR_STRT | ((uint32_t)VoltageRange << 8U);
979 uint32_t tmp_psize = 0U;
982 assert_param(IS_FLASH_SECTOR(Sector));
983 assert_param(IS_VOLTAGERANGE(VoltageRange));
985 if (VoltageRange == FLASH_VOLTAGE_RANGE_1)
987 tmp_psize = FLASH_PSIZE_BYTE;
989 else if (VoltageRange == FLASH_VOLTAGE_RANGE_2)
991 tmp_psize = FLASH_PSIZE_HALF_WORD;
993 else if (VoltageRange == FLASH_VOLTAGE_RANGE_3)
995 tmp_psize = FLASH_PSIZE_WORD;
999 tmp_psize = FLASH_PSIZE_DOUBLE_WORD;
1003 CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
1004 FLASH->CR |= tmp_psize;
1005 CLEAR_BIT(FLASH->CR, FLASH_CR_SNB);
1006 FLASH->CR |= FLASH_CR_SER | (Sector << FLASH_CR_SNB_Pos);
1007 FLASH->CR |= FLASH_CR_STRT;
1027 static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WRPSector, uint32_t Banks)
1029 HAL_StatusTypeDef status = HAL_OK;
1032 assert_param(IS_OB_WRP_SECTOR(WRPSector));
1033 assert_param(IS_FLASH_BANK(Banks));
1038 if (status == HAL_OK)
1040 *(__IO uint16_t *)OPTCR_BYTE2_ADDRESS &= (~WRPSector);
1063 static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WRPSector, uint32_t Banks)
1065 HAL_StatusTypeDef status = HAL_OK;
1068 assert_param(IS_OB_WRP_SECTOR(WRPSector));
1069 assert_param(IS_FLASH_BANK(Banks));
1074 if (status == HAL_OK)
1076 *(__IO uint16_t *)OPTCR_BYTE2_ADDRESS |= (uint16_t)WRPSector;
1084 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) ||\
1085 defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
1086 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
1096 static HAL_StatusTypeDef FLASH_OB_EnablePCROP(uint32_t Sector)
1098 HAL_StatusTypeDef status = HAL_OK;
1101 assert_param(IS_OB_PCROP(Sector));
1106 if (status == HAL_OK)
1108 *(__IO uint16_t *)OPTCR_BYTE2_ADDRESS |= (uint16_t)Sector;
1124 static HAL_StatusTypeDef FLASH_OB_DisablePCROP(uint32_t Sector)
1126 HAL_StatusTypeDef status = HAL_OK;
1129 assert_param(IS_OB_PCROP(Sector));
1134 if (status == HAL_OK)
1136 *(__IO uint16_t *)OPTCR_BYTE2_ADDRESS &= (~Sector);
1157 static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig(uint8_t Level)
1159 HAL_StatusTypeDef status = HAL_OK;
1162 assert_param(IS_OB_RDP_LEVEL(Level));
1167 if (status == HAL_OK)
1169 *(__IO uint8_t *)OPTCR_BYTE1_ADDRESS = Level;
1191 static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t Iwdg, uint8_t Stop, uint8_t Stdby)
1193 uint8_t optiontmp = 0xFF;
1194 HAL_StatusTypeDef status = HAL_OK;
1197 assert_param(IS_OB_IWDG_SOURCE(Iwdg));
1198 assert_param(IS_OB_STOP_SOURCE(Stop));
1199 assert_param(IS_OB_STDBY_SOURCE(Stdby));
1204 if (status == HAL_OK)
1207 optiontmp = (uint8_t)((*(__IO uint8_t *)OPTCR_BYTE0_ADDRESS) & (uint8_t)0x1F);
1210 *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS = Iwdg | (uint8_t)(Stdby | (uint8_t)(Stop | ((uint8_t)optiontmp)));
1226 static HAL_StatusTypeDef FLASH_OB_BOR_LevelConfig(uint8_t Level)
1229 assert_param(IS_OB_BOR_LEVEL(Level));
1232 *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS &= (~FLASH_OPTCR_BOR_LEV);
1233 *(__IO uint8_t *)OPTCR_BYTE0_ADDRESS |= Level;
1244 static uint8_t FLASH_OB_GetUser(
void)
1247 return ((uint8_t)(FLASH->OPTCR & 0xE0));
1254 static uint16_t FLASH_OB_GetWRP(
void)
1257 return (*(__IO uint16_t *)(OPTCR_BYTE2_ADDRESS));
1268 static uint8_t FLASH_OB_GetRDP(
void)
1270 uint8_t readstatus = OB_RDP_LEVEL_0;
1272 if (*(__IO uint8_t *)(OPTCR_BYTE1_ADDRESS) == (uint8_t)OB_RDP_LEVEL_2)
1274 readstatus = OB_RDP_LEVEL_2;
1276 else if (*(__IO uint8_t *)(OPTCR_BYTE1_ADDRESS) == (uint8_t)OB_RDP_LEVEL_0)
1278 readstatus = OB_RDP_LEVEL_0;
1282 readstatus = OB_RDP_LEVEL_1;
1296 static uint8_t FLASH_OB_GetBOR(
void)
1299 return (uint8_t)(*(__IO uint8_t *)(OPTCR_BYTE0_ADDRESS) & (uint8_t)0x0C);
1309 if (READ_BIT(FLASH->ACR, FLASH_ACR_ICEN) != RESET)
1312 __HAL_FLASH_INSTRUCTION_CACHE_DISABLE();
1314 __HAL_FLASH_INSTRUCTION_CACHE_RESET();
1316 __HAL_FLASH_INSTRUCTION_CACHE_ENABLE();
1320 if (READ_BIT(FLASH->ACR, FLASH_ACR_DCEN) != RESET)
1323 __HAL_FLASH_DATA_CACHE_DISABLE();
1325 __HAL_FLASH_DATA_CACHE_RESET();
1327 __HAL_FLASH_DATA_CACHE_ENABLE();
HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit)
Program option bytes.
HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *SectorError)
Perform a mass erase or erase the specified FLASH memory sectors.
uint16_t HAL_FLASHEx_OB_GetBank2WRP(void)
Returns the FLASH Write Protection Option Bytes value for Bank 2.
void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit)
Get the OBEX byte configuration.
void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit)
Get the Option byte configuration.
HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void)
Select the Protection Mode.
HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void)
Deselect the Protection Mode.
HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit)
Program option bytes.
HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit)
Perform a mass erase or erase the specified FLASH memory sectors with interrupt enabled.
void FLASH_FlushCaches(void)
Flush the instruction and data caches.
void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange)
Erase the specified FLASH memory sector.
FLASH Advanced Option Bytes Program structure definition.
FLASH Erase structure definition.
FLASH Option Bytes Program structure definition.
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
Wait for a FLASH operation to complete.
FLASH handle Structure definition.
This file contains all the functions prototypes for the HAL module driver.