Skip to content

Commit 38b959e

Browse files
ahasztagkartben
authored andcommitted
drivers: flash: nrf: Add possibility to add custom context
This commit adds the possibility to add additional custom context for flash operations for usage by non-standard flash drivers. Signed-off-by: Artur Hadasz <[email protected]>
1 parent 6f9dbbd commit 38b959e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

drivers/flash/Kconfig.nrf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ config FLASH_NRF_FORCE_ALT
77
This option can be enabled to force an alternative implementation
88
of the flash driver.
99

10+
config SOC_FLASH_NRF_CUSTOM_CONTEXT
11+
bool "Nordic nRFx flash driver operation custom context"
12+
depends on SOC_COMPATIBLE_NRF
13+
help
14+
Enable pointer to custom context, for drivers that need to store additional data,
15+
not covered by the structure.
16+
1017
menuconfig SOC_FLASH_NRF
1118
bool "Nordic Semiconductor nRF flash driver"
1219
default y

drivers/flash/soc_flash_nrf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ struct flash_context {
2525
#if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE)
2626
uint32_t flash_addr_next;
2727
#endif /* CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE */
28+
#if defined(CONFIG_SOC_FLASH_NRF_CUSTOM_CONTEXT)
29+
void *custom_context;
30+
#endif
2831
}; /*< Context type for f. @ref write_op @ref erase_op */
2932

3033
#ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE

0 commit comments

Comments
 (0)