File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -49,9 +49,12 @@ config FLASH_STM32_WRITE_PROTECT_DISABLE_PREVENTION
49
49
50
50
config FLASH_STM32_READOUT_PROTECTION
51
51
bool "Extended operation for flash readout protection control"
52
- depends on SOC_SERIES_STM32F4X || SOC_SERIES_STM32L4X || \
53
- SOC_SERIES_STM32G4X || SOC_SERIES_STM32F7X || \
54
- SOC_SERIES_STM32H7X
52
+ depends on SOC_SERIES_STM32F4X || \
53
+ SOC_SERIES_STM32F7X || \
54
+ SOC_SERIES_STM32G0X || \
55
+ SOC_SERIES_STM32G4X || \
56
+ SOC_SERIES_STM32H7X || \
57
+ SOC_SERIES_STM32L4X
55
58
select FLASH_HAS_EX_OP
56
59
default n
57
60
help
Original file line number Diff line number Diff line change @@ -239,6 +239,21 @@ uint32_t flash_stm32_option_bytes_read(const struct device *dev)
239
239
return regs -> OPTR ;
240
240
}
241
241
242
+ #if defined(CONFIG_FLASH_STM32_READOUT_PROTECTION )
243
+ uint8_t flash_stm32_get_rdp_level (const struct device * dev )
244
+ {
245
+ FLASH_TypeDef * regs = FLASH_STM32_REGS (dev );
246
+
247
+ return (regs -> OPTR & FLASH_OPTR_RDP_Msk ) >> FLASH_OPTR_RDP_Pos ;
248
+ }
249
+
250
+ void flash_stm32_set_rdp_level (const struct device * dev , uint8_t level )
251
+ {
252
+ flash_stm32_option_bytes_write (dev , FLASH_OPTR_RDP_Msk ,
253
+ (uint32_t )level << FLASH_OPTR_RDP_Pos );
254
+ }
255
+ #endif /* CONFIG_FLASH_STM32_READOUT_PROTECTION */
256
+
242
257
/*
243
258
* The address space is always continuous, even though a subset of G0 SoCs has
244
259
* two flash banks.
You can’t perform that action at this time.
0 commit comments