Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
littlefs.h File Reference
#include <zephyr/types.h>
#include <zephyr/kernel.h>
#include <zephyr/storage/flash_map.h>
#include <lfs.h>

Go to the source code of this file.

Data Structures

struct  fs_littlefs
 Filesystem info structure for LittleFS mount. More...
 

Macros

#define FS_LITTLEFS_DECLARE_CUSTOM_CONFIG(name, alignment, read_sz, prog_sz, cache_sz, lookahead_sz)
 Define a littlefs configuration with customized size characteristics.
 
#define FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(name)
 Define a littlefs configuration with default characteristics.
 

Macro Definition Documentation

◆ FS_LITTLEFS_DECLARE_CUSTOM_CONFIG

#define FS_LITTLEFS_DECLARE_CUSTOM_CONFIG ( name,
alignment,
read_sz,
prog_sz,
cache_sz,
lookahead_sz )
Value:
static uint8_t __aligned(alignment) name ## _read_buffer[cache_sz]; \
static uint8_t __aligned(alignment) name ## _prog_buffer[cache_sz]; \
static uint32_t name ## _lookahead_buffer[(lookahead_sz) / sizeof(uint32_t)]; \
static struct fs_littlefs name = { \
.cfg = { \
.read_size = (read_sz), \
.prog_size = (prog_sz), \
.cache_size = (cache_sz), \
.lookahead_size = (lookahead_sz), \
.read_buffer = name ## _read_buffer, \
.prog_buffer = name ## _prog_buffer, \
.lookahead_buffer = name ## _lookahead_buffer, \
}, \
}
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Filesystem info structure for LittleFS mount.
Definition littlefs.h:21
uint8_t * prog_buffer
Definition littlefs.h:29
uint32_t * lookahead_buffer[CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE/sizeof(uint32_t)]
Definition littlefs.h:34

Define a littlefs configuration with customized size characteristics.

This defines static arrays required for caches, and initializes the littlefs configuration structure to use the provided values instead of the global Kconfig defaults. A pointer to the named object must be stored in the fs_mount_t::fs_data field of a fs_mount_t object.

To define an instance for the Kconfig defaults, use FS_LITTLEFS_DECLARE_DEFAULT_CONFIG.

To completely control file system configuration the application can directly define and initialize a fs_littlefs object. The application is responsible for ensuring the configured values are consistent with littlefs requirements.

Note
If you use a non-default configuration for cache size, you must also select CONFIG_FS_LITTLEFS_FC_HEAP_SIZE to relax the size constraints on per-file cache allocations.
Parameters
namethe name for the structure. The defined object has file scope.
alignmentneeded alignment for read/prog buffer for specific device
read_szsee CONFIG_FS_LITTLEFS_READ_SIZE
prog_szsee CONFIG_FS_LITTLEFS_PROG_SIZE
cache_szsee CONFIG_FS_LITTLEFS_CACHE_SIZE
lookahead_szsee CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE

◆ FS_LITTLEFS_DECLARE_DEFAULT_CONFIG

#define FS_LITTLEFS_DECLARE_DEFAULT_CONFIG ( name)
Value:
4, \
CONFIG_FS_LITTLEFS_READ_SIZE, \
CONFIG_FS_LITTLEFS_PROG_SIZE, \
CONFIG_FS_LITTLEFS_CACHE_SIZE, \
CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE)
#define FS_LITTLEFS_DECLARE_CUSTOM_CONFIG(name, alignment, read_sz, prog_sz, cache_sz, lookahead_sz)
Define a littlefs configuration with customized size characteristics.
Definition littlefs.h:70

Define a littlefs configuration with default characteristics.

This defines static arrays and initializes the littlefs configuration structure to use the default size configuration provided by Kconfig.

Parameters
namethe name for the structure. The defined object has file scope.