Select one of the symbols to view example projects that use it.
 
Outline
#define ESP_LITTLEFS_API_H__
#include <stdint.h>
#include <stddef.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "esp_vfs.h"
#include "esp_partition.h"
#include "littlefs/lfs.h"
#include <sdkconfig.h>
#include <sdmmc_cmd.h>
_vfs_littlefs_file_t
esp_littlefs_t
littlefs_esp_part_read(const struct lfs_config *, lfs_block_t, lfs_off_t, void *, lfs_size_t);
littlefs_esp_part_write(const struct lfs_config *, lfs_block_t, lfs_off_t, const void *, lfs_size_t);
littlefs_esp_part_erase(const struct lfs_config *, lfs_block_t);
littlefs_esp_part_sync(const struct lfs_config *);
littlefs_sdmmc_read(const struct lfs_config *, lfs_block_t, lfs_off_t, void *, lfs_size_t);
littlefs_sdmmc_write(const struct lfs_config *, lfs_block_t, lfs_off_t, const void *, lfs_size_t);
littlefs_sdmmc_erase(const struct lfs_config *, lfs_block_t);
littlefs_sdmmc_sync(const struct lfs_config *);
Files
loading...
SourceVuESP-IDF Framework and Examplesperf_benchmark samplemanaged_components/joltwallet__littlefs/src/littlefs_api.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
#ifndef ESP_LITTLEFS_API_H__ #define ESP_LITTLEFS_API_H__ #include <stdint.h> #include <stddef.h> #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" #include "esp_vfs.h" #include "esp_partition.h" #include "littlefs/lfs.h" #include <sdkconfig.h>9 includes #ifdef CONFIG_LITTLEFS_SDMMC_SUPPORT #include <sdmmc_cmd.h> #endif #ifdef __cplusplus extern "C" { #endif /** * @brief a file descriptor * That's also a singly linked list used for keeping tracks of all opened file descriptor * * Shortcomings/potential issues of 32-bit hash (when CONFIG_LITTLEFS_USE_ONLY_HASH) listed here: * * unlink - If a different file is open that generates a hash collision, it will report an * error that it cannot unlink an open file. * * rename - If a different file is open that generates a hash collision with * src or dst, it will report an error that it cannot rename an open file. * Potential consequences: * 1. A file cannot be deleted while a collision-geneating file is open. * Worst-case, if the other file is always open during the lifecycle * of your app, it's collision file cannot be deleted, which in the * worst-case could cause storage-capacity issues. * 2. Same as (1), but for renames *//* ... */ typedef struct _vfs_littlefs_file_t { lfs_file_t file; uint32_t hash; struct _vfs_littlefs_file_t * next; /*!< Pointer to next file in Singly Linked List */ #ifndef CONFIG_LITTLEFS_USE_ONLY_HASH char * path; #endif }{ ... } vfs_littlefs_file_t; /** * @brief littlefs definition structure *//* ... */ typedef struct { lfs_t *fs; /*!< Handle to the underlying littlefs */ SemaphoreHandle_t lock; /*!< FS lock */ #ifdef CONFIG_LITTLEFS_SDMMC_SUPPORT sdmmc_card_t *sdcard; /*!< The SD card driver handle on which littlefs is located */ #endif const esp_partition_t* partition; /*!< The partition on which littlefs is located */ char base_path[ESP_VFS_PATH_MAX+1]; /*!< Mount point */ struct lfs_config cfg; /*!< littlefs Mount configuration */ vfs_littlefs_file_t *file; /*!< Singly Linked List of files */ vfs_littlefs_file_t **cache; /*!< A cache of pointers to the opened files */ uint16_t cache_size; /*!< The cache allocated size (in pointers) */ uint16_t fd_count; /*!< The count of opened file descriptor used to speed up computation */ bool read_only; /*!< Filesystem is read-only */ }{ ... } esp_littlefs_t; /** * @brief Read a region in a block. * * Negative error codes are propogated to the user. * * @return errorcode. 0 on success. *//* ... */ int littlefs_esp_part_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size); /** * @brief Program a region in a block. * * The block must have previously been erased. * Negative error codes are propogated to the user. * May return LFS_ERR_CORRUPT if the block should be considered bad. * * @return errorcode. 0 on success. *//* ... */ int littlefs_esp_part_write(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size); /** * @brief Erase a block. * * A block must be erased before being programmed. * The state of an erased block is undefined. * Negative error codes are propogated to the user. * May return LFS_ERR_CORRUPT if the block should be considered bad. * @return errorcode. 0 on success. *//* ... */ int littlefs_esp_part_erase(const struct lfs_config *c, lfs_block_t block); /** * @brief Sync the state of the underlying block device. * * Negative error codes are propogated to the user. * * @return errorcode. 0 on success. *//* ... */ int littlefs_esp_part_sync(const struct lfs_config *c); #ifdef CONFIG_LITTLEFS_SDMMC_SUPPORT /** * @brief Read a region in a block on SD card * * Negative error codes are propogated to the user. * * @return errorcode. 0 on success. *//* ... */ int littlefs_sdmmc_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size); /** * @brief Program a region in a block on SD card. * * The block must have previously been erased. * Negative error codes are propogated to the user. * May return LFS_ERR_CORRUPT if the block should be considered bad. * * @return errorcode. 0 on success. *//* ... */ int littlefs_sdmmc_write(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size); /** * @brief Erase a block on SD card. * * A block must be erased before being programmed. * The state of an erased block is undefined. * Negative error codes are propogated to the user. * May return LFS_ERR_CORRUPT if the block should be considered bad. * @return errorcode. 0 on success. *//* ... */ int littlefs_sdmmc_erase(const struct lfs_config *c, lfs_block_t block); /** * @brief Sync the state of the underlying SD card. * * Negative error codes are propogated to the user. * * @return errorcode. 0 on success. *//* ... */ int littlefs_sdmmc_sync(const struct lfs_config *c); /* ... */ #endif // CONFIG_LITTLEFS_SDMMC_SUPPORT #ifdef __cplusplus }{...} #endif /* ... */ #endif
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.