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
4949
5050config FLASH_STM32_READOUT_PROTECTION
5151 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
5558 select FLASH_HAS_EX_OP
5659 default n
5760 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)
239239 return regs -> OPTR ;
240240}
241241
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+
242257/*
243258 * The address space is always continuous, even though a subset of G0 SoCs has
244259 * two flash banks.
You can’t perform that action at this time.
0 commit comments