Support functions for the NVM driver.
These functions are helper functions for the functions of the NVM driver.
Functions | |
void | nvm_common_spm (uint32_t addr, uint8_t nvm_cmd) |
Perform SPM write. More... | |
static void | nvm_exec (void) |
Non-Volatile Memory Execute Command. More... | |
static void | nvm_issue_command (NVM_CMD_t nvm_command) |
Non-Volatile Memory Execute Specific Command. More... | |
uint8_t | nvm_read_byte (uint8_t nvm_cmd, uint16_t address) |
Read one byte using the LDI instruction. More... | |
static void | nvm_wait_until_ready (void) |
Wait for any NVM access to finish. More... | |
void nvm_common_spm | ( | uint32_t | addr, |
uint8_t | nvm_cmd | ||
) |
Perform SPM write.
This function sets the specified NVM_CMD, sets CCP and then runs the SPM instruction to write to flash.
addr | Address to perform the SPM on. |
nvm_cmd | NVM command to use in the NVM_CMD register |
Referenced by nvm_flash_atomic_write_app_page(), nvm_flash_atomic_write_boot_page(), nvm_flash_erase_app(), nvm_flash_erase_app_page(), nvm_flash_erase_boot_page(), nvm_flash_erase_user_section(), nvm_flash_flush_buffer(), nvm_flash_split_write_app_page(), nvm_flash_split_write_boot_page(), and nvm_flash_write_user_page().
|
inlinestatic |
Non-Volatile Memory Execute Command.
This function sets the CCP register before setting the CMDEX bit in the NVM.CTRLA register.
References ccp_write_io().
Referenced by nvm_eeprom_flush_buffer(), and nvm_eeprom_write_byte().
|
inlinestatic |
Non-Volatile Memory Execute Specific Command.
This function sets a command in the NVM.CMD register, then performs an execute command by writing the CMDEX bit to the NVM.CTRLA register.
nvm_command | NVM Command to execute. |
References ccp_write_io().
Referenced by nvm_eeprom_atomic_write_page(), nvm_eeprom_erase_bytes_in_all_pages(), nvm_eeprom_erase_bytes_in_page(), nvm_eeprom_split_write_page(), nvm_fuses_read(), and nvm_lock_bits_write().
uint8_t nvm_read_byte | ( | uint8_t | nvm_cmd, |
uint16_t | address | ||
) |
Read one byte using the LDI instruction.
This function sets the specified NVM_CMD, reads one byte using at the specified byte address with the LPM instruction. NVM_CMD is restored after use.
nvm_cmd | NVM command to load before running LPM |
address | Byte offset into the signature row |
Referenced by nvm_read_production_signature_row(), and nvm_read_user_signature_row().
|
inlinestatic |
Wait for any NVM access to finish.
This function is blocking and waits for any NVM access to finish. Use this function before any NVM accesses, if you are not certain that any previous operations are finished yet.
Referenced by nvm_eeprom_atomic_write_page(), nvm_eeprom_erase_bytes_in_all_pages(), nvm_eeprom_erase_bytes_in_page(), nvm_eeprom_fill_buffer_with_value(), nvm_eeprom_flush_buffer(), nvm_eeprom_load_byte_to_buffer(), nvm_eeprom_load_page_to_buffer(), nvm_eeprom_read_buffer(), nvm_eeprom_read_byte(), nvm_eeprom_split_write_page(), nvm_eeprom_write_byte(), nvm_flash_atomic_write_app_page(), nvm_flash_atomic_write_boot_page(), nvm_flash_erase_and_write_buffer(), nvm_flash_erase_app(), nvm_flash_erase_app_page(), nvm_flash_erase_boot_page(), nvm_flash_erase_user_section(), nvm_flash_flush_buffer(), nvm_flash_read_buffer(), nvm_flash_split_write_app_page(), nvm_flash_split_write_boot_page(), nvm_flash_write_user_page(), nvm_fuses_read(), nvm_lock_bits_write(), nvram_read(), and nvram_write().