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 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include "vfs.h"
32 #include "lfs.h"
33 #include "mtd.h"
34 #include "mutex.h"
35 
41 #ifndef CONFIG_LITTLEFS2_LOOKAHEAD_SIZE
42 
43 #define CONFIG_LITTLEFS2_LOOKAHEAD_SIZE (16)
44 #endif
45 
46 #ifndef CONFIG_LITTLEFS2_FILE_BUFFER_SIZE
47 
50 #define CONFIG_LITTLEFS2_FILE_BUFFER_SIZE (0)
51 #endif
52 
53 #ifndef CONFIG_LITTLEFS2_READ_BUFFER_SIZE
54 
57 #define CONFIG_LITTLEFS2_READ_BUFFER_SIZE (0)
58 #endif
59 
60 #ifndef CONFIG_LITTLEFS2_PROG_BUFFER_SIZE
61 
63 #define CONFIG_LITTLEFS2_PROG_BUFFER_SIZE (0)
64 #endif
65 
66 #ifndef CONFIG_LITTLEFS2_CACHE_PAGES
67 
69 #define CONFIG_LITTLEFS2_CACHE_PAGES (1)
70 #endif
71 
72 #ifndef CONFIG_LITTLEFS2_BLOCK_CYCLES
73 
75 #define CONFIG_LITTLEFS2_BLOCK_CYCLES (512)
76 #endif
77 
82 typedef struct {
83  lfs_t fs;
84  struct lfs_config config;
90  uint32_t base_addr;
91 #if CONFIG_LITTLEFS2_FILE_BUFFER_SIZE || DOXYGEN
92 
95 #endif
96 #if CONFIG_LITTLEFS2_READ_BUFFER_SIZE || DOXYGEN
97 
100 #endif
101 #if CONFIG_LITTLEFS2_PROG_BUFFER_SIZE || DOXYGEN
102 
105 #endif
106 
107  uint8_t lookahead_buf[CONFIG_LITTLEFS2_LOOKAHEAD_SIZE];
109 
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif /* FS_LITTLEFS2_FS_H */
118 
littlefs2_desc_t::lock
mutex_t lock
mutex
Definition: littlefs2_fs.h:86
CONFIG_LITTLEFS2_FILE_BUFFER_SIZE
#define CONFIG_LITTLEFS2_FILE_BUFFER_SIZE
File buffer size, if 0, dynamic allocation is used.
Definition: littlefs2_fs.h:50
mtd_dev_t
MTD device descriptor.
Definition: mtd.h:58
littlefs2_file_system
const vfs_file_system_t littlefs2_file_system
The littlefs vfs driver.
littlefs2_desc_t::dev
mtd_dev_t * dev
mtd device to use
Definition: littlefs2_fs.h:85
littlefs2_desc_t::base_addr
uint32_t base_addr
first block number to use, total number of block is defined in config.
Definition: littlefs2_fs.h:90
littlefs2_desc_t
littlefs descriptor for vfs integration
Definition: littlefs2_fs.h:82
CONFIG_LITTLEFS2_PROG_BUFFER_SIZE
#define CONFIG_LITTLEFS2_PROG_BUFFER_SIZE
Prog buffer size, if 0, dynamic allocation is used.
Definition: littlefs2_fs.h:63
littlefs2_desc_t::fs
lfs_t fs
littlefs descriptor
Definition: littlefs2_fs.h:83
CONFIG_LITTLEFS2_READ_BUFFER_SIZE
#define CONFIG_LITTLEFS2_READ_BUFFER_SIZE
Read buffer size, if 0, dynamic allocation is used.
Definition: littlefs2_fs.h:57
CONFIG_LITTLEFS2_LOOKAHEAD_SIZE
#define CONFIG_LITTLEFS2_LOOKAHEAD_SIZE
Default lookahead size.
Definition: littlefs2_fs.h:43
mutex.h
Mutex for thread synchronization.
vfs_file_system_t
A file system driver.
Definition: vfs.h:256
vfs.h
VFS layer API declarations.
mutex_t
Mutex structure.
Definition: mutex.h:120