stm32f3xx_hal_flash_ex.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. /**
  2. ******************************************************************************
  3. * @file stm32f3xx_hal_flash_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of Flash HAL Extended module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file in
  13. * the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. ******************************************************************************
  16. */
  17. /* Define to prevent recursive inclusion -------------------------------------*/
  18. #ifndef __STM32F3xx_HAL_FLASH_EX_H
  19. #define __STM32F3xx_HAL_FLASH_EX_H
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /* Includes ------------------------------------------------------------------*/
  24. #include "stm32f3xx_hal_def.h"
  25. /** @addtogroup STM32F3xx_HAL_Driver
  26. * @{
  27. */
  28. /** @addtogroup FLASHEx
  29. * @{
  30. */
  31. /** @addtogroup FLASHEx_Private_Constants
  32. * @{
  33. */
  34. #define FLASH_SIZE_DATA_REGISTER (0x1FFFF7CCU)
  35. /**
  36. * @}
  37. */
  38. /** @addtogroup FLASHEx_Private_Macros
  39. * @{
  40. */
  41. #define IS_FLASH_TYPEERASE(VALUE) (((VALUE) == FLASH_TYPEERASE_PAGES) || \
  42. ((VALUE) == FLASH_TYPEERASE_MASSERASE))
  43. #define IS_OPTIONBYTE(VALUE) ((VALUE) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_DATA))
  44. #define IS_WRPSTATE(VALUE) (((VALUE) == OB_WRPSTATE_DISABLE) || \
  45. ((VALUE) == OB_WRPSTATE_ENABLE))
  46. #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == OB_DATA_ADDRESS_DATA0) || ((ADDRESS) == OB_DATA_ADDRESS_DATA1))
  47. #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\
  48. ((LEVEL) == OB_RDP_LEVEL_1))/*||\
  49. ((LEVEL) == OB_RDP_LEVEL_2))*/
  50. #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
  51. #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST))
  52. #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST))
  53. #define IS_OB_BOOT1(BOOT1) (((BOOT1) == OB_BOOT1_RESET) || ((BOOT1) == OB_BOOT1_SET))
  54. #define IS_OB_VDDA_ANALOG(ANALOG) (((ANALOG) == OB_VDDA_ANALOG_ON) || ((ANALOG) == OB_VDDA_ANALOG_OFF))
  55. #define IS_OB_SRAM_PARITY(PARITY) (((PARITY) == OB_SRAM_PARITY_SET) || ((PARITY) == OB_SRAM_PARITY_RESET))
  56. #if defined(FLASH_OBR_SDADC12_VDD_MONITOR)
  57. #define IS_OB_SDACD_VDD_MONITOR(VDD_MONITOR) (((VDD_MONITOR) == OB_SDACD_VDD_MONITOR_SET) || \
  58. ((VDD_MONITOR) == OB_SDACD_VDD_MONITOR_RESET))
  59. #endif /* FLASH_OBR_SDADC12_VDD_MONITOR */
  60. #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000U))
  61. #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) \
  62. || defined(STM32F373xC) || defined(STM32F378xx)
  63. #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x100U) ? \
  64. ((ADDRESS) <= 0x0803FFFFU) : (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x80U) ? \
  65. ((ADDRESS) <= 0x0801FFFFU) : ((ADDRESS) <= 0x0800FFFFU))))
  66. #endif /* STM32F302xC || STM32F303xC || STM32F358xx || */
  67. /* STM32F373xC || STM32F378xx */
  68. #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx)
  69. #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= 0x0807FFFFU))
  70. #endif /* STM32F302xE || STM32F303xE || STM32F398xx */
  71. #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) \
  72. || defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
  73. #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x40U) ? \
  74. ((ADDRESS) <= 0x0800FFFFU) : (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x20U) ? \
  75. ((ADDRESS) <= 0x08007FFFU) : ((ADDRESS) <= 0x08003FFFU))))
  76. #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || */
  77. /* STM32F303x8 || STM32F334x8 || STM32F328xx */
  78. #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) \
  79. || defined(STM32F373xC) || defined(STM32F378xx)
  80. #define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x100U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1U <= 0x0803FFFFU) : \
  81. (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x80U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1U <= 0x0801FFFFU) : \
  82. ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1U <= 0x0800FFFFU)))
  83. #endif /* STM32F302xC || STM32F303xC || STM32F358xx || */
  84. /* STM32F373xC || STM32F378xx */
  85. #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx)
  86. #define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1U <= 0x0807FFFFU)
  87. #endif /* STM32F302xE || STM32F303xE || STM32F398xx */
  88. #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) \
  89. || defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
  90. #define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x40U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1U <= 0x0800FFFFU) : \
  91. (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x20U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1U <= 0x08007FFFU) : \
  92. ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1U <= 0x08003FFFU)))
  93. #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || */
  94. /* STM32F303x8 || STM32F334x8 || STM32F328xx */
  95. /**
  96. * @}
  97. */
  98. /* Exported types ------------------------------------------------------------*/
  99. /** @defgroup FLASHEx_Exported_Types FLASHEx Exported Types
  100. * @{
  101. */
  102. /**
  103. * @brief FLASH Erase structure definition
  104. */
  105. typedef struct
  106. {
  107. uint32_t TypeErase; /*!< TypeErase: Mass erase or page erase.
  108. This parameter can be a value of @ref FLASHEx_Type_Erase */
  109. uint32_t PageAddress; /*!< PageAdress: Initial FLASH page address to erase when mass erase is disabled
  110. This parameter must be a number between Min_Data = FLASH_BASE and Max_Data = FLASH_BANK1_END */
  111. uint32_t NbPages; /*!< NbPages: Number of pagess to be erased.
  112. This parameter must be a value between Min_Data = 1 and Max_Data = (max number of pages - value of initial page)*/
  113. } FLASH_EraseInitTypeDef;
  114. /**
  115. * @brief FLASH Options bytes program structure definition
  116. */
  117. typedef struct
  118. {
  119. uint32_t OptionType; /*!< OptionType: Option byte to be configured.
  120. This parameter can be a value of @ref FLASHEx_OB_Type */
  121. uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation.
  122. This parameter can be a value of @ref FLASHEx_OB_WRP_State */
  123. uint32_t WRPPage; /*!< WRPPage: specifies the page(s) to be write protected
  124. This parameter can be a value of @ref FLASHEx_OB_Write_Protection */
  125. uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level..
  126. This parameter can be a value of @ref FLASHEx_OB_Read_Protection */
  127. uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte:
  128. IWDG / STOP / STDBY / BOOT1 / VDDA_ANALOG / SRAM_PARITY / SDADC12_VDD_MONITOR
  129. This parameter can be a combination of @ref FLASHEx_OB_IWatchdog, @ref FLASHEx_OB_nRST_STOP,
  130. @ref FLASHEx_OB_nRST_STDBY, @ref FLASHEx_OB_BOOT1, @ref FLASHEx_OB_VDDA_Analog_Monitoring,
  131. @ref FLASHEx_OB_RAM_Parity_Check_Enable.
  132. @if STM32F373xC
  133. And @ref FLASHEx_OB_SDADC12_VDD_MONITOR (only for STM32F373xC & STM32F378xx devices)
  134. @endif
  135. @if STM32F378xx
  136. And @ref FLASHEx_OB_SDADC12_VDD_MONITOR (only for STM32F373xC & STM32F378xx devices)
  137. @endif
  138. */
  139. uint32_t DATAAddress; /*!< DATAAddress: Address of the option byte DATA to be programmed
  140. This parameter can be a value of @ref FLASHEx_OB_Data_Address */
  141. uint8_t DATAData; /*!< DATAData: Data to be stored in the option byte DATA
  142. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFU */
  143. } FLASH_OBProgramInitTypeDef;
  144. /**
  145. * @}
  146. */
  147. /* Exported constants --------------------------------------------------------*/
  148. /** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants
  149. * @{
  150. */
  151. /** @defgroup FLASHEx_Page_Size FLASHEx Page Size
  152. * @{
  153. */
  154. #define FLASH_PAGE_SIZE 0x800
  155. /**
  156. * @}
  157. */
  158. /** @defgroup FLASHEx_Type_Erase FLASH Type Erase
  159. * @{
  160. */
  161. #define FLASH_TYPEERASE_PAGES (0x00U) /*!<Pages erase only*/
  162. #define FLASH_TYPEERASE_MASSERASE (0x01U) /*!<Flash mass erase activation*/
  163. /**
  164. * @}
  165. */
  166. /** @defgroup FLASHEx_OptionByte_Constants Option Byte Constants
  167. * @{
  168. */
  169. /** @defgroup FLASHEx_OB_Type Option Bytes Type
  170. * @{
  171. */
  172. #define OPTIONBYTE_WRP (0x01U) /*!<WRP option byte configuration*/
  173. #define OPTIONBYTE_RDP (0x02U) /*!<RDP option byte configuration*/
  174. #define OPTIONBYTE_USER (0x04U) /*!<USER option byte configuration*/
  175. #define OPTIONBYTE_DATA (0x08U) /*!<DATA option byte configuration*/
  176. /**
  177. * @}
  178. */
  179. /** @defgroup FLASHEx_OB_WRP_State Option Byte WRP State
  180. * @{
  181. */
  182. #define OB_WRPSTATE_DISABLE (0x00U) /*!<Disable the write protection of the desired pages*/
  183. #define OB_WRPSTATE_ENABLE (0x01U) /*!<Enable the write protection of the desired pagess*/
  184. /**
  185. * @}
  186. */
  187. /** @defgroup FLASHEx_OB_Write_Protection FLASHEx OB Write Protection
  188. * @{
  189. */
  190. #define OB_WRP_PAGES0TO1 (0x00000001U) /* Write protection of page 0 to 1 */
  191. #define OB_WRP_PAGES2TO3 (0x00000002U) /* Write protection of page 2 to 3 */
  192. #define OB_WRP_PAGES4TO5 (0x00000004U) /* Write protection of page 4 to 5 */
  193. #define OB_WRP_PAGES6TO7 (0x00000008U) /* Write protection of page 6 to 7 */
  194. #define OB_WRP_PAGES8TO9 (0x00000010U) /* Write protection of page 8 to 9 */
  195. #define OB_WRP_PAGES10TO11 (0x00000020U) /* Write protection of page 10 to 11 */
  196. #define OB_WRP_PAGES12TO13 (0x00000040U) /* Write protection of page 12 to 13 */
  197. #define OB_WRP_PAGES14TO15 (0x00000080U) /* Write protection of page 14 to 15 */
  198. #define OB_WRP_PAGES16TO17 (0x00000100U) /* Write protection of page 16 to 17 */
  199. #define OB_WRP_PAGES18TO19 (0x00000200U) /* Write protection of page 18 to 19 */
  200. #define OB_WRP_PAGES20TO21 (0x00000400U) /* Write protection of page 20 to 21 */
  201. #define OB_WRP_PAGES22TO23 (0x00000800U) /* Write protection of page 22 to 23 */
  202. #define OB_WRP_PAGES24TO25 (0x00001000U) /* Write protection of page 24 to 25 */
  203. #define OB_WRP_PAGES26TO27 (0x00002000U) /* Write protection of page 26 to 27 */
  204. #define OB_WRP_PAGES28TO29 (0x00004000U) /* Write protection of page 28 to 29 */
  205. #define OB_WRP_PAGES30TO31 (0x00008000U) /* Write protection of page 30 to 31 */
  206. #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) \
  207. || defined(STM32F373xC) || defined(STM32F378xx)
  208. #define OB_WRP_PAGES32TO33 (0x00010000U) /* Write protection of page 32 to 33 */
  209. #define OB_WRP_PAGES34TO35 (0x00020000U) /* Write protection of page 34 to 35 */
  210. #define OB_WRP_PAGES36TO37 (0x00040000U) /* Write protection of page 36 to 37 */
  211. #define OB_WRP_PAGES38TO39 (0x00080000U) /* Write protection of page 38 to 39 */
  212. #define OB_WRP_PAGES40TO41 (0x00100000U) /* Write protection of page 40 to 41 */
  213. #define OB_WRP_PAGES42TO43 (0x00200000U) /* Write protection of page 42 to 43 */
  214. #define OB_WRP_PAGES44TO45 (0x00400000U) /* Write protection of page 44 to 45 */
  215. #define OB_WRP_PAGES46TO47 (0x00800000U) /* Write protection of page 46 to 47 */
  216. #define OB_WRP_PAGES48TO49 (0x01000000U) /* Write protection of page 48 to 49 */
  217. #define OB_WRP_PAGES50TO51 (0x02000000U) /* Write protection of page 50 to 51 */
  218. #define OB_WRP_PAGES52TO53 (0x04000000U) /* Write protection of page 52 to 53 */
  219. #define OB_WRP_PAGES54TO55 (0x08000000U) /* Write protection of page 54 to 55 */
  220. #define OB_WRP_PAGES56TO57 (0x10000000U) /* Write protection of page 56 to 57 */
  221. #define OB_WRP_PAGES58TO59 (0x20000000U) /* Write protection of page 58 to 59 */
  222. #define OB_WRP_PAGES60TO61 (0x40000000U) /* Write protection of page 60 to 61 */
  223. #define OB_WRP_PAGES62TO127 (0x80000000U) /* Write protection of page 62 to 127 */
  224. #endif /* STM32F302xC || STM32F303xC || STM32F358xx || */
  225. /* STM32F373xC || STM32F378xx */
  226. #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx)
  227. #define OB_WRP_PAGES32TO33 (0x00010000U) /* Write protection of page 32 to 33 */
  228. #define OB_WRP_PAGES34TO35 (0x00020000U) /* Write protection of page 34 to 35 */
  229. #define OB_WRP_PAGES36TO37 (0x00040000U) /* Write protection of page 36 to 37 */
  230. #define OB_WRP_PAGES38TO39 (0x00080000U) /* Write protection of page 38 to 39 */
  231. #define OB_WRP_PAGES40TO41 (0x00100000U) /* Write protection of page 40 to 41 */
  232. #define OB_WRP_PAGES42TO43 (0x00200000U) /* Write protection of page 42 to 43 */
  233. #define OB_WRP_PAGES44TO45 (0x00400000U) /* Write protection of page 44 to 45 */
  234. #define OB_WRP_PAGES46TO47 (0x00800000U) /* Write protection of page 46 to 47 */
  235. #define OB_WRP_PAGES48TO49 (0x01000000U) /* Write protection of page 48 to 49 */
  236. #define OB_WRP_PAGES50TO51 (0x02000000U) /* Write protection of page 50 to 51 */
  237. #define OB_WRP_PAGES52TO53 (0x04000000U) /* Write protection of page 52 to 53 */
  238. #define OB_WRP_PAGES54TO55 (0x08000000U) /* Write protection of page 54 to 55 */
  239. #define OB_WRP_PAGES56TO57 (0x10000000U) /* Write protection of page 56 to 57 */
  240. #define OB_WRP_PAGES58TO59 (0x20000000U) /* Write protection of page 58 to 59 */
  241. #define OB_WRP_PAGES60TO61 (0x40000000U) /* Write protection of page 60 to 61 */
  242. #define OB_WRP_PAGES62TO255 (0x80000000U) /* Write protection of page 62 to 255 */
  243. #endif /* STM32F302xE || STM32F303xE || STM32F398xx */
  244. #define OB_WRP_PAGES0TO15MASK (0x000000FFU)
  245. #define OB_WRP_PAGES16TO31MASK (0x0000FF00U)
  246. #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) \
  247. || defined(STM32F373xC) || defined(STM32F378xx)
  248. #define OB_WRP_PAGES32TO47MASK (0x00FF0000U)
  249. #define OB_WRP_PAGES48TO127MASK (0xFF000000U)
  250. #endif /* STM32F302xC || STM32F303xC || STM32F358xx || */
  251. /* STM32F373xC || STM32F378xx */
  252. #if defined(STM32F302xE) || defined(STM32F303xE)
  253. #define OB_WRP_PAGES32TO47MASK (0x00FF0000U)
  254. #define OB_WRP_PAGES48TO255MASK (0xFF000000U)
  255. #endif /* STM32F302xE || STM32F303xE */
  256. #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) \
  257. || defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) \
  258. || defined(STM32F373xC) || defined(STM32F378xx)
  259. #define OB_WRP_ALLPAGES (0xFFFFFFFFU) /*!< Write protection of all pages */
  260. #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
  261. /* STM32F302xC || STM32F303xC || STM32F358xx || */
  262. /* STM32F373xC || STM32F378xx */
  263. #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) \
  264. || defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
  265. #define OB_WRP_ALLPAGES (0x0000FFFFU) /*!< Write protection of all pages */
  266. #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || */
  267. /* STM32F303x8 || STM32F334x8 || STM32F328xx */
  268. /**
  269. * @}
  270. */
  271. /** @defgroup FLASHEx_OB_Read_Protection Option Byte Read Protection
  272. * @{
  273. */
  274. #define OB_RDP_LEVEL_0 ((uint8_t)0xAAU)
  275. #define OB_RDP_LEVEL_1 ((uint8_t)0xBBU)
  276. #define OB_RDP_LEVEL_2 ((uint8_t)0xCCU) /*!< Warning: When enabling read protection level 2
  277. it's no more possible to go back to level 1 or 0U */
  278. /**
  279. * @}
  280. */
  281. /** @defgroup FLASHEx_OB_IWatchdog Option Byte IWatchdog
  282. * @{
  283. */
  284. #define OB_IWDG_SW ((uint8_t)0x01U) /*!< Software IWDG selected */
  285. #define OB_IWDG_HW ((uint8_t)0x00U) /*!< Hardware IWDG selected */
  286. /**
  287. * @}
  288. */
  289. /** @defgroup FLASHEx_OB_nRST_STOP Option Byte nRST STOP
  290. * @{
  291. */
  292. #define OB_STOP_NO_RST ((uint8_t)0x02U) /*!< No reset generated when entering in STOP */
  293. #define OB_STOP_RST ((uint8_t)0x00U) /*!< Reset generated when entering in STOP */
  294. /**
  295. * @}
  296. */
  297. /** @defgroup FLASHEx_OB_nRST_STDBY Option Byte nRST STDBY
  298. * @{
  299. */
  300. #define OB_STDBY_NO_RST ((uint8_t)0x04U) /*!< No reset generated when entering in STANDBY */
  301. #define OB_STDBY_RST ((uint8_t)0x00U) /*!< Reset generated when entering in STANDBY */
  302. /**
  303. * @}
  304. */
  305. /** @defgroup FLASHEx_OB_BOOT1 Option Byte BOOT1
  306. * @{
  307. */
  308. #define OB_BOOT1_RESET ((uint8_t)0x00U) /*!< BOOT1 Reset */
  309. #define OB_BOOT1_SET ((uint8_t)0x10U) /*!< BOOT1 Set */
  310. /**
  311. * @}
  312. */
  313. /** @defgroup FLASHEx_OB_VDDA_Analog_Monitoring Option Byte VDDA Analog Monitoring
  314. * @{
  315. */
  316. #define OB_VDDA_ANALOG_ON ((uint8_t)0x20U) /*!< Analog monitoring on VDDA Power source ON */
  317. #define OB_VDDA_ANALOG_OFF ((uint8_t)0x00U) /*!< Analog monitoring on VDDA Power source OFF */
  318. /**
  319. * @}
  320. */
  321. /** @defgroup FLASHEx_OB_RAM_Parity_Check_Enable Option Byte SRAM Parity Check Enable
  322. * @{
  323. */
  324. #define OB_SRAM_PARITY_SET ((uint8_t)0x00U) /*!< SRAM parity check enable set */
  325. #define OB_SRAM_PARITY_RESET ((uint8_t)0x40U) /*!< SRAM parity check enable reset */
  326. /**
  327. * @}
  328. */
  329. #if defined(FLASH_OBR_SDADC12_VDD_MONITOR)
  330. /** @defgroup FLASHEx_OB_SDADC12_VDD_MONITOR OB SDADC12 VDD MONITOR
  331. * @{
  332. */
  333. #define OB_SDACD_VDD_MONITOR_RESET ((uint8_t)0x00U) /*!< SDADC VDD Monitor reset */
  334. #define OB_SDACD_VDD_MONITOR_SET ((uint8_t)0x80U) /*!< SDADC VDD Monitor set */
  335. /**
  336. * @}
  337. */
  338. #endif /* FLASH_OBR_SDADC12_VDD_MONITOR */
  339. /** @defgroup FLASHEx_OB_Data_Address Option Byte Data Address
  340. * @{
  341. */
  342. #define OB_DATA_ADDRESS_DATA0 (0x1FFFF804U)
  343. #define OB_DATA_ADDRESS_DATA1 (0x1FFFF806U)
  344. /**
  345. * @}
  346. */
  347. /**
  348. * @}
  349. */
  350. /**
  351. * @}
  352. */
  353. /* Exported functions --------------------------------------------------------*/
  354. /** @addtogroup FLASHEx_Exported_Functions
  355. * @{
  356. */
  357. /** @addtogroup FLASHEx_Exported_Functions_Group1
  358. * @{
  359. */
  360. /* IO operation functions *****************************************************/
  361. HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
  362. HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
  363. /**
  364. * @}
  365. */
  366. /** @addtogroup FLASHEx_Exported_Functions_Group2
  367. * @{
  368. */
  369. /* Peripheral Control functions ***********************************************/
  370. HAL_StatusTypeDef HAL_FLASHEx_OBErase(void);
  371. HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
  372. void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
  373. uint32_t HAL_FLASHEx_OBGetUserData(uint32_t DATAAdress);
  374. /**
  375. * @}
  376. */
  377. /**
  378. * @}
  379. */
  380. /**
  381. * @}
  382. */
  383. /**
  384. * @}
  385. */
  386. #ifdef __cplusplus
  387. }
  388. #endif
  389. #endif /* __STM32F3xx_HAL_FLASH_EX_H */