Skip to content

Commit 0e32c11

Browse files
committed
drivers/flash/soc_flash_nrf: Add support for flash_map API call
Adds implementation for mmap callback for flash_driver_api. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 307b998 commit 0e32c11

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/flash/soc_flash_nrf.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,20 @@ static int flash_nrf_get_size(const struct device *dev, uint64_t *size)
270270
return 0;
271271
}
272272

273+
static int flash_nrf_mmap(const struct device *dev, void **base, uint64_t *size,
274+
uint32_t flags)
275+
{
276+
/* Currently supporting read operation only */
277+
if (flags & ~(FLASH_MMAP_F_READ)) {
278+
return -EINVAL;
279+
}
280+
281+
*base = (void *)DT_REG_ADDR(SOC_NV_FLASH_NODE);
282+
*size = nrfx_nvmc_flash_size_get();
283+
284+
return 0;
285+
}
286+
273287
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
274288
static struct flash_pages_layout dev_layout;
275289

@@ -294,6 +308,7 @@ static DEVICE_API(flash, flash_nrf_api) = {
294308
.read = flash_nrf_read,
295309
.write = flash_nrf_write,
296310
.erase = flash_nrf_erase,
311+
.mmap = flash_nrf_mmap,
297312
.get_parameters = flash_nrf_get_parameters,
298313
.get_size = flash_nrf_get_size,
299314
#if defined(CONFIG_FLASH_PAGE_LAYOUT)

0 commit comments

Comments
 (0)