28 #error Wrong configuration file (ffconf.h).
45 extern PARTITION VolToPart[];
46 #define LD2PD(vol) (VolToPart[vol].pd)
47 #define LD2PT(vol) (VolToPart[vol].pt)
50 #define LD2PD(vol) (BYTE)(vol)
59 #error _LFN_UNICODE must be 0 at non-LFN cfg.
64 #define _TEXT(x) L ## x
91 #if _MAX_SS != _MIN_SS
210 FR_TOO_MANY_OPEN_FILES,
218 FRESULT f_open (
FIL* fp,
const TCHAR* path, BYTE mode);
219 FRESULT f_close (
FIL* fp);
220 FRESULT f_read (
FIL* fp,
void* buff, UINT btr, UINT* br);
221 FRESULT f_write (
FIL* fp,
const void* buff, UINT btw, UINT* bw);
222 FRESULT f_forward (
FIL* fp, UINT(*func)(
const BYTE*,UINT), UINT btf, UINT* bf);
223 FRESULT f_lseek (
FIL* fp, DWORD ofs);
224 FRESULT f_truncate (
FIL* fp);
225 FRESULT f_sync (
FIL* fp);
226 FRESULT f_opendir (
DIR* dp,
const TCHAR* path);
227 FRESULT f_closedir (
DIR* dp);
229 FRESULT f_mkdir (
const TCHAR* path);
230 FRESULT f_unlink (
const TCHAR* path);
231 FRESULT f_rename (
const TCHAR* path_old,
const TCHAR* path_new);
232 FRESULT f_stat (
const TCHAR* path,
FILINFO* fno);
233 FRESULT f_chmod (
const TCHAR* path, BYTE value, BYTE mask);
234 FRESULT f_utime (
const TCHAR* path,
const FILINFO* fno);
235 FRESULT f_chdir (
const TCHAR* path);
236 FRESULT f_chdrive (
const TCHAR* path);
237 FRESULT f_getcwd (TCHAR* buff, UINT len);
238 FRESULT f_getfree (
const TCHAR* path, DWORD* nclst,
FATFS** fatfs);
239 FRESULT f_getlabel (
const TCHAR* path, TCHAR* label, DWORD* vsn);
240 FRESULT f_setlabel (
const TCHAR* label);
241 FRESULT f_mount (
FATFS* fs,
const TCHAR* path, BYTE opt);
242 FRESULT f_mkfs (
const TCHAR* path, BYTE sfd, UINT au);
243 FRESULT f_fdisk (BYTE pdrv,
const DWORD szt[],
void* work);
244 int f_putc (TCHAR c,
FIL* fp);
245 int f_puts (
const TCHAR* str,
FIL* cp);
246 int f_printf (
FIL* fp,
const TCHAR* str, ...);
247 TCHAR* f_gets (TCHAR* buff,
int len,
FIL* fp);
249 #define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
250 #define f_error(fp) ((fp)->err)
251 #define f_tell(fp) ((fp)->fptr)
252 #define f_size(fp) ((fp)->fsize)
269 WCHAR ff_convert (WCHAR chr, UINT dir);
270 WCHAR ff_wtoupper (WCHAR chr);
272 void* ff_memalloc (UINT msize);
273 void ff_memfree (
void* mblock);
279 int ff_cre_syncobj (BYTE vol, _SYNC_t* sobj);
280 int ff_req_grant (_SYNC_t sobj);
281 void ff_rel_grant (_SYNC_t sobj);
282 int ff_del_syncobj (_SYNC_t sobj);
293 #define FA_OPEN_EXISTING 0x00
296 #define FA_WRITE 0x02
297 #define FA_CREATE_NEW 0x04
298 #define FA_CREATE_ALWAYS 0x08
299 #define FA_OPEN_ALWAYS 0x10
300 #define FA__WRITTEN 0x20
301 #define FA__DIRTY 0x40
325 #define CREATE_LINKMAP 0xFFFFFFFF
331 #if _WORD_ACCESS == 1
332 #define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
333 #define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
334 #define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
335 #define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
337 #define LD_WORD(ptr) (WORD)(((WORD)*((BYTE*)(ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
338 #define LD_DWORD(ptr) (DWORD)(((DWORD)*((BYTE*)(ptr)+3)<<24)|((DWORD)*((BYTE*)(ptr)+2)<<16)|((WORD)*((BYTE*)(ptr)+1)<<8)|*(BYTE*)(ptr))
339 #define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8)
340 #define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24)
FATFS * fs
Pointer to the owner file system object (do not change order)
Definition: ff.h:152
WORD index
Current read/write index number.
Definition: ff.h:154
DWORD n_fatent
Number of FAT entries, = number of clusters + 2.
Definition: ff.h:104
DWORD sect
Current sector.
Definition: ff.h:157
DWORD database
Data start sector.
Definition: ff.h:109
WCHAR * lfn
Pointer to the LFN working buffer.
Definition: ff.h:164
WORD fdate
Last modified date.
Definition: ff.h:176
DWORD last_clust
Last allocated cluster.
Definition: ff.h:98
File status structure (FILINFO)
Definition: ff.h:173
DWORD fsize
File size.
Definition: ff.h:126
File system object structure (FATFS)
Definition: ff.h:81
WORD ftime
Last modified time.
Definition: ff.h:177
WORD id
Owner file system mount ID (do not change order)
Definition: ff.h:122
WORD id
Owner file system mount ID (do not change order)
Definition: ff.h:153
BYTE flag
Status flags.
Definition: ff.h:123
WORD lfn_idx
Last matched LFN index number (0xFFFF:No LFN)
Definition: ff.h:165
TCHAR * lfname
Pointer to the LFN buffer.
Definition: ff.h:181
BYTE * dir
Pointer to the current SFN entry in the win[].
Definition: ff.h:158
BYTE csize
Sectors per cluster (1,2,4...128)
Definition: ff.h:85
DWORD sclust
Table start cluster (0:Root dir)
Definition: ff.h:155
BYTE fs_type
FAT sub-type (0:Not mounted)
Definition: ff.h:83
Directory object structure (DIR)
Definition: ff.h:150
BYTE n_fats
Number of FAT copies (1 or 2)
Definition: ff.h:86
UINT lfsize
Size of LFN buffer in TCHAR.
Definition: ff.h:182
DWORD winsect
Current sector appearing in the win[].
Definition: ff.h:110
DWORD fatbase
FAT start sector.
Definition: ff.h:107
WORD id
File system mount ID.
Definition: ff.h:89
DWORD sclust
File start cluster (0:no cluster chain, always 0 when fsize is 0)
Definition: ff.h:127
BYTE drv
Physical drive number.
Definition: ff.h:84
BYTE fsi_flag
FSINFO flags (b7:disabled, b0:dirty)
Definition: ff.h:88
BYTE * dir_ptr
Pointer to the directory entry in the win[].
Definition: ff.h:132
BYTE fattrib
Attribute.
Definition: ff.h:178
DWORD dsect
Sector number appearing in buf[] (0:invalid)
Definition: ff.h:129
DWORD clust
Current cluster.
Definition: ff.h:156
BYTE err
Abort flag (error code)
Definition: ff.h:124
DWORD get_fattime(void)
The time to write the metadata of the files.
Definition: diskio.c:388
DWORD volbase
Volume start sector.
Definition: ff.h:106
DWORD fsize
File size.
Definition: ff.h:175
WORD n_rootdir
Number of root directory entries (FAT12/16)
Definition: ff.h:90
File object structure (FIL)
Definition: ff.h:119
DWORD free_clust
Number of free clusters.
Definition: ff.h:99
BYTE wflag
win[] flag (b0:dirty)
Definition: ff.h:87
DWORD fptr
File read/write pointer (Zeroed on file open)
Definition: ff.h:125
DWORD clust
Current cluster of fpter (not valid when fprt is 0)
Definition: ff.h:128
FATFS * fs
Pointer to the related file system object (do not change order)
Definition: ff.h:121
DWORD dir_sect
Sector number containing the directory entry.
Definition: ff.h:131
BYTE * fn
Pointer to the SFN (in/out) {file[8],ext[3],status[1]}.
Definition: ff.h:159
DWORD fsize
Sectors per FAT.
Definition: ff.h:105
DWORD dirbase
Root directory start sector (FAT32:Cluster#)
Definition: ff.h:108