Updated FatFS to R.12b

This commit is contained in:
d0k3 2016-11-25 21:31:57 +01:00
parent 79dec02e92
commit 9d42c04271
7 changed files with 243 additions and 246 deletions

View File

@ -260,8 +260,20 @@ R0.12a (July 10, 2016)
Added support for creating exFAT volume with some changes of f_mkfs().
Added a file open method FA_OPEN_APPEND. An f_lseek() following f_open() is no longer needed.
f_forward() is available regardless of _FS_TINY.
Fixed f_mkfs() creates wrong volume.
Fixed f_mkfs() creates wrong volume. (appeared at R0.12)
Fixed wrong memory read in create_name(). (appeared at R0.12)
Fixed compilation fails at some configurations, _USE_FASTSEEK and _USE_FORWARD.
Fixed wrong memory read in create_name().
R0.12b (September 04, 2016)
Improved f_rename() to be able to rename objects with the same name but case.
Fixed an error in the case conversion teble of code page 866. (ff.c)
Fixed writing data is truncated at the file offset 4GiB on the exFAT volume. (appeared at R0.12)
Fixed creating a file in the root directory of exFAT volume can fail. (appeared at R0.12)
Fixed f_mkfs() creating exFAT volume with too small cluster size can collapse unallocated memory. (appeared at R0.12)
Fixed wrong object name can be returned when read directory at Unicode cfg. (appeared at R0.12)
Fixed large file allocation/removing on the exFAT volume collapses allocation bitmap. (appeared at R0.12)
Fixed some internal errors in f_expand() and f_lseek(). (appeared at R0.12)

View File

@ -45,9 +45,9 @@ FATpartition DriveInfo[11] = {
{ TYPE_EMUNAND, SUBTYPE_CTRN }, // 4 - EMUNAND CTRNAND
{ TYPE_EMUNAND, SUBTYPE_TWLN }, // 5 - EMUNAND TWLN
{ TYPE_EMUNAND, SUBTYPE_TWLP }, // 6 - EMUNAND TWLP
{ TYPE_IMGNAND, SUBTYPE_CTRN }, // 7 - EMUNAND CTRNAND
{ TYPE_IMGNAND, SUBTYPE_TWLN }, // 8 - EMUNAND TWLN
{ TYPE_IMGNAND, SUBTYPE_TWLP }, // 9 - EMUNAND TWLP
{ TYPE_IMGNAND, SUBTYPE_CTRN }, // 7 - IMGNAND CTRNAND
{ TYPE_IMGNAND, SUBTYPE_TWLN }, // 8 - IMGNAND TWLN
{ TYPE_IMGNAND, SUBTYPE_TWLP }, // 9 - IMGNAND TWLP
{ TYPE_IMAGE, SUBTYPE_NONE } // X - IMAGE
};

View File

@ -67,6 +67,9 @@ DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
#define MMC_GET_CID 12 /* Get CID */
#define MMC_GET_OCR 13 /* Get OCR */
#define MMC_GET_SDSTAT 14 /* Get SD status */
#define ISDIO_READ 55 /* Read data form SD iSDIO register */
#define ISDIO_WRITE 56 /* Write data to SD iSDIO register */
#define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */
/* ATA/CF specific ioctl command */
#define ATA_GET_REV 20 /* Get F/W revision */

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------/
/ FatFs - Generic FAT file system module R0.12a /
/ FatFs - Generic FAT file system module R0.12b /
/-----------------------------------------------------------------------------/
/
/ Copyright (C) 2016, ChaN, all right reserved.
@ -19,7 +19,7 @@
#ifndef _FATFS
#define _FATFS 80186 /* Revision ID */
#define _FATFS 68020 /* Revision ID */
#ifdef __cplusplus
extern "C" {
@ -159,7 +159,7 @@ typedef struct {
/* File object structure (FIL) */
typedef struct {
_FDID obj; /* Object identifier */
_FDID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */
BYTE flag; /* File status flags */
BYTE err; /* Abort flag (error code) */
FSIZE_t fptr; /* File read/write pointer (Zeroed on file open) */

View File

@ -2,7 +2,7 @@
/ FatFs - FAT file system module configuration file
/---------------------------------------------------------------------------*/
#define _FFCONF 80186 /* Revision ID */
#define _FFCONF 68020 /* Revision ID */
/*---------------------------------------------------------------------------/
/ Function Configurations
@ -204,14 +204,14 @@
#define _FS_TINY 0
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
/ At the tiny configuration, size of the file object (FIL) is reduced _MAX_SS bytes.
/ At the tiny configuration, size of file object (FIL) is reduced _MAX_SS bytes.
/ Instead of private sector buffer eliminated from the file object, common sector
/ buffer in the file system object (FATFS) is used for the file data transfer. */
#define _FS_EXFAT 0
/* This option switches support of exFAT file system in addition to the traditional
/ FAT file system. (0:Disable or 1:Enable) To enable exFAT, also LFN must be enabled.
/* This option switches support of exFAT file system. (0:Disable or 1:Enable)
/ When enable exFAT, also LFN needs to be enabled. (_USE_LFN >= 1)
/ Note that enabling exFAT discards C89 compatibility. */
@ -259,7 +259,9 @@
/ The _FS_TIMEOUT defines timeout period in unit of time tick.
/ The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
/ SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.c. */
/ included somewhere in the scope of ff.h. */
/* #include <windows.h> // O/S definitions */
/*--- End of configuration options ---*/

View File

@ -329,21 +329,6 @@ u32 GetWritePermissions() {
return write_permissions;
}
bool GetTempFileName(char* path) {
// this assumes path is initialized with enough room
char* tempname = strrchr(path, '/');
if (!tempname) return false;
tempname++;
strncpy(tempname, "AAAAAAAA.TMP", 255 - (tempname - path));
char* cc = tempname;
// this does not try all permutations
for (; (*cc <= 'Z') && (cc - tempname < 8); (*cc)++) {
if (fa_stat(path, NULL) != FR_OK) break;
if (*cc == 'Z') cc++;
}
return (cc - tempname < 8) ? true : false;
}
bool FileSetData(const char* path, const u8* data, size_t size, size_t foffset, bool create) {
int drvtype = DriveType(path);
if (!CheckWritePermissions(path)) return false;
@ -985,19 +970,7 @@ bool PathRename(const char* path, const char* newname) {
strncpy(npath, path, oldname - path);
strncpy(npath + (oldname - path), newname, 255 - (oldname - path));
FRESULT res = f_rename(path, npath);
if (res == FR_EXIST) { // new path already exists (possible LFN/case issue)
char temp[256];
strncpy(temp, path, oldname - path);
if (!GetTempFileName(temp)) return false;
if (f_rename(path, temp) == FR_OK) {
if ((fa_stat(npath, NULL) == FR_OK) || (f_rename(temp, npath) != FR_OK)) {
ShowPrompt(false, "Destination exists in folder");
f_rename(temp, path); // something went wrong - try renaming back
return false;
} else return true;
} else return false;
} else return (res == FR_OK) ? true : false;
return (f_rename(path, npath) == FR_OK);
}
bool DirCreate(const char* cpath, const char* dirname) {