File lt_flash.h
FileList > api > lt_flash.h
Go to the source code of this file.
#include <libretiny.h>
Classes
Type | Name |
---|---|
struct | lt_flash_id_t Flash chip ID structure. |
Public Functions
Type | Name |
---|---|
bool | lt_flash_erase (uint32_t offset, size_t length) Erase flash area. Flash can only be erased in blocks (usually 4 KiB). |
bool | lt_flash_erase_block (uint32_t offset) Erase a single block of flash (usually 4 KiB). |
lt_flash_id_t | lt_flash_get_id () Read flash chip ID and return a lt_flash_id_t struct. |
uint32_t | lt_flash_get_size () Get flash chip total size. |
uint32_t | lt_flash_read (uint32_t offset, uint8_t * data, size_t length) Read data from the flash. |
uint32_t | lt_flash_write (uint32_t offset, const uint8_t * data, size_t length) Write data to the flash. |
Public Functions Documentation
function lt_flash_erase
Erase flash area. Flash can only be erased in blocks (usually 4 KiB).
Parameters:
offset
starting offset to erase (in bytes); must be multiple of the flash chip's block sizelength
length of data to erase (in bytes); will be rounded up to block size
Returns:
whether erasing was successful
function lt_flash_erase_block
Erase a single block of flash (usually 4 KiB).
Parameters:
offset
offset of the block (in bytes); must be multiple of the flash chip's block size
Returns:
whether erasing was successful
function lt_flash_get_id
function lt_flash_get_size
Get flash chip total size.
The default implementation uses the least significant byte of the chip ID to determine the size.
function lt_flash_read
Read data from the flash.
Parameters:
offset
starting offset (in bytes)data
pointer to where to store the datalength
length of data to read
Returns:
length of data successfully read (should equal 'length')
function lt_flash_write
Write data to the flash.
Parameters:
offset
starting offset (in bytes)data
pointer to data to writelength
length of data to write
Returns:
length of data successfully written (should equal 'length')
The documentation for this class was generated from the following file cores/common/base/api/lt_flash.h