SEcube
SEcube Open Source Library - Device
|
Flash management. More...
#include "se3_flash.h"
Functions | |
static bool | flash_fill (uint32_t addr, uint8_t val, size_t size) |
static bool | flash_zero (uint32_t addr, size_t size) |
static bool | flash_program (uint32_t addr, const uint8_t *data, size_t size) |
static bool | flash_erase (uint32_t sector) |
static bool | flash_swap () |
void | se3_flash_info_setup (uint32_t sector, const uint8_t *base) |
Initialize flash structures. More... | |
bool | se3_flash_canfit (size_t size) |
Check if enough space for new node. More... | |
bool | se3_flash_init () |
Initialize flash. More... | |
bool | se3_flash_it_write (se3_flash_it *it, uint16_t off, const uint8_t *data, uint16_t size) |
Write to flash node. More... | |
void | se3_flash_it_init (se3_flash_it *it) |
Initialize flash iterator. More... | |
bool | se3_flash_it_next (se3_flash_it *it) |
Increment flash iterator. More... | |
size_t | se3_flash_unused () |
Get unused space. More... | |
bool | se3_flash_it_new (se3_flash_it *it, uint8_t type, uint16_t size) |
Allocate new node. More... | |
bool | se3_flash_pos_delete (size_t pos) |
Delete flash node by index. More... | |
bool | se3_flash_it_delete (se3_flash_it *it) |
Delete flash node. More... | |
Flash management.
bool se3_flash_canfit | ( | size_t | size | ) |
Check if enough space for new node.
Check if there is enough space
size | size of the data to be stored inside the new node |
void se3_flash_info_setup | ( | uint32_t | sector, |
const uint8_t * | base | ||
) |
Initialize flash structures.
Initializes the structures for flash management, selecting a sector and its base address.
sector | active sector number |
base | active sector base address |
bool se3_flash_init | ( | ) |
Initialize flash.
Selects the active flash sector or initializes one
bool se3_flash_it_delete | ( | se3_flash_it * | it | ) |
Delete flash node.
Delete a flash node and its data
it | flash iterator structure |
void se3_flash_it_init | ( | se3_flash_it * | it | ) |
Initialize flash iterator.
it | flash iterator structure |
bool se3_flash_it_new | ( | se3_flash_it * | it, |
uint8_t | type, | ||
uint16_t | size | ||
) |
Allocate new node.
Allocates a new node in the flash and points the iterator to the new node.
it | flash iterator structure |
type | type of the new flash node |
size | size of the data in the new flash node |
bool se3_flash_it_next | ( | se3_flash_it * | it | ) |
Increment flash iterator.
Increment iterator and read information of the next node in flash
it | flash iterator structure |
bool se3_flash_it_write | ( | se3_flash_it * | it, |
uint16_t | off, | ||
const uint8_t * | data, | ||
uint16_t | size | ||
) |
Write to flash node.
Write data to flash node.
it | flash iterator structure |
off | offset of data |
data | pointer to data to be written |
size | size of data to be written |
bool se3_flash_pos_delete | ( | size_t | pos | ) |
Delete flash node by index.
Delete a flash node given its index
pos | the index of the node |
size_t se3_flash_unused | ( | ) |
Get unused space.
Get unused space in the flash memory, including the space marked as invalid. If space is available, it does not mean that flash sectors will not be swapped.