This commit is contained in:
Christopher Williams
2025-06-23 16:37:39 -07:00
parent ff60b17ea7
commit 79eff96e0b
18 changed files with 460 additions and 327 deletions
+6
View File
@@ -375,3 +375,9 @@ R0.15a (November 22, 2024)
Made f_setlabel() accept a volume label in Unix style volume ID when FF_STR_VOLUME_ID == 2.
Made FatFs update PercInUse field in exFAT VBR. (A preceding f_getfree() is needed for the accuracy)
R0.15b (June 21, 2025)
Added support for timestamp of created time. (FF_FS_CRTIME)
Fixed FatFs fails to load the FsInfo in FAT32 volumes and the f_getfree always be forced a full FAT scan which takes a long time. (appeared at R0.15a)
+295 -254
View File
File diff suppressed because it is too large Load Diff
+18 -18
View File
@@ -1,8 +1,8 @@
/*----------------------------------------------------------------------------/
/ FatFs - Generic FAT Filesystem module R0.15a /
/ FatFs - Generic FAT Filesystem module R0.15b /
/-----------------------------------------------------------------------------/
/
/ Copyright (C) 2024, ChaN, all right reserved.
/ Copyright (C) 2025, ChaN, all right reserved.
/
/ FatFs module is an open source software. Redistribution and use of FatFs in
/ source and binary forms, with or without modification, are permitted provided
@@ -20,7 +20,7 @@
#ifndef FF_DEFINED
#define FF_DEFINED 5380 /* Revision ID */
#define FF_DEFINED 5385 /* Revision ID */
#ifdef __cplusplus
extern "C" {
@@ -131,11 +131,11 @@ extern const char* VolumeStr[FF_VOLUMES]; /* User defined volume ID table */
/* Filesystem object structure (FATFS) */
typedef struct {
BYTE fs_type; /* Filesystem type (0:blank filesystem object) */
BYTE fs_type; /* Filesystem type (0:not mounted) */
BYTE pdrv; /* Volume hosting physical drive */
BYTE ldrv; /* Logical drive number (used only when FF_FS_REENTRANT) */
BYTE n_fats; /* Number of FATs (1 or 2) */
BYTE wflag; /* win[] status (1:dirty) */
BYTE wflag; /* win[] status (b0:dirty) */
BYTE fsi_flag; /* Allocation information control (b7:disabled, b0:dirty) */
WORD id; /* Volume mount ID */
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
@@ -144,33 +144,29 @@ typedef struct {
WORD ssize; /* Sector size (512, 1024, 2048 or 4096) */
#endif
#if FF_USE_LFN
WCHAR* lfnbuf; /* LFN working buffer */
#endif
#if FF_FS_EXFAT
BYTE* dirbuf; /* Directory entry block scratch pad buffer for exFAT */
WCHAR *lfnbuf; /* LFN working buffer */
#endif
#if !FF_FS_READONLY
DWORD last_clst; /* Last allocated cluster (Unknown if >= n_fatent) */
DWORD free_clst; /* Number of free clusters (Unknown if >= n_fatent-2) */
DWORD last_clst; /* Last allocated cluster (Unknown if >=n_fatent) */
DWORD free_clst; /* Number of free clusters (Unknown if >=fs->n_fatent-2) */
#endif
#if FF_FS_RPATH
DWORD cdir; /* Current directory start cluster (0:root) */
#if FF_FS_EXFAT
DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */
DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */
DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */
#endif
#endif
DWORD n_fatent; /* Number of FAT entries (number of clusters + 2) */
DWORD fsize; /* Number of sectors per FAT */
LBA_t winsect; /* Current sector appearing in the win[] */
LBA_t volbase; /* Volume base sector */
LBA_t fatbase; /* FAT base sector */
LBA_t dirbase; /* Root directory base sector (FAT12/16) or cluster (FAT32/exFAT) */
LBA_t database; /* Data base sector */
#if FF_FS_EXFAT
LBA_t bitbase; /* Allocation bitmap base sector */
BYTE *dirbuf; /* Directory entry block scratchpad buffer for exFAT */
DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */
DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */
DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */
#endif
LBA_t winsect; /* Current sector appearing in the win[] */
BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
} FATFS;
@@ -190,7 +186,7 @@ typedef struct {
DWORD n_frag; /* Size of last fragment needs to be written to FAT (valid when not zero) */
DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */
DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
DWORD c_ofs; /* Offset in the containing directory (valid when file object and sclust != 0) */
DWORD c_ofs; /* Offset in the containing directory (valid when in file object and sclust != 0) */
#endif
#if FF_FS_LOCK
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
@@ -247,6 +243,10 @@ typedef struct {
FSIZE_t fsize; /* File size */
WORD fdate; /* Modified date */
WORD ftime; /* Modified time */
#if FF_FS_CRTIME
WORD crdate; /* Created date */
WORD crtime; /* Created time */
#endif
BYTE fattrib; /* File attribute */
#if FF_USE_LFN
TCHAR altname[FF_SFN_BUF + 1];/* Alternative file name */
+16 -11
View File
@@ -2,7 +2,7 @@
/ Configurations of FatFs Module
/---------------------------------------------------------------------------*/
#define FFCONF_DEF 5380 /* Revision ID */
#define FFCONF_DEF 5385 /* Revision ID */
/*---------------------------------------------------------------------------/
/ Function Configurations
@@ -57,15 +57,15 @@
#define FF_USE_STRFUNC 0
#define FF_PRINT_LLI 0
#define FF_PRINT_FLOAT 0
#define FF_PRINT_LLI 1
#define FF_PRINT_FLOAT 1
#define FF_STRF_ENCODE 3
/* FF_USE_STRFUNC switches the string API functions, f_gets(), f_putc(), f_puts()
/ and f_printf().
/* FF_USE_STRFUNC switches string API functions, f_gets(), f_putc(), f_puts() and
/ f_printf().
/
/ 0: Disable. FF_PRINT_LLI, FF_PRINT_FLOAT and FF_STRF_ENCODE have no effect.
/ 1: Enable without LF - CRLF conversion.
/ 2: Enable with LF - CRLF conversion.
/ 1: Enable without LF-CRLF conversion.
/ 2: Enable with LF-CRLF conversion.
/
/ FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2
/ makes f_printf() support floating point argument. These features want C99 or later.
@@ -238,9 +238,9 @@
#define FF_FS_NORTC 0
#define FF_NORTC_MON 11
#define FF_NORTC_MON 6
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2024
#define FF_NORTC_YEAR 2025
/* The option FF_FS_NORTC switches timestamp feature. If the system does not have
/ an RTC or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable the
/ timestamp feature. Every object modified by FatFs will have a fixed timestamp
@@ -251,9 +251,14 @@
/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */
#define FF_FS_CRTIME 0
/* This option enables(1)/disables(0) the timestamp of the file created. When
/ set 1, the file created time is available in FILINFO structure. */
#define FF_FS_NOFSINFO 0
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option, and f_getfree() at the first time after volume mount will force
/* If you need to know the correct free space on the FAT32 volume, set bit 0 of
/ this option, and f_getfree() on the first time after volume mount will force
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
/
/ bit0=0: Use free cluster count in the FSINFO if available.