spiffs_fs.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 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 
25 #ifndef FS_SPIFFS_FS_H
26 #define FS_SPIFFS_FS_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include "spiffs.h"
33 #include "spiffs_config.h"
34 #include "vfs.h"
35 #include "mtd.h"
36 #include "mutex.h"
37 
39 #define SPIFFS_DIR_SIZE (12)
40 
41 #if (VFS_DIR_BUFFER_SIZE < SPIFFS_DIR_SIZE)
42 #error "VFS_DIR_BUFFER_SIZE too small"
43 #endif
44 
49 #ifndef SPIFFS_FS_CACHE_SIZE
50 #if SPIFFS_CACHE || defined(DOXYGEN)
51 
58 #define SPIFFS_FS_CACHE_SIZE (512)
59 #else
60 #define SPIFFS_FS_CACHE_SIZE (0)
61 #endif /* SPIFFS_CACHE */
62 #endif /* SPIFFS_FS_CACHE_SIZE */
63 #ifndef SPIFFS_FS_WORK_SIZE
64 
71 #define SPIFFS_FS_WORK_SIZE (512)
72 #endif
73 #ifndef SPIFFS_FS_FD_SPACE_SIZE
74 
80 #define SPIFFS_FS_FD_SPACE_SIZE (4 * 32)
81 #endif
82 
87 typedef struct spiffs_desc {
88  spiffs fs;
91 #if (SPIFFS_CACHE == 1) || defined(DOXYGEN)
93 #endif
94  spiffs_config config;
97 #if (SPIFFS_HAL_CALLBACK_EXTRA == 1) || defined(DOXYGEN)
99 #endif
100 } spiffs_desc_t;
101 
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* FS_SPIFFS_FS_H */
110 
const vfs_file_system_t spiffs_file_system
The SPIFFS vfs driver, a pointer to a spiffs_desc_t must be provided as vfs_mountp::private_data.
VFS layer API declarations.
uint8_t cache[SPIFFS_FS_CACHE_SIZE]
SPIFFS cache.
Definition: spiffs_fs.h:92
#define SPIFFS_FS_FD_SPACE_SIZE
the size of the file descriptor buffer
Definition: spiffs_fs.h:80
#define SPIFFS_FS_WORK_SIZE
The size of the work buffer.
Definition: spiffs_fs.h:71
spiffs fs
The SPIFFS struct.
Definition: spiffs_fs.h:88
mutex_t lock
A lock for SPIFFS internal use.
Definition: spiffs_fs.h:96
mtd_dev_t * dev
The underlying mtd device, must be set by user.
Definition: spiffs_fs.h:98
spiffs_config config
SPIFFS config, filled at mount time depending on the underlying mtdi_dev_t dev.
Definition: spiffs_fs.h:94
#define SPIFFS_FS_CACHE_SIZE
the size of the cache buffer
Definition: spiffs_fs.h:58
uint8_t work[SPIFFS_FS_WORK_SIZE]
SPIFFS work buffer.
Definition: spiffs_fs.h:89
RIOT synchronization API.
MTD device descriptor.
Definition: mtd.h:58
This contains everything needed to run an instance of SPIFFS.
Definition: spiffs_fs.h:87
uint8_t fd_space[SPIFFS_FS_FD_SPACE_SIZE]
SPIFFS file descriptor cache.
Definition: spiffs_fs.h:90
A file system driver.
Definition: vfs.h:163
Mutex structure.
Definition: mutex.h:36
struct spiffs_desc spiffs_desc_t
This contains everything needed to run an instance of SPIFFS.