Smart Remote 3 nRF52 v1.2
Typedefs | Functions
Flash operations

Typedefs

typedef nrf_fstorage_evt_handler_t dfu_flash_callback_t
 nrf_fstorage event handler function for DFU fstorage operations. More...
 

Functions

ret_code_t nrf_dfu_flash_erase (uint32_t page_addr, uint32_t num_pages, dfu_flash_callback_t callback)
 Function for erasing data from flash. More...
 
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, dfu_flash_callback_t callback)
 Function for storing data to flash. More...
 

Detailed Description

Typedef Documentation

typedef nrf_fstorage_evt_handler_t dfu_flash_callback_t

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,
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 NRF fstorage backend: SoftDevice or NVMC based. Refer to NRF storage page for more information.

Parameters
[in]sd_irq_initializedTrue if the SoftDevice has 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,
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.

Warning
The content of p_src must be kept in memory until the operation is 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