mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
adapt SPIFFS from 128kb -> 192kb. Increased GC to fit sector size 4kb. (thanks @mwalker33)
This commit is contained in:
parent
4fd8f378af
commit
79cfa1d8fa
3 changed files with 70 additions and 41 deletions
|
@ -18,7 +18,7 @@
|
||||||
// SPIFFS api for RDV40 Integration
|
// SPIFFS api for RDV40 Integration
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define SPIFFS_CFG_PHYS_SZ (1024 * 128)
|
#define SPIFFS_CFG_PHYS_SZ (1024 * 192)
|
||||||
#define SPIFFS_CFG_PHYS_ERASE_SZ (4 * 1024)
|
#define SPIFFS_CFG_PHYS_ERASE_SZ (4 * 1024)
|
||||||
#define SPIFFS_CFG_PHYS_ADDR (0)
|
#define SPIFFS_CFG_PHYS_ADDR (0)
|
||||||
#define SPIFFS_CFG_LOG_PAGE_SZ (256)
|
#define SPIFFS_CFG_LOG_PAGE_SZ (256)
|
||||||
|
@ -69,7 +69,7 @@ static s32_t rdv40_spiffs_llread(u32_t addr, u32_t size, u8_t *dst) {
|
||||||
|
|
||||||
static s32_t rdv40_spiffs_llwrite(u32_t addr, u32_t size, u8_t *src) {
|
static s32_t rdv40_spiffs_llwrite(u32_t addr, u32_t size, u8_t *src) {
|
||||||
|
|
||||||
if (!FlashInit()) {
|
if (FlashInit() == false) {
|
||||||
return 129;
|
return 129;
|
||||||
}
|
}
|
||||||
Flash_Write(addr, src, size);
|
Flash_Write(addr, src, size);
|
||||||
|
@ -77,9 +77,7 @@ static s32_t rdv40_spiffs_llwrite(u32_t addr, u32_t size, u8_t *src) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32_t rdv40_spiffs_llerase(u32_t addr, u32_t size) {
|
static s32_t rdv40_spiffs_llerase(u32_t addr, u32_t size) {
|
||||||
uint8_t erased = 0;
|
if (FlashInit() == false) {
|
||||||
|
|
||||||
if (!FlashInit()) {
|
|
||||||
return 130;
|
return 130;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,10 +97,12 @@ static s32_t rdv40_spiffs_llerase(u32_t addr, u32_t size) {
|
||||||
|
|
||||||
if (g_dbglevel >= DBG_DEBUG) Dbprintf("LLERASEDBG : block : %d, sector : %d \n", block, sector);
|
if (g_dbglevel >= DBG_DEBUG) Dbprintf("LLERASEDBG : block : %d, sector : %d \n", block, sector);
|
||||||
|
|
||||||
erased = Flash_Erase4k(block, sector);
|
uint8_t erased = Flash_Erase4k(block, sector);
|
||||||
Flash_CheckBusy(BUSY_TIMEOUT);
|
Flash_CheckBusy(BUSY_TIMEOUT);
|
||||||
FlashStop();
|
FlashStop();
|
||||||
|
|
||||||
|
// iceman: SPIFFS_OK expands to 0, erased is bool from Flash_Erase4k, which returns TRUE if ok.
|
||||||
|
// so this return logic looks wrong.
|
||||||
return (SPIFFS_OK == erased);
|
return (SPIFFS_OK == erased);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,8 +151,17 @@ int rdv40_spiffs_mount(void) {
|
||||||
// uncached version
|
// uncached version
|
||||||
// int ret = SPIFFS_mount(&fs, &cfg, spiffs_work_buf, spiffs_fds,
|
// int ret = SPIFFS_mount(&fs, &cfg, spiffs_work_buf, spiffs_fds,
|
||||||
// sizeof(spiffs_fds), 0, 0, 0); cached version, experimental
|
// sizeof(spiffs_fds), 0, 0, 0); cached version, experimental
|
||||||
int ret = SPIFFS_mount(&fs, &cfg, spiffs_work_buf, spiffs_fds, sizeof(spiffs_fds), spiffs_cache_buf,
|
int ret = SPIFFS_mount(
|
||||||
sizeof(spiffs_cache_buf), 0);
|
&fs,
|
||||||
|
&cfg,
|
||||||
|
spiffs_work_buf,
|
||||||
|
spiffs_fds,
|
||||||
|
sizeof(spiffs_fds),
|
||||||
|
spiffs_cache_buf,
|
||||||
|
sizeof(spiffs_cache_buf),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
if (ret == SPIFFS_OK) {
|
if (ret == SPIFFS_OK) {
|
||||||
RDV40_SPIFFS_MOUNT_STATUS = RDV40_SPIFFS_MOUNTED;
|
RDV40_SPIFFS_MOUNT_STATUS = RDV40_SPIFFS_MOUNTED;
|
||||||
}
|
}
|
||||||
|
@ -189,33 +198,38 @@ int rdv40_spiffs_check(void) {
|
||||||
|
|
||||||
void write_to_spiffs(const char *filename, uint8_t *src, uint32_t size) {
|
void write_to_spiffs(const char *filename, uint8_t *src, uint32_t size) {
|
||||||
spiffs_file fd = SPIFFS_open(&fs, filename, SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR, 0);
|
spiffs_file fd = SPIFFS_open(&fs, filename, SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR, 0);
|
||||||
if (SPIFFS_write(&fs, fd, src, size) < 0)
|
if (SPIFFS_write(&fs, fd, src, size) < 0) {
|
||||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
Dbprintf("wr errno %i\n", SPIFFS_errno(&fs));
|
||||||
|
}
|
||||||
SPIFFS_close(&fs, fd);
|
SPIFFS_close(&fs, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void append_to_spiffs(const char *filename, uint8_t *src, uint32_t size) {
|
void append_to_spiffs(const char *filename, uint8_t *src, uint32_t size) {
|
||||||
spiffs_file fd = SPIFFS_open(&fs, filename, SPIFFS_APPEND | SPIFFS_RDWR, 0);
|
spiffs_file fd = SPIFFS_open(&fs, filename, SPIFFS_APPEND | SPIFFS_RDWR, 0);
|
||||||
if (SPIFFS_write(&fs, fd, src, size) < 0)
|
if (SPIFFS_write(&fs, fd, src, size) < 0) {
|
||||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||||
|
}
|
||||||
SPIFFS_close(&fs, fd);
|
SPIFFS_close(&fs, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_from_spiffs(const char *filename, uint8_t *dst, uint32_t size) {
|
void read_from_spiffs(const char *filename, uint8_t *dst, uint32_t size) {
|
||||||
spiffs_file fd = SPIFFS_open(&fs, filename, SPIFFS_RDWR, 0);
|
spiffs_file fd = SPIFFS_open(&fs, filename, SPIFFS_RDWR, 0);
|
||||||
if (SPIFFS_read(&fs, fd, dst, size) < 0)
|
if (SPIFFS_read(&fs, fd, dst, size) < 0) {
|
||||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||||
|
}
|
||||||
SPIFFS_close(&fs, fd);
|
SPIFFS_close(&fs, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rename_in_spiffs(const char *old_filename, const char *new_filename) {
|
static void rename_in_spiffs(const char *old_filename, const char *new_filename) {
|
||||||
if (SPIFFS_rename(&fs, old_filename, new_filename) < 0)
|
if (SPIFFS_rename(&fs, old_filename, new_filename) < 0) {
|
||||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remove_from_spiffs(const char *filename) {
|
static void remove_from_spiffs(const char *filename) {
|
||||||
if (SPIFFS_remove(&fs, filename) < 0)
|
if (SPIFFS_remove(&fs, filename) < 0) {
|
||||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t size_in_spiffs(const char *filename) {
|
uint32_t size_in_spiffs(const char *filename) {
|
||||||
|
@ -233,8 +247,11 @@ static rdv40_spiffs_fsinfo info_of_spiffs(void) {
|
||||||
fsinfo.pageSize = LOG_PAGE_SIZE;
|
fsinfo.pageSize = LOG_PAGE_SIZE;
|
||||||
fsinfo.maxOpenFiles = RDV40_SPIFFS_MAX_FD;
|
fsinfo.maxOpenFiles = RDV40_SPIFFS_MAX_FD;
|
||||||
fsinfo.maxPathLength = SPIFFS_OBJ_NAME_LEN;
|
fsinfo.maxPathLength = SPIFFS_OBJ_NAME_LEN;
|
||||||
if (SPIFFS_info(&fs, &fsinfo.totalBytes, &fsinfo.usedBytes) < 0)
|
|
||||||
|
if (SPIFFS_info(&fs, &fsinfo.totalBytes, &fsinfo.usedBytes) < 0) {
|
||||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||||
|
}
|
||||||
|
|
||||||
fsinfo.freeBytes = fsinfo.totalBytes - fsinfo.usedBytes;
|
fsinfo.freeBytes = fsinfo.totalBytes - fsinfo.usedBytes;
|
||||||
// Rounding without float may be improved
|
// Rounding without float may be improved
|
||||||
fsinfo.usedPercent = ((100 * fsinfo.usedBytes) + (fsinfo.totalBytes / 2)) / fsinfo.totalBytes;
|
fsinfo.usedPercent = ((100 * fsinfo.usedBytes) + (fsinfo.totalBytes / 2)) / fsinfo.totalBytes;
|
||||||
|
@ -245,16 +262,18 @@ static rdv40_spiffs_fsinfo info_of_spiffs(void) {
|
||||||
int exists_in_spiffs(const char *filename) {
|
int exists_in_spiffs(const char *filename) {
|
||||||
spiffs_stat stat;
|
spiffs_stat stat;
|
||||||
int rc = SPIFFS_stat(&fs, filename, &stat);
|
int rc = SPIFFS_stat(&fs, filename, &stat);
|
||||||
return rc == SPIFFS_OK;
|
return (rc == SPIFFS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RDV40SpiFFSFileType filetype_in_spiffs(const char *filename) {
|
static RDV40SpiFFSFileType filetype_in_spiffs(const char *filename) {
|
||||||
RDV40SpiFFSFileType filetype = RDV40_SPIFFS_FILETYPE_UNKNOWN;
|
RDV40SpiFFSFileType filetype = RDV40_SPIFFS_FILETYPE_UNKNOWN;
|
||||||
char symlinked[SPIFFS_OBJ_NAME_LEN];
|
char symlinked[SPIFFS_OBJ_NAME_LEN];
|
||||||
sprintf(symlinked, "%s.lnk", filename);
|
sprintf(symlinked, "%s.lnk", filename);
|
||||||
|
|
||||||
if (exists_in_spiffs(filename)) {
|
if (exists_in_spiffs(filename)) {
|
||||||
filetype = RDV40_SPIFFS_FILETYPE_REAL;
|
filetype = RDV40_SPIFFS_FILETYPE_REAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exists_in_spiffs(symlinked)) {
|
if (exists_in_spiffs(symlinked)) {
|
||||||
if (filetype != RDV40_SPIFFS_FILETYPE_UNKNOWN) {
|
if (filetype != RDV40_SPIFFS_FILETYPE_UNKNOWN) {
|
||||||
filetype = RDV40_SPIFFS_FILETYPE_BOTH;
|
filetype = RDV40_SPIFFS_FILETYPE_BOTH;
|
||||||
|
@ -262,19 +281,20 @@ static RDV40SpiFFSFileType filetype_in_spiffs(const char *filename) {
|
||||||
filetype = RDV40_SPIFFS_FILETYPE_SYMLINK;
|
filetype = RDV40_SPIFFS_FILETYPE_SYMLINK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_dbglevel >= DBG_DEBUG) {
|
if (g_dbglevel >= DBG_DEBUG) {
|
||||||
switch (filetype) {
|
switch (filetype) {
|
||||||
case RDV40_SPIFFS_FILETYPE_REAL:
|
case RDV40_SPIFFS_FILETYPE_REAL:
|
||||||
Dbprintf("Filetype is : RDV40_SPIFFS_FILETYPE_REAL");
|
Dbprintf("Filetype is " _YELLOW_("RDV40_SPIFFS_FILETYPE_REAL"));
|
||||||
break;
|
break;
|
||||||
case RDV40_SPIFFS_FILETYPE_SYMLINK:
|
case RDV40_SPIFFS_FILETYPE_SYMLINK:
|
||||||
Dbprintf("Filetype is : RDV40_SPIFFS_FILETYPE_SYMLINK");
|
Dbprintf("Filetype is " _YELLOW_("RDV40_SPIFFS_FILETYPE_SYMLINK"));
|
||||||
break;
|
break;
|
||||||
case RDV40_SPIFFS_FILETYPE_BOTH:
|
case RDV40_SPIFFS_FILETYPE_BOTH:
|
||||||
Dbprintf("Filetype is : RDV40_SPIFFS_FILETYPE_BOTH");
|
Dbprintf("Filetype is " _YELLOW_("RDV40_SPIFFS_FILETYPE_BOTH"));
|
||||||
break;
|
break;
|
||||||
case RDV40_SPIFFS_FILETYPE_UNKNOWN:
|
case RDV40_SPIFFS_FILETYPE_UNKNOWN:
|
||||||
Dbprintf("Filetype is : RDV40_SPIFFS_FILETYPE_UNKNOWN");
|
Dbprintf("Filetype is " _YELLOW_("RDV40_SPIFFS_FILETYPE_UNKNOWN"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,10 +406,13 @@ just get back to this state. If not, just don't.
|
||||||
// went well, it will return SPIFFS_OK if everything went well, and a report
|
// went well, it will return SPIFFS_OK if everything went well, and a report
|
||||||
// back the chain a SPI_ERRNO if not.
|
// back the chain a SPI_ERRNO if not.
|
||||||
int rdv40_spiffs_lazy_mount_rollback(int changed) {
|
int rdv40_spiffs_lazy_mount_rollback(int changed) {
|
||||||
if (!changed)
|
if (!changed) {
|
||||||
return SPIFFS_OK;
|
return SPIFFS_OK;
|
||||||
if (rdv40_spiffs_mounted())
|
}
|
||||||
|
|
||||||
|
if (rdv40_spiffs_mounted()) {
|
||||||
return rdv40_spiffs_unmount();
|
return rdv40_spiffs_unmount();
|
||||||
|
}
|
||||||
return rdv40_spiffs_mount();
|
return rdv40_spiffs_mount();
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -433,24 +456,24 @@ int rdv40_spiffs_read(const char *filename, uint8_t *dst, uint32_t size, RDV40Sp
|
||||||
// TODO : forbid writing to a filename.lnk which already exists without lnk !
|
// TODO : forbid writing to a filename.lnk which already exists without lnk !
|
||||||
int rdv40_spiffs_rename(char *old_filename, char *new_filename, RDV40SpiFFSSafetyLevel level) {
|
int rdv40_spiffs_rename(char *old_filename, char *new_filename, RDV40SpiFFSSafetyLevel level) {
|
||||||
RDV40_SPIFFS_SAFE_FUNCTION( //
|
RDV40_SPIFFS_SAFE_FUNCTION( //
|
||||||
rename_in_spiffs((char *)old_filename, (char *)new_filename); //
|
rename_in_spiffs(old_filename, new_filename); //
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
int rdv40_spiffs_remove(char *filename, RDV40SpiFFSSafetyLevel level) {
|
int rdv40_spiffs_remove(char *filename, RDV40SpiFFSSafetyLevel level) {
|
||||||
RDV40_SPIFFS_SAFE_FUNCTION( //
|
RDV40_SPIFFS_SAFE_FUNCTION( //
|
||||||
remove_from_spiffs((char *)filename); //
|
remove_from_spiffs(filename); //
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
int rdv40_spiffs_copy(char *src, char *dst, RDV40SpiFFSSafetyLevel level) {
|
int rdv40_spiffs_copy(char *src, char *dst, RDV40SpiFFSSafetyLevel level) {
|
||||||
RDV40_SPIFFS_SAFE_FUNCTION( //
|
RDV40_SPIFFS_SAFE_FUNCTION( //
|
||||||
copy_in_spiffs((char *)src, (char *)dst); //
|
copy_in_spiffs(src, dst); //
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
int rdv40_spiffs_stat(char *filename, uint32_t *buf, RDV40SpiFFSSafetyLevel level) {
|
int rdv40_spiffs_stat(char *filename, uint32_t *buf, RDV40SpiFFSSafetyLevel level) {
|
||||||
RDV40_SPIFFS_SAFE_FUNCTION( //
|
RDV40_SPIFFS_SAFE_FUNCTION( //
|
||||||
*buf = size_in_spiffs((char *)filename); //
|
*buf = size_in_spiffs(filename); //
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,16 +512,16 @@ int rdv40_spiffs_read_as_symlink(char *filename, uint8_t *dst, uint32_t size, RD
|
||||||
sprintf(linkfilename, "%s.lnk", filename);
|
sprintf(linkfilename, "%s.lnk", filename);
|
||||||
|
|
||||||
if (g_dbglevel >= DBG_DEBUG)
|
if (g_dbglevel >= DBG_DEBUG)
|
||||||
Dbprintf("Linkk real filename is : " _YELLOW_("%s"), linkfilename);
|
Dbprintf("Linkk real filename is " _YELLOW_("%s"), linkfilename);
|
||||||
|
|
||||||
read_from_spiffs((char *)linkfilename, (uint8_t *)linkdest, SPIFFS_OBJ_NAME_LEN);
|
read_from_spiffs((char *)linkfilename, (uint8_t *)linkdest, SPIFFS_OBJ_NAME_LEN);
|
||||||
|
|
||||||
if (g_dbglevel >= DBG_DEBUG)
|
if (g_dbglevel >= DBG_DEBUG)
|
||||||
Dbprintf("Symlink destination is : " _YELLOW_("%s"), linkdest);
|
Dbprintf("Symlink destination is " _YELLOW_("%s"), linkdest);
|
||||||
|
|
||||||
read_from_spiffs((char *)linkdest, (uint8_t *)dst, size);
|
read_from_spiffs((char *)linkdest, (uint8_t *)dst, size);
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BEWARE ! This function is DESTRUCTIVE as it will UPDATE an existing symlink
|
// BEWARE ! This function is DESTRUCTIVE as it will UPDATE an existing symlink
|
||||||
// Since it creates a .lnk extension file it may be minor to mistake the order of arguments
|
// Since it creates a .lnk extension file it may be minor to mistake the order of arguments
|
||||||
|
@ -534,7 +557,7 @@ int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, R
|
||||||
rdv40_spiffs_read((char *)filename, (uint8_t *)dst, size, level);
|
rdv40_spiffs_read((char *)filename, (uint8_t *)dst, size, level);
|
||||||
break;
|
break;
|
||||||
case RDV40_SPIFFS_FILETYPE_SYMLINK:
|
case RDV40_SPIFFS_FILETYPE_SYMLINK:
|
||||||
rdv40_spiffs_read_as_symlink((char *)filename, (uint8_t *)dst, size, level);
|
rdv40_spiffs_read_as_symlink(filename, (uint8_t *)dst, size, level);
|
||||||
break;
|
break;
|
||||||
case RDV40_SPIFFS_FILETYPE_BOTH:
|
case RDV40_SPIFFS_FILETYPE_BOTH:
|
||||||
case RDV40_SPIFFS_FILETYPE_UNKNOWN:
|
case RDV40_SPIFFS_FILETYPE_UNKNOWN:
|
||||||
|
@ -559,18 +582,20 @@ void rdv40_spiffs_safe_print_fsinfo(void) {
|
||||||
rdv40_spiffs_fsinfo fsinfo;
|
rdv40_spiffs_fsinfo fsinfo;
|
||||||
rdv40_spiffs_getfsinfo(&fsinfo, RDV40_SPIFFS_SAFETY_SAFE);
|
rdv40_spiffs_getfsinfo(&fsinfo, RDV40_SPIFFS_SAFETY_SAFE);
|
||||||
|
|
||||||
Dbprintf(" Logical block size......... " _YELLOW_("%d")" bytes", fsinfo.blockSize);
|
Dbprintf(" Logical block size... " _YELLOW_("%d")" bytes", fsinfo.blockSize);
|
||||||
Dbprintf(" Logical page size.......... " _YELLOW_("%d")" bytes", fsinfo.pageSize);
|
Dbprintf(" Logical page size.... " _YELLOW_("%d")" bytes", fsinfo.pageSize);
|
||||||
Dbprintf(" Max open files............. " _YELLOW_("%d")" file descriptors", fsinfo.maxOpenFiles);
|
Dbprintf(" Max open files....... " _YELLOW_("%d")" file descriptors", fsinfo.maxOpenFiles);
|
||||||
Dbprintf(" Max path length............ " _YELLOW_("%d")" chars", fsinfo.maxPathLength);
|
Dbprintf(" Max path length...... " _YELLOW_("%d")" chars", fsinfo.maxPathLength);
|
||||||
DbpString("");
|
DbpString("");
|
||||||
Dbprintf(" Filesystem size used available use% mounted");
|
Dbprintf(" Filesystem size used available use% mounted");
|
||||||
|
DbpString("------------------------------------------------------------------");
|
||||||
Dbprintf(" spiffs %6d B %6d B %6d B " _YELLOW_("%2d%")" /"
|
Dbprintf(" spiffs %6d B %6d B %6d B " _YELLOW_("%2d%")" /"
|
||||||
, fsinfo.totalBytes
|
, fsinfo.totalBytes
|
||||||
, fsinfo.usedBytes
|
, fsinfo.usedBytes
|
||||||
, fsinfo.freeBytes
|
, fsinfo.freeBytes
|
||||||
, fsinfo.usedPercent
|
, fsinfo.usedPercent
|
||||||
);
|
);
|
||||||
|
DbpString("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function is safe and WILL rollback since it is only a PRINTING function,
|
// this function is safe and WILL rollback since it is only a PRINTING function,
|
||||||
|
|
|
@ -24,7 +24,11 @@ extern "C" {
|
||||||
|
|
||||||
#include "spiffs_config.h"
|
#include "spiffs_config.h"
|
||||||
|
|
||||||
typedef enum spiffs_safety_level { RDV40_SPIFFS_SAFETY_NORMAL, RDV40_SPIFFS_SAFETY_LAZY, RDV40_SPIFFS_SAFETY_SAFE } RDV40SpiFFSSafetyLevel;
|
typedef enum spiffs_safety_level {
|
||||||
|
RDV40_SPIFFS_SAFETY_NORMAL,
|
||||||
|
RDV40_SPIFFS_SAFETY_LAZY,
|
||||||
|
RDV40_SPIFFS_SAFETY_SAFE
|
||||||
|
} RDV40SpiFFSSafetyLevel;
|
||||||
|
|
||||||
typedef enum spiffs_file_type {
|
typedef enum spiffs_file_type {
|
||||||
RDV40_SPIFFS_FILETYPE_REAL,
|
RDV40_SPIFFS_FILETYPE_REAL,
|
||||||
|
@ -198,16 +202,16 @@ typedef void (*spiffs_file_callback)(struct spiffs_t *fs, spiffs_fileop_type op,
|
||||||
|
|
||||||
#ifndef SPIFFS_DBG
|
#ifndef SPIFFS_DBG
|
||||||
#define SPIFFS_DBG(...) \
|
#define SPIFFS_DBG(...) \
|
||||||
printf(__VA_ARGS__)
|
Dbprintf(__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
#ifndef SPIFFS_GC_DBG
|
#ifndef SPIFFS_GC_DBG
|
||||||
#define SPIFFS_GC_DBG(...) printf(__VA_ARGS__)
|
#define SPIFFS_GC_DBG(...) Dbprintf(__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
#ifndef SPIFFS_CACHE_DBG
|
#ifndef SPIFFS_CACHE_DBG
|
||||||
#define SPIFFS_CACHE_DBG(...) printf(__VA_ARGS__)
|
#define SPIFFS_CACHE_DBG(...) Dbprintf(__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
#ifndef SPIFFS_CHECK_DBG
|
#ifndef SPIFFS_CHECK_DBG
|
||||||
#define SPIFFS_CHECK_DBG(...) printf(__VA_ARGS__)
|
#define SPIFFS_CHECK_DBG(...) Dbprintf(__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Any write to the filehandle is appended to end of the file */
|
/* Any write to the filehandle is appended to end of the file */
|
||||||
|
|
|
@ -136,7 +136,7 @@ typedef uint8_t u8_t;
|
||||||
|
|
||||||
// Define maximum number of gc runs to perform to reach desired free pages.
|
// Define maximum number of gc runs to perform to reach desired free pages.
|
||||||
#ifndef SPIFFS_GC_MAX_RUNS
|
#ifndef SPIFFS_GC_MAX_RUNS
|
||||||
#define SPIFFS_GC_MAX_RUNS 5
|
#define SPIFFS_GC_MAX_RUNS 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable/disable statistics on gc. Debug/test purpose only.
|
// Enable/disable statistics on gc. Debug/test purpose only.
|
||||||
|
@ -236,7 +236,7 @@ typedef uint8_t u8_t;
|
||||||
// Instead of giving parameters in config struct, singleton build must
|
// Instead of giving parameters in config struct, singleton build must
|
||||||
// give parameters in defines below.
|
// give parameters in defines below.
|
||||||
#ifndef SPIFFS_CFG_PHYS_SZ
|
#ifndef SPIFFS_CFG_PHYS_SZ
|
||||||
#define SPIFFS_CFG_PHYS_SZ(ignore) (1024*128)
|
#define SPIFFS_CFG_PHYS_SZ(ignore) (1024*192)
|
||||||
#endif
|
#endif
|
||||||
#ifndef SPIFFS_CFG_PHYS_ERASE_SZ
|
#ifndef SPIFFS_CFG_PHYS_ERASE_SZ
|
||||||
#define SPIFFS_CFG_PHYS_ERASE_SZ(ignore) (4*1024)
|
#define SPIFFS_CFG_PHYS_ERASE_SZ(ignore) (4*1024)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue