Go to the documentation of this file.
21 #ifndef __STM32F7xx_HAL_FLASH_H
22 #define __STM32F7xx_HAL_FLASH_H
63 __IO uint32_t NbSectorsToErase;
65 __IO uint8_t VoltageForErase;
69 __IO uint32_t Address;
73 __IO uint32_t ErrorCode;
90 #define HAL_FLASH_ERROR_NONE ((uint32_t)0x00000000U)
91 #define HAL_FLASH_ERROR_ERS ((uint32_t)0x00000002U)
92 #define HAL_FLASH_ERROR_PGP ((uint32_t)0x00000004U)
93 #define HAL_FLASH_ERROR_PGA ((uint32_t)0x00000008U)
94 #define HAL_FLASH_ERROR_WRP ((uint32_t)0x00000010U)
95 #define HAL_FLASH_ERROR_OPERATION ((uint32_t)0x00000020U)
96 #define HAL_FLASH_ERROR_RD ((uint32_t)0x00000040U)
104 #define FLASH_TYPEPROGRAM_BYTE ((uint32_t)0x00U)
105 #define FLASH_TYPEPROGRAM_HALFWORD ((uint32_t)0x01U)
106 #define FLASH_TYPEPROGRAM_WORD ((uint32_t)0x02U)
107 #define FLASH_TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03U)
116 #define FLASH_FLAG_EOP FLASH_SR_EOP
117 #define FLASH_FLAG_OPERR FLASH_SR_OPERR
118 #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR
119 #define FLASH_FLAG_PGAERR FLASH_SR_PGAERR
120 #define FLASH_FLAG_PGPERR FLASH_SR_PGPERR
121 #define FLASH_FLAG_ERSERR FLASH_SR_ERSERR
122 #define FLASH_FLAG_BSY FLASH_SR_BSY
124 #if defined (FLASH_OPTCR2_PCROP)
125 #define FLASH_FLAG_RDERR FLASH_SR_RDERR
126 #define FLASH_FLAG_ALL_ERRORS (FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \
127 FLASH_FLAG_PGPERR | FLASH_FLAG_ERSERR | FLASH_FLAG_RDERR)
129 #define FLASH_FLAG_ALL_ERRORS (FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \
130 FLASH_FLAG_PGPERR | FLASH_FLAG_ERSERR)
140 #define FLASH_IT_EOP FLASH_CR_EOPIE
141 #define FLASH_IT_ERR ((uint32_t)0x02000000U)
149 #define FLASH_PSIZE_BYTE ((uint32_t)0x00000000U)
150 #define FLASH_PSIZE_HALF_WORD ((uint32_t)FLASH_CR_PSIZE_0)
151 #define FLASH_PSIZE_WORD ((uint32_t)FLASH_CR_PSIZE_1)
152 #define FLASH_PSIZE_DOUBLE_WORD ((uint32_t)FLASH_CR_PSIZE)
153 #define CR_PSIZE_MASK ((uint32_t)0xFFFFFCFFU)
161 #define FLASH_KEY1 ((uint32_t)0x45670123U)
162 #define FLASH_KEY2 ((uint32_t)0xCDEF89ABU)
163 #define FLASH_OPT_KEY1 ((uint32_t)0x08192A3BU)
164 #define FLASH_OPT_KEY2 ((uint32_t)0x4C5D6E7FU)
172 #if (FLASH_SECTOR_TOTAL == 2)
173 #define FLASH_SECTOR_0 ((uint32_t)0U)
174 #define FLASH_SECTOR_1 ((uint32_t)1U)
175 #elif (FLASH_SECTOR_TOTAL == 4)
176 #define FLASH_SECTOR_0 ((uint32_t)0U)
177 #define FLASH_SECTOR_1 ((uint32_t)1U)
178 #define FLASH_SECTOR_2 ((uint32_t)2U)
179 #define FLASH_SECTOR_3 ((uint32_t)3U)
181 #define FLASH_SECTOR_0 ((uint32_t)0U)
182 #define FLASH_SECTOR_1 ((uint32_t)1U)
183 #define FLASH_SECTOR_2 ((uint32_t)2U)
184 #define FLASH_SECTOR_3 ((uint32_t)3U)
185 #define FLASH_SECTOR_4 ((uint32_t)4U)
186 #define FLASH_SECTOR_5 ((uint32_t)5U)
187 #define FLASH_SECTOR_6 ((uint32_t)6U)
188 #define FLASH_SECTOR_7 ((uint32_t)7U)
208 #define __HAL_FLASH_SET_LATENCY(__LATENCY__) \
209 MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(__LATENCY__))
216 #define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))
222 #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTEN)
228 #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTEN))
235 #define __HAL_FLASH_ART_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_ARTEN)
241 #define __HAL_FLASH_ART_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_ARTEN)
249 #define __HAL_FLASH_ART_RESET() (FLASH->ACR |= FLASH_ACR_ARTRST)
259 #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__))
269 #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__))
284 #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__)))
298 #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__))
369 #define OPTCR_BYTE1_ADDRESS ((uint32_t)0x40023C15)
383 #define IS_FLASH_TYPEPROGRAM(VALUE)(((VALUE) == FLASH_TYPEPROGRAM_BYTE) || \
384 ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \
385 ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \
386 ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD))
HAL_StatusTypeDef HAL_FLASH_Lock(void)
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
HAL_StatusTypeDef
HAL Status structures definition
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void)
Header file of FLASH HAL Extension module.
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void)
void HAL_FLASH_IRQHandler(void)
HAL_LockTypeDef
HAL Lock structures definition
uint32_t HAL_FLASH_GetError(void)
FLASH_ProcedureTypeDef
FLASH Procedure structure definition.
void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue)
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
FLASH handle Structure definition
This file contains HAL common defines, enumeration, macros and structures definitions.
void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue)
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void)
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
HAL_StatusTypeDef HAL_FLASH_Unlock(void)