FatFS R0.10b, released May 19, 2014

This commit is contained in:
Christopher Williams
2015-01-31 09:24:04 -07:00
parent 935031e4e5
commit 762b341574
75 changed files with 812 additions and 704 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
FatFs Module Source Files R0.10a (C)ChaN, 2014
FatFs Module Source Files R0.10b (C)ChaN, 2014
FILES
@@ -153,3 +153,6 @@ REVISION HISTORY
Fixed f_close() invalidates the file object without volume lock.
Fixed f_closedir() returns but the volume lock is left acquired.
Fixed creation of an entry with LFN fails on too many SFN collisions.
Mar 19,'14 R0.10b Fixed a hard error in the disk I/O layer can collapse the directory entry.
Fixed LFN entry is not deleted on delete/rename an object with lossy converted SFN.
+58 -64
View File
@@ -1,10 +1,10 @@
/*-----------------------------------------------------------------------*/
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2013 */
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2014 */
/*-----------------------------------------------------------------------*/
/* If a working storage control module is available, it should be */
/* attached to the FatFs via a glue function rather than modifying it. */
/* This is an example of glue functions to attach various exsisting */
/* storage control module to the FatFs module with a defined API. */
/* storage control modules to the FatFs module with a defined API. */
/*-----------------------------------------------------------------------*/
#include "diskio.h" /* FatFs lower layer API */
@@ -12,56 +12,18 @@
#include "atadrive.h" /* Example: ATA drive control */
#include "sdcard.h" /* Example: MMC/SDC contorl */
/* Definitions of physical drive number for each media */
#define ATA 0
#define MMC 1
#define USB 2
/* Definitions of physical drive number for each drive */
#define ATA 0 /* Example: Map ATA drive to drive number 0 */
#define MMC 1 /* Example: Map MMC/SD card to drive number 1 */
#define USB 2 /* Example: Map USB drive to drive number 2 */
/*-----------------------------------------------------------------------*/
/* Inidialize a Drive */
/*-----------------------------------------------------------------------*/
DSTATUS disk_initialize (
BYTE pdrv /* Physical drive nmuber (0..) */
)
{
DSTATUS stat;
int result;
switch (pdrv) {
case ATA :
result = ATA_disk_initialize();
// translate the reslut code here
return stat;
case MMC :
result = MMC_disk_initialize();
// translate the reslut code here
return stat;
case USB :
result = USB_disk_initialize();
// translate the reslut code here
return stat;
}
return STA_NOINIT;
}
/*-----------------------------------------------------------------------*/
/* Get Disk Status */
/* Get Drive Status */
/*-----------------------------------------------------------------------*/
DSTATUS disk_status (
BYTE pdrv /* Physical drive nmuber (0..) */
BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
DSTATUS stat;
@@ -94,15 +56,53 @@ DSTATUS disk_status (
/*-----------------------------------------------------------------------*/
/* Inidialize a Drive */
/*-----------------------------------------------------------------------*/
DSTATUS disk_initialize (
BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
DSTATUS stat;
int result;
switch (pdrv) {
case ATA :
result = ATA_disk_initialize();
// translate the reslut code here
return stat;
case MMC :
result = MMC_disk_initialize();
// translate the reslut code here
return stat;
case USB :
result = USB_disk_initialize();
// translate the reslut code here
return stat;
}
return STA_NOINIT;
}
/*-----------------------------------------------------------------------*/
/* Read Sector(s) */
/*-----------------------------------------------------------------------*/
DRESULT disk_read (
BYTE pdrv, /* Physical drive nmuber (0..) */
BYTE pdrv, /* Physical drive nmuber to identify the drive */
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to read (1..128) */
DWORD sector, /* Sector address in LBA */
UINT count /* Number of sectors to read */
)
{
DRESULT res;
@@ -136,6 +136,7 @@ DRESULT disk_read (
return res;
}
return RES_PARERR;
}
@@ -147,10 +148,10 @@ DRESULT disk_read (
#if _USE_WRITE
DRESULT disk_write (
BYTE pdrv, /* Physical drive nmuber (0..) */
BYTE pdrv, /* Physical drive nmuber to identify the drive */
const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to write (1..128) */
DWORD sector, /* Sector address in LBA */
UINT count /* Number of sectors to write */
)
{
DRESULT res;
@@ -184,6 +185,7 @@ DRESULT disk_write (
return res;
}
return RES_PARERR;
}
#endif
@@ -205,32 +207,24 @@ DRESULT disk_ioctl (
switch (pdrv) {
case ATA :
// pre-process here
result = ATA_disk_ioctl(cmd, buff);
// post-process here
// Process of the command for the ATA drive
return res;
case MMC :
// pre-process here
result = MMC_disk_ioctl(cmd, buff);
// post-process here
// Process of the command for the MMC/SD card
return res;
case USB :
// pre-process here
result = USB_disk_ioctl(cmd, buff);
// post-process here
// Process of the command the USB drive
return res;
}
return RES_PARERR;
}
#endif
+74 -71
View File
@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------/
/ FatFs - FAT file system module R0.10a (C)ChaN, 2014
/ FatFs - FAT file system module R0.10b (C)ChaN, 2014
/-----------------------------------------------------------------------------/
/ FatFs module is a generic FAT file system module for small embedded systems.
/ This is a free software that opened for education, research and commercial
@@ -111,6 +111,8 @@
/ Fixed f_close() invalidates the file object without volume lock.
/ Fixed f_closedir() returns but the volume lock is left acquired.
/ Fixed creation of an entry with LFN fails on too many SFN collisions.
/ May 19,'14 R0.10b Fixed a hard error in the disk I/O layer can collapse the directory entry.
/ Fixed LFN entry is not deleted on delete/rename an object with lossy converted SFN.
/---------------------------------------------------------------------------*/
#include "ff.h" /* Declarations of FatFs API */
@@ -125,7 +127,7 @@
---------------------------------------------------------------------------*/
#if _FATFS != 29000 /* Revision ID */
#if _FATFS != 8051 /* Revision ID */
#error Wrong include file (ff.h).
#endif
@@ -150,7 +152,7 @@
#error Wrong sector size configuration.
#endif
#if _MAX_SS == _MIN_SS
#define SS(fs) ((UINT)_MIN_SS) /* Fixed sector size */
#define SS(fs) ((UINT)_MAX_SS) /* Fixed sector size */
#else
#define SS(fs) ((fs)->ssize) /* Variable sector size */
#endif
@@ -162,10 +164,10 @@
#error _FS_LOCK must be 0 at read-only cfg.
#endif
typedef struct {
FATFS *fs; /* Object ID 1, volume (NULL:blank entry) */
DWORD clu; /* Object ID 2, directory */
WORD idx; /* Object ID 3, directory index */
WORD ctr; /* Object open counter, 0:none, 0x01..0xFF:read mode open count, 0x100:write mode */
FATFS *fs; /* Object ID 1, volume (NULL:blank entry) */
DWORD clu; /* Object ID 2, directory (0:root) */
WORD idx; /* Object ID 3, directory index */
WORD ctr; /* Object open counter, 0:none, 0x01..0xFF:read mode open count, 0x100:write mode */
} FILESEM;
#endif
@@ -414,61 +416,61 @@ typedef struct {
/ structure member because the structure is not binary compatible between
/ different platforms */
#define BS_jmpBoot 0 /* Jump instruction (3) */
#define BS_OEMName 3 /* OEM name (8) */
#define BPB_BytsPerSec 11 /* Sector size [byte] (2) */
#define BPB_SecPerClus 13 /* Cluster size [sector] (1) */
#define BPB_RsvdSecCnt 14 /* Size of reserved area [sector] (2) */
#define BPB_NumFATs 16 /* Number of FAT copies (1) */
#define BPB_RootEntCnt 17 /* Number of root directory entries for FAT12/16 (2) */
#define BPB_TotSec16 19 /* Volume size [sector] (2) */
#define BPB_Media 21 /* Media descriptor (1) */
#define BPB_FATSz16 22 /* FAT size [sector] (2) */
#define BPB_SecPerTrk 24 /* Track size [sector] (2) */
#define BPB_NumHeads 26 /* Number of heads (2) */
#define BPB_HiddSec 28 /* Number of special hidden sectors (4) */
#define BPB_TotSec32 32 /* Volume size [sector] (4) */
#define BS_DrvNum 36 /* Physical drive number (2) */
#define BS_BootSig 38 /* Extended boot signature (1) */
#define BS_VolID 39 /* Volume serial number (4) */
#define BS_VolLab 43 /* Volume label (8) */
#define BS_FilSysType 54 /* File system type (1) */
#define BPB_FATSz32 36 /* FAT size [sector] (4) */
#define BPB_ExtFlags 40 /* Extended flags (2) */
#define BPB_FSVer 42 /* File system version (2) */
#define BPB_RootClus 44 /* Root directory first cluster (4) */
#define BPB_FSInfo 48 /* Offset of FSINFO sector (2) */
#define BPB_BkBootSec 50 /* Offset of backup boot sector (2) */
#define BS_DrvNum32 64 /* Physical drive number (2) */
#define BS_BootSig32 66 /* Extended boot signature (1) */
#define BS_VolID32 67 /* Volume serial number (4) */
#define BS_VolLab32 71 /* Volume label (8) */
#define BS_FilSysType32 82 /* File system type (1) */
#define FSI_LeadSig 0 /* FSI: Leading signature (4) */
#define FSI_StrucSig 484 /* FSI: Structure signature (4) */
#define FSI_Free_Count 488 /* FSI: Number of free clusters (4) */
#define FSI_Nxt_Free 492 /* FSI: Last allocated cluster (4) */
#define MBR_Table 446 /* MBR: Partition table offset (2) */
#define SZ_PTE 16 /* MBR: Size of a partition table entry */
#define BS_55AA 510 /* Boot sector signature (2) */
#define BS_jmpBoot 0 /* Jump instruction (3) */
#define BS_OEMName 3 /* OEM name (8) */
#define BPB_BytsPerSec 11 /* Sector size [byte] (2) */
#define BPB_SecPerClus 13 /* Cluster size [sector] (1) */
#define BPB_RsvdSecCnt 14 /* Size of reserved area [sector] (2) */
#define BPB_NumFATs 16 /* Number of FAT copies (1) */
#define BPB_RootEntCnt 17 /* Number of root directory entries for FAT12/16 (2) */
#define BPB_TotSec16 19 /* Volume size [sector] (2) */
#define BPB_Media 21 /* Media descriptor (1) */
#define BPB_FATSz16 22 /* FAT size [sector] (2) */
#define BPB_SecPerTrk 24 /* Track size [sector] (2) */
#define BPB_NumHeads 26 /* Number of heads (2) */
#define BPB_HiddSec 28 /* Number of special hidden sectors (4) */
#define BPB_TotSec32 32 /* Volume size [sector] (4) */
#define BS_DrvNum 36 /* Physical drive number (2) */
#define BS_BootSig 38 /* Extended boot signature (1) */
#define BS_VolID 39 /* Volume serial number (4) */
#define BS_VolLab 43 /* Volume label (8) */
#define BS_FilSysType 54 /* File system type (1) */
#define BPB_FATSz32 36 /* FAT size [sector] (4) */
#define BPB_ExtFlags 40 /* Extended flags (2) */
#define BPB_FSVer 42 /* File system version (2) */
#define BPB_RootClus 44 /* Root directory first cluster (4) */
#define BPB_FSInfo 48 /* Offset of FSINFO sector (2) */
#define BPB_BkBootSec 50 /* Offset of backup boot sector (2) */
#define BS_DrvNum32 64 /* Physical drive number (2) */
#define BS_BootSig32 66 /* Extended boot signature (1) */
#define BS_VolID32 67 /* Volume serial number (4) */
#define BS_VolLab32 71 /* Volume label (8) */
#define BS_FilSysType32 82 /* File system type (1) */
#define FSI_LeadSig 0 /* FSI: Leading signature (4) */
#define FSI_StrucSig 484 /* FSI: Structure signature (4) */
#define FSI_Free_Count 488 /* FSI: Number of free clusters (4) */
#define FSI_Nxt_Free 492 /* FSI: Last allocated cluster (4) */
#define MBR_Table 446 /* MBR: Partition table offset (2) */
#define SZ_PTE 16 /* MBR: Size of a partition table entry */
#define BS_55AA 510 /* Signature word (2) */
#define DIR_Name 0 /* Short file name (11) */
#define DIR_Attr 11 /* Attribute (1) */
#define DIR_NTres 12 /* NT flag (1) */
#define DIR_CrtTimeTenth 13 /* Created time sub-second (1) */
#define DIR_CrtTime 14 /* Created time (2) */
#define DIR_CrtDate 16 /* Created date (2) */
#define DIR_LstAccDate 18 /* Last accessed date (2) */
#define DIR_FstClusHI 20 /* Higher 16-bit of first cluster (2) */
#define DIR_WrtTime 22 /* Modified time (2) */
#define DIR_WrtDate 24 /* Modified date (2) */
#define DIR_FstClusLO 26 /* Lower 16-bit of first cluster (2) */
#define DIR_FileSize 28 /* File size (4) */
#define LDIR_Ord 0 /* LFN entry order and LLE flag (1) */
#define LDIR_Attr 11 /* LFN attribute (1) */
#define LDIR_Type 12 /* LFN type (1) */
#define LDIR_Chksum 13 /* Sum of corresponding SFN entry */
#define LDIR_FstClusLO 26 /* Filled by zero (0) */
#define DIR_Name 0 /* Short file name (11) */
#define DIR_Attr 11 /* Attribute (1) */
#define DIR_NTres 12 /* NT flag (1) */
#define DIR_CrtTimeTenth 13 /* Created time sub-second (1) */
#define DIR_CrtTime 14 /* Created time (2) */
#define DIR_CrtDate 16 /* Created date (2) */
#define DIR_LstAccDate 18 /* Last accessed date (2) */
#define DIR_FstClusHI 20 /* Higher 16-bit of first cluster (2) */
#define DIR_WrtTime 22 /* Modified time (2) */
#define DIR_WrtDate 24 /* Modified date (2) */
#define DIR_FstClusLO 26 /* Lower 16-bit of first cluster (2) */
#define DIR_FileSize 28 /* File size (4) */
#define LDIR_Ord 0 /* LFN entry order and LLE flag (1) */
#define LDIR_Attr 11 /* LFN attribute (1) */
#define LDIR_Type 12 /* LFN type (1) */
#define LDIR_Chksum 13 /* Sum of corresponding SFN entry */
#define LDIR_FstClusLO 26 /* Filled by zero (0) */
#define SZ_DIR 32 /* Size of a directory entry */
#define LLE 0x40 /* Last long entry flag in LDIR_Ord */
#define DDE 0xE5 /* Deleted directory entry mark in DIR_Name[0] */
@@ -482,7 +484,7 @@ typedef struct {
/*------------------------------------------------------------*/
/* Note that uninitialized variables with static duration are
/ guaranteed zero/null as initial value. If not, either the
/ compiler or start-up routine is out of ANSI-C standard.
/ linker or start-up routine is out of ANSI-C standard.
*/
#if _VOLUMES >= 1 || _VOLUMES <= 10
@@ -641,7 +643,7 @@ void unlock_fs (
static
FRESULT chk_lock ( /* Check if the file can be accessed */
DIR* dp, /* Directory object pointing the file to be checked */
int acc /* Desired access (0:Read, 1:Write, 2:Delete/Rename) */
int acc /* Desired access type (0:Read, 1:Write, 2:Delete/Rename) */
)
{
UINT i, be;
@@ -1499,7 +1501,7 @@ FRESULT dir_find (
if (res != FR_OK) return res;
#if _USE_LFN
ord = sum = 0xFF;
ord = sum = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */
#endif
do {
res = move_window(dp->fs, dp->sect);
@@ -1510,22 +1512,22 @@ FRESULT dir_find (
#if _USE_LFN /* LFN configuration */
a = dir[DIR_Attr] & AM_MASK;
if (c == DDE || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */
ord = 0xFF;
ord = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */
} else {
if (a == AM_LFN) { /* An LFN entry is found */
if (dp->lfn) {
if (c & LLE) { /* Is it start of LFN sequence? */
sum = dir[LDIR_Chksum];
c &= ~LLE; ord = c; /* LFN start order */
dp->lfn_idx = dp->index;
dp->lfn_idx = dp->index; /* Start index of LFN */
}
/* Check validity of the LFN entry and compare it with given name */
ord = (c == ord && sum == dir[LDIR_Chksum] && cmp_lfn(dp->lfn, dir)) ? ord - 1 : 0xFF;
}
} else { /* An SFN entry is found */
if (!ord && sum == sum_sfn(dir)) break; /* LFN matched? */
ord = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */
if (!(dp->fn[NS] & NS_LOSS) && !mem_cmp(dir, dp->fn, 11)) break; /* SFN matched? */
ord = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */
}
}
#else /* Non LFN configuration */
@@ -2678,7 +2680,7 @@ FRESULT f_write (
if (fp->fptr == 0) { /* On the top of the file? */
clst = fp->sclust; /* Follow from the origin */
if (clst == 0) /* When no cluster is allocated, */
fp->sclust = clst = create_chain(fp->fs, 0); /* Create a new cluster chain */
clst = create_chain(fp->fs, 0); /* Create a new cluster chain */
} else { /* Middle or end of the file */
#if _USE_FASTSEEK
if (fp->cltbl)
@@ -2691,6 +2693,7 @@ FRESULT f_write (
if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
fp->clust = clst; /* Update current cluster */
if (fp->sclust == 0) fp->sclust = clst; /* Set start cluster if the first write */
}
#if _FS_TINY
if (fp->fs->winsect == fp->dsect && sync_window(fp->fs)) /* Write-back sector cache */
@@ -3750,7 +3753,7 @@ FRESULT f_rename (
FRESULT f_getlabel (
const TCHAR* path, /* Path name of the logical drive number */
TCHAR* label, /* Pointer to a buffer to return the volume label */
DWORD* sn /* Pointer to a variable to return the volume serial number */
DWORD* vsn /* Pointer to a variable to return the volume serial number */
)
{
FRESULT res;
@@ -3794,11 +3797,11 @@ FRESULT f_getlabel (
}
/* Get volume serial number */
if (res == FR_OK && sn) {
if (res == FR_OK && vsn) {
res = move_window(dj.fs, dj.fs->volbase);
if (res == FR_OK) {
i = dj.fs->fs_type == FS_FAT32 ? BS_VolID32 : BS_VolID;
*sn = LD_DWORD(&dj.fs->win[i]);
*vsn = LD_DWORD(&dj.fs->win[i]);
}
}
+13 -13
View File
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------/
/ FatFs - FAT file system module include file R0.10a (C)ChaN, 2014
/ FatFs - FAT file system module include file R0.10b (C)ChaN, 2014
/----------------------------------------------------------------------------/
/ FatFs module is a generic FAT file system module for small embedded systems.
/ This is a free software that opened for education, research and commercial
@@ -15,7 +15,7 @@
/----------------------------------------------------------------------------*/
#ifndef _FATFS
#define _FATFS 29000 /* Revision ID */
#define _FATFS 8051 /* Revision ID */
#ifdef __cplusplus
extern "C" {
@@ -53,7 +53,7 @@ extern PARTITION VolToPart[]; /* Volume - Partition resolution table */
#if _LFN_UNICODE /* Unicode string */
#if !_USE_LFN
#error _LFN_UNICODE must be 0 in non-LFN cfg.
#error _LFN_UNICODE must be 0 at non-LFN cfg.
#endif
#ifndef _INC_TCHAR
typedef WCHAR TCHAR;
@@ -96,7 +96,7 @@ typedef struct {
#if _FS_RPATH
DWORD cdir; /* Current directory start cluster (0:root) */
#endif
DWORD n_fatent; /* Number of FAT entries (= number of clusters + 2) */
DWORD n_fatent; /* Number of FAT entries, = number of clusters + 2 */
DWORD fsize; /* Sectors per FAT */
DWORD volbase; /* Volume start sector */
DWORD fatbase; /* FAT start sector */
@@ -113,25 +113,25 @@ typedef struct {
typedef struct {
FATFS* fs; /* Pointer to the related file system object (**do not change order**) */
WORD id; /* Owner file system mount ID (**do not change order**) */
BYTE flag; /* File status flags */
BYTE flag; /* Status flags */
BYTE err; /* Abort flag (error code) */
DWORD fptr; /* File read/write pointer (Zeroed on file open) */
DWORD fsize; /* File size */
DWORD sclust; /* File data start cluster (0:no data cluster, always 0 when fsize is 0) */
DWORD clust; /* Current cluster of fpter */
DWORD dsect; /* Current data sector of fpter */
DWORD sclust; /* File start cluster (0:no cluster chain, always 0 when fsize is 0) */
DWORD clust; /* Current cluster of fpter (not valid when fprt is 0) */
DWORD dsect; /* Sector number appearing in buf[] (0:invalid) */
#if !_FS_READONLY
DWORD dir_sect; /* Sector containing the directory entry */
BYTE* dir_ptr; /* Pointer to the directory entry in the window */
DWORD dir_sect; /* Sector number containing the directory entry */
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] */
#endif
#if _USE_FASTSEEK
DWORD* cltbl; /* Pointer to the cluster link map table (Nulled on file open) */
#endif
#if _FS_LOCK
UINT lockid; /* File lock ID (index of file semaphore table Files[]) */
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
#endif
#if !_FS_TINY
BYTE buf[_MAX_SS]; /* File data read/write buffer */
BYTE buf[_MAX_SS]; /* File private data read/write window */
#endif
} FIL;
@@ -226,7 +226,7 @@ FRESULT f_chdir (const TCHAR* path); /* Change current directory */
FRESULT f_chdrive (const TCHAR* path); /* Change current drive */
FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */
FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* sn); /* Get volume label */
FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */
FRESULT f_setlabel (const TCHAR* label); /* Set volume label */
FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */
FRESULT f_mkfs (const TCHAR* path, BYTE sfd, UINT au); /* Create a file system on the volume */
+57 -51
View File
@@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------/
/ FatFs - FAT file system module configuration file R0.10a (C)ChaN, 2014
/ FatFs - FAT file system module configuration file R0.10b (C)ChaN, 2014
/---------------------------------------------------------------------------*/
#ifndef _FFCONF
#define _FFCONF 29000 /* Revision ID */
#define _FFCONF 8051 /* Revision ID */
/*---------------------------------------------------------------------------/
@@ -33,11 +33,11 @@
/ 3: f_lseek() function is removed in addition to 2. */
#define _USE_STRFUNC 2 /* 0:Disable or 1-2:Enable */
#define _USE_STRFUNC 0 /* 0:Disable or 1-2:Enable */
/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
#define _USE_MKFS 1 /* 0:Disable or 1:Enable */
#define _USE_MKFS 0 /* 0:Disable or 1:Enable */
/* To enable f_mkfs() function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
@@ -45,7 +45,7 @@
/* To enable fast seek feature, set _USE_FASTSEEK to 1. */
#define _USE_LABEL 1 /* 0:Disable or 1:Enable */
#define _USE_LABEL 0 /* 0:Disable or 1:Enable */
/* To enable volume label functions, set _USE_LAVEL to 1 */
@@ -61,7 +61,7 @@
/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
/ Incorrect setting of the code page can cause a file open failure.
/
/ 932 - Japanese Shift-JIS (DBCS, OEM, Windows)
/ 932 - Japanese Shift_JIS (DBCS, OEM, Windows)
/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
/ 949 - Korean (DBCS, OEM, Windows)
/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
@@ -86,14 +86,14 @@
/ 857 - Turkish (OEM)
/ 862 - Hebrew (OEM)
/ 874 - Thai (OEM, Windows)
/ 1 - ASCII (Valid for only non-LFN cfg.) */
/ 1 - ASCII (Valid for only non-LFN configuration) */
#define _USE_LFN 1 /* 0 to 3 */
#define _USE_LFN 0 /* 0 to 3 */
#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
/* The _USE_LFN option switches the LFN feature.
/
/ 0: Disable LFN feature. _MAX_LFN and _LFN_UNICODE have no effect.
/ 0: Disable LFN feature. _MAX_LFN has no effect.
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
/ 2: Enable LFN with dynamic working buffer on the STACK.
/ 3: Enable LFN with dynamic working buffer on the HEAP.
@@ -109,16 +109,17 @@
#define _LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */
/* To switch the character encoding on the FatFs API (TCHAR) to Unicode, enable LFN
/ feature and set _LFN_UNICODE to 1. This option affects behavior of string I/O
/ functions. */
/ functions. This option must be 0 when LFN feature is not enabled. */
#define _STRF_ENCODE 3 /* 0:ANSI/OEM, 1:UTF-16LE, 2:UTF-16BE, 3:UTF-8 */
/* When Unicode API is enabled by _LFN_UNICODE option, this option selects the character
/ encoding on the file to be read/written via string I/O functions, f_gets(), f_putc(),
/ f_puts and f_printf(). This option has no effect when Unicode API is not enabled. */
/ f_puts and f_printf(). This option has no effect when _LFN_UNICODE == 0. Note that
/ FatFs supports only BMP. */
#define _FS_RPATH 2 /* 0 to 2 */
#define _FS_RPATH 0 /* 0 to 2 */
/* The _FS_RPATH option configures relative path feature.
/
/ 0: Disable relative path feature and remove related functions.
@@ -132,16 +133,16 @@
/ Drive/Volume Configurations
/---------------------------------------------------------------------------*/
#define _VOLUMES 8
#define _VOLUMES 1
/* Number of volumes (logical drives) to be used. */
#define _STR_VOLUME_ID 1 /* 0:Use only 0-9 for drive ID, 1:Use strings for drive ID */
#define _STR_VOLUME_ID 0 /* 0:Use only 0-9 for drive ID, 1:Use strings for drive ID */
#define _VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3"
/* When _STR_VOLUME_ID is set to 1, also pre-defined string can be used as drive number
/ in the path name. _VOLUME_STRS defines the drive ID strings for each logical drives.
/ Number of items must be equal to _VOLUMES. Valid characters for the drive ID strings
/ are: 0-9 and A-Z. */
/* When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
/ number in the path name. _VOLUME_STRS defines the drive ID strings for each logical
/ drives. Number of items must be equal to _VOLUMES. Valid characters for the drive ID
/ strings are: 0-9 and A-Z. */
#define _MULTI_PARTITION 0 /* 0:Single partition, 1:Enable multiple partition */
@@ -152,11 +153,11 @@
#define _MIN_SS 512
#define _MAX_SS 2048
/* These options configure the sector size to be supported. (512, 1024, 2048 or 4096)
/ Always set both 512 for most systems, all memory card and hard disk. But a larger
#define _MAX_SS 512
/* These options configure the range of sector size to be supported. (512, 1024, 2048 or
/ 4096) Always set both 512 for most systems, all memory card and harddisk. But a larger
/ value may be required for on-board flash memory and some type of optical media.
/ When _MIN_SS != _MAX_SS, FatFs is configured to multiple sector size and
/ When _MAX_SS is larger than _MIN_SS, FatFs is configured to variable sector size and
/ GET_SECTOR_SIZE command must be implemented to the disk_ioctl() function. */
@@ -166,9 +167,9 @@
#define _FS_NOFSINFO 0 /* 0 to 3 */
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option and f_getfree() function at first time after volume mount will force
/ a full FAT scan. Bit 1 controls the last allocated cluster number as bit 0.
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this option
/ and f_getfree() function at first time after volume mount will force a full FAT scan.
/ Bit 1 controls the last allocated cluster number as bit 0.
/
/ bit0=0: Use free cluster count in the FSINFO if available.
/ bit0=1: Do not trust free cluster count in the FSINFO.
@@ -182,35 +183,16 @@
/ System Configurations
/---------------------------------------------------------------------------*/
#define _WORD_ACCESS 1 /* 0 or 1 */
/* The _WORD_ACCESS option is an only platform dependent option. It defines
/ which access method is used to the word data on the FAT volume.
/
/ 0: Byte-by-byte access. Always compatible with all platforms.
/ 1: Word access. Do not choose this unless under both the following conditions.
/
/ * Address misaligned memory access is always allowed for all instructions.
/ * Byte order on the memory is little-endian.
/
/ If it is the case, _WORD_ACCESS can also be set to 1 to improve performance
/ and reduce code size.
*/
#define _FS_LOCK 0 /* 0:Disable or >=1:Enable */
/* To enable file lock control feature, set _FS_LOCK to 1 or greater.
/ The value defines how many files/sub-directories can be opened simultaneously.
/ This feature consumes _FS_LOCK * 12 bytes of bss area. */
/* To enable file lock control feature, set _FS_LOCK to non-zero value.
/ The value defines how many files/sub-directories can be opened simultaneously
/ with file lock control. This feature uses bss _FS_LOCK * 12 bytes. */
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
#define _SYNC_t HANDLE /* O/S dependent sync object type. e.g. HANDLE, OS_EVENT*, ID and etc.. */
/*#include <windows.h>*/
/* A header file that defines sync object types on the O/S, such as windows.h,
/ ucos_ii.h and semphr.h, should be included here when enable this option.
/ The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs module.
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time tick */
#define _SYNC_t HANDLE /* O/S dependent sync object type. e.g. HANDLE, OS_EVENT*, ID, SemaphoreHandle_t and etc.. */
/* The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs module.
/
/ 0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect.
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
@@ -219,4 +201,28 @@
*/
#endif /* _FFCONFIG */
#define _WORD_ACCESS 0 /* 0 or 1 */
/* The _WORD_ACCESS option is an only platform dependent option. It defines
/ which access method is used to the word data on the FAT volume.
/
/ 0: Byte-by-byte access. Always compatible with all platforms.
/ 1: Word access. Do not choose this unless under both the following conditions.
/
/ * Address misaligned memory access is always allowed for ALL instructions.
/ * Byte order on the memory is little-endian.
/
/ If it is the case, _WORD_ACCESS can also be set to 1 to improve performance and
/ reduce code size. Following table shows an example of some processor types.
/
/ ARM7TDMI 0 ColdFire 0 V850E 0
/ Cortex-M3 0 Z80 0/1 V850ES 0/1
/ Cortex-M0 0 RX600(LE) 0/1 TLCS-870 0/1
/ AVR 0/1 RX600(BE) 0 TLCS-900 0/1
/ AVR32 0 RL78 0 R32C 0
/ PIC18 0/1 SH-2 0 M16C 0/1
/ PIC24 0 H8S 0 MSP430 0
/ PIC32 0 H8/300H 0 x86 0/1
*/
#endif /* _FFCONF */
+5 -5
View File
@@ -2,15 +2,15 @@
#if _USE_LFN != 0
#if _CODE_PAGE == 932
#if _CODE_PAGE == 932 /* Japanese Shift_JIS */
#include "cc932.c"
#elif _CODE_PAGE == 936
#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */
#include "cc936.c"
#elif _CODE_PAGE == 949
#elif _CODE_PAGE == 949 /* Korean */
#include "cc949.c"
#elif _CODE_PAGE == 950
#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */
#include "cc950.c"
#else
#else /* Small character-set */
#include "ccsbcs.c"
#endif