nRF5 SDK v16.0.0
Macros | Enumerations | Functions
NVMC HAL

Hardware access layer (HAL) for managing the Non-Volatile Memory Controller (NVMC) peripheral. More...

Macros

#define NRF_NVMC_ICACHE_PRESENT
 Symbol indicating whether Instruction Cache (ICache) is present.
 
#define NRF_NVMC_PARTIAL_ERASE_PRESENT
 Symbol indicating whether the option of page partial erase is present.
 

Enumerations

enum  nrf_nvmc_mode_t {
  NRF_NVMC_MODE_READONLY = NVMC_CONFIG_WEN_Ren,
  NRF_NVMC_MODE_WRITE = NVMC_CONFIG_WEN_Wen,
  NRF_NVMC_MODE_ERASE = NVMC_CONFIG_WEN_Een
}
 NVMC modes. More...
 
enum  nrf_nvmc_ns_mode_t {
  NRF_NVMC_NS_MODE_READONLY = NVMC_CONFIGNS_WEN_Ren,
  NRF_NVMC_NS_MODE_WRITE = NVMC_CONFIGNS_WEN_Wen,
  NRF_NVMC_NS_MODE_ERASE = NVMC_CONFIGNS_WEN_Een
}
 Non-secure NVMC modes. More...
 
enum  nrf_nvmc_icache_config_t {
  NRF_NVMC_ICACHE_DISABLE = NVMC_ICACHECNF_CACHEEN_Disabled,
  NRF_NVMC_ICACHE_ENABLE = NVMC_ICACHECNF_CACHEEN_Enabled,
  NRF_NVMC_ICACHE_ENABLE_WITH_PROFILING
}
 NVMC ICache configuration. More...
 

Functions

__STATIC_INLINE bool nrf_nvmc_ready_check (NRF_NVMC_Type const *p_reg)
 Function for checking if NVMC is ready to perform write or erase operation. More...
 
__STATIC_INLINE bool nrf_nvmc_write_ready_check (NRF_NVMC_Type const *p_reg)
 Function for checking if NVMC is ready to accept the next write operation. More...
 
__STATIC_INLINE void nrf_nvmc_mode_set (NRF_NVMC_Type *p_reg, nrf_nvmc_mode_t mode)
 Function for setting the NVMC mode. More...
 
__STATIC_INLINE void nrf_nvmc_nonsecure_mode_set (NRF_NVMC_Type *p_reg, nrf_nvmc_ns_mode_t mode)
 Function for setting the NVMC mode for non-secure Flash page operations. More...
 
__STATIC_INLINE void nrf_nvmc_page_erase_start (NRF_NVMC_Type *p_reg, uint32_t page_addr)
 Function for starting a single page erase in the Flash memory. More...
 
__STATIC_INLINE void nrf_nvmc_uicr_erase_start (NRF_NVMC_Type *p_reg)
 Function for starting the user information configuration registers (UICR) erase. More...
 
__STATIC_INLINE void nrf_nvmc_erase_all_start (NRF_NVMC_Type *p_reg)
 Function for starting the erase of the whole NVM, including UICR. More...
 
__STATIC_INLINE void nrf_nvmc_partial_erase_duration_set (NRF_NVMC_Type *p_reg, uint32_t duration_ms)
 Function for configuring the page partial erase duration in milliseconds. More...
 
__STATIC_INLINE uint32_t nrf_nvmc_partial_erase_duration_get (NRF_NVMC_Type const *p_reg)
 Function for getting the current setting for the page partial erase duration. More...
 
__STATIC_INLINE void nrf_nvmc_page_partial_erase_start (NRF_NVMC_Type *p_reg, uint32_t page_addr)
 Function for starting a partial erase operation. More...
 
__STATIC_INLINE void nrf_nvmc_icache_config_set (NRF_NVMC_Type *p_reg, nrf_nvmc_icache_config_t config)
 Function for applying the Instruction Cache (ICache) configuration. More...
 
__STATIC_INLINE bool nrf_nvmc_icache_enable_check (NRF_NVMC_Type const *p_reg)
 Function for checking if ICache is enabled. More...
 
__STATIC_INLINE bool nrf_nvmc_icache_profiling_enable_check (NRF_NVMC_Type const *p_reg)
 Function for checking if the ICache profiling option is enabled. More...
 
__STATIC_INLINE uint32_t nrf_nvmc_icache_hit_get (NRF_NVMC_Type const *p_reg)
 Function for getting the number of ICache hits. More...
 
__STATIC_INLINE uint32_t nrf_nvmc_icache_miss_get (NRF_NVMC_Type const *p_reg)
 Function for getting the number of ICache misses. More...
 
__STATIC_INLINE void nrf_nvmc_icache_hit_miss_reset (NRF_NVMC_Type *p_reg)
 Function for resetting the ICache hit and miss counters. More...
 

Detailed Description

Hardware access layer (HAL) for managing the Non-Volatile Memory Controller (NVMC) peripheral.

Enumeration Type Documentation

NVMC ICache configuration.

Enumerator
NRF_NVMC_ICACHE_DISABLE 

Instruction Cache disabled.

NRF_NVMC_ICACHE_ENABLE 

Instruction Cache enabled.

NRF_NVMC_ICACHE_ENABLE_WITH_PROFILING 

Instruction Cache with cache profiling enabled.

NVMC modes.

Enumerator
NRF_NVMC_MODE_READONLY 

NVMC in read-only mode.

NRF_NVMC_MODE_WRITE 

NVMC in read and write mode.

NRF_NVMC_MODE_ERASE 

NVMC in read and erase mode.

Non-secure NVMC modes.

Enumerator
NRF_NVMC_NS_MODE_READONLY 

Non-secure NVMC in read-only mode.

NRF_NVMC_NS_MODE_WRITE 

Non-secure NVMC in read and write mode.

NRF_NVMC_NS_MODE_ERASE 

Non-secure NVMC in read and erase mode.

Function Documentation

__STATIC_INLINE void nrf_nvmc_erase_all_start ( NRF_NVMC_Type *  p_reg)

Function for starting the erase of the whole NVM, including UICR.

This function purges all user code.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
__STATIC_INLINE void nrf_nvmc_icache_config_set ( NRF_NVMC_Type *  p_reg,
nrf_nvmc_icache_config_t  config 
)

Function for applying the Instruction Cache (ICache) configuration.

Enabling the cache can increase CPU performance and reduce power consumption by reducing the number of wait cycles and the number of flash accesses.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]configICache configuration.
__STATIC_INLINE bool nrf_nvmc_icache_enable_check ( NRF_NVMC_Type const *  p_reg)

Function for checking if ICache is enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueICache enabled.
falseICache disabled.
__STATIC_INLINE uint32_t nrf_nvmc_icache_hit_get ( NRF_NVMC_Type const *  p_reg)

Function for getting the number of ICache hits.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
Numberof the ICache hits.
__STATIC_INLINE void nrf_nvmc_icache_hit_miss_reset ( NRF_NVMC_Type *  p_reg)

Function for resetting the ICache hit and miss counters.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
__STATIC_INLINE uint32_t nrf_nvmc_icache_miss_get ( NRF_NVMC_Type const *  p_reg)

Function for getting the number of ICache misses.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
Numberof the ICache misses.
__STATIC_INLINE bool nrf_nvmc_icache_profiling_enable_check ( NRF_NVMC_Type const *  p_reg)

Function for checking if the ICache profiling option is enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueICache profiling enabled.
falseICache profiling disabled.
__STATIC_INLINE void nrf_nvmc_mode_set ( NRF_NVMC_Type *  p_reg,
nrf_nvmc_mode_t  mode 
)

Function for setting the NVMC mode.

Only activate erase and write modes when they are actively used. If Instruction Cache (ICache) is present, enabling write or erase will invalidate the cache and keep it invalidated.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]modeDesired operating mode for NVMC.
__STATIC_INLINE void nrf_nvmc_nonsecure_mode_set ( NRF_NVMC_Type *  p_reg,
nrf_nvmc_ns_mode_t  mode 
)

Function for setting the NVMC mode for non-secure Flash page operations.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]modeDesired operating mode for NVMC.
__STATIC_INLINE void nrf_nvmc_page_erase_start ( NRF_NVMC_Type *  p_reg,
uint32_t  page_addr 
)

Function for starting a single page erase in the Flash memory.

The NVMC mode must be correctly configured with nrf_nvmc_mode_set before starting the erase operation.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]page_addrAddress of the first word of the page to erase.
__STATIC_INLINE void nrf_nvmc_page_partial_erase_start ( NRF_NVMC_Type *  p_reg,
uint32_t  page_addr 
)

Function for starting a partial erase operation.

It must be called successively until the page erase time is reached.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]page_addrAddress of the first word of the page to erase.
__STATIC_INLINE uint32_t nrf_nvmc_partial_erase_duration_get ( NRF_NVMC_Type const *  p_reg)

Function for getting the current setting for the page partial erase duration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
Intervalduration setting in milliseconds.
__STATIC_INLINE void nrf_nvmc_partial_erase_duration_set ( NRF_NVMC_Type *  p_reg,
uint32_t  duration_ms 
)

Function for configuring the page partial erase duration in milliseconds.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]duration_msPage partial erase duration in milliseconds.
__STATIC_INLINE bool nrf_nvmc_ready_check ( NRF_NVMC_Type const *  p_reg)

Function for checking if NVMC is ready to perform write or erase operation.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueNVMC can perform write or erase.
falseNVMC is busy and cannot perform next operation yet.
__STATIC_INLINE void nrf_nvmc_uicr_erase_start ( NRF_NVMC_Type *  p_reg)

Function for starting the user information configuration registers (UICR) erase.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
__STATIC_INLINE bool nrf_nvmc_write_ready_check ( NRF_NVMC_Type const *  p_reg)

Function for checking if NVMC is ready to accept the next write operation.

NVM writing time can be reduced by using this function.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueNVMC can accept the next write. It will be buffered and will be taken into account as soon as the ongoing write operation is completed.
falseNVMC is busy and cannot accept the next write yet.

Documentation feedback | Developer Zone | Subscribe | Updated