Hanna
Sourcecode Batteriemanagementsystem |
XMEGA EEPROM driver header file. Mehr ...
#include "compiler.h"
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
#define | EEPROM(_pageAddr, _byteAddr) ((uint8_t *) MAPPED_EEPROM_START)[_pageAddr*EEPROM_PAGESIZE + _byteAddr] |
#define | EEPROM_DisableMapping() ( NVM.CTRLB &= ~NVM_EEMAPEN_bm ) |
Disable EEPROM mapping into data space. Mehr ... | |
#define | EEPROM_DisablePowerReduction() ( NVM.CTRLB &= ~NVM_EPRM_bm ) |
Disable EEPROM block sleep-when-not-used mode. Mehr ... | |
#define | EEPROM_EnableMapping() ( NVM.CTRLB |= NVM_EEMAPEN_bm ) |
Enable EEPROM mapping into data space. Mehr ... | |
#define | EEPROM_EnablePowerReduction() ( NVM.CTRLB |= NVM_EPRM_bm ) |
Enable EEPROM block sleep-when-not-used mode. Mehr ... | |
#define | EEPROM_PAGESIZE 32 |
#define | NVM_EXEC() |
Non-Volatile Memory Execute Command. Mehr ... | |
Funktionen | |
void | EEPROM_AtomicWritePage (uint8_t pageAddr) |
Write already loaded page into EEPROM. Mehr ... | |
void | eeprom_demo (void) |
void | EEPROM_EraseAll (void) |
Erase entire EEPROM memory. Mehr ... | |
void | EEPROM_ErasePage (uint8_t pageAddress) |
Erase EEPROM page. Mehr ... | |
void | EEPROM_FlushBuffer (void) |
Flush temporary EEPROM page buffer. Mehr ... | |
void | EEPROM_LoadByte (uint8_t byteAddr, uint8_t value) |
Load single byte into temporary page buffer. Mehr ... | |
void | EEPROM_LoadPage (const uint8_t *values) |
Load entire page into temporary EEPROM page buffer. Mehr ... | |
uint8_t | EEPROM_ReadByte (uint8_t pageAddr, uint8_t byteAddr) |
Read one byte from EEPROM using IO mapping. Mehr ... | |
uint32_t | EEPROM_ReadBytes (uint8_t pageAddr, uint8_t byteAddr, uint8_t len) |
void | EEPROM_SplitWritePage (uint8_t pageAddr) |
Write (without erasing) EEPROM page. Mehr ... | |
void | EEPROM_WaitForNVM (void) |
Wait for any NVM access to finish, including EEPROM. Mehr ... | |
void | EEPROM_WriteByte (uint8_t pageAddr, uint8_t byteAddr, uint8_t value) |
Write one byte to EEPROM using IO mapping. Mehr ... | |
void | EEPROM_WriteBytes (uint8_t pageAddr, uint8_t byteAddr, uint8_t len, uint32_t value) |
XMEGA EEPROM driver header file.
This file contains the function prototypes and enumerator definitions for various configuration parameters for the XMEGA EEPROM driver.
The driver is not intended for size and/or speed critical code, since most functions are just a few lines of code, and the function call overhead would decrease code performance. The driver is intended for rapid prototyping and documentation purposes for getting started with the XMEGA EEPROM module.
For size and/or speed critical code, it is recommended to copy the function contents directly into your application instead of making a function call.
Copyright (c) 2008, Atmel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definiert in Datei eeprom_driver.h.
#define EEPROM_DisableMapping | ( | ) | ( NVM.CTRLB &= ~NVM_EEMAPEN_bm ) |
Disable EEPROM mapping into data space.
This macro disables mapping of EEPROM into data space. IO mapped access is now enabled.
Definiert in Zeile 102 der Datei eeprom_driver.h.
#define EEPROM_DisablePowerReduction | ( | ) | ( NVM.CTRLB &= ~NVM_EPRM_bm ) |
Disable EEPROM block sleep-when-not-used mode.
This macro disables power reduction mode for EEPROM.
Definiert in Zeile 84 der Datei eeprom_driver.h.
#define EEPROM_EnableMapping | ( | ) | ( NVM.CTRLB |= NVM_EEMAPEN_bm ) |
Enable EEPROM mapping into data space.
This macro enables mapping of EEPROM into data space. EEPROM starts at EEPROM_START in data memory. Read access can be done similar to ordinary SRAM access.
Definiert in Zeile 95 der Datei eeprom_driver.h.
#define EEPROM_EnablePowerReduction | ( | ) | ( NVM.CTRLB |= NVM_EPRM_bm ) |
Enable EEPROM block sleep-when-not-used mode.
This macro enables power reduction mode for EEPROM. It means that the EEPROM block is disabled when not used. Note that there will be a penalty of 6 CPU cycles if EEPROM is accessed.
Definiert in Zeile 78 der Datei eeprom_driver.h.
#define NVM_EXEC | ( | ) |
Non-Volatile Memory Execute Command.
This macro set the CCP register before setting the CMDEX bit in the NVM.CTRLA register.
Definiert in Zeile 112 der Datei eeprom_driver.h.
void EEPROM_AtomicWritePage | ( | uint8_t | pageAddr | ) |
Write already loaded page 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.
pageAddr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGESIZE |
Definiert in Zeile 263 der Datei eeprom_driver.c.
void EEPROM_EraseAll | ( | void | ) |
Erase entire EEPROM memory.
This function erases the entire EEPROM memory block to 0xFF.
Definiert in Zeile 337 der Datei eeprom_driver.c.
void EEPROM_ErasePage | ( | uint8_t | pageAddr | ) |
Erase EEPROM page.
This function erases one EEPROM page, so that every location reads 0xFF.
pageAddr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGESIZE |
Definiert in Zeile 287 der Datei eeprom_driver.c.
void EEPROM_FlushBuffer | ( | 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.
Definiert in Zeile 173 der Datei eeprom_driver.c.
void EEPROM_LoadByte | ( | uint8_t | byteAddr, |
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.
byteAddr | EEPROM Byte address, between 0 and EEPROM_PAGESIZE. |
value | Byte value to write to buffer. |
Definiert in Zeile 201 der Datei eeprom_driver.c.
void EEPROM_LoadPage | ( | 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. |
Definiert in Zeile 230 der Datei eeprom_driver.c.
uint8_t EEPROM_ReadByte | ( | uint8_t | pageAddr, |
uint8_t | byteAddr | ||
) |
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.
pageAddr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGESIZE |
byteAddr | EEPROM Byte address, between 0 and EEPROM_PAGESIZE. |
Definiert in Zeile 119 der Datei eeprom_driver.c.
void EEPROM_SplitWritePage | ( | uint8_t | pageAddr | ) |
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.
pageAddr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGESIZE |
Definiert in Zeile 315 der Datei eeprom_driver.c.
void EEPROM_WaitForNVM | ( | void | ) |
Wait for any NVM access to finish, including EEPROM.
This function is blcoking and waits for any NVM access to finish, including EEPROM. Use this function before any EEPROM accesses, if you are not certain that any previous operations are finished yet, like an EEPROM write.
Definiert in Zeile 156 der Datei eeprom_driver.c.
void EEPROM_WriteByte | ( | uint8_t | pageAddr, |
uint8_t | byteAddr, | ||
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.
pageAddr | EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGESIZE |
byteAddr | EEPROM Byte address, between 0 and EEPROM_PAGESIZE. |
value | Byte value to write to EEPROM. |
Definiert in Zeile 72 der Datei eeprom_driver.c.