Zephyr API Documentation
4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
littlefs.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2019 Bolt Innovation Management, LLC
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_FS_LITTLEFS_H_
8
#define ZEPHYR_INCLUDE_FS_LITTLEFS_H_
9
10
#include <
zephyr/types.h
>
11
#include <
zephyr/kernel.h
>
12
#include <
zephyr/storage/flash_map.h
>
13
14
#include <lfs.h>
15
16
#ifdef __cplusplus
17
extern
"C"
{
18
#endif
19
21
struct
fs_littlefs
{
22
/* Defaulted in driver, customizable before mount. */
23
struct
lfs_config
cfg
;
24
25
/* Must be cfg.cache_size */
26
uint8_t
*
read_buffer
;
27
28
/* Must be cfg.cache_size */
29
uint8_t
*
prog_buffer
;
30
31
/* Must be cfg.lookahead_size/4 elements, and
32
* cfg.lookahead_size must be a multiple of 8.
33
*/
34
uint32_t
*
lookahead_buffer
[CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE /
sizeof
(
uint32_t
)];
35
36
/* These structures are filled automatically at mount. */
37
struct
lfs
lfs
;
38
void
*
backend
;
39
struct
k_mutex
mutex
;
40
};
41
70
#define FS_LITTLEFS_DECLARE_CUSTOM_CONFIG(name, alignment, read_sz, prog_sz, cache_sz, \
71
lookahead_sz) \
72
static uint8_t __aligned(alignment) name ## _read_buffer[cache_sz]; \
73
static uint8_t __aligned(alignment) name ## _prog_buffer[cache_sz]; \
74
static uint32_t name ## _lookahead_buffer[(lookahead_sz) / sizeof(uint32_t)]; \
75
static struct fs_littlefs name = { \
76
.cfg = { \
77
.read_size = (read_sz), \
78
.prog_size = (prog_sz), \
79
.cache_size = (cache_sz), \
80
.lookahead_size = (lookahead_sz), \
81
.read_buffer = name ## _read_buffer, \
82
.prog_buffer = name ## _prog_buffer, \
83
.lookahead_buffer = name ## _lookahead_buffer, \
84
}, \
85
}
86
96
#define FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(name) \
97
FS_LITTLEFS_DECLARE_CUSTOM_CONFIG(name, \
98
4, \
99
CONFIG_FS_LITTLEFS_READ_SIZE, \
100
CONFIG_FS_LITTLEFS_PROG_SIZE, \
101
CONFIG_FS_LITTLEFS_CACHE_SIZE, \
102
CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE)
103
104
#ifdef __cplusplus
105
}
106
#endif
107
108
#endif
/* ZEPHYR_INCLUDE_FS_LITTLEFS_H_ */
flash_map.h
Public API for flash map.
types.h
kernel.h
Public kernel APIs.
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
fs_littlefs
Filesystem info structure for LittleFS mount.
Definition
littlefs.h:21
fs_littlefs::backend
void * backend
Definition
littlefs.h:38
fs_littlefs::prog_buffer
uint8_t * prog_buffer
Definition
littlefs.h:29
fs_littlefs::mutex
struct k_mutex mutex
Definition
littlefs.h:39
fs_littlefs::lfs
struct lfs lfs
Definition
littlefs.h:37
fs_littlefs::lookahead_buffer
uint32_t * lookahead_buffer[CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE/sizeof(uint32_t)]
Definition
littlefs.h:34
fs_littlefs::cfg
struct lfs_config cfg
Definition
littlefs.h:23
fs_littlefs::read_buffer
uint8_t * read_buffer
Definition
littlefs.h:26
k_mutex
Mutex Structure.
Definition
kernel.h:2994
zephyr
fs
littlefs.h
Generated on Fri Nov 22 2024 00:03:34 for Zephyr API Documentation by
1.12.0