Loading...
Searching...
No Matches
littlefs_fs.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 OTA keys S.A.
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
22#ifndef FS_LITTLEFS_FS_H
23#define FS_LITTLEFS_FS_H
24
25#include <stdalign.h>
26
27#include "vfs.h"
28#include "lfs.h"
29#include "mtd.h"
30#include "mutex.h"
31
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
41#ifndef LITTLEFS_LOOKAHEAD_SIZE
43#define LITTLEFS_LOOKAHEAD_SIZE (128)
44#endif
45
46#ifndef LITTLEFS_FILE_BUFFER_SIZE
50#define LITTLEFS_FILE_BUFFER_SIZE (0)
51#endif
52
53#ifndef LITTLEFS_READ_BUFFER_SIZE
56#define LITTLEFS_READ_BUFFER_SIZE (0)
57#endif
58
59#ifndef LITTLEFS_PROG_BUFFER_SIZE
62#define LITTLEFS_PROG_BUFFER_SIZE (0)
63#endif
64
65#ifndef LITTLEFS_MIN_BLOCK_SIZE_EXP
69#define LITTLEFS_MIN_BLOCK_SIZE_EXP (-1)
70#endif
76typedef struct {
77 lfs_t fs;
78 struct lfs_config config;
84 uint32_t base_addr;
85#if LITTLEFS_FILE_BUFFER_SIZE || DOXYGEN
87 alignas(uint32_t) uint8_t file_buf[LITTLEFS_FILE_BUFFER_SIZE];
88#endif
89#if LITTLEFS_READ_BUFFER_SIZE || DOXYGEN
91 alignas(uint32_t) uint8_t read_buf[LITTLEFS_READ_BUFFER_SIZE];
92#endif
93#if LITTLEFS_PROG_BUFFER_SIZE || DOXYGEN
95 alignas(uint32_t) uint8_t prog_buf[LITTLEFS_PROG_BUFFER_SIZE];
96#endif
98 alignas(uint32_t) uint8_t lookahead_buf[LITTLEFS_LOOKAHEAD_SIZE / 8];
101
104
105#ifdef __cplusplus
106}
107#endif
108
109#endif /* FS_LITTLEFS_FS_H */
#define LITTLEFS_LOOKAHEAD_SIZE
Default lookahead size.
Definition littlefs_fs.h:43
#define LITTLEFS_FILE_BUFFER_SIZE
File buffer size, if 0, dynamic allocation is used.
Definition littlefs_fs.h:50
const vfs_file_system_t littlefs_file_system
The littlefs vfs driver.
#define LITTLEFS_READ_BUFFER_SIZE
Read buffer size, if 0, dynamic allocation is used.
Definition littlefs_fs.h:56
#define LITTLEFS_PROG_BUFFER_SIZE
Prog buffer size, if 0, dynamic allocation is used.
Definition littlefs_fs.h:62
Mutex for thread synchronization.
littlefs descriptor for vfs integration
Definition littlefs_fs.h:76
lfs_t fs
littlefs descriptor
Definition littlefs_fs.h:77
uint16_t sectors_per_block
number of sectors per block
Definition littlefs_fs.h:99
mtd_dev_t * dev
mtd device to use
Definition littlefs_fs.h:79
mutex_t lock
mutex
Definition littlefs_fs.h:80
uint32_t base_addr
first block number to use, total number of block is defined in config.
Definition littlefs_fs.h:84
MTD device descriptor.
Definition mtd.h:112
Mutex structure.
Definition mutex.h:146
A file system driver.
Definition vfs.h:375