stm32f7xx_hal_flash.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32F7xx_HAL_FLASH_H
22 #define __STM32F7xx_HAL_FLASH_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f7xx_hal_def.h"
30 
39 /* Exported types ------------------------------------------------------------*/
47 typedef enum
48 {
54 
55 
59 typedef struct
60 {
61  __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /* Internal variable to indicate which procedure is ongoing or not in IT context */
62 
63  __IO uint32_t NbSectorsToErase; /* Internal variable to save the remaining sectors to erase in IT context */
64 
65  __IO uint8_t VoltageForErase; /* Internal variable to provide voltage range selected by user in IT context */
66 
67  __IO uint32_t Sector; /* Internal variable to define the current sector which is erasing */
68 
69  __IO uint32_t Address; /* Internal variable to save address selected for program */
70 
71  HAL_LockTypeDef Lock; /* FLASH locking object */
72 
73  __IO uint32_t ErrorCode; /* FLASH error code */
74 
76 
81 /* Exported constants --------------------------------------------------------*/
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)
128 #else
129 #define FLASH_FLAG_ALL_ERRORS (FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \
130  FLASH_FLAG_PGPERR | FLASH_FLAG_ERSERR)
131 #endif /* FLASH_OPTCR2_PCROP */
132 
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)
154 
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)
165 
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)
180 #else
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)
189 #endif /* FLASH_SECTOR_TOTAL */
190 
198 /* Exported macro ------------------------------------------------------------*/
208 #define __HAL_FLASH_SET_LATENCY(__LATENCY__) \
209  MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(__LATENCY__))
210 
216 #define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))
217 
222 #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTEN)
223 
228 #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTEN))
229 
235 #define __HAL_FLASH_ART_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_ARTEN)
236 
241 #define __HAL_FLASH_ART_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_ARTEN)
242 
249 #define __HAL_FLASH_ART_RESET() (FLASH->ACR |= FLASH_ACR_ARTRST)
250 
259 #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__))
260 
269 #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__))
270 
284 #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__)))
285 
298 #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__))
299 
303 /* Include FLASH HAL Extension module */
304 #include "stm32f7xx_hal_flash_ex.h"
305 
306 /* Exported functions --------------------------------------------------------*/
313 /* Program operation functions ***********************************************/
314 HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
315 HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
316 /* FLASH IRQ handler method */
317 void HAL_FLASH_IRQHandler(void);
318 /* Callbacks in non blocking modes */
319 void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
320 void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
328 /* Peripheral Control functions **********************************************/
333 /* Option bytes control */
342 /* Peripheral State functions ************************************************/
343 uint32_t HAL_FLASH_GetError(void);
352 /* Private types -------------------------------------------------------------*/
353 /* Private variables ---------------------------------------------------------*/
361 /* Private constants ---------------------------------------------------------*/
369 #define OPTCR_BYTE1_ADDRESS ((uint32_t)0x40023C15)
370 
375 /* Private macros ------------------------------------------------------------*/
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))
387 
395 /* Private functions ---------------------------------------------------------*/
412 #ifdef __cplusplus
413 }
414 #endif
415 
416 #endif /* __STM32F7xx_HAL_FLASH_H */
417 
418 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_FLASH_Lock
HAL_StatusTypeDef HAL_FLASH_Lock(void)
HAL_FLASH_Program
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
__IO
#define __IO
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:237
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
HAL_FLASH_OB_Unlock
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void)
stm32f7xx_hal_flash_ex.h
Header file of FLASH HAL Extension module.
HAL_FLASH_OB_Launch
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void)
HAL_FLASH_IRQHandler
void HAL_FLASH_IRQHandler(void)
HAL_LockTypeDef
HAL_LockTypeDef
HAL Lock structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:51
HAL_FLASH_GetError
uint32_t HAL_FLASH_GetError(void)
FLASH_PROC_PROGRAM
@ FLASH_PROC_PROGRAM
Definition: stm32f7xx_hal_flash.h:52
FLASH_ProcedureTypeDef
FLASH_ProcedureTypeDef
FLASH Procedure structure definition.
Definition: stm32f7xx_hal_flash.h:47
HAL_FLASH_OperationErrorCallback
void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue)
FLASH_PROC_NONE
@ FLASH_PROC_NONE
Definition: stm32f7xx_hal_flash.h:49
FLASH_WaitForLastOperation
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
FLASH_PROC_MASSERASE
@ FLASH_PROC_MASSERASE
Definition: stm32f7xx_hal_flash.h:51
FLASH_PROC_SECTERASE
@ FLASH_PROC_SECTERASE
Definition: stm32f7xx_hal_flash.h:50
FLASH_ProcessTypeDef
FLASH handle Structure definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h:58
stm32f7xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_FLASH_EndOfOperationCallback
void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue)
HAL_FLASH_OB_Lock
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void)
HAL_FLASH_Program_IT
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
HAL_FLASH_Unlock
HAL_StatusTypeDef HAL_FLASH_Unlock(void)


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:53