Hardware access layer (HAL) for managing the Non-Volatile Memory Controller (NVMC) peripheral. More...
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... | |
Functions | |
NRF_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. | |
NRF_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. | |
NRF_STATIC_INLINE void | nrf_nvmc_mode_set (NRF_NVMC_Type *p_reg, nrf_nvmc_mode_t mode) |
Function for setting the NVMC mode. | |
NRF_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. | |
NRF_STATIC_INLINE void | nrf_nvmc_word_write (uint32_t address, uint32_t value) |
Function for writing a 32-bit word to flash. | |
NRF_STATIC_INLINE uint8_t | nrf_nvmc_byte_read (uint32_t address) |
Function for reading a byte from the flash. | |
NRF_STATIC_INLINE uint16_t | nrf_nvmc_halfword_read (uint32_t address) |
Function for reading a 16-bit halfword from the flash. | |
NRF_STATIC_INLINE uint32_t | nrf_nvmc_word_read (uint32_t address) |
Function for reading a 32-bit word from the flash. | |
NRF_STATIC_INLINE void | nrf_nvmc_buffer_read (void *dst, uint32_t address, uint32_t num_bytes) |
Function for reading a given number of bytes from the flash into the specified buffer. | |
NRF_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. | |
NRF_STATIC_INLINE void | nrf_nvmc_uicr_erase_start (NRF_NVMC_Type *p_reg) |
Function for starting the user information configuration registers (UICR) erase. | |
NRF_STATIC_INLINE void | nrf_nvmc_erase_all_start (NRF_NVMC_Type *p_reg) |
Function for starting the erase of the whole NVM, including UICR. | |
NRF_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. | |
NRF_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. | |
NRF_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. | |
Hardware access layer (HAL) for managing the Non-Volatile Memory Controller (NVMC) peripheral.
enum nrf_nvmc_mode_t |
enum nrf_nvmc_ns_mode_t |
NRF_STATIC_INLINE void nrf_nvmc_buffer_read | ( | void * | dst, |
uint32_t | address, | ||
uint32_t | num_bytes | ||
) |
Function for reading a given number of bytes from the flash into the specified buffer.
Using this function when accessing the flash gives the possibility to run the code in an environment where the flash is simulated.
[in] | dst | Pointer to the buffer to store the data. |
[in] | address | Address of the first byte to read. |
[in] | num_bytes | Number of bytes to read. |
NRF_STATIC_INLINE uint8_t nrf_nvmc_byte_read | ( | uint32_t | address | ) |
Function for reading a byte from the flash.
Using this function when accessing the flash gives the possibility to run the code in an environment where the flash is simulated.
[in] | address | Address of the byte to read. |
NRF_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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint16_t nrf_nvmc_halfword_read | ( | uint32_t | address | ) |
Function for reading a 16-bit halfword from the flash.
Using this function when accessing the flash gives the possibility to run the code in an environment where the flash is simulated.
[in] | address | Address of the halfword to read. |
NRF_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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mode | Desired operating mode for NVMC. |
NRF_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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mode | Desired operating mode for NVMC. |
NRF_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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | page_addr | Address of the first word of the page to erase. |
NRF_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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | page_addr | Address of the first word of the page to erase. |
NRF_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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
Interval | duration setting in milliseconds. |
NRF_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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | duration_ms | Page partial erase duration in milliseconds. |
NRF_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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
true | NVMC can perform write or erase. |
false | NVMC is busy and cannot perform next operation yet. |
NRF_STATIC_INLINE void nrf_nvmc_uicr_erase_start | ( | NRF_NVMC_Type * | p_reg | ) |
Function for starting the user information configuration registers (UICR) erase.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_nvmc_word_read | ( | uint32_t | address | ) |
Function for reading a 32-bit word from the flash.
Using this function when accessing the flash gives the possibility to run the code in an environment where the flash is simulated.
[in] | address | Address of the word to read. |
NRF_STATIC_INLINE void nrf_nvmc_word_write | ( | uint32_t | address, |
uint32_t | value | ||
) |
Function for writing a 32-bit word to flash.
address
is word-aligned,Using this function when accessing the flash gives the possibility to run the code in an environment where the flash is simulated.
[in] | address | Address of the word to write. |
[in] | value | Value to write. |
NRF_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.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
true | NVMC can accept the next write. It will be buffered and will be taken into account as soon as the ongoing write operation is completed. |
false | NVMC is busy and cannot accept the next write yet. |