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 
20 #ifndef SPIFFS_FS_H
21 #define SPIFFS_FS_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include "spiffs.h"
28 #include "spiffs_config.h"
29 #include "vfs.h"
30 #include "mtd.h"
31 #include "mutex.h"
32 
34 #define SPIFFS_DIR_SIZE (12)
35 
36 #if (VFS_DIR_BUFFER_SIZE < SPIFFS_DIR_SIZE)
37 #error "VFS_DIR_BUFFER_SIZE too small"
38 #endif
39 
44 #ifndef SPIFFS_FS_CACHE_SIZE
45 #if SPIFFS_CACHE
46 #define SPIFFS_FS_CACHE_SIZE (512)
47 #else
48 #define SPIFFS_FS_CACHE_SIZE (0)
49 #endif /* SPIFFS_CACHE */
50 #endif /* SPIFFS_FS_CACHE_SIZE */
51 #ifndef SPIFFS_FS_WORK_SIZE
52 #define SPIFFS_FS_WORK_SIZE (512)
53 #endif
54 #ifndef SPIFFS_FS_FD_SPACE_SIZE
55 #define SPIFFS_FS_FD_SPACE_SIZE (125)
56 #endif
57 
62 typedef struct spiffs_desc {
63  spiffs fs;
64  uint8_t work[SPIFFS_FS_WORK_SIZE];
65  uint8_t fd_space[SPIFFS_FS_FD_SPACE_SIZE];
66 #if (SPIFFS_CACHE == 1) || defined(DOXYGEN)
67  uint8_t cache[SPIFFS_FS_CACHE_SIZE];
68 #endif
69  spiffs_config config;
72 #if (SPIFFS_HAL_CALLBACK_EXTRA == 1) || defined(DOXYGEN)
74 #endif
76 
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* SPIFFS_FS_H */
85 
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:67
spiffs fs
The SPIFFS struct.
Definition: spiffs_fs.h:63
mutex_t lock
A lock for SPIFFS internal use.
Definition: spiffs_fs.h:71
mtd_dev_t * dev
The underlying mtd device, must be set by user.
Definition: spiffs_fs.h:73
spiffs_config config
SPIFFS config, filled at mount time depending on the underlying mtdi_dev_t dev.
Definition: spiffs_fs.h:69
uint8_t work[SPIFFS_FS_WORK_SIZE]
SPIFFS work buffer.
Definition: spiffs_fs.h:64
RIOT synchronization API.
MTD device descriptor.
Definition: mtd.h:58
This contains everything needed to run an instance of SPIFFS.
Definition: spiffs_fs.h:62
uint8_t fd_space[SPIFFS_FS_FD_SPACE_SIZE]
SPIFFS file descriptor cache.
Definition: spiffs_fs.h:65
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.