nRF5 SDK v17.1.0
Typedefs | Functions
Flash operations

Typedefs

typedef void(* nrf_dfu_flash_callback_t )(void *p_buf)
 nrf_fstorage event handler function for DFU fstorage operations. More...
 

Functions

ret_code_t nrf_dfu_flash_init (bool sd_irq_initialized)
 Function for initializing the flash module. More...
 
ret_code_t nrf_dfu_flash_store (uint32_t dest, void const *p_src, uint32_t len, nrf_dfu_flash_callback_t callback)
 Function for storing data to flash. More...
 
ret_code_t nrf_dfu_flash_erase (uint32_t page_addr, uint32_t num_pages, nrf_dfu_flash_callback_t callback)
 Function for erasing data from flash. More...
 

Detailed Description

Typedef Documentation

typedef void(* nrf_dfu_flash_callback_t)(void *p_buf)

nrf_fstorage event handler function for DFU fstorage operations.

This function will be called after a flash operation has completed.

Function Documentation

ret_code_t nrf_dfu_flash_erase ( uint32_t  page_addr,
uint32_t  num_pages,
nrf_dfu_flash_callback_t  callback 
)

Function for erasing data from flash.

This functions is asynchronous when the SoftDevice is enabled and synchronous when the SoftDevice is not present or disabled. In both cases, if a callback function is provided, it will be called when the operation has completed.

Parameters
[in]page_addrThe address of the first flash page to be deleted.
[in]num_pagesThe number of flash pages to be deleted.
[in]callbackCallback function.
Return values
NRF_SUCCESSIf the operation was successful.
NRF_ERROR_INVALID_STATEIf nrf_dfu_flash is not initialized.
NRF_ERROR_INVALID_ADDRIf page_addr is not aligned to a page boundary or the operation would go beyond the flash memory boundaries.
NRF_ERROR_INVALID_LENGTHIf num_pages is zero.
NRF_ERROR_NULLIf page_addr is NULL.
NRF_ERROR_NO_MEMIf the queue of nrf_fstorage is full.
ret_code_t nrf_dfu_flash_init ( bool  sd_irq_initialized)

Function for initializing the flash module.

Depending on whether or not the SoftDevice is present and its IRQ have been initialized, this function initializes the correct Flash storage (fstorage) backend.

Parameters
[in]sd_irq_initializedWhether or not the SoftDevice IRQ have been initialized.
Return values
NRF_SUCCESSIf the operation was successful.
ret_code_t nrf_dfu_flash_store ( uint32_t  dest,
void const *  p_src,
uint32_t  len,
nrf_dfu_flash_callback_t  callback 
)

Function for storing data to flash.

This functions is asynchronous when the SoftDevice is enabled and synchronous when the SoftDevice is not present or disabled. In both cases, if a callback function is provided, it will be called when the operation has completed.

Note
The content of p_src should be kept in memory until the operation has completed.
Parameters
[in]destThe address where the data should be stored.
[in]p_srcPointer to the address where the data should be copied from. This address can be in flash or RAM.
[in]lenThe number of bytes to be copied from p_src to dest.
[in]callbackCallback function.
Return values
NRF_SUCCESSIf the operation was successful.
NRF_ERROR_INVALID_STATEIf nrf_dfu_flash is not initialized.
NRF_ERROR_INVALID_ADDRIf p_src or dest is not word-aligned.
NRF_ERROR_INVALID_LENGTHIf len is zero.
NRF_ERROR_NULLIf p_src is NULL.
NRF_ERROR_NO_MEMIf nrf_fstorage is out of memory.

Documentation feedback | Developer Zone | Subscribe | Updated