stm32f1xx_hal_flash_ex.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_hal_flash_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of Flash HAL Extended module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F1xx_HAL_FLASH_EX_H
  37. #define __STM32F1xx_HAL_FLASH_EX_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f1xx_hal_def.h"
  43. /** @addtogroup STM32F1xx_HAL_Driver
  44. * @{
  45. */
  46. /** @addtogroup FLASHEx
  47. * @{
  48. */
  49. /** @addtogroup FLASHEx_Private_Constants
  50. * @{
  51. */
  52. #define FLASH_SIZE_DATA_REGISTER 0x1FFFF7E0U
  53. #define OBR_REG_INDEX 1U
  54. #define SR_FLAG_MASK ((uint32_t)(FLASH_SR_BSY | FLASH_SR_PGERR | FLASH_SR_WRPRTERR | FLASH_SR_EOP))
  55. /**
  56. * @}
  57. */
  58. /** @addtogroup FLASHEx_Private_Macros
  59. * @{
  60. */
  61. #define IS_FLASH_TYPEERASE(VALUE) (((VALUE) == FLASH_TYPEERASE_PAGES) || ((VALUE) == FLASH_TYPEERASE_MASSERASE))
  62. #define IS_OPTIONBYTE(VALUE) (((VALUE) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_DATA)))
  63. #define IS_WRPSTATE(VALUE) (((VALUE) == OB_WRPSTATE_DISABLE) || ((VALUE) == OB_WRPSTATE_ENABLE))
  64. #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) || ((LEVEL) == OB_RDP_LEVEL_1))
  65. #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == OB_DATA_ADDRESS_DATA0) || ((ADDRESS) == OB_DATA_ADDRESS_DATA1))
  66. #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
  67. #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST))
  68. #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST))
  69. #if defined(FLASH_BANK2_END)
  70. #define IS_OB_BOOT1(BOOT1) (((BOOT1) == OB_BOOT1_RESET) || ((BOOT1) == OB_BOOT1_SET))
  71. #endif /* FLASH_BANK2_END */
  72. /* Low Density */
  73. #if (defined(STM32F101x6) || defined(STM32F102x6) || defined(STM32F103x6))
  74. #define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x20U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)- 1 <= 0x08007FFFU) : \
  75. ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)- 1 <= 0x08003FFFU))
  76. #endif /* STM32F101x6 || STM32F102x6 || STM32F103x6 */
  77. /* Medium Density */
  78. #if (defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F102xB) || defined(STM32F103xB))
  79. #define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x80U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0801FFFFU) : \
  80. (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x40U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0800FFFFU) : \
  81. (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x20U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x08007FFFU) : \
  82. ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x08003FFFU))))
  83. #endif /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB*/
  84. /* High Density */
  85. #if (defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F103xE))
  86. #define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x200U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0807FFFFU) : \
  87. (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x180U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0805FFFFU) : \
  88. ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0803FFFFU)))
  89. #endif /* STM32F100xE || STM32F101xE || STM32F103xE */
  90. /* XL Density */
  91. #if defined(FLASH_BANK2_END)
  92. #define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x400U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x080FFFFFU) : \
  93. ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x080BFFFFU))
  94. #endif /* FLASH_BANK2_END */
  95. /* Connectivity Line */
  96. #if (defined(STM32F105xC) || defined(STM32F107xC))
  97. #define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x100U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0803FFFFU) : \
  98. (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x80U) ? ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0801FFFFU) : \
  99. ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0800FFFFU)))
  100. #endif /* STM32F105xC || STM32F107xC */
  101. #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000U))
  102. #if defined(FLASH_BANK2_END)
  103. #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \
  104. ((BANK) == FLASH_BANK_2) || \
  105. ((BANK) == FLASH_BANK_BOTH))
  106. #else
  107. #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1))
  108. #endif /* FLASH_BANK2_END */
  109. /* Low Density */
  110. #if (defined(STM32F101x6) || defined(STM32F102x6) || defined(STM32F103x6))
  111. #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x20U) ? \
  112. ((ADDRESS) <= FLASH_BANK1_END) : ((ADDRESS) <= 0x08003FFFU)))
  113. #endif /* STM32F101x6 || STM32F102x6 || STM32F103x6 */
  114. /* Medium Density */
  115. #if (defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F102xB) || defined(STM32F103xB))
  116. #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x80U) ? \
  117. ((ADDRESS) <= FLASH_BANK1_END) : (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x40U) ? \
  118. ((ADDRESS) <= 0x0800FFFF) : (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x20U) ? \
  119. ((ADDRESS) <= 0x08007FFF) : ((ADDRESS) <= 0x08003FFFU)))))
  120. #endif /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB*/
  121. /* High Density */
  122. #if (defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F103xE))
  123. #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x200U) ? \
  124. ((ADDRESS) <= FLASH_BANK1_END) : (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x180U) ? \
  125. ((ADDRESS) <= 0x0805FFFFU) : ((ADDRESS) <= 0x0803FFFFU))))
  126. #endif /* STM32F100xE || STM32F101xE || STM32F103xE */
  127. /* XL Density */
  128. #if defined(FLASH_BANK2_END)
  129. #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x400U) ? \
  130. ((ADDRESS) <= FLASH_BANK2_END) : ((ADDRESS) <= 0x080BFFFFU)))
  131. #endif /* FLASH_BANK2_END */
  132. /* Connectivity Line */
  133. #if (defined(STM32F105xC) || defined(STM32F107xC))
  134. #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x100U) ? \
  135. ((ADDRESS) <= FLASH_BANK1_END) : (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x80U) ? \
  136. ((ADDRESS) <= 0x0801FFFFU) : ((ADDRESS) <= 0x0800FFFFU))))
  137. #endif /* STM32F105xC || STM32F107xC */
  138. /**
  139. * @}
  140. */
  141. /* Exported types ------------------------------------------------------------*/
  142. /** @defgroup FLASHEx_Exported_Types FLASHEx Exported Types
  143. * @{
  144. */
  145. /**
  146. * @brief FLASH Erase structure definition
  147. */
  148. typedef struct
  149. {
  150. uint32_t TypeErase; /*!< TypeErase: Mass erase or page erase.
  151. This parameter can be a value of @ref FLASHEx_Type_Erase */
  152. uint32_t Banks; /*!< Select banks to erase when Mass erase is enabled.
  153. This parameter must be a value of @ref FLASHEx_Banks */
  154. uint32_t PageAddress; /*!< PageAdress: Initial FLASH page address to erase when mass erase is disabled
  155. This parameter must be a number between Min_Data = 0x08000000 and Max_Data = FLASH_BANKx_END
  156. (x = 1 or 2 depending on devices)*/
  157. uint32_t NbPages; /*!< NbPages: Number of pagess to be erased.
  158. This parameter must be a value between Min_Data = 1 and Max_Data = (max number of pages - value of initial page)*/
  159. } FLASH_EraseInitTypeDef;
  160. /**
  161. * @brief FLASH Options bytes program structure definition
  162. */
  163. typedef struct
  164. {
  165. uint32_t OptionType; /*!< OptionType: Option byte to be configured.
  166. This parameter can be a value of @ref FLASHEx_OB_Type */
  167. uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation.
  168. This parameter can be a value of @ref FLASHEx_OB_WRP_State */
  169. uint32_t WRPPage; /*!< WRPPage: specifies the page(s) to be write protected
  170. This parameter can be a value of @ref FLASHEx_OB_Write_Protection */
  171. uint32_t Banks; /*!< Select banks for WRP activation/deactivation of all sectors.
  172. This parameter must be a value of @ref FLASHEx_Banks */
  173. uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level..
  174. This parameter can be a value of @ref FLASHEx_OB_Read_Protection */
  175. #if defined(FLASH_BANK2_END)
  176. uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte:
  177. IWDG / STOP / STDBY / BOOT1
  178. This parameter can be a combination of @ref FLASHEx_OB_IWatchdog, @ref FLASHEx_OB_nRST_STOP,
  179. @ref FLASHEx_OB_nRST_STDBY, @ref FLASHEx_OB_BOOT1 */
  180. #else
  181. uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte:
  182. IWDG / STOP / STDBY
  183. This parameter can be a combination of @ref FLASHEx_OB_IWatchdog, @ref FLASHEx_OB_nRST_STOP,
  184. @ref FLASHEx_OB_nRST_STDBY */
  185. #endif /* FLASH_BANK2_END */
  186. uint32_t DATAAddress; /*!< DATAAddress: Address of the option byte DATA to be programmed
  187. This parameter can be a value of @ref FLASHEx_OB_Data_Address */
  188. uint8_t DATAData; /*!< DATAData: Data to be stored in the option byte DATA
  189. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */
  190. } FLASH_OBProgramInitTypeDef;
  191. /**
  192. * @}
  193. */
  194. /* Exported constants --------------------------------------------------------*/
  195. /** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants
  196. * @{
  197. */
  198. /** @defgroup FLASHEx_Constants FLASH Constants
  199. * @{
  200. */
  201. /** @defgroup FLASHEx_Page_Size Page Size
  202. * @{
  203. */
  204. #if (defined(STM32F101x6) || defined(STM32F102x6) || defined(STM32F103x6) || defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F102xB) || defined(STM32F103xB))
  205. #define FLASH_PAGE_SIZE 0x400U
  206. #endif /* STM32F101x6 || STM32F102x6 || STM32F103x6 */
  207. /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB */
  208. #if (defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG) || defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC))
  209. #define FLASH_PAGE_SIZE 0x800U
  210. #endif /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB */
  211. /* STM32F101xG || STM32F103xG */
  212. /* STM32F105xC || STM32F107xC */
  213. /**
  214. * @}
  215. */
  216. /** @defgroup FLASHEx_Type_Erase Type Erase
  217. * @{
  218. */
  219. #define FLASH_TYPEERASE_PAGES 0x00U /*!<Pages erase only*/
  220. #define FLASH_TYPEERASE_MASSERASE 0x02U /*!<Flash mass erase activation*/
  221. /**
  222. * @}
  223. */
  224. /** @defgroup FLASHEx_Banks Banks
  225. * @{
  226. */
  227. #if defined(FLASH_BANK2_END)
  228. #define FLASH_BANK_1 1U /*!< Bank 1 */
  229. #define FLASH_BANK_2 2U /*!< Bank 2 */
  230. #define FLASH_BANK_BOTH ((uint32_t)FLASH_BANK_1 | FLASH_BANK_2) /*!< Bank1 and Bank2 */
  231. #else
  232. #define FLASH_BANK_1 1U /*!< Bank 1 */
  233. #endif
  234. /**
  235. * @}
  236. */
  237. /**
  238. * @}
  239. */
  240. /** @defgroup FLASHEx_OptionByte_Constants Option Byte Constants
  241. * @{
  242. */
  243. /** @defgroup FLASHEx_OB_Type Option Bytes Type
  244. * @{
  245. */
  246. #define OPTIONBYTE_WRP 0x01U /*!<WRP option byte configuration*/
  247. #define OPTIONBYTE_RDP 0x02U /*!<RDP option byte configuration*/
  248. #define OPTIONBYTE_USER 0x04U /*!<USER option byte configuration*/
  249. #define OPTIONBYTE_DATA 0x08U /*!<DATA option byte configuration*/
  250. /**
  251. * @}
  252. */
  253. /** @defgroup FLASHEx_OB_WRP_State Option Byte WRP State
  254. * @{
  255. */
  256. #define OB_WRPSTATE_DISABLE 0x00U /*!<Disable the write protection of the desired pages*/
  257. #define OB_WRPSTATE_ENABLE 0x01U /*!<Enable the write protection of the desired pagess*/
  258. /**
  259. * @}
  260. */
  261. /** @defgroup FLASHEx_OB_Write_Protection Option Bytes Write Protection
  262. * @{
  263. */
  264. /* STM32 Low and Medium density devices */
  265. #if defined(STM32F101x6) || defined(STM32F102x6) || defined(STM32F103x6) \
  266. || defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F102xB) \
  267. || defined(STM32F103xB)
  268. #define OB_WRP_PAGES0TO3 0x00000001U /*!< Write protection of page 0 to 3 */
  269. #define OB_WRP_PAGES4TO7 0x00000002U /*!< Write protection of page 4 to 7 */
  270. #define OB_WRP_PAGES8TO11 0x00000004U /*!< Write protection of page 8 to 11 */
  271. #define OB_WRP_PAGES12TO15 0x00000008U /*!< Write protection of page 12 to 15 */
  272. #define OB_WRP_PAGES16TO19 0x00000010U /*!< Write protection of page 16 to 19 */
  273. #define OB_WRP_PAGES20TO23 0x00000020U /*!< Write protection of page 20 to 23 */
  274. #define OB_WRP_PAGES24TO27 0x00000040U /*!< Write protection of page 24 to 27 */
  275. #define OB_WRP_PAGES28TO31 0x00000080U /*!< Write protection of page 28 to 31 */
  276. #endif /* STM32F101x6 || STM32F102x6 || STM32F103x6 */
  277. /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB */
  278. /* STM32 Medium-density devices */
  279. #if defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F102xB) || defined(STM32F103xB)
  280. #define OB_WRP_PAGES32TO35 0x00000100U /*!< Write protection of page 32 to 35 */
  281. #define OB_WRP_PAGES36TO39 0x00000200U /*!< Write protection of page 36 to 39 */
  282. #define OB_WRP_PAGES40TO43 0x00000400U /*!< Write protection of page 40 to 43 */
  283. #define OB_WRP_PAGES44TO47 0x00000800U /*!< Write protection of page 44 to 47 */
  284. #define OB_WRP_PAGES48TO51 0x00001000U /*!< Write protection of page 48 to 51 */
  285. #define OB_WRP_PAGES52TO55 0x00002000U /*!< Write protection of page 52 to 55 */
  286. #define OB_WRP_PAGES56TO59 0x00004000U /*!< Write protection of page 56 to 59 */
  287. #define OB_WRP_PAGES60TO63 0x00008000U /*!< Write protection of page 60 to 63 */
  288. #define OB_WRP_PAGES64TO67 0x00010000U /*!< Write protection of page 64 to 67 */
  289. #define OB_WRP_PAGES68TO71 0x00020000U /*!< Write protection of page 68 to 71 */
  290. #define OB_WRP_PAGES72TO75 0x00040000U /*!< Write protection of page 72 to 75 */
  291. #define OB_WRP_PAGES76TO79 0x00080000U /*!< Write protection of page 76 to 79 */
  292. #define OB_WRP_PAGES80TO83 0x00100000U /*!< Write protection of page 80 to 83 */
  293. #define OB_WRP_PAGES84TO87 0x00200000U /*!< Write protection of page 84 to 87 */
  294. #define OB_WRP_PAGES88TO91 0x00400000U /*!< Write protection of page 88 to 91 */
  295. #define OB_WRP_PAGES92TO95 0x00800000U /*!< Write protection of page 92 to 95 */
  296. #define OB_WRP_PAGES96TO99 0x01000000U /*!< Write protection of page 96 to 99 */
  297. #define OB_WRP_PAGES100TO103 0x02000000U /*!< Write protection of page 100 to 103 */
  298. #define OB_WRP_PAGES104TO107 0x04000000U /*!< Write protection of page 104 to 107 */
  299. #define OB_WRP_PAGES108TO111 0x08000000U /*!< Write protection of page 108 to 111 */
  300. #define OB_WRP_PAGES112TO115 0x10000000U /*!< Write protection of page 112 to 115 */
  301. #define OB_WRP_PAGES116TO119 0x20000000U /*!< Write protection of page 115 to 119 */
  302. #define OB_WRP_PAGES120TO123 0x40000000U /*!< Write protection of page 120 to 123 */
  303. #define OB_WRP_PAGES124TO127 0x80000000U /*!< Write protection of page 124 to 127 */
  304. #endif /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB */
  305. /* STM32 High-density, XL-density and Connectivity line devices */
  306. #if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F103xE) \
  307. || defined(STM32F101xG) || defined(STM32F103xG) \
  308. || defined(STM32F105xC) || defined(STM32F107xC)
  309. #define OB_WRP_PAGES0TO1 0x00000001U /*!< Write protection of page 0 TO 1 */
  310. #define OB_WRP_PAGES2TO3 0x00000002U /*!< Write protection of page 2 TO 3 */
  311. #define OB_WRP_PAGES4TO5 0x00000004U /*!< Write protection of page 4 TO 5 */
  312. #define OB_WRP_PAGES6TO7 0x00000008U /*!< Write protection of page 6 TO 7 */
  313. #define OB_WRP_PAGES8TO9 0x00000010U /*!< Write protection of page 8 TO 9 */
  314. #define OB_WRP_PAGES10TO11 0x00000020U /*!< Write protection of page 10 TO 11 */
  315. #define OB_WRP_PAGES12TO13 0x00000040U /*!< Write protection of page 12 TO 13 */
  316. #define OB_WRP_PAGES14TO15 0x00000080U /*!< Write protection of page 14 TO 15 */
  317. #define OB_WRP_PAGES16TO17 0x00000100U /*!< Write protection of page 16 TO 17 */
  318. #define OB_WRP_PAGES18TO19 0x00000200U /*!< Write protection of page 18 TO 19 */
  319. #define OB_WRP_PAGES20TO21 0x00000400U /*!< Write protection of page 20 TO 21 */
  320. #define OB_WRP_PAGES22TO23 0x00000800U /*!< Write protection of page 22 TO 23 */
  321. #define OB_WRP_PAGES24TO25 0x00001000U /*!< Write protection of page 24 TO 25 */
  322. #define OB_WRP_PAGES26TO27 0x00002000U /*!< Write protection of page 26 TO 27 */
  323. #define OB_WRP_PAGES28TO29 0x00004000U /*!< Write protection of page 28 TO 29 */
  324. #define OB_WRP_PAGES30TO31 0x00008000U /*!< Write protection of page 30 TO 31 */
  325. #define OB_WRP_PAGES32TO33 0x00010000U /*!< Write protection of page 32 TO 33 */
  326. #define OB_WRP_PAGES34TO35 0x00020000U /*!< Write protection of page 34 TO 35 */
  327. #define OB_WRP_PAGES36TO37 0x00040000U /*!< Write protection of page 36 TO 37 */
  328. #define OB_WRP_PAGES38TO39 0x00080000U /*!< Write protection of page 38 TO 39 */
  329. #define OB_WRP_PAGES40TO41 0x00100000U /*!< Write protection of page 40 TO 41 */
  330. #define OB_WRP_PAGES42TO43 0x00200000U /*!< Write protection of page 42 TO 43 */
  331. #define OB_WRP_PAGES44TO45 0x00400000U /*!< Write protection of page 44 TO 45 */
  332. #define OB_WRP_PAGES46TO47 0x00800000U /*!< Write protection of page 46 TO 47 */
  333. #define OB_WRP_PAGES48TO49 0x01000000U /*!< Write protection of page 48 TO 49 */
  334. #define OB_WRP_PAGES50TO51 0x02000000U /*!< Write protection of page 50 TO 51 */
  335. #define OB_WRP_PAGES52TO53 0x04000000U /*!< Write protection of page 52 TO 53 */
  336. #define OB_WRP_PAGES54TO55 0x08000000U /*!< Write protection of page 54 TO 55 */
  337. #define OB_WRP_PAGES56TO57 0x10000000U /*!< Write protection of page 56 TO 57 */
  338. #define OB_WRP_PAGES58TO59 0x20000000U /*!< Write protection of page 58 TO 59 */
  339. #define OB_WRP_PAGES60TO61 0x40000000U /*!< Write protection of page 60 TO 61 */
  340. #define OB_WRP_PAGES62TO127 0x80000000U /*!< Write protection of page 62 TO 127 */
  341. #define OB_WRP_PAGES62TO255 0x80000000U /*!< Write protection of page 62 TO 255 */
  342. #define OB_WRP_PAGES62TO511 0x80000000U /*!< Write protection of page 62 TO 511 */
  343. #endif /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB */
  344. /* STM32F101xG || STM32F103xG */
  345. /* STM32F105xC || STM32F107xC */
  346. #define OB_WRP_ALLPAGES 0xFFFFFFFFU /*!< Write protection of all Pages */
  347. /* Low Density */
  348. #if defined(STM32F101x6) || defined(STM32F102x6) || defined(STM32F103x6)
  349. #define OB_WRP_PAGES0TO31MASK 0x000000FFU
  350. #endif /* STM32F101x6 || STM32F102x6 || STM32F103x6 */
  351. /* Medium Density */
  352. #if defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F102xB) || defined(STM32F103xB)
  353. #define OB_WRP_PAGES0TO31MASK 0x000000FFU
  354. #define OB_WRP_PAGES32TO63MASK 0x0000FF00U
  355. #define OB_WRP_PAGES64TO95MASK 0x00FF0000U
  356. #define OB_WRP_PAGES96TO127MASK 0xFF000000U
  357. #endif /* STM32F100xB || STM32F101xB || STM32F102xB || STM32F103xB*/
  358. /* High Density */
  359. #if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F103xE)
  360. #define OB_WRP_PAGES0TO15MASK 0x000000FFU
  361. #define OB_WRP_PAGES16TO31MASK 0x0000FF00U
  362. #define OB_WRP_PAGES32TO47MASK 0x00FF0000U
  363. #define OB_WRP_PAGES48TO255MASK 0xFF000000U
  364. #endif /* STM32F100xE || STM32F101xE || STM32F103xE */
  365. /* XL Density */
  366. #if defined(STM32F101xG) || defined(STM32F103xG)
  367. #define OB_WRP_PAGES0TO15MASK 0x000000FFU
  368. #define OB_WRP_PAGES16TO31MASK 0x0000FF00U
  369. #define OB_WRP_PAGES32TO47MASK 0x00FF0000U
  370. #define OB_WRP_PAGES48TO511MASK 0xFF000000U
  371. #endif /* STM32F101xG || STM32F103xG */
  372. /* Connectivity line devices */
  373. #if defined(STM32F105xC) || defined(STM32F107xC)
  374. #define OB_WRP_PAGES0TO15MASK 0x000000FFU
  375. #define OB_WRP_PAGES16TO31MASK 0x0000FF00U
  376. #define OB_WRP_PAGES32TO47MASK 0x00FF0000U
  377. #define OB_WRP_PAGES48TO127MASK 0xFF000000U
  378. #endif /* STM32F105xC || STM32F107xC */
  379. /**
  380. * @}
  381. */
  382. /** @defgroup FLASHEx_OB_Read_Protection Option Byte Read Protection
  383. * @{
  384. */
  385. #define OB_RDP_LEVEL_0 ((uint8_t)0xA5)
  386. #define OB_RDP_LEVEL_1 ((uint8_t)0x00)
  387. /**
  388. * @}
  389. */
  390. /** @defgroup FLASHEx_OB_IWatchdog Option Byte IWatchdog
  391. * @{
  392. */
  393. #define OB_IWDG_SW ((uint16_t)0x0001) /*!< Software IWDG selected */
  394. #define OB_IWDG_HW ((uint16_t)0x0000) /*!< Hardware IWDG selected */
  395. /**
  396. * @}
  397. */
  398. /** @defgroup FLASHEx_OB_nRST_STOP Option Byte nRST STOP
  399. * @{
  400. */
  401. #define OB_STOP_NO_RST ((uint16_t)0x0002) /*!< No reset generated when entering in STOP */
  402. #define OB_STOP_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STOP */
  403. /**
  404. * @}
  405. */
  406. /** @defgroup FLASHEx_OB_nRST_STDBY Option Byte nRST STDBY
  407. * @{
  408. */
  409. #define OB_STDBY_NO_RST ((uint16_t)0x0004) /*!< No reset generated when entering in STANDBY */
  410. #define OB_STDBY_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STANDBY */
  411. /**
  412. * @}
  413. */
  414. #if defined(FLASH_BANK2_END)
  415. /** @defgroup FLASHEx_OB_BOOT1 Option Byte BOOT1
  416. * @{
  417. */
  418. #define OB_BOOT1_RESET ((uint16_t)0x0000) /*!< BOOT1 Reset */
  419. #define OB_BOOT1_SET ((uint16_t)0x0008) /*!< BOOT1 Set */
  420. /**
  421. * @}
  422. */
  423. #endif /* FLASH_BANK2_END */
  424. /** @defgroup FLASHEx_OB_Data_Address Option Byte Data Address
  425. * @{
  426. */
  427. #define OB_DATA_ADDRESS_DATA0 0x1FFFF804U
  428. #define OB_DATA_ADDRESS_DATA1 0x1FFFF806U
  429. /**
  430. * @}
  431. */
  432. /**
  433. * @}
  434. */
  435. /** @addtogroup FLASHEx_Constants
  436. * @{
  437. */
  438. /** @defgroup FLASH_Flag_definition Flag definition
  439. * @brief Flag definition
  440. * @{
  441. */
  442. #if defined(FLASH_BANK2_END)
  443. #define FLASH_FLAG_BSY FLASH_FLAG_BSY_BANK1 /*!< FLASH Bank1 Busy flag */
  444. #define FLASH_FLAG_PGERR FLASH_FLAG_PGERR_BANK1 /*!< FLASH Bank1 Programming error flag */
  445. #define FLASH_FLAG_WRPERR FLASH_FLAG_WRPERR_BANK1 /*!< FLASH Bank1 Write protected error flag */
  446. #define FLASH_FLAG_EOP FLASH_FLAG_EOP_BANK1 /*!< FLASH Bank1 End of Operation flag */
  447. #define FLASH_FLAG_BSY_BANK1 FLASH_SR_BSY /*!< FLASH Bank1 Busy flag */
  448. #define FLASH_FLAG_PGERR_BANK1 FLASH_SR_PGERR /*!< FLASH Bank1 Programming error flag */
  449. #define FLASH_FLAG_WRPERR_BANK1 FLASH_SR_WRPRTERR /*!< FLASH Bank1 Write protected error flag */
  450. #define FLASH_FLAG_EOP_BANK1 FLASH_SR_EOP /*!< FLASH Bank1 End of Operation flag */
  451. #define FLASH_FLAG_BSY_BANK2 (FLASH_SR2_BSY << 16U) /*!< FLASH Bank2 Busy flag */
  452. #define FLASH_FLAG_PGERR_BANK2 (FLASH_SR2_PGERR << 16U) /*!< FLASH Bank2 Programming error flag */
  453. #define FLASH_FLAG_WRPERR_BANK2 (FLASH_SR2_WRPRTERR << 16U) /*!< FLASH Bank2 Write protected error flag */
  454. #define FLASH_FLAG_EOP_BANK2 (FLASH_SR2_EOP << 16U) /*!< FLASH Bank2 End of Operation flag */
  455. #else
  456. #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */
  457. #define FLASH_FLAG_PGERR FLASH_SR_PGERR /*!< FLASH Programming error flag */
  458. #define FLASH_FLAG_WRPERR FLASH_SR_WRPRTERR /*!< FLASH Write protected error flag */
  459. #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Operation flag */
  460. #endif
  461. #define FLASH_FLAG_OPTVERR ((OBR_REG_INDEX << 8U | FLASH_OBR_OPTERR)) /*!< Option Byte Error */
  462. /**
  463. * @}
  464. */
  465. /** @defgroup FLASH_Interrupt_definition Interrupt definition
  466. * @brief FLASH Interrupt definition
  467. * @{
  468. */
  469. #if defined(FLASH_BANK2_END)
  470. #define FLASH_IT_EOP FLASH_IT_EOP_BANK1 /*!< End of FLASH Operation Interrupt source Bank1 */
  471. #define FLASH_IT_ERR FLASH_IT_ERR_BANK1 /*!< Error Interrupt source Bank1 */
  472. #define FLASH_IT_EOP_BANK1 FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source Bank1 */
  473. #define FLASH_IT_ERR_BANK1 FLASH_CR_ERRIE /*!< Error Interrupt source Bank1 */
  474. #define FLASH_IT_EOP_BANK2 (FLASH_CR2_EOPIE << 16U) /*!< End of FLASH Operation Interrupt source Bank2 */
  475. #define FLASH_IT_ERR_BANK2 (FLASH_CR2_ERRIE << 16U) /*!< Error Interrupt source Bank2 */
  476. #else
  477. #define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */
  478. #define FLASH_IT_ERR FLASH_CR_ERRIE /*!< Error Interrupt source */
  479. #endif
  480. /**
  481. * @}
  482. */
  483. /**
  484. * @}
  485. */
  486. /**
  487. * @}
  488. */
  489. /* Exported macro ------------------------------------------------------------*/
  490. /** @defgroup FLASHEx_Exported_Macros FLASHEx Exported Macros
  491. * @{
  492. */
  493. /** @defgroup FLASH_Interrupt Interrupt
  494. * @brief macros to handle FLASH interrupts
  495. * @{
  496. */
  497. #if defined(FLASH_BANK2_END)
  498. /**
  499. * @brief Enable the specified FLASH interrupt.
  500. * @param __INTERRUPT__ FLASH interrupt
  501. * This parameter can be any combination of the following values:
  502. * @arg @ref FLASH_IT_EOP_BANK1 End of FLASH Operation Interrupt on bank1
  503. * @arg @ref FLASH_IT_ERR_BANK1 Error Interrupt on bank1
  504. * @arg @ref FLASH_IT_EOP_BANK2 End of FLASH Operation Interrupt on bank2
  505. * @arg @ref FLASH_IT_ERR_BANK2 Error Interrupt on bank2
  506. * @retval none
  507. */
  508. #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) do { \
  509. /* Enable Bank1 IT */ \
  510. SET_BIT(FLASH->CR, ((__INTERRUPT__) & 0x0000FFFFU)); \
  511. /* Enable Bank2 IT */ \
  512. SET_BIT(FLASH->CR2, ((__INTERRUPT__) >> 16U)); \
  513. } while(0U)
  514. /**
  515. * @brief Disable the specified FLASH interrupt.
  516. * @param __INTERRUPT__ FLASH interrupt
  517. * This parameter can be any combination of the following values:
  518. * @arg @ref FLASH_IT_EOP_BANK1 End of FLASH Operation Interrupt on bank1
  519. * @arg @ref FLASH_IT_ERR_BANK1 Error Interrupt on bank1
  520. * @arg @ref FLASH_IT_EOP_BANK2 End of FLASH Operation Interrupt on bank2
  521. * @arg @ref FLASH_IT_ERR_BANK2 Error Interrupt on bank2
  522. * @retval none
  523. */
  524. #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) do { \
  525. /* Disable Bank1 IT */ \
  526. CLEAR_BIT(FLASH->CR, ((__INTERRUPT__) & 0x0000FFFFU)); \
  527. /* Disable Bank2 IT */ \
  528. CLEAR_BIT(FLASH->CR2, ((__INTERRUPT__) >> 16U)); \
  529. } while(0U)
  530. /**
  531. * @brief Get the specified FLASH flag status.
  532. * @param __FLAG__ specifies the FLASH flag to check.
  533. * This parameter can be one of the following values:
  534. * @arg @ref FLASH_FLAG_EOP_BANK1 FLASH End of Operation flag on bank1
  535. * @arg @ref FLASH_FLAG_WRPERR_BANK1 FLASH Write protected error flag on bank1
  536. * @arg @ref FLASH_FLAG_PGERR_BANK1 FLASH Programming error flag on bank1
  537. * @arg @ref FLASH_FLAG_BSY_BANK1 FLASH Busy flag on bank1
  538. * @arg @ref FLASH_FLAG_EOP_BANK2 FLASH End of Operation flag on bank2
  539. * @arg @ref FLASH_FLAG_WRPERR_BANK2 FLASH Write protected error flag on bank2
  540. * @arg @ref FLASH_FLAG_PGERR_BANK2 FLASH Programming error flag on bank2
  541. * @arg @ref FLASH_FLAG_BSY_BANK2 FLASH Busy flag on bank2
  542. * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match
  543. * @retval The new state of __FLAG__ (SET or RESET).
  544. */
  545. #define __HAL_FLASH_GET_FLAG(__FLAG__) (((__FLAG__) == FLASH_FLAG_OPTVERR) ? \
  546. (FLASH->OBR & FLASH_OBR_OPTERR) : \
  547. ((((__FLAG__) & SR_FLAG_MASK) != RESET)? \
  548. (FLASH->SR & ((__FLAG__) & SR_FLAG_MASK)) : \
  549. (FLASH->SR2 & ((__FLAG__) >> 16U))))
  550. /**
  551. * @brief Clear the specified FLASH flag.
  552. * @param __FLAG__ specifies the FLASH flags to clear.
  553. * This parameter can be any combination of the following values:
  554. * @arg @ref FLASH_FLAG_EOP_BANK1 FLASH End of Operation flag on bank1
  555. * @arg @ref FLASH_FLAG_WRPERR_BANK1 FLASH Write protected error flag on bank1
  556. * @arg @ref FLASH_FLAG_PGERR_BANK1 FLASH Programming error flag on bank1
  557. * @arg @ref FLASH_FLAG_BSY_BANK1 FLASH Busy flag on bank1
  558. * @arg @ref FLASH_FLAG_EOP_BANK2 FLASH End of Operation flag on bank2
  559. * @arg @ref FLASH_FLAG_WRPERR_BANK2 FLASH Write protected error flag on bank2
  560. * @arg @ref FLASH_FLAG_PGERR_BANK2 FLASH Programming error flag on bank2
  561. * @arg @ref FLASH_FLAG_BSY_BANK2 FLASH Busy flag on bank2
  562. * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match
  563. * @retval none
  564. */
  565. #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) do { \
  566. /* Clear FLASH_FLAG_OPTVERR flag */ \
  567. if ((__FLAG__) == FLASH_FLAG_OPTVERR) \
  568. { \
  569. CLEAR_BIT(FLASH->OBR, FLASH_OBR_OPTERR); \
  570. } \
  571. else { \
  572. /* Clear Flag in Bank1 */ \
  573. if (((__FLAG__) & SR_FLAG_MASK) != RESET) \
  574. { \
  575. FLASH->SR = ((__FLAG__) & SR_FLAG_MASK); \
  576. } \
  577. /* Clear Flag in Bank2 */ \
  578. if (((__FLAG__) >> 16U) != RESET) \
  579. { \
  580. FLASH->SR2 = ((__FLAG__) >> 16U); \
  581. } \
  582. } \
  583. } while(0U)
  584. #else
  585. /**
  586. * @brief Enable the specified FLASH interrupt.
  587. * @param __INTERRUPT__ FLASH interrupt
  588. * This parameter can be any combination of the following values:
  589. * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt
  590. * @arg @ref FLASH_IT_ERR Error Interrupt
  591. * @retval none
  592. */
  593. #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__))
  594. /**
  595. * @brief Disable the specified FLASH interrupt.
  596. * @param __INTERRUPT__ FLASH interrupt
  597. * This parameter can be any combination of the following values:
  598. * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt
  599. * @arg @ref FLASH_IT_ERR Error Interrupt
  600. * @retval none
  601. */
  602. #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(__INTERRUPT__))
  603. /**
  604. * @brief Get the specified FLASH flag status.
  605. * @param __FLAG__ specifies the FLASH flag to check.
  606. * This parameter can be one of the following values:
  607. * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag
  608. * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag
  609. * @arg @ref FLASH_FLAG_PGERR FLASH Programming error flag
  610. * @arg @ref FLASH_FLAG_BSY FLASH Busy flag
  611. * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match
  612. * @retval The new state of __FLAG__ (SET or RESET).
  613. */
  614. #define __HAL_FLASH_GET_FLAG(__FLAG__) (((__FLAG__) == FLASH_FLAG_OPTVERR) ? \
  615. (FLASH->OBR & FLASH_OBR_OPTERR) : \
  616. (FLASH->SR & (__FLAG__)))
  617. /**
  618. * @brief Clear the specified FLASH flag.
  619. * @param __FLAG__ specifies the FLASH flags to clear.
  620. * This parameter can be any combination of the following values:
  621. * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag
  622. * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag
  623. * @arg @ref FLASH_FLAG_PGERR FLASH Programming error flag
  624. * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match
  625. * @retval none
  626. */
  627. #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) do { \
  628. /* Clear FLASH_FLAG_OPTVERR flag */ \
  629. if ((__FLAG__) == FLASH_FLAG_OPTVERR) \
  630. { \
  631. CLEAR_BIT(FLASH->OBR, FLASH_OBR_OPTERR); \
  632. } \
  633. else { \
  634. /* Clear Flag in Bank1 */ \
  635. FLASH->SR = (__FLAG__); \
  636. } \
  637. } while(0U)
  638. #endif
  639. /**
  640. * @}
  641. */
  642. /**
  643. * @}
  644. */
  645. /* Exported functions --------------------------------------------------------*/
  646. /** @addtogroup FLASHEx_Exported_Functions
  647. * @{
  648. */
  649. /** @addtogroup FLASHEx_Exported_Functions_Group1
  650. * @{
  651. */
  652. /* IO operation functions *****************************************************/
  653. HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
  654. HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
  655. /**
  656. * @}
  657. */
  658. /** @addtogroup FLASHEx_Exported_Functions_Group2
  659. * @{
  660. */
  661. /* Peripheral Control functions ***********************************************/
  662. HAL_StatusTypeDef HAL_FLASHEx_OBErase(void);
  663. HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
  664. void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
  665. uint32_t HAL_FLASHEx_OBGetUserData(uint32_t DATAAdress);
  666. /**
  667. * @}
  668. */
  669. /**
  670. * @}
  671. */
  672. /**
  673. * @}
  674. */
  675. /**
  676. * @}
  677. */
  678. #ifdef __cplusplus
  679. }
  680. #endif
  681. #endif /* __STM32F1xx_HAL_FLASH_EX_H */
  682. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/