Skip to content

File lt_flash.c

FileList > api > lt_flash.c

Go to the source code of this file.

  • #include "lt_flash.h"
  • #include <fal.h>

Public Functions

Type Name
__attribute__ ((weak))
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).
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 __attribute__

__attribute__ (
    (weak)
) 

function lt_flash_erase

Erase flash area. Flash can only be erased in blocks (usually 4 KiB).

bool lt_flash_erase (
    uint32_t offset,
    size_t length
) 

Parameters:

  • offset starting offset to erase (in bytes); must be multiple of the flash chip's block size
  • length 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).

bool lt_flash_erase_block (
    uint32_t offset
) 

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_read

Read data from the flash.

uint32_t lt_flash_read (
    uint32_t offset,
    uint8_t * data,
    size_t length
) 

Parameters:

  • offset starting offset (in bytes)
  • data pointer to where to store the data
  • length length of data to read

Returns:

length of data successfully read (should equal 'length')

function lt_flash_write

Write data to the flash.

uint32_t lt_flash_write (
    uint32_t offset,
    const uint8_t * data,
    size_t length
) 

Parameters:

  • offset starting offset (in bytes)
  • data pointer to data to write
  • length 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.c