You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

812 lines
38 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32l0xx_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.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __STM32L0xx_HAL_FLASH_EX_H
  21. #define __STM32L0xx_HAL_FLASH_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32l0xx_hal_def.h"
  27. /** @addtogroup STM32L0xx_HAL_Driver
  28. * @{
  29. */
  30. /** @addtogroup FLASHEx
  31. * @{
  32. */
  33. /** @addtogroup FLASHEx_Private_Constants
  34. * @{
  35. */
  36. #define FLASH_SIZE_DATA_REGISTER FLASHSIZE_BASE
  37. #define FLASH_NBPAGES_MAX (FLASH_SIZE / FLASH_PAGE_SIZE)
  38. #define WRP_MASK_LOW (0x0000FFFFU)
  39. #define WRP_MASK_HIGH (0xFFFF0000U)
  40. /**
  41. * @}
  42. */
  43. /** @addtogroup FLASHEx_Private_Macros
  44. * @{
  45. */
  46. #define IS_FLASH_TYPEERASE(__VALUE__) (((__VALUE__) == FLASH_TYPEERASE_PAGES))
  47. #define IS_OPTIONBYTE(__VALUE__) (((__VALUE__) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | \
  48. OPTIONBYTE_USER | OPTIONBYTE_BOR | OPTIONBYTE_BOOT_BIT1)))
  49. #define IS_WRPSTATE(__VALUE__) (((__VALUE__) == OB_WRPSTATE_DISABLE) || \
  50. ((__VALUE__) == OB_WRPSTATE_ENABLE))
  51. #define IS_OB_WRP(__PAGE__) (((__PAGE__) != 0x0000000U))
  52. #define IS_OB_RDP(__LEVEL__) (((__LEVEL__) == OB_RDP_LEVEL_0) ||\
  53. ((__LEVEL__) == OB_RDP_LEVEL_1) ||\
  54. ((__LEVEL__) == OB_RDP_LEVEL_2))
  55. #define IS_OB_BOR_LEVEL(__LEVEL__) (((__LEVEL__) == OB_BOR_OFF) || \
  56. ((__LEVEL__) == OB_BOR_LEVEL1) || \
  57. ((__LEVEL__) == OB_BOR_LEVEL2) || \
  58. ((__LEVEL__) == OB_BOR_LEVEL3) || \
  59. ((__LEVEL__) == OB_BOR_LEVEL4) || \
  60. ((__LEVEL__) == OB_BOR_LEVEL5))
  61. #define IS_OB_IWDG_SOURCE(__SOURCE__) (((__SOURCE__) == OB_IWDG_SW) || ((__SOURCE__) == OB_IWDG_HW))
  62. #define IS_OB_STOP_SOURCE(__SOURCE__) (((__SOURCE__) == OB_STOP_NORST) || ((__SOURCE__) == OB_STOP_RST))
  63. #define IS_OB_STDBY_SOURCE(__SOURCE__) (((__SOURCE__) == OB_STDBY_NORST) || ((__SOURCE__) == OB_STDBY_RST))
  64. #if defined(FLASH_OPTR_WPRMOD) && defined(FLASH_OPTR_BFB2)
  65. #define IS_OBEX(__VALUE__) (((__VALUE__) <= (OPTIONBYTE_PCROP | OPTIONBYTE_BOOTCONFIG)) && ((__VALUE__) != 0U))
  66. #elif defined(FLASH_OPTR_WPRMOD) && !defined(FLASH_OPTR_BFB2)
  67. #define IS_OBEX(__VALUE__) ((__VALUE__) == OPTIONBYTE_PCROP)
  68. #elif !defined(FLASH_OPTR_WPRMOD) && defined(FLASH_OPTR_BFB2)
  69. #define IS_OBEX(__VALUE__) ((__VALUE__) == OPTIONBYTE_BOOTCONFIG)
  70. #endif /* FLASH_OPTR_WPRMOD && FLASH_OPTR_BFB2 */
  71. #if defined(FLASH_OPTR_WPRMOD)
  72. #define IS_PCROPSTATE(__VALUE__) (((__VALUE__) == OB_PCROP_STATE_DISABLE) || \
  73. ((__VALUE__) == OB_PCROP_STATE_ENABLE))
  74. #define IS_OB_PCROP(__PAGE__) (((__PAGE__) != 0x0000000U))
  75. #endif /* FLASH_OPTR_WPRMOD */
  76. #if defined(FLASH_OPTR_BFB2)
  77. #define IS_OB_BOOT_BANK(__BANK__) (((__BANK__) == OB_BOOT_BANK2) || ((__BANK__) == OB_BOOT_BANK1))
  78. #endif /* FLASH_OPTR_BFB2 */
  79. #define IS_OB_BOOT1(__BOOT_BIT1__) (((__BOOT_BIT1__) == OB_BOOT_BIT1_RESET) || ((__BOOT_BIT1__) == OB_BOOT_BIT1_SET))
  80. #define IS_TYPEPROGRAMDATA(__VALUE__) (((__VALUE__) == FLASH_TYPEPROGRAMDATA_BYTE) || \
  81. ((__VALUE__) == FLASH_TYPEPROGRAMDATA_HALFWORD) || \
  82. ((__VALUE__) == FLASH_TYPEPROGRAMDATA_WORD))
  83. /** @defgroup FLASHEx_Address FLASHEx Address
  84. * @{
  85. */
  86. #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
  87. #define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK2_END))
  88. #define IS_FLASH_DATA_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK1_END))
  89. #define IS_FLASH_DATA_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BANK2_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK2_END))
  90. #define IS_FLASH_PROGRAM_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE)))
  91. #define IS_FLASH_PROGRAM_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + (FLASH_SIZE >> 1))))
  92. #define IS_FLASH_PROGRAM_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BANK2_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE)))
  93. #else
  94. #define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_END))
  95. #define IS_FLASH_PROGRAM_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE)))
  96. #endif
  97. #define IS_NBPAGES(__PAGES__) (((__PAGES__) >= 1) && ((__PAGES__) <= FLASH_NBPAGES_MAX))
  98. /**
  99. * @}
  100. */
  101. /**
  102. * @}
  103. */
  104. /* Exported types ------------------------------------------------------------*/
  105. /** @defgroup FLASHEx_Exported_Types FLASHEx Exported Types
  106. * @{
  107. */
  108. /**
  109. * @brief FLASH Erase structure definition
  110. */
  111. typedef struct
  112. {
  113. uint32_t TypeErase; /*!< TypeErase: Page Erase only.
  114. This parameter can be a value of @ref FLASHEx_Type_Erase */
  115. uint32_t PageAddress; /*!< PageAddress: Initial FLASH address to be erased
  116. This parameter must be a value belonging to FLASH Programm address (depending on the devices) */
  117. uint32_t NbPages; /*!< NbPages: Number of pages to be erased.
  118. This parameter must be a value between 1 and (max number of pages - value of Initial page)*/
  119. } FLASH_EraseInitTypeDef;
  120. /**
  121. * @brief FLASH Option Bytes PROGRAM structure definition
  122. */
  123. typedef struct
  124. {
  125. uint32_t OptionType; /*!< OptionType: Option byte to be configured.
  126. This parameter can be a value of @ref FLASHEx_Option_Type */
  127. uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation.
  128. This parameter can be a value of @ref FLASHEx_WRP_State */
  129. uint32_t WRPSector; /*!< WRPSector: This bitfield specifies the sector (s) which are write protected.
  130. This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection */
  131. #if defined(STM32L071xx) || defined(STM32L072xx) || defined(STM32L073xx) || defined(STM32L081xx) || defined(STM32L082xx) || defined(STM32L083xx)
  132. uint32_t WRPSector2; /*!< WRPSector2 : This bitfield specifies the sector(s) upper Sector31 which are write protected.
  133. This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection2 */
  134. #endif
  135. uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level.
  136. This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */
  137. uint8_t BORLevel; /*!< BORLevel: Set the BOR Level.
  138. This parameter can be a value of @ref FLASHEx_Option_Bytes_BOR_Level */
  139. uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.
  140. This parameter can be a combination of @ref FLASHEx_Option_Bytes_IWatchdog,
  141. @ref FLASHEx_Option_Bytes_nRST_STOP and @ref FLASHEx_Option_Bytes_nRST_STDBY*/
  142. uint8_t BOOTBit1Config; /*!< BOOT1Config: Together with input pad Boot0, this bit selects the boot source, flash, ram or system memory
  143. This parameter can be a value of @ref FLASHEx_Option_Bytes_BOOTBit1 */
  144. } FLASH_OBProgramInitTypeDef;
  145. #if defined(FLASH_OPTR_WPRMOD) || defined(FLASH_OPTR_BFB2)
  146. /**
  147. * @brief FLASH Advanced Option Bytes Program structure definition
  148. */
  149. typedef struct
  150. {
  151. uint32_t OptionType; /*!< OptionType: Option byte to be configured for extension .
  152. This parameter can be a value of @ref FLASHEx_OptionAdv_Type */
  153. #if defined(FLASH_OPTR_WPRMOD)
  154. uint32_t PCROPState; /*!< PCROPState: PCROP activation or deactivation.
  155. This parameter can be a value of @ref FLASHEx_PCROP_State */
  156. uint32_t PCROPSector; /*!< PCROPSector : This bitfield specifies the sector(s) which are read/write protected.
  157. This parameter can be a combination of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */
  158. #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
  159. uint32_t PCROPSector2; /*!< PCROPSector : This bitfield specifies the sector(s) upper Sector31 which are read/write protected.
  160. This parameter can be a combination of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection2 */
  161. #endif /* STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */
  162. #endif /* FLASH_OPTR_WPRMOD */
  163. #if defined(FLASH_OPTR_BFB2)
  164. uint16_t BootConfig; /*!< BootConfig: specifies Option bytes for boot config
  165. This parameter can be a value of @ref FLASHEx_Option_Bytes_BOOT */
  166. #endif /* FLASH_OPTR_BFB2*/
  167. } FLASH_AdvOBProgramInitTypeDef;
  168. /**
  169. * @}
  170. */
  171. #endif /* FLASH_OPTR_WPRMOD || FLASH_OPTR_BFB2 */
  172. /* Exported constants --------------------------------------------------------*/
  173. /** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants
  174. * @{
  175. */
  176. /** @defgroup FLASHEx_Type_Erase FLASHEx_Type_Erase
  177. * @{
  178. */
  179. #define FLASH_TYPEERASE_PAGES ((uint32_t)0x00U) /*!<Page erase only*/
  180. /**
  181. * @}
  182. */
  183. /** @defgroup FLASHEx_Option_Type FLASHEx Option Type
  184. * @{
  185. */
  186. #define OPTIONBYTE_WRP ((uint32_t)0x01U) /*!<WRP option byte configuration*/
  187. #define OPTIONBYTE_RDP ((uint32_t)0x02U) /*!<RDP option byte configuration*/
  188. #define OPTIONBYTE_USER ((uint32_t)0x04U) /*!<USER option byte configuration*/
  189. #define OPTIONBYTE_BOR ((uint32_t)0x08U) /*!<BOR option byte configuration*/
  190. #define OPTIONBYTE_BOOT_BIT1 ((uint32_t)0x10U) /*!< BOOT PIN1 option byte configuration*/
  191. /**
  192. * @}
  193. */
  194. /** @defgroup FLASHEx_WRP_State FLASHEx WRP State
  195. * @{
  196. */
  197. #define OB_WRPSTATE_DISABLE ((uint32_t)0x00U) /*!<Disable the write protection of the desired sectors*/
  198. #define OB_WRPSTATE_ENABLE ((uint32_t)0x01U) /*!<Enable the write protection of the desired sectors*/
  199. /**
  200. * @}
  201. */
  202. #if defined (STM32L011xx) || defined (STM32L021xx) || defined (STM32L031xx) || defined (STM32L041xx)
  203. /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write Protection
  204. * @{
  205. */
  206. #define OB_WRP_Pages0to31 ((uint32_t)0x00000001U) /* Write protection of Sector0 */
  207. #define OB_WRP_Pages32to63 ((uint32_t)0x00000002U) /* Write protection of Sector1 */
  208. #define OB_WRP_Pages64to95 ((uint32_t)0x00000004U) /* Write protection of Sector2 */
  209. #define OB_WRP_Pages96to127 ((uint32_t)0x00000008U) /* Write protection of Sector3 */
  210. #define OB_WRP_Pages128to159 ((uint32_t)0x00000010U) /* Write protection of Sector4 */
  211. #define OB_WRP_Pages160to191 ((uint32_t)0x00000020U) /* Write protection of Sector5 */
  212. #define OB_WRP_Pages192to223 ((uint32_t)0x00000040U) /* Write protection of Sector6 */
  213. #define OB_WRP_Pages224to255 ((uint32_t)0x00000080U) /* Write protection of Sector7 */
  214. #define OB_WRP_AllPages ((uint32_t)0x000000FFU) /*!< Write protection of all Sectors */
  215. /**
  216. * @}
  217. */
  218. #elif defined (STM32L051xx) || defined (STM32L052xx) || defined (STM32L053xx) || defined (STM32L061xx) || defined (STM32L062xx) || defined (STM32L063xx)
  219. /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write Protection
  220. * @{
  221. */
  222. #define OB_WRP_Pages0to31 ((uint32_t)0x00000001U) /* Write protection of Sector0 */
  223. #define OB_WRP_Pages32to63 ((uint32_t)0x00000002U) /* Write protection of Sector1 */
  224. #define OB_WRP_Pages64to95 ((uint32_t)0x00000004U) /* Write protection of Sector2 */
  225. #define OB_WRP_Pages96to127 ((uint32_t)0x00000008U) /* Write protection of Sector3 */
  226. #define OB_WRP_Pages128to159 ((uint32_t)0x00000010U) /* Write protection of Sector4 */
  227. #define OB_WRP_Pages160to191 ((uint32_t)0x00000020U) /* Write protection of Sector5 */
  228. #define OB_WRP_Pages192to223 ((uint32_t)0x00000040U) /* Write protection of Sector6 */
  229. #define OB_WRP_Pages224to255 ((uint32_t)0x00000080U) /* Write protection of Sector7 */
  230. #define OB_WRP_Pages256to287 ((uint32_t)0x00000100U) /* Write protection of Sector8 */
  231. #define OB_WRP_Pages288to319 ((uint32_t)0x00000200U) /* Write protection of Sector9 */
  232. #define OB_WRP_Pages320to351 ((uint32_t)0x00000400U) /* Write protection of Sector10 */
  233. #define OB_WRP_Pages352to383 ((uint32_t)0x00000800U) /* Write protection of Sector11 */
  234. #define OB_WRP_Pages384to415 ((uint32_t)0x00001000U) /* Write protection of Sector12 */
  235. #define OB_WRP_Pages416to447 ((uint32_t)0x00002000U) /* Write protection of Sector13 */
  236. #define OB_WRP_Pages448to479 ((uint32_t)0x00004000U) /* Write protection of Sector14 */
  237. #define OB_WRP_Pages480to511 ((uint32_t)0x00008000U) /* Write protection of Sector15 */
  238. #define OB_WRP_AllPages ((uint32_t)0x0000FFFFU) /*!< Write protection of all Sectors */
  239. /**
  240. * @}
  241. */
  242. #elif defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
  243. /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write ProtectionP
  244. * @{
  245. */
  246. #define OB_WRP_Pages0to31 ((uint32_t)0x00000001U) /* Write protection of Sector0 */
  247. #define OB_WRP_Pages32to63 ((uint32_t)0x00000002U) /* Write protection of Sector1 */
  248. #define OB_WRP_Pages64to95 ((uint32_t)0x00000004U) /* Write protection of Sector2 */
  249. #define OB_WRP_Pages96to127 ((uint32_t)0x00000008U) /* Write protection of Sector3 */
  250. #define OB_WRP_Pages128to159 ((uint32_t)0x00000010U) /* Write protection of Sector4 */
  251. #define OB_WRP_Pages160to191 ((uint32_t)0x00000020U) /* Write protection of Sector5 */
  252. #define OB_WRP_Pages192to223 ((uint32_t)0x00000040U) /* Write protection of Sector6 */
  253. #define OB_WRP_Pages224to255 ((uint32_t)0x00000080U) /* Write protection of Sector7 */
  254. #define OB_WRP_Pages256to287 ((uint32_t)0x00000100U) /* Write protection of Sector8 */
  255. #define OB_WRP_Pages288to319 ((uint32_t)0x00000200U) /* Write protection of Sector9 */
  256. #define OB_WRP_Pages320to351 ((uint32_t)0x00000400U) /* Write protection of Sector10 */
  257. #define OB_WRP_Pages352to383 ((uint32_t)0x00000800U) /* Write protection of Sector11 */
  258. #define OB_WRP_Pages384to415 ((uint32_t)0x00001000U) /* Write protection of Sector12 */
  259. #define OB_WRP_Pages416to447 ((uint32_t)0x00002000U) /* Write protection of Sector13 */
  260. #define OB_WRP_Pages448to479 ((uint32_t)0x00004000U) /* Write protection of Sector14 */
  261. #define OB_WRP_Pages480to511 ((uint32_t)0x00008000U) /* Write protection of Sector15 */
  262. #define OB_WRP_Pages512to543 ((uint32_t)0x00010000U) /* Write protection of Sector16 */
  263. #define OB_WRP_Pages544to575 ((uint32_t)0x00020000U) /* Write protection of Sector17 */
  264. #define OB_WRP_Pages576to607 ((uint32_t)0x00040000U) /* Write protection of Sector18 */
  265. #define OB_WRP_Pages608to639 ((uint32_t)0x00080000U) /* Write protection of Sector19 */
  266. #define OB_WRP_Pages640to671 ((uint32_t)0x00100000U) /* Write protection of Sector20 */
  267. #define OB_WRP_Pages672to703 ((uint32_t)0x00200000U) /* Write protection of Sector21 */
  268. #define OB_WRP_Pages704to735 ((uint32_t)0x00400000U) /* Write protection of Sector22 */
  269. #define OB_WRP_Pages736to767 ((uint32_t)0x00800000U) /* Write protection of Sector23 */
  270. #define OB_WRP_Pages768to799 ((uint32_t)0x01000000U) /* Write protection of Sector24 */
  271. #define OB_WRP_Pages800to831 ((uint32_t)0x02000000U) /* Write protection of Sector25 */
  272. #define OB_WRP_Pages832to863 ((uint32_t)0x04000000U) /* Write protection of Sector26 */
  273. #define OB_WRP_Pages864to895 ((uint32_t)0x08000000U) /* Write protection of Sector27 */
  274. #define OB_WRP_Pages896to927 ((uint32_t)0x10000000U) /* Write protection of Sector28 */
  275. #define OB_WRP_Pages928to959 ((uint32_t)0x20000000U) /* Write protection of Sector29 */
  276. #define OB_WRP_Pages960to991 ((uint32_t)0x40000000U) /* Write protection of Sector30 */
  277. #define OB_WRP_Pages992to1023 ((uint32_t)0x80000000U) /* Write protection of Sector31 */
  278. #define OB_WRP_AllPages ((uint32_t)0xFFFFFFFFU) /*!<Write protection of all Sectors */
  279. /**
  280. * @}
  281. */
  282. /** @defgroup FLASHEx_Option_Bytes_Write_Protection2 FLASH Option Bytes Write Protection
  283. * @{
  284. */
  285. #define OB_WRP2_Pages1024to1055 ((uint32_t)0x00000001U) /* Write protection of Sector32 */
  286. #define OB_WRP2_Pages1056to1087 ((uint32_t)0x00000002U) /* Write protection of Sector33 */
  287. #define OB_WRP2_Pages1088to1119 ((uint32_t)0x00000004U) /* Write protection of Sector34 */
  288. #define OB_WRP2_Pages1120to1151 ((uint32_t)0x00000008U) /* Write protection of Sector35 */
  289. #define OB_WRP2_Pages1152to1183 ((uint32_t)0x00000010U) /* Write protection of Sector36 */
  290. #define OB_WRP2_Pages1184to1215 ((uint32_t)0x00000020U) /* Write protection of Sector37 */
  291. #define OB_WRP2_Pages1216to1247 ((uint32_t)0x00000040U) /* Write protection of Sector38 */
  292. #define OB_WRP2_Pages1248to1279 ((uint32_t)0x00000080U) /* Write protection of Sector39 */
  293. #define OB_WRP2_Pages1280to1311 ((uint32_t)0x00000100U) /* Write protection of Sector40 */
  294. #define OB_WRP2_Pages1312to1343 ((uint32_t)0x00000200U) /* Write protection of Sector41 */
  295. #define OB_WRP2_Pages1344to1375 ((uint32_t)0x00000400U) /* Write protection of Sector42 */
  296. #define OB_WRP2_Pages1376to1407 ((uint32_t)0x00000800U) /* Write protection of Sector43 */
  297. #define OB_WRP2_Pages1408to1439 ((uint32_t)0x00001000U) /* Write protection of Sector44 */
  298. #define OB_WRP2_Pages1440to1471 ((uint32_t)0x00002000U) /* Write protection of Sector45 */
  299. #define OB_WRP2_Pages1472to1503 ((uint32_t)0x00004000U) /* Write protection of Sector46 */
  300. #define OB_WRP2_Pages1504to1535 ((uint32_t)0x00008000U) /* Write protection of Sector47 */
  301. #define OB_WRP2_AllPages ((uint32_t)0x0000FFFFU) /*!< Write protection of all Sectors WRP2 */
  302. /**
  303. * @}
  304. */
  305. #endif /* STM32L071xx || STM32L072xx || (STM32L073xx) || (STM32L081xx) || (STM32L082xx) || (STM32L083xx) */
  306. /** @defgroup FLASHEx_Option_Bytes_Read_Protection FLASHEx Option Bytes Read Protection
  307. * @{
  308. */
  309. #define OB_RDP_LEVEL_0 ((uint8_t)0xAAU)
  310. #define OB_RDP_LEVEL_1 ((uint8_t)0xBBU)
  311. #define OB_RDP_LEVEL_2 ((uint8_t)0xCCU) /* Warning: When enabling read protection level 2
  312. it is no more possible to go back to level 1 or 0 */
  313. /**
  314. * @}
  315. */
  316. /** @defgroup FLASHEx_Option_Bytes_BOR_Level FLASHEx Option Bytes BOR Level
  317. * @{
  318. */
  319. #define OB_BOR_OFF ((uint8_t)0x00U) /*!< BOR is disabled at power down, the reset is asserted when the VDD
  320. power supply reaches the PDR(Power Down Reset) threshold (1.5V) */
  321. #define OB_BOR_LEVEL1 ((uint8_t)0x08U) /*!< BOR Reset threshold levels for 1.7V - 1.8V VDD power supply */
  322. #define OB_BOR_LEVEL2 ((uint8_t)0x09U) /*!< BOR Reset threshold levels for 1.9V - 2.0V VDD power supply */
  323. #define OB_BOR_LEVEL3 ((uint8_t)0x0AU) /*!< BOR Reset threshold levels for 2.3V - 2.4V VDD power supply */
  324. #define OB_BOR_LEVEL4 ((uint8_t)0x0BU) /*!< BOR Reset threshold levels for 2.55V - 2.65V VDD power supply */
  325. #define OB_BOR_LEVEL5 ((uint8_t)0x0CU) /*!< BOR Reset threshold levels for 2.8V - 2.9V VDD power supply */
  326. /**
  327. * @}
  328. */
  329. /** @defgroup FLASHEx_Option_Bytes_IWatchdog FLASHEx Option Bytes IWatchdog
  330. * @{
  331. */
  332. #define OB_IWDG_SW ((uint8_t)0x10U) /*!< Software WDG selected */
  333. #define OB_IWDG_HW ((uint8_t)0x00U) /*!< Hardware WDG selected */
  334. /**
  335. * @}
  336. */
  337. /** @defgroup FLASHEx_Option_Bytes_nRST_STOP FLASHEx Option Bytes nRST_STOP
  338. * @{
  339. */
  340. #define OB_STOP_NORST ((uint8_t)0x20U) /*!< No reset generated when entering in STOP */
  341. #define OB_STOP_RST ((uint8_t)0x00U) /*!< Reset generated when entering in STOP */
  342. /**
  343. * @}
  344. */
  345. /** @defgroup FLASHEx_Option_Bytes_nRST_STDBY FLASHEx Option Bytes nRST_STDBY
  346. * @{
  347. */
  348. #define OB_STDBY_NORST ((uint8_t)0x40U) /*!< No reset generated when entering in STANDBY */
  349. #define OB_STDBY_RST ((uint8_t)0x00U) /*!< Reset generated when entering in STANDBY */
  350. /**
  351. * @}
  352. */
  353. #if defined(FLASH_OPTR_WPRMOD)
  354. /** @defgroup FLASHEx_OptionAdv_Type FLASHEx Option Advanced Type
  355. * @{
  356. */
  357. #define OPTIONBYTE_PCROP ((uint32_t)0x01U) /*!<PCROP option byte configuration*/
  358. /**
  359. * @}
  360. */
  361. #endif /* FLASH_OPTR_WPRMOD */
  362. #if defined(FLASH_OPTR_BFB2)
  363. /** @defgroup FLASHEx_OptionAdv_Type FLASHEx Option Advanced Type
  364. * @{
  365. */
  366. #define OPTIONBYTE_BOOTCONFIG ((uint32_t)0x02U) /*!<BOOTConfig option byte configuration*/
  367. /**
  368. * @}
  369. */
  370. #endif /* FLASH_OPTR_BFB2 */
  371. #if defined(FLASH_OPTR_WPRMOD)
  372. /** @defgroup FLASHEx_PCROP_State FLASHEx PCROP State
  373. * @{
  374. */
  375. #define OB_PCROP_STATE_DISABLE ((uint32_t)0x00U) /*!<Disable PCROP for selected sectors */
  376. #define OB_PCROP_STATE_ENABLE ((uint32_t)0x01U) /*!<Enable PCROP for selected sectors */
  377. /**
  378. * @}
  379. */
  380. /** @defgroup FLASHEx_Selection_Protection_Mode FLASHEx Selection Protection Mode
  381. * @{
  382. */
  383. #define OB_PCROP_DESELECTED ((uint16_t)0x0000U) /*!< Disabled PCROP, nWPRi bits used for Write Protection on sector i */
  384. #define OB_PCROP_SELECTED ((uint16_t)FLASH_OPTR_WPRMOD) /*!< Enable PCROP, nWPRi bits used for PCRoP Protection on sector i */
  385. /**
  386. * @}
  387. */
  388. #endif /* FLASH_OPTR_WPRMOD */
  389. #if defined (STM32L011xx) || defined (STM32L021xx) || defined (STM32L031xx) || defined (STM32L041xx)
  390. /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASHEx Option Bytes PC Read/Write Protection
  391. * @{
  392. */
  393. #define OB_PCROP_Pages0to31 ((uint32_t)0x00000001U) /* PC Read/Write protection of Sector0 */
  394. #define OB_PCROP_Pages32to63 ((uint32_t)0x00000002U) /* PC Read/Write protection of Sector1 */
  395. #define OB_PCROP_Pages64to95 ((uint32_t)0x00000004U) /* PC Read/Write protection of Sector2 */
  396. #define OB_PCROP_Pages96to127 ((uint32_t)0x00000008U) /* PC Read/Write protection of Sector3 */
  397. #define OB_PCROP_Pages128to159 ((uint32_t)0x00000010U) /* PC Read/Write protection of Sector4 */
  398. #define OB_PCROP_Pages160to191 ((uint32_t)0x00000020U) /* PC Read/Write protection of Sector5 */
  399. #define OB_PCROP_Pages192to223 ((uint32_t)0x00000040U) /* PC Read/Write protection of Sector6 */
  400. #define OB_PCROP_Pages224to255 ((uint32_t)0x00000080U) /* PC Read/Write protection of Sector7 */
  401. #define OB_PCROP_AllPages ((uint32_t)0x000000FFU) /*!< PC Read/Write protection of all Sectors */
  402. /**
  403. * @}
  404. */
  405. #elif defined (STM32L051xx) || defined (STM32L052xx) || defined (STM32L053xx) || defined (STM32L061xx) || defined (STM32L062xx) || defined (STM32L063xx)
  406. /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASHEx Option Bytes PC Read/Write Protection
  407. * @{
  408. */
  409. #define OB_PCROP_Pages0to31 ((uint32_t)0x00000001U) /* PC Read/Write protection of Sector0 */
  410. #define OB_PCROP_Pages32to63 ((uint32_t)0x00000002U) /* PC Read/Write protection of Sector1 */
  411. #define OB_PCROP_Pages64to95 ((uint32_t)0x00000004U) /* PC Read/Write protection of Sector2 */
  412. #define OB_PCROP_Pages96to127 ((uint32_t)0x00000008U) /* PC Read/Write protection of Sector3 */
  413. #define OB_PCROP_Pages128to159 ((uint32_t)0x00000010U) /* PC Read/Write protection of Sector4 */
  414. #define OB_PCROP_Pages160to191 ((uint32_t)0x00000020U) /* PC Read/Write protection of Sector5 */
  415. #define OB_PCROP_Pages192to223 ((uint32_t)0x00000040U) /* PC Read/Write protection of Sector6 */
  416. #define OB_PCROP_Pages224to255 ((uint32_t)0x00000080U) /* PC Read/Write protection of Sector7 */
  417. #define OB_PCROP_Pages256to287 ((uint32_t)0x00000100U) /* PC Read/Write protection of Sector8 */
  418. #define OB_PCROP_Pages288to319 ((uint32_t)0x00000200U) /* PC Read/Write protection of Sector9 */
  419. #define OB_PCROP_Pages320to351 ((uint32_t)0x00000400U) /* PC Read/Write protection of Sector10 */
  420. #define OB_PCROP_Pages352to383 ((uint32_t)0x00000800U) /* PC Read/Write protection of Sector11 */
  421. #define OB_PCROP_Pages384to415 ((uint32_t)0x00001000U) /* PC Read/Write protection of Sector12 */
  422. #define OB_PCROP_Pages416to447 ((uint32_t)0x00002000U) /* PC Read/Write protection of Sector13 */
  423. #define OB_PCROP_Pages448to479 ((uint32_t)0x00004000U) /* PC Read/Write protection of Sector14 */
  424. #define OB_PCROP_Pages480to511 ((uint32_t)0x00008000U) /* PC Read/Write protection of Sector15 */
  425. #define OB_PCROP_AllPages ((uint32_t)0x0000FFFFU) /*!< PC Read/Write protection of all Sectors */
  426. /**
  427. * @}
  428. */
  429. #endif
  430. #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
  431. /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASH Option Bytes PC Read/Write Protection
  432. * @{
  433. */
  434. #define OB_PCROP_Pages0to31 ((uint32_t)0x00000001U) /* PC Read/Write protection of Sector0 */
  435. #define OB_PCROP_Pages32to63 ((uint32_t)0x00000002U) /* PC Read/Write protection of Sector1 */
  436. #define OB_PCROP_Pages64to95 ((uint32_t)0x00000004U) /* PC Read/Write protection of Sector2 */
  437. #define OB_PCROP_Pages96to127 ((uint32_t)0x00000008U) /* PC Read/Write protection of Sector3 */
  438. #define OB_PCROP_Pages128to159 ((uint32_t)0x00000010U) /* PC Read/Write protection of Sector4 */
  439. #define OB_PCROP_Pages160to191 ((uint32_t)0x00000020U) /* PC Read/Write protection of Sector5 */
  440. #define OB_PCROP_Pages192to223 ((uint32_t)0x00000040U) /* PC Read/Write protection of Sector6 */
  441. #define OB_PCROP_Pages224to255 ((uint32_t)0x00000080U) /* PC Read/Write protection of Sector7 */
  442. #define OB_PCROP_Pages256to287 ((uint32_t)0x00000100U) /* PC Read/Write protection of Sector8 */
  443. #define OB_PCROP_Pages288to319 ((uint32_t)0x00000200U) /* PC Read/Write protection of Sector9 */
  444. #define OB_PCROP_Pages320to351 ((uint32_t)0x00000400U) /* PC Read/Write protection of Sector10 */
  445. #define OB_PCROP_Pages352to383 ((uint32_t)0x00000800U) /* PC Read/Write protection of Sector11 */
  446. #define OB_PCROP_Pages384to415 ((uint32_t)0x00001000U) /* PC Read/Write protection of Sector12 */
  447. #define OB_PCROP_Pages416to447 ((uint32_t)0x00002000U) /* PC Read/Write protection of Sector13 */
  448. #define OB_PCROP_Pages448to479 ((uint32_t)0x00004000U) /* PC Read/Write protection of Sector14 */
  449. #define OB_PCROP_Pages480to511 ((uint32_t)0x00008000U) /* PC Read/Write protection of Sector15 */
  450. #define OB_PCROP_Pages512to543 ((uint32_t)0x00010000U) /* PC Read/Write protection of Sector16 */
  451. #define OB_PCROP_Pages544to575 ((uint32_t)0x00020000U) /* PC Read/Write protection of Sector17 */
  452. #define OB_PCROP_Pages576to607 ((uint32_t)0x00040000U) /* PC Read/Write protection of Sector18 */
  453. #define OB_PCROP_Pages608to639 ((uint32_t)0x00080000U) /* PC Read/Write protection of Sector19 */
  454. #define OB_PCROP_Pages640to671 ((uint32_t)0x00100000U) /* PC Read/Write protection of Sector20 */
  455. #define OB_PCROP_Pages672to703 ((uint32_t)0x00200000U) /* PC Read/Write protection of Sector21 */
  456. #define OB_PCROP_Pages704to735 ((uint32_t)0x00400000U) /* PC Read/Write protection of Sector22 */
  457. #define OB_PCROP_Pages736to767 ((uint32_t)0x00800000U) /* PC Read/Write protection of Sector23 */
  458. #define OB_PCROP_Pages768to799 ((uint32_t)0x01000000U) /* PC Read/Write protection of Sector24 */
  459. #define OB_PCROP_Pages800to831 ((uint32_t)0x02000000U) /* PC Read/Write protection of Sector25 */
  460. #define OB_PCROP_Pages832to863 ((uint32_t)0x04000000U) /* PC Read/Write protection of Sector26 */
  461. #define OB_PCROP_Pages864to895 ((uint32_t)0x08000000U) /* PC Read/Write protection of Sector27 */
  462. #define OB_PCROP_Pages896to927 ((uint32_t)0x10000000U) /* PC Read/Write protection of Sector28 */
  463. #define OB_PCROP_Pages928to959 ((uint32_t)0x20000000U) /* PC Read/Write protection of Sector29 */
  464. #define OB_PCROP_Pages960to991 ((uint32_t)0x40000000U) /* PC Read/Write protection of Sector30 */
  465. #define OB_PCROP_Pages992to1023 ((uint32_t)0x80000000U) /* PC Read/Write protection of Sector31 */
  466. #define OB_PCROP_AllPages ((uint32_t)0xFFFFFFFFU) /*!<PC Read/Write protection of all Sectors */
  467. /**
  468. * @}
  469. */
  470. /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection2 FLASH Option Bytes PC Read/Write Protection (Sector 2)
  471. * @{
  472. */
  473. #define OB_PCROP2_Pages1024to1055 ((uint32_t)0x00000001U) /* PC Read/Write protection of Sector32 */
  474. #define OB_PCROP2_Pages1056to1087 ((uint32_t)0x00000002U) /* PC Read/Write protection of Sector33 */
  475. #define OB_PCROP2_Pages1088to1119 ((uint32_t)0x00000004U) /* PC Read/Write protection of Sector34 */
  476. #define OB_PCROP2_Pages1120to1151 ((uint32_t)0x00000008U) /* PC Read/Write protection of Sector35 */
  477. #define OB_PCROP2_Pages1152to1183 ((uint32_t)0x00000010U) /* PC Read/Write protection of Sector36 */
  478. #define OB_PCROP2_Pages1184to1215 ((uint32_t)0x00000020U) /* PC Read/Write protection of Sector37 */
  479. #define OB_PCROP2_Pages1216to1247 ((uint32_t)0x00000040U) /* PC Read/Write protection of Sector38 */
  480. #define OB_PCROP2_Pages1248to1279 ((uint32_t)0x00000080U) /* PC Read/Write protection of Sector39 */
  481. #define OB_PCROP2_Pages1280to1311 ((uint32_t)0x00000100U) /* PC Read/Write protection of Sector40 */
  482. #define OB_PCROP2_Pages1312to1343 ((uint32_t)0x00000200U) /* PC Read/Write protection of Sector41 */
  483. #define OB_PCROP2_Pages1344to1375 ((uint32_t)0x00000400U) /* PC Read/Write protection of Sector42 */
  484. #define OB_PCROP2_Pages1376to1407 ((uint32_t)0x00000800U) /* PC Read/Write protection of Sector43 */
  485. #define OB_PCROP2_Pages1408to1439 ((uint32_t)0x00001000U) /* PC Read/Write protection of Sector44 */
  486. #define OB_PCROP2_Pages1440to1471 ((uint32_t)0x00002000U) /* PC Read/Write protection of Sector45 */
  487. #define OB_PCROP2_Pages1472to1503 ((uint32_t)0x00004000U) /* PC Read/Write protection of Sector46 */
  488. #define OB_PCROP2_Pages1504to1535 ((uint32_t)0x00008000U) /* PC Read/Write protection of Sector47 */
  489. #define OB_PCROP2_AllPages ((uint32_t)0x0000FFFFU) /*!< PC Read/Write protection of all Sectors PCROP2 */
  490. /**
  491. * @}
  492. */
  493. #endif /* STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */
  494. /** @defgroup FLASHEx_Option_Bytes_BOOTBit1 FLASH Option Bytes BOOT Bit1 Setup
  495. * @{
  496. */
  497. #define OB_BOOT_BIT1_RESET (uint8_t)(0x00U) /*!< BOOT Bit 1 Reset */
  498. #define OB_BOOT_BIT1_SET (uint8_t)(0x01U) /*!< BOOT Bit 1 Set */
  499. /**
  500. * @}
  501. */
  502. /** @defgroup FLASHEx_Type_Program_Data FLASHEx Type Program Data
  503. * @{
  504. */
  505. #define FLASH_TYPEPROGRAMDATA_BYTE ((uint32_t)0x00U) /*!<Program byte (8-bit) at a specified address.*/
  506. #define FLASH_TYPEPROGRAMDATA_HALFWORD ((uint32_t)0x01U) /*!<Program a half-word (16-bit) at a specified address.*/
  507. #define FLASH_TYPEPROGRAMDATA_WORD ((uint32_t)0x02U) /*!<Program a word (32-bit) at a specified address.*/
  508. /**
  509. * @}
  510. */
  511. #if defined(FLASH_OPTR_BFB2)
  512. /** @defgroup FLASHEx_Option_Bytes_BOOT FLASHEx Option Bytes BOOT
  513. * @{
  514. */
  515. #define OB_BOOT_BANK1 ((uint8_t)0x00U) /*!< At startup, if boot pin 0 and BOOT1 bit are set in boot from user Flash position
  516. and this parameter is selected the device will boot from Bank 1 (Default)*/
  517. #define OB_BOOT_BANK2 ((uint8_t)(FLASH_OPTR_BFB2 >> 16)) /*!< At startup, if boot pin 0 and BOOT1 bit are set in boot from user Flash position
  518. and this parameter is selected the device will boot from Bank 2 */
  519. /**
  520. * @}
  521. */
  522. #endif /* FLASH_OPTR_BFB2 */
  523. /**
  524. * @}
  525. */
  526. /* Exported macro ------------------------------------------------------------*/
  527. /** @defgroup FLASHEx_Exported_Macros FLASHEx Exported Macros
  528. * @{
  529. */
  530. /**
  531. * @brief Set the FLASH Latency.
  532. * @param __LATENCY__ FLASH Latency
  533. * This parameter can be one of the following values:
  534. * @arg @ref FLASH_LATENCY_0 FLASH Zero Latency cycle
  535. * @arg @ref FLASH_LATENCY_1 FLASH One Latency cycle
  536. * @retval none
  537. */
  538. #define __HAL_FLASH_SET_LATENCY(__LATENCY__) \
  539. MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(__LATENCY__))
  540. /**
  541. * @brief Get the FLASH Latency.
  542. * @retval FLASH Latency
  543. * This parameter can be one of the following values:
  544. * @arg @ref FLASH_LATENCY_0 FLASH Zero Latency cycle
  545. * @arg @ref FLASH_LATENCY_1 FLASH One Latency cycle
  546. */
  547. #define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))
  548. /**
  549. * @brief Enable the FLASH prefetch buffer.
  550. * @retval none
  551. */
  552. #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() SET_BIT((FLASH->ACR), FLASH_ACR_PRFTEN)
  553. /**
  554. * @brief Disable the FLASH prefetch buffer.
  555. * @retval none
  556. */
  557. #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_PRFTEN)
  558. /**
  559. * @brief Enable the FLASH Buffer cache.
  560. * @retval none
  561. */
  562. #define __HAL_FLASH_BUFFER_CACHE_ENABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_DISAB_BUF)
  563. /**
  564. * @brief Disable the FLASH Buffer cache.
  565. * @retval none
  566. */
  567. #define __HAL_FLASH_BUFFER_CACHE_DISABLE() SET_BIT((FLASH->ACR), FLASH_ACR_DISAB_BUF)
  568. /**
  569. * @brief Enable the FLASH preread buffer.
  570. * @retval none
  571. */
  572. #define __HAL_FLASH_PREREAD_BUFFER_ENABLE() SET_BIT((FLASH->ACR), FLASH_ACR_PRE_READ)
  573. /**
  574. * @brief Disable the FLASH preread buffer.
  575. * @retval none
  576. */
  577. #define __HAL_FLASH_PREREAD_BUFFER_DISABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_PRE_READ)
  578. /**
  579. * @brief Enable the FLASH power down during Sleep mode
  580. * @retval none
  581. */
  582. #define __HAL_FLASH_SLEEP_POWERDOWN_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD)
  583. /**
  584. * @brief Disable the FLASH power down during Sleep mode
  585. * @retval none
  586. */
  587. #define __HAL_FLASH_SLEEP_POWERDOWN_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD)
  588. /**
  589. * @brief Enable the Flash Run power down mode.
  590. * @note Writing this bit to 0 this bit, automatically the keys are
  591. * loss and a new unlock sequence is necessary to re-write it to 1.
  592. */
  593. #define __HAL_FLASH_POWER_DOWN_ENABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \
  594. FLASH->PDKEYR = FLASH_PDKEY2; \
  595. SET_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \
  596. } while (0)
  597. /**
  598. * @brief Disable the Flash Run power down mode.
  599. * @note Writing this bit to 0 this bit, automatically the keys are
  600. * loss and a new unlock sequence is necessary to re-write it to 1.
  601. */
  602. #define __HAL_FLASH_POWER_DOWN_DISABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \
  603. FLASH->PDKEYR = FLASH_PDKEY2; \
  604. CLEAR_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \
  605. } while (0)
  606. /**
  607. * @}
  608. */
  609. /* Exported functions --------------------------------------------------------*/
  610. /** @addtogroup FLASHEx_Exported_Functions
  611. * @{
  612. */
  613. /** @addtogroup FLASHEx_Exported_Functions_Group1
  614. * @{
  615. */
  616. HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
  617. HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
  618. /**
  619. * @}
  620. */
  621. /** @addtogroup FLASHEx_Exported_Functions_Group2
  622. * @{
  623. */
  624. HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
  625. void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
  626. #if defined(FLASH_OPTR_WPRMOD) || defined(FLASH_OPTR_BFB2)
  627. HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
  628. void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
  629. #endif /* FLASH_OPTR_WPRMOD || FLASH_OPTR_BFB2 */
  630. #if defined(FLASH_OPTR_WPRMOD)
  631. HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void);
  632. HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void);
  633. #endif /* FLASH_OPTR_WPRMOD */
  634. /**
  635. * @}
  636. */
  637. /** @addtogroup FLASHEx_Exported_Functions_Group3
  638. * @{
  639. */
  640. HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Unlock(void);
  641. HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Lock(void);
  642. HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Erase(uint32_t Address);
  643. HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Program(uint32_t TypeProgram, uint32_t Address, uint32_t Data);
  644. void HAL_FLASHEx_DATAEEPROM_EnableFixedTimeProgram(void);
  645. void HAL_FLASHEx_DATAEEPROM_DisableFixedTimeProgram(void);
  646. /**
  647. * @}
  648. */
  649. /**
  650. * @}
  651. */
  652. /**
  653. * @}
  654. */
  655. /**
  656. * @}
  657. */
  658. #ifdef __cplusplus
  659. }
  660. #endif
  661. #endif /* __STM32L0xx_HAL_FLASH_EX_H */
  662. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/