DMCP interface 03.15_021
Loading...
Searching...
No Matches
ff_ifc.h
1#ifndef __FF_IFC_H__
2#define __FF_IFC_H__
3
4
5
6/* These types MUST be 16-bit or 32-bit */
7typedef int INT;
8typedef unsigned int UINT;
9
10/* This type MUST be 8-bit */
11typedef unsigned char BYTE;
12
13/* These types MUST be 16-bit */
14typedef short SHORT;
15typedef unsigned short WORD;
16typedef unsigned short WCHAR;
17
18/* These types MUST be 32-bit */
19typedef long LONG;
20typedef unsigned long DWORD;
21
22/* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */
23typedef unsigned long long QWORD;
24
25typedef char TCHAR;
26#define _T(x) x
27#define _TEXT(x) x
28
29typedef DWORD FSIZE_t;
30
31typedef struct __FATFS FATFS;
32
33
36typedef struct {
37 FATFS* fs;
38 WORD id;
39 BYTE attr;
40 BYTE stat;
41 DWORD sclust;
42 FSIZE_t objsize;
43 UINT lockid;
44} _FDID;
45
66typedef struct {
67 _FDID obj;
68 BYTE flag;
69 BYTE err;
70 FSIZE_t fptr;
71 DWORD clust;
72 DWORD sect;
73 DWORD dir_sect;
74 BYTE* dir_ptr;
75 DWORD* cltbl;
76 BYTE buf[512];
77} FIL;
78
79
80// --------------------------------------
82// -------------------------------------
89/* File access mode and open method flags (3rd argument of f_open) */
90#define FA_READ 0x01
91#define FA_WRITE 0x02
92#define FA_OPEN_EXISTING 0x00
93#define FA_CREATE_NEW 0x04
94#define FA_CREATE_ALWAYS 0x08
95#define FA_OPEN_ALWAYS 0x10
96#define FA_OPEN_APPEND 0x30
128
129
130
131FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode);
133FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br);
134FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw);
135FRESULT f_lseek (FIL* fp, FSIZE_t ofs);
136FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new);
137FRESULT f_unlink (const TCHAR* path);
139#define f_size(fp) ((fp)->obj.objsize)
140#define f_tell(fp) ((fp)->fptr)
141#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
143#ifndef EOF
144#define EOF (-1)
145#endif
146
150#endif
FRESULT f_unlink(const TCHAR *path)
Delete an existing file or directory.
FRESULT
File function return code (FRESULT)
Definition ff_ifc.h:106
FRESULT f_close(FIL *fp)
Close an open file object.
FRESULT f_lseek(FIL *fp, FSIZE_t ofs)
Move file pointer of the file object.
FRESULT f_rename(const TCHAR *path_old, const TCHAR *path_new)
Rename/Move a file or directory.
FRESULT f_read(FIL *fp, void *buff, UINT btr, UINT *br)
Read data from the file.
FRESULT f_write(FIL *fp, const void *buff, UINT btw, UINT *bw)
Write data to the file.
FRESULT f_open(FIL *fp, const TCHAR *path, BYTE mode)
Open or create a file.
@ FR_NO_FILESYSTEM
(13) There is no valid FAT volume
Definition ff_ifc.h:120
@ FR_EXIST
(8) Access denied due to prohibited access
Definition ff_ifc.h:115
@ FR_INVALID_PARAMETER
(19) Given parameter is invalid
Definition ff_ifc.h:126
@ FR_INVALID_OBJECT
(9) The file/directory object is invalid
Definition ff_ifc.h:116
@ FR_TIMEOUT
(15) Could not get a grant to access the volume within defined period
Definition ff_ifc.h:122
@ FR_INVALID_DRIVE
(11) The logical drive number is invalid
Definition ff_ifc.h:118
@ FR_MKFS_ABORTED
(14) The f_mkfs() aborted due to any problem
Definition ff_ifc.h:121
@ FR_TOO_MANY_OPEN_FILES
(18) Number of open files > _FS_LOCK
Definition ff_ifc.h:125
@ FR_OK
(0) Succeeded
Definition ff_ifc.h:107
@ FR_LOCKED
(16) The operation is rejected according to the file sharing policy
Definition ff_ifc.h:123
@ FR_INVALID_NAME
(6) The path name format is invalid
Definition ff_ifc.h:113
@ FR_DENIED
(7) Access denied due to prohibited access or directory full
Definition ff_ifc.h:114
@ FR_NO_FILE
(4) Could not find the file
Definition ff_ifc.h:111
@ FR_DISK_ERR
(1) A hard error occurred in the low level disk I/O layer
Definition ff_ifc.h:108
@ FR_INT_ERR
(2) Assertion failed
Definition ff_ifc.h:109
@ FR_WRITE_PROTECTED
(10) The physical drive is write protected
Definition ff_ifc.h:117
@ FR_NOT_READY
(3) The physical drive cannot work
Definition ff_ifc.h:110
@ FR_NO_PATH
(5) Could not find the path
Definition ff_ifc.h:112
@ FR_NOT_ENOUGH_CORE
(17) LFN working buffer could not be allocated
Definition ff_ifc.h:124
@ FR_NOT_ENABLED
(12) The volume has no work area
Definition ff_ifc.h:119
FatFs file structure used in file operations.
Definition ff_ifc.h:66
BYTE * dir_ptr
FIL.dir_ptr.
Definition ff_ifc.h:74
BYTE err
FIL.err.
Definition ff_ifc.h:69
DWORD sect
FIL.sect.
Definition ff_ifc.h:72
DWORD dir_sect
FIL.dir_sect.
Definition ff_ifc.h:73
DWORD * cltbl
FIL.cltbl.
Definition ff_ifc.h:75
_FDID obj
FIL.obj.
Definition ff_ifc.h:67
BYTE flag
FIL.flag.
Definition ff_ifc.h:68
DWORD clust
FIL.clust.
Definition ff_ifc.h:71
FSIZE_t fptr
FIL.fptr.
Definition ff_ifc.h:70