Xmega Application Note | |||||
Support functions for the NVM driver. More...
Functions | |
void | nvm_common_spm (uint32_t addr, uint8_t nvm_cmd) |
Perform SPM write. | |
static void | nvm_exec (void) |
Non-Volatile Memory Execute Command. | |
static void | nvm_issue_command (NVM_CMD_t nvm_command) |
Non-Volatile Memory Execute Specific Command. | |
uint8_t | nvm_read_byte_near (uint8_t nvm_cmd, uint8_t address) |
Read one byte using the LDI instruction. | |
static void | nvm_wait_until_ready (void) |
Wait for any NVM access to finish. |
Support functions for the NVM driver.
These functions are helper functions for the functions of the NVM driver.
void nvm_common_spm | ( | uint32_t | addr, | |
uint8_t | nvm_cmd | |||
) |
Perform SPM write.
For internal use only.
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_split_write_app_page(), nvm_flash_split_write_boot_page(), and nvm_flash_write_user_page().
static void nvm_exec | ( | void | ) | [inline, static] |
Non-Volatile Memory Execute Command.
This function sets the CCP register before setting the CMDEX bit in the NVM.CTRLA register.
Definition at line 97 of file nvm.h.
References ccp_write_io().
00098 { 00099 ccp_write_io((uint8_t *)&NVM.CTRLA, NVM_CMDEX_bm); 00100 }
static void nvm_issue_command | ( | NVM_CMD_t | nvm_command | ) | [inline, static] |
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. |
Definition at line 114 of file nvm.h.
References ccp_write_io().
00115 { 00116 uint8_t old_cmd; 00117 00118 old_cmd = NVM.CMD; 00119 NVM.CMD = nvm_command; 00120 ccp_write_io((uint8_t *)&NVM.CTRLA, NVM_CMDEX_bm); 00121 NVM.CMD = old_cmd; 00122 }
uint8_t nvm_read_byte_near | ( | uint8_t | nvm_cmd, | |
uint8_t | address | |||
) |
Read one byte using the LDI instruction.
For internal use only.
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 commad 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().
static void nvm_wait_until_ready | ( | void | ) | [inline, static] |
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.
Definition at line 81 of file nvm.h.
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_split_write_app_page(), nvm_flash_split_write_boot_page(), and nvm_flash_write_user_page().
Generated on Fri Oct 22 12:15:26 2010 for AVR1300 Using the Xmega ADC by ![]() |