Loading...
Searching...
No Matches
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
44#ifndef FS_SPIFFS_FS_H
45#define FS_SPIFFS_FS_H
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51#include "spiffs.h"
52#include "spiffs_config.h"
53#include "vfs.h"
54#include "mtd.h"
55#include "mutex.h"
56
58#define SPIFFS_DIR_SIZE (12)
59
60#if (VFS_DIR_BUFFER_SIZE < SPIFFS_DIR_SIZE)
61#error "VFS_DIR_BUFFER_SIZE too small"
62#endif
63
68#ifndef SPIFFS_FS_CACHE_SIZE
69#if SPIFFS_CACHE || defined(DOXYGEN)
77#define SPIFFS_FS_CACHE_SIZE (512)
78#else
79#define SPIFFS_FS_CACHE_SIZE (0)
80#endif /* SPIFFS_CACHE */
81#endif /* SPIFFS_FS_CACHE_SIZE */
82#ifndef SPIFFS_FS_WORK_SIZE
90#define SPIFFS_FS_WORK_SIZE (512)
91#endif
92#ifndef SPIFFS_FS_FD_SPACE_SIZE
99#define SPIFFS_FS_FD_SPACE_SIZE (4 * 32)
100#endif
106typedef struct spiffs_desc {
107 spiffs fs;
110#if (SPIFFS_CACHE == 1) || defined(DOXYGEN)
112#endif
113 spiffs_config config;
116#if (SPIFFS_HAL_CALLBACK_EXTRA == 1) || defined(DOXYGEN)
118#endif
119#if (SPIFFS_SINGLETON == 0) || defined(DOXYGEN)
120 uint32_t base_addr;
121 uint32_t block_count;
123#endif
125
128
137void spiffs_lock(struct spiffs_t *fs);
138
147void spiffs_unlock(struct spiffs_t *fs);
148
149#ifdef __cplusplus
150}
151#endif
152
153#endif /* FS_SPIFFS_FS_H */
154
#define SPIFFS_FS_WORK_SIZE
The size of the work buffer.
Definition spiffs_fs.h:90
void spiffs_lock(struct spiffs_t *fs)
SPIFFS lock function.
struct spiffs_desc spiffs_desc_t
This contains everything needed to run an instance of SPIFFS.
void spiffs_unlock(struct spiffs_t *fs)
SPIFFS unlock function.
#define SPIFFS_FS_FD_SPACE_SIZE
the size of the file descriptor buffer
Definition spiffs_fs.h:99
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.
#define SPIFFS_FS_CACHE_SIZE
the size of the cache buffer
Definition spiffs_fs.h:77
Mutex for thread synchronization.
MTD device descriptor.
Definition mtd.h:112
Mutex structure.
Definition mutex.h:146
This contains everything needed to run an instance of SPIFFS.
Definition spiffs_fs.h:106
mutex_t lock
A lock for SPIFFS internal use.
Definition spiffs_fs.h:115
spiffs_config config
SPIFFS config, filled at mount time depending on the underlying mtdi_dev_t dev.
Definition spiffs_fs.h:113
uint8_t work[SPIFFS_FS_WORK_SIZE]
SPIFFS work buffer.
Definition spiffs_fs.h:108
uint32_t block_count
Number of blocks in current partition, if 0, the mtd number of sector is used.
Definition spiffs_fs.h:121
uint8_t cache[SPIFFS_FS_CACHE_SIZE]
SPIFFS cache.
Definition spiffs_fs.h:111
mtd_dev_t * dev
The underlying mtd device, must be set by user.
Definition spiffs_fs.h:117
spiffs fs
The SPIFFS struct.
Definition spiffs_fs.h:107
uint32_t base_addr
Base address of partition.
Definition spiffs_fs.h:120
uint8_t fd_space[SPIFFS_FS_FD_SPACE_SIZE]
SPIFFS file descriptor cache.
Definition spiffs_fs.h:109
A file system driver.
Definition vfs.h:375