Loading...
Searching...
No Matches
littlefs2_fs.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 OTA keys S.A.
3 * Copyright (C) 2020 Inria
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
24#ifndef FS_LITTLEFS2_FS_H
25#define FS_LITTLEFS2_FS_H
26
27#include <stdalign.h>
28
29#include "vfs.h"
30#include "lfs.h"
31#include "mtd.h"
32#include "mutex.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
43#ifndef CONFIG_LITTLEFS2_LOOKAHEAD_SIZE
45#define CONFIG_LITTLEFS2_LOOKAHEAD_SIZE (16)
46#endif
47
48#ifndef CONFIG_LITTLEFS2_FILE_BUFFER_SIZE
52#define CONFIG_LITTLEFS2_FILE_BUFFER_SIZE (0)
53#endif
54
55#ifndef CONFIG_LITTLEFS2_READ_BUFFER_SIZE
59#define CONFIG_LITTLEFS2_READ_BUFFER_SIZE (0)
60#endif
61
62#ifndef CONFIG_LITTLEFS2_PROG_BUFFER_SIZE
65#define CONFIG_LITTLEFS2_PROG_BUFFER_SIZE (0)
66#endif
67
68#ifndef CONFIG_LITTLEFS2_CACHE_PAGES
71#define CONFIG_LITTLEFS2_CACHE_PAGES (1)
72#endif
73
74#ifndef CONFIG_LITTLEFS2_BLOCK_CYCLES
77#define CONFIG_LITTLEFS2_BLOCK_CYCLES (512)
78#endif
79
80#ifndef CONFIG_LITTLEFS2_MIN_BLOCK_SIZE_EXP
84#define CONFIG_LITTLEFS2_MIN_BLOCK_SIZE_EXP (-1)
85#endif
91typedef struct {
92 lfs_t fs;
93 struct lfs_config config;
99 uint32_t base_addr;
100#if CONFIG_LITTLEFS2_FILE_BUFFER_SIZE || DOXYGEN
103 alignas(uint32_t) uint8_t file_buf[CONFIG_LITTLEFS2_FILE_BUFFER_SIZE];
104#endif
105#if CONFIG_LITTLEFS2_READ_BUFFER_SIZE || DOXYGEN
108 alignas(uint32_t) uint8_t read_buf[CONFIG_LITTLEFS2_READ_BUFFER_SIZE];
109#endif
110#if CONFIG_LITTLEFS2_PROG_BUFFER_SIZE || DOXYGEN
113 alignas(uint32_t) uint8_t prog_buf[CONFIG_LITTLEFS2_PROG_BUFFER_SIZE];
114#endif
116 alignas(uint32_t) uint8_t lookahead_buf[CONFIG_LITTLEFS2_LOOKAHEAD_SIZE];
119
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* FS_LITTLEFS2_FS_H */
#define CONFIG_LITTLEFS2_READ_BUFFER_SIZE
Read buffer size, if 0, dynamic allocation is used.
#define CONFIG_LITTLEFS2_PROG_BUFFER_SIZE
Prog buffer size, if 0, dynamic allocation is used.
#define CONFIG_LITTLEFS2_LOOKAHEAD_SIZE
Default lookahead size.
#define CONFIG_LITTLEFS2_FILE_BUFFER_SIZE
File buffer size, if 0, dynamic allocation is used.
const vfs_file_system_t littlefs2_file_system
The littlefs vfs driver.
Mutex for thread synchronization.
littlefs descriptor for vfs integration
mtd_dev_t * dev
mtd device to use
uint16_t sectors_per_block
number of sectors per block
lfs_t fs
littlefs descriptor
uint32_t base_addr
first block number to use, total number of block is defined in config.
mutex_t lock
mutex
MTD device descriptor.
Definition mtd.h:112
Mutex structure.
Definition mutex.h:146
A file system driver.
Definition vfs.h:375