|
Contiki 3.x
|
App for easy usage of additional flash memoryMore...
#include <nvm.h>Go to the source code of this file.
Macros | |
| #define | flash_stack_read(dest, offset, numBytes) flash_getVar(dest, FLASH_STACK + (offset), numBytes) |
| Read data from stack. More... | |
Functions | |
| void | flash_init () |
| Initialize or clear random access blocks. More... | |
| nvmErr_t | flash_getVar (void *dest, flash_addr_t address, uint32_t numBytes) |
| Read data from flash memory. More... | |
| nvmErr_t | flash_setVar (void *src, flash_addr_t address, uint32_t numBytes) |
| Write data to flash memory. More... | |
| nvmErr_t | flash_cmp (void *src, flash_addr_t address, uint32_t numBytes) |
| Compares data from RAM with flash memory. More... | |
| void | flash_stack_init () |
| Stack initialisation. More... | |
| nvmErr_t | flash_stack_push (uint8_t *src, uint32_t numBytes) |
| Push data to stack. More... | |
| uint32_t | flash_stack_size () |
| Stacksize. More... | |
App for easy usage of additional flash memory
Purposes of the different flash blocks 1 : 0x18000 - 0x18FFF : Random access block 1.1 2 : 0x19000 - 0x19FFF : Random access block 1.2 3 : 0x1A000 - 0x1AFFF : Random access block 2.1 4 : 0x1B000 - 0x1BFFF : Random access block 2.2 5 : 0x1C000 - 0x1CFFF : Stack without pop function 6 : 0x1D000 - 0x1DFFF : Read only 7 : 0x1E000 - 0x1EFFF : Read only 8 : 0x1F000 - 0x1FFFF : System reserved
This app only allows write access to blocks 1 - 5 and read access to blocks 1 - 7.
To use the stack in block 5 you need: flash_stack_init, flash_stack_push, flash_stack_size, flash_stack_read.
To use the random access blocks 1.x and 2.x you need: flash_init, flash_getVar, flash_setVar, flash_cmp.
Blocks 1.x and 2.x are accessible with adresses 0x0001 - 0x0FFF and 0x1001 - 0x1FFF.
To be able to write to flash memory, its required to delete it first, but its only possible to delete a full block. So this app copies the data of a block, changing the requested data. Copying a block needs time. So when you only use the first N bytes, you can set FLASH_CONF_B1=N and FLASH_CONF_B2=N in your makefile to optimize speed.
You can find an example in examples/econotag-flash-test.
Definition in file flash.h.
| #define flash_stack_read | ( | dest, | |
| offset, | |||
| numBytes | |||
| ) | flash_getVar(dest, FLASH_STACK + (offset), numBytes) |
| nvmErr_t flash_cmp | ( | void * | src, |
| flash_addr_t | address, | ||
| uint32_t | numBytes | ||
| ) |
Compares data from RAM with flash memory.
Compares data from RAM with flash memory. Valid addresses are 0x18000 - 0x1EFFF. Addresses 0x0 - 0x1FFF will be mapped to 0x18000 - 0x1BFFF.
| src | Memory area with data to compare |
| address | Area in flash memory |
| numBytes | Number of bytes to compare |
| nvmErr_t flash_getVar | ( | void * | dest, |
| flash_addr_t | address, | ||
| uint32_t | numBytes | ||
| ) |
Read data from flash memory.
Reads data from flash memory and stores it into RAM. You can read the flash area 0x18000 - 0x1EFFF. Addresses 0x0000 - 0x1FFF will be mapped to 0x18000 - 0x1BFFF.
| dest | Memory area to store the data |
| address | Area in flash memory to read from |
| numBytes | Number of bytes to read |
| void flash_init | ( | ) |
| nvmErr_t flash_setVar | ( | void * | src, |
| flash_addr_t | address, | ||
| uint32_t | numBytes | ||
| ) |
Write data to flash memory.
Writes data to flash memory. Valid addresses are 0x0001 - 0x0FFF and 0x1001 - 0x1FFF -> Mapped to 0x18000 - 0x1BFFF.
| src | Memory area with data to store in flash memory |
| address | Area in flash memory to write |
| numBytes | Number of bytes to write |
| void flash_stack_init | ( | ) |
| nvmErr_t flash_stack_push | ( | uint8_t * | src, |
| uint32_t | numBytes | ||
| ) |
1.8.6