Non-Volatile Memory Controller (NVMC) peripheral driver. More...
Functions | |
nrfx_err_t | nrfx_nvmc_page_erase (uint32_t address) |
Function for erasing a page in flash. | |
nrfx_err_t | nrfx_nvmc_uicr_erase (void) |
Function for erasing the user information configuration register (UICR). | |
void | nrfx_nvmc_all_erase (void) |
Function for erasing the whole flash memory. | |
nrfx_err_t | nrfx_nvmc_page_partial_erase_init (uint32_t address, uint32_t duration_ms) |
Function for initiating a complete page erase split into parts (also known as partial erase). | |
bool | nrfx_nvmc_page_partial_erase_continue (void) |
Function for performing a part of the complete page erase (also known as partial erase). | |
bool | nrfx_nvmc_byte_writable_check (uint32_t address, uint8_t value) |
Function for checking whether a byte is writable at the specified address. | |
void | nrfx_nvmc_byte_write (uint32_t address, uint8_t value) |
Function for writing a single byte to flash. | |
bool | nrfx_nvmc_halfword_writable_check (uint32_t address, uint16_t value) |
Function for checking whether a halfword is writable at the specified address. | |
void | nrfx_nvmc_halfword_write (uint32_t address, uint16_t value) |
Function for writing a 16-bit halfword to flash. | |
bool | nrfx_nvmc_word_writable_check (uint32_t address, uint32_t value) |
Function for checking whether a word is writable at the specified address. | |
void | nrfx_nvmc_word_write (uint32_t address, uint32_t value) |
Function for writing a 32-bit word to flash. | |
void | nrfx_nvmc_bytes_write (uint32_t address, void const *src, uint32_t num_bytes) |
Function for writing consecutive bytes to flash. | |
void | nrfx_nvmc_words_write (uint32_t address, void const *src, uint32_t num_words) |
Function for writing consecutive words to flash. | |
uint16_t | nrfx_nvmc_otp_halfword_read (uint32_t address) |
Function for reading a 16-bit aligned halfword from the OTP (UICR) | |
NRFX_STATIC_INLINE uint32_t | nrfx_nvmc_uicr_word_read (uint32_t const volatile *address) |
Function for reading a 32-bit aligned word from the UICR. | |
uint32_t | nrfx_nvmc_flash_size_get (void) |
Function for getting the total flash size in bytes. | |
uint32_t | nrfx_nvmc_flash_page_size_get (void) |
Function for getting the flash page size in bytes. | |
uint32_t | nrfx_nvmc_flash_page_count_get (void) |
Function for getting the flash page count. | |
NRFX_STATIC_INLINE bool | nrfx_nvmc_write_done_check (void) |
Function for checking if the last flash write has been completed. | |
NRFX_STATIC_INLINE void | nrfx_nvmc_icache_enable (void) |
Function for enabling the Instruction Cache (ICache). | |
NRFX_STATIC_INLINE void | nrfx_nvmc_icache_disable (void) |
Function for disabling ICache. | |
Non-Volatile Memory Controller (NVMC) peripheral driver.
void nrfx_nvmc_all_erase | ( | void | ) |
Function for erasing the whole flash memory.
bool nrfx_nvmc_byte_writable_check | ( | uint32_t | address, |
uint8_t | value | ||
) |
Function for checking whether a byte is writable at the specified address.
The NVMC is only able to write '0' to bits in the flash that are erased (set to '1'). It cannot rewrite a bit back to '1'. This function checks if the value currently residing at the specified address can be transformed to the desired value without any '0' to '1' transitions.
address | Address to be checked. |
value | Value to be checked. |
true | Byte can be written at the specified address. |
false | Byte cannot be written at the specified address. Erase the page or change the address. |
void nrfx_nvmc_byte_write | ( | uint32_t | address, |
uint8_t | value | ||
) |
Function for writing a single byte to flash.
To determine if the flash write has been completed, use nrfx_nvmc_write_done_check().
address | Address to write to. |
value | Value to write. |
void nrfx_nvmc_bytes_write | ( | uint32_t | address, |
void const * | src, | ||
uint32_t | num_bytes | ||
) |
Function for writing consecutive bytes to flash.
To determine if the last flash write has been completed, use nrfx_nvmc_write_done_check().
address | Address to write to. |
src | Pointer to the data to copy from. |
num_bytes | Number of bytes to write. |
uint32_t nrfx_nvmc_flash_page_count_get | ( | void | ) |
Function for getting the flash page count.
uint32_t nrfx_nvmc_flash_page_size_get | ( | void | ) |
Function for getting the flash page size in bytes.
uint32_t nrfx_nvmc_flash_size_get | ( | void | ) |
Function for getting the total flash size in bytes.
bool nrfx_nvmc_halfword_writable_check | ( | uint32_t | address, |
uint16_t | value | ||
) |
Function for checking whether a halfword is writable at the specified address.
The NVMC is only able to write '0' to bits in the Flash that are erased (set to '1'). It cannot rewrite a bit back to '1'. This function checks if the value currently residing at the specified address can be transformed to the desired value without any '0' to '1' transitions.
address | Address to be checked. Must be halfword-aligned. |
value | Value to be checked. |
true | Halfword can be written at the specified address. |
false | Halfword cannot be written at the specified address. Erase page or change address. |
void nrfx_nvmc_halfword_write | ( | uint32_t | address, |
uint16_t | value | ||
) |
Function for writing a 16-bit halfword to flash.
To determine if the flash write has been completed, use nrfx_nvmc_write_done_check().
address | Address to write to. Must be halfword-aligned. |
value | Value to write. |
NRFX_STATIC_INLINE void nrfx_nvmc_icache_enable | ( | void | ) |
Function for enabling the Instruction Cache (ICache).
Enabling ICache reduces the amount of accesses to flash memory, which can boost performance and lower power consumption.
uint16_t nrfx_nvmc_otp_halfword_read | ( | uint32_t | address | ) |
Function for reading a 16-bit aligned halfword from the OTP (UICR)
OTP is a region of the UICR present in some chips. This function must be used to read halfword data from this region since unaligned accesses are not available on the OTP flash area.
address | Address to read from. Must be halfword-aligned. |
The | contents at address . |
nrfx_err_t nrfx_nvmc_page_erase | ( | uint32_t | address | ) |
Function for erasing a page in flash.
This function blocks until the erase operation finishes.
address | Address of the first word in the page to erase. |
NRFX_SUCCESS | Page erase complete. |
NRFX_ERROR_INVALID_ADDR | Address is not aligned to the size of the page. |
bool nrfx_nvmc_page_partial_erase_continue | ( | void | ) |
Function for performing a part of the complete page erase (also known as partial erase).
This function must be called several times to erase the whole page, once for each erase part.
true | Partial erase finished. |
false | Partial erase not finished. Call the function again to process the next part. |
nrfx_err_t nrfx_nvmc_page_partial_erase_init | ( | uint32_t | address, |
uint32_t | duration_ms | ||
) |
Function for initiating a complete page erase split into parts (also known as partial erase).
This function initiates a partial erase with the specified duration. To execute each part of the partial erase, use nrfx_nvmc_page_partial_erase_continue.
address | Address of the first word in the page to erase. |
duration_ms | Time in milliseconds that each partial erase will take. |
NRFX_SUCCESS | Partial erase started. |
NRFX_ERROR_INVALID_ADDR | Address is not aligned to the size of the page. |
nrfx_err_t nrfx_nvmc_uicr_erase | ( | void | ) |
Function for erasing the user information configuration register (UICR).
NRFX_SUCCESS | UICR has been successfully erased. |
NRFX_ERROR_NOT_SUPPORTED | UICR erase is not supported. |
NRFX_STATIC_INLINE uint32_t nrfx_nvmc_uicr_word_read | ( | uint32_t const volatile * | address | ) |
Function for reading a 32-bit aligned word from the UICR.
This function should be used to read from the UICR since reading the flash main memory area straight after reading the UICR results in undefined behaviour for nRF9160.
address | Address to read from. Must be word-aligned. |
The | contents at address . |
bool nrfx_nvmc_word_writable_check | ( | uint32_t | address, |
uint32_t | value | ||
) |
Function for checking whether a word is writable at the specified address.
The NVMC is only able to write '0' to bits in the Flash that are erased (set to '1'). It cannot rewrite a bit back to '1'. This function checks if the value currently residing at the specified address can be transformed to the desired value without any '0' to '1' transitions.
address | Address to be checked. Must be word-aligned. |
value | Value to be checked. |
true | Word can be written at the specified address. |
false | Word cannot be written at the specified address. Erase page or change address. |
void nrfx_nvmc_word_write | ( | uint32_t | address, |
uint32_t | value | ||
) |
Function for writing a 32-bit word to flash.
To determine if the flash write has been completed, use nrfx_nvmc_write_done_check().
address | Address to write to. Must be word-aligned. |
value | Value to write. |
void nrfx_nvmc_words_write | ( | uint32_t | address, |
void const * | src, | ||
uint32_t | num_words | ||
) |
Function for writing consecutive words to flash.
To determine if the last flash write has been completed, use nrfx_nvmc_write_done_check().
address | Address to write to. Must be word-aligned. |
src | Pointer to data to copy from. Must be word-aligned. |
num_words | Number of words to write. |
NRFX_STATIC_INLINE bool nrfx_nvmc_write_done_check | ( | void | ) |
Function for checking if the last flash write has been completed.
true | Last write completed successfully. |
false | Last write is still in progress. |