Xmega Application Note | |||||
Functions for handling internal EEPROM memory. More...
Functions | |
void | nvm_eeprom_atomic_write_page (uint8_t page_addr) |
Erase and write bytes from page buffer into EEPROM. | |
void | nvm_eeprom_erase_all (void) |
Erase entire EEPROM memory. | |
void | nvm_eeprom_erase_bytes_in_all_pages (void) |
Erase bytes from all EEPROM pages. | |
void | nvm_eeprom_erase_bytes_in_page (uint8_t page_addr) |
Erase bytes from EEPROM page. | |
void | nvm_eeprom_erase_page (uint8_t page_addr) |
Erase EEPROM page. | |
void | nvm_eeprom_fill_buffer_with_value (uint8_t value) |
Fill temporary EEPROM page buffer with value. | |
void | nvm_eeprom_flush_buffer (void) |
Flush temporary EEPROM page buffer. | |
void | nvm_eeprom_load_byte_to_buffer (uint8_t byte_addr, uint8_t value) |
Load single byte into temporary page buffer. | |
void | nvm_eeprom_load_page_to_buffer (const uint8_t *values) |
Load entire page into temporary EEPROM page buffer. | |
uint8_t | nvm_eeprom_read_byte (uint8_t page_addr, uint8_t byte_addr) |
Read one byte from EEPROM using IO mapping. | |
void | nvm_eeprom_split_write_page (uint8_t page_addr) |
Write (without erasing) EEPROM page. | |
void | nvm_eeprom_write_byte (uint8_t page_addr, uint8_t byte_addr, uint8_t value) |
Write one byte to EEPROM using IO mapping. |
Functions for handling internal EEPROM memory.
The internal EEPROM can be used to store data that will persist after power is removed. This can typically be used to store calibration data, application state, encryption keys or other data that need to be preserved when power is removed.
The functions in this module uses IO register access to manipulate the EEPROM.
void nvm_eeprom_atomic_write_page | ( | uint8_t | page_addr | ) |
Erase and write bytes from page buffer into EEPROM.
This function writes the contents of an already loaded EEPROM page buffer into EEPROM memory.
As this is an atomic write, the page in EEPROM will be erased automatically before writing. Note that only the page buffer locations that have been loaded will be used when writing to EEPROM. Page buffer locations that have not been loaded will be left untouched in EEPROM.
page_addr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGE_SIZE |
void nvm_eeprom_erase_all | ( | void | ) |
Erase entire EEPROM memory.
This function erases the entire EEPROM memory block to 0xFF.
void nvm_eeprom_erase_bytes_in_all_pages | ( | void | ) |
Erase bytes from all EEPROM pages.
This function erases bytes from all EEPROM pages, so that every location written to in the page buffer reads 0xFF.
void nvm_eeprom_erase_bytes_in_page | ( | uint8_t | page_addr | ) |
Erase bytes from EEPROM page.
This function erases bytes from one EEPROM page, so that every location written to in the page buffer reads 0xFF.
page_addr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGE_SIZE |
void nvm_eeprom_erase_page | ( | uint8_t | page_addr | ) |
Erase EEPROM page.
This function erases one EEPROM page, so that every location reads 0xFF.
page_addr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGE_SIZE |
void nvm_eeprom_fill_buffer_with_value | ( | uint8_t | value | ) |
Fill temporary EEPROM page buffer with value.
This fills the the EEPROM page buffers with a given value. If memory mapped EEPROM is enabled, this function will not work.
value | Value to copy to the page buffer. |
void nvm_eeprom_flush_buffer | ( | void | ) |
Flush temporary EEPROM page buffer.
This function flushes the EEPROM page buffers. This function will cancel any ongoing EEPROM page buffer loading operations, if any. This function also works for memory mapped EEPROM access.
void nvm_eeprom_load_byte_to_buffer | ( | uint8_t | byte_addr, | |
uint8_t | value | |||
) |
Load single byte into temporary page buffer.
This function loads one byte into the temporary EEPROM page buffers. If memory mapped EEPROM is enabled, this function will not work. Make sure that the buffer is flushed before starting to load bytes. Also, if multiple bytes are loaded into the same location, they will be ANDed together, thus 0x55 and 0xAA will result in 0x00 in the buffer.
byte_addr | EEPROM Byte address, between 0 and EEPROM_PAGE_SIZE. | |
value | Byte value to write to buffer. |
void nvm_eeprom_load_page_to_buffer | ( | const uint8_t * | values | ) |
Load entire page into temporary EEPROM page buffer.
This function loads an entire EEPROM page from an SRAM buffer to the EEPROM page buffers. If memory mapped EEPROM is enabled, this function will not work. Make sure that the buffer is flushed before starting to load bytes.
values | Pointer to SRAM buffer containing an entire page. |
uint8_t nvm_eeprom_read_byte | ( | uint8_t | page_addr, | |
uint8_t | byte_addr | |||
) |
Read one byte from EEPROM using IO mapping.
This function reads one byte from EEPROM using IO-mapped access. If memory mapped EEPROM is enabled, this function will not work.
page_addr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGE_SIZE | |
byte_addr | EEPROM Byte address, between 0 and EEPROM_PAGE_SIZE. |
void nvm_eeprom_split_write_page | ( | uint8_t | page_addr | ) |
Write (without erasing) EEPROM page.
This function writes the contents of an already loaded EEPROM page buffer into EEPROM memory.
As this is a split write, the page in EEPROM will _not_ be erased before writing.
page_addr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGE_SIZE |
void nvm_eeprom_write_byte | ( | uint8_t | page_addr, | |
uint8_t | byte_addr, | |||
uint8_t | value | |||
) |
Write one byte to EEPROM using IO mapping.
This function writes one byte to EEPROM using IO-mapped access. If memory mapped EEPROM is enabled, this function will not work. This functiom will cancel all ongoing EEPROM page buffer loading operations, if any.
page_addr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGE_SIZE | |
byte_addr | EEPROM Byte address, between 0 and EEPROM_PAGE_SIZE. | |
value | Byte value to write to EEPROM. |
Generated on Fri Oct 22 12:15:26 2010 for AVR1300 Using the Xmega ADC by ![]() |