CMSIS2000  0.0.7
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ff.h File Reference
#include "integer.h"
#include "ffconf.h"
Include dependency graph for ff.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DIR
struct  FATFS
struct  FIL
struct  FILINFO

Macros

#define _FATFS   82786 /* Revision ID */
#define _T(x)   x
#define _TEXT(x)   x
#define AM_ARC   0x20 /* Archive */
#define AM_DIR   0x10 /* Directory */
#define AM_HID   0x02 /* Hidden */
#define AM_LFN   0x0F /* LFN entry */
#define AM_MASK   0x3F /* Mask of defined bits */
#define AM_RDO   0x01 /* Read only */
#define AM_SYS   0x04 /* System */
#define AM_VOL   0x08 /* Volume label */
#define CREATE_LINKMAP   0xFFFFFFFF
#define EOF   (-1)
#define f_eof(fp)   (((fp)->fptr == (fp)->fsize) ? 1 : 0)
#define f_error(fp)   (((fp)->flag & FA__ERROR) ? 1 : 0)
#define f_size(fp)   ((fp)->fsize)
#define f_tell(fp)   ((fp)->fptr)
#define FA__DIRTY   0x40
#define FA__ERROR   0x80
#define FA__WRITTEN   0x20
#define FA_CREATE_ALWAYS   0x08
#define FA_CREATE_NEW   0x04
#define FA_OPEN_ALWAYS   0x10
#define FA_OPEN_EXISTING   0x00
#define FA_READ   0x01
#define FA_WRITE   0x02
#define FS_FAT12   1
#define FS_FAT16   2
#define FS_FAT32   3
#define LD2PD(vol)   (BYTE)(vol) /* Each logical drive is bound to the same physical drive number */
#define LD2PT(vol)   0 /* Always mounts the 1st partition or in SFD */
#define LD_DWORD(ptr)   (DWORD)(((DWORD)*((BYTE*)(ptr)+3)<<24)|((DWORD)*((BYTE*)(ptr)+2)<<16)|((WORD)*((BYTE*)(ptr)+1)<<8)|*(BYTE*)(ptr))
#define LD_WORD(ptr)   (WORD)(((WORD)*((BYTE*)(ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
#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)
#define ST_WORD(ptr, val)   *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8)

Typedefs

typedef char TCHAR

Enumerations

enum  FRESULT {
  FR_OK = 0, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY,
  FR_NO_FILE, FR_NO_PATH, FR_INVALID_NAME, FR_DENIED,
  FR_EXIST, FR_INVALID_OBJECT, FR_WRITE_PROTECTED, FR_INVALID_DRIVE,
  FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_MKFS_ABORTED, FR_TIMEOUT,
  FR_LOCKED, FR_NOT_ENOUGH_CORE, FR_TOO_MANY_OPEN_FILES, FR_INVALID_PARAMETER
}

Functions

FRESULT f_chdir (const TCHAR *path)
FRESULT f_chdrive (BYTE drv)
FRESULT f_chmod (const TCHAR *path, BYTE value, BYTE mask)
FRESULT f_close (FIL *fp)
FRESULT f_fdisk (BYTE pdrv, const DWORD szt[], void *work)
FRESULT f_forward (FIL *fp, UINT(*func)(const BYTE *, UINT), UINT btf, UINT *bf)
FRESULT f_getcwd (TCHAR *buff, UINT len)
FRESULT f_getfree (const TCHAR *path, DWORD *nclst, FATFS **fatfs)
FRESULT f_getlabel (const TCHAR *path, TCHAR *label, DWORD *sn)
TCHARf_gets (TCHAR *buff, int len, FIL *fp)
FRESULT f_lseek (FIL *fp, DWORD ofs)
FRESULT f_mkdir (const TCHAR *path)
FRESULT f_mkfs (BYTE vol, BYTE sfd, UINT au)
FRESULT f_mount (BYTE vol, FATFS *fs)
FRESULT f_open (FIL *fp, const TCHAR *path, BYTE mode)
FRESULT f_opendir (DIR *dj, const TCHAR *path)
int f_printf (FIL *fp, const TCHAR *str,...)
int f_putc (TCHAR c, FIL *fp)
int f_puts (const TCHAR *str, FIL *cp)
FRESULT f_read (FIL *fp, void *buff, UINT btr, UINT *br)
FRESULT f_readdir (DIR *dj, FILINFO *fno)
FRESULT f_rename (const TCHAR *path_old, const TCHAR *path_new)
FRESULT f_setlabel (const TCHAR *label)
FRESULT f_stat (const TCHAR *path, FILINFO *fno)
FRESULT f_sync (FIL *fp)
FRESULT f_truncate (FIL *fp)
FRESULT f_unlink (const TCHAR *path)
FRESULT f_utime (const TCHAR *path, const FILINFO *fno)
FRESULT f_write (FIL *fp, const void *buff, UINT btw, UINT *bw)
DWORD get_fattime (void)

Macro Definition Documentation

#define _FATFS   82786 /* Revision ID */

Definition at line 18 of file ff.h.

#define _T (   x)    x

Definition at line 67 of file ff.h.

#define _TEXT (   x)    x

Definition at line 68 of file ff.h.

#define AM_ARC   0x20 /* Archive */

Definition at line 312 of file ff.h.

Referenced by f_chmod(), f_rename(), and f_sync().

#define AM_DIR   0x10 /* Directory */

Definition at line 311 of file ff.h.

Referenced by f_mkdir(), f_open(), f_opendir(), f_rename(), f_unlink(), and follow_path().

#define AM_HID   0x02 /* Hidden */

Definition at line 307 of file ff.h.

Referenced by f_chmod().

#define AM_LFN   0x0F /* LFN entry */

Definition at line 310 of file ff.h.

Referenced by dir_find(), and dir_read().

#define AM_MASK   0x3F /* Mask of defined bits */

Definition at line 313 of file ff.h.

Referenced by dir_find(), and dir_read().

#define AM_RDO   0x01 /* Read only */

Definition at line 306 of file ff.h.

Referenced by f_chmod(), f_open(), and f_unlink().

#define AM_SYS   0x04 /* System */

Definition at line 308 of file ff.h.

Referenced by f_chmod().

#define AM_VOL   0x08 /* Volume label */

Definition at line 309 of file ff.h.

Referenced by dir_find(), and dir_read().

#define CREATE_LINKMAP   0xFFFFFFFF

Definition at line 317 of file ff.h.

Referenced by f_lseek().

#define EOF   (-1)

Definition at line 242 of file ff.h.

#define f_eof (   fp)    (((fp)->fptr == (fp)->fsize) ? 1 : 0)

Definition at line 236 of file ff.h.

#define f_error (   fp)    (((fp)->flag & FA__ERROR) ? 1 : 0)

Definition at line 237 of file ff.h.

#define f_size (   fp)    ((fp)->fsize)

Definition at line 239 of file ff.h.

#define f_tell (   fp)    ((fp)->fptr)

Definition at line 238 of file ff.h.

#define FA__DIRTY   0x40

Definition at line 293 of file ff.h.

Referenced by f_lseek(), f_read(), f_sync(), and f_write().

#define FA__ERROR   0x80

Definition at line 285 of file ff.h.

Referenced by f_lseek(), f_read(), f_truncate(), and f_write().

#define FA__WRITTEN   0x20

Definition at line 292 of file ff.h.

Referenced by f_lseek(), f_open(), f_sync(), f_truncate(), and f_write().

#define FA_CREATE_ALWAYS   0x08

Definition at line 290 of file ff.h.

Referenced by f_open().

#define FA_CREATE_NEW   0x04

Definition at line 289 of file ff.h.

Referenced by f_open().

#define FA_OPEN_ALWAYS   0x10

Definition at line 291 of file ff.h.

Referenced by f_open().

#define FA_OPEN_EXISTING   0x00

Definition at line 284 of file ff.h.

Referenced by load_file_from_external_source_to().

#define FA_READ   0x01

Definition at line 283 of file ff.h.

Referenced by f_open(), f_read(), and load_file_from_external_source_to().

#define FA_WRITE   0x02

Definition at line 288 of file ff.h.

Referenced by f_lseek(), f_open(), f_truncate(), and f_write().

#define FS_FAT12   1

Definition at line 299 of file ff.h.

Referenced by chk_mounted(), f_getfree(), get_fat(), and put_fat().

#define FS_FAT16   2

Definition at line 300 of file ff.h.

Referenced by chk_mounted(), f_getfree(), get_fat(), and put_fat().

#define FS_FAT32   3

Definition at line 301 of file ff.h.

Referenced by chk_mounted(), dir_sdi(), f_getfree(), f_mkdir(), f_rename(), get_fat(), ld_clust(), put_fat(), and sync_fs().

#define LD2PD (   vol)    (BYTE)(vol) /* Each logical drive is bound to the same physical drive number */

Definition at line 45 of file ff.h.

Referenced by chk_mounted().

#define LD2PT (   vol)    0 /* Always mounts the 1st partition or in SFD */

Definition at line 46 of file ff.h.

Referenced by chk_mounted().

#define LD_DWORD (   ptr)    (DWORD)(((DWORD)*((BYTE*)(ptr)+3)<<24)|((DWORD)*((BYTE*)(ptr)+2)<<16)|((WORD)*((BYTE*)(ptr)+1)<<8)|*(BYTE*)(ptr))

Definition at line 331 of file ff.h.

Referenced by check_fs(), chk_mounted(), f_getfree(), f_open(), get_fat(), get_fileinfo(), and put_fat().

#define LD_WORD (   ptr)    (WORD)(((WORD)*((BYTE*)(ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))

Definition at line 330 of file ff.h.

Referenced by check_fs(), chk_mounted(), f_getfree(), get_fat(), get_fileinfo(), and ld_clust().

#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)

Definition at line 333 of file ff.h.

Referenced by f_mkdir(), f_open(), f_sync(), put_fat(), and sync_fs().

#define ST_WORD (   ptr,
  val 
)    *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8)

Definition at line 332 of file ff.h.

Referenced by f_sync(), f_utime(), put_fat(), st_clust(), and sync_fs().

Typedef Documentation

typedef char TCHAR

Definition at line 66 of file ff.h.

Enumeration Type Documentation

enum FRESULT
Enumerator:
FR_OK 
FR_DISK_ERR 
FR_INT_ERR 
FR_NOT_READY 
FR_NO_FILE 
FR_NO_PATH 
FR_INVALID_NAME 
FR_DENIED 
FR_EXIST 
FR_INVALID_OBJECT 
FR_WRITE_PROTECTED 
FR_INVALID_DRIVE 
FR_NOT_ENABLED 
FR_NO_FILESYSTEM 
FR_MKFS_ABORTED 
FR_TIMEOUT 
FR_LOCKED 
FR_NOT_ENOUGH_CORE 
FR_TOO_MANY_OPEN_FILES 
FR_INVALID_PARAMETER 

Definition at line 178 of file ff.h.

Function Documentation

FRESULT f_chdir ( const TCHAR path)
FRESULT f_chdrive ( BYTE  drv)
FRESULT f_chmod ( const TCHAR path,
BYTE  value,
BYTE  mask 
)

Definition at line 3414 of file ff.c.

References _FS_RPATH, AM_ARC, AM_HID, AM_RDO, AM_SYS, chk_mounted(), DEF_NAMEBUF, DIR::dir, DIR_Attr, DIR::fn, follow_path(), FR_INVALID_NAME, FR_OK, FREE_BUF, DIR::fs, INIT_BUF, LEAVE_FF, NS, NS_DOT, sync_fs(), and FATFS::wflag.

Here is the call graph for this function:

FRESULT f_close ( FIL fp)

Definition at line 2708 of file ff.c.

References f_sync(), FR_OK, FIL::fs, LEAVE_FF, and validate().

Referenced by load_file_from_external_source_to().

Here is the call graph for this function:

Here is the caller graph for this function:

FRESULT f_fdisk ( BYTE  pdrv,
const DWORD  szt[],
void *  work 
)
FRESULT f_forward ( FIL fp,
UINT(*)(const BYTE *, UINT func,
UINT  btf,
UINT bf 
)
FRESULT f_getcwd ( TCHAR buff,
UINT  len 
)
FRESULT f_getfree ( const TCHAR path,
DWORD nclst,
FATFS **  fatfs 
)
FRESULT f_getlabel ( const TCHAR path,
TCHAR label,
DWORD sn 
)
TCHAR* f_gets ( TCHAR buff,
int  len,
FIL fp 
)
FRESULT f_mkfs ( BYTE  vol,
BYTE  sfd,
UINT  au 
)
FRESULT f_mount ( BYTE  vol,
FATFS fs 
)

Definition at line 2268 of file ff.c.

References _VOLUMES, FR_INT_ERR, FR_INVALID_DRIVE, FR_OK, and FATFS::fs_type.

Referenced by load_file_from_external_source_to().

Here is the caller graph for this function:

FRESULT f_opendir ( DIR dj,
const TCHAR path 
)

Definition at line 3035 of file ff.c.

References AM_DIR, chk_mounted(), DEF_NAMEBUF, DIR::dir, DIR_Attr, dir_sdi(), follow_path(), FR_INVALID_OBJECT, FR_NO_FILE, FR_NO_PATH, FR_OK, FREE_BUF, DIR::fs, FATFS::id, DIR::id, INIT_BUF, ld_clust(), LEAVE_FF, and DIR::sclust.

Here is the call graph for this function:

int f_printf ( FIL fp,
const TCHAR str,
  ... 
)
int f_putc ( TCHAR  c,
FIL fp 
)
int f_puts ( const TCHAR str,
FIL cp 
)
FRESULT f_read ( FIL fp,
void *  buff,
UINT  btr,
UINT br 
)
FRESULT f_readdir ( DIR dj,
FILINFO fno 
)

Definition at line 3082 of file ff.c.

References DEF_NAMEBUF, dir_next(), dir_read(), dir_sdi(), FR_NO_FILE, FR_OK, FREE_BUF, DIR::fs, get_fileinfo(), INIT_BUF, LEAVE_FF, DIR::sect, and validate().

Here is the call graph for this function:

FRESULT f_setlabel ( const TCHAR label)
FRESULT f_stat ( const TCHAR path,
FILINFO fno 
)

Definition at line 3124 of file ff.c.

References chk_mounted(), DEF_NAMEBUF, DIR::dir, follow_path(), FR_INVALID_NAME, FR_OK, FREE_BUF, DIR::fs, get_fileinfo(), INIT_BUF, and LEAVE_FF.

Here is the call graph for this function:

FRESULT f_sync ( FIL fp)

Definition at line 2660 of file ff.c.

References AM_ARC, FIL::buf, DIR_Attr, DIR_FileSize, DIR_LstAccDate, FIL::dir_ptr, FIL::dir_sect, DIR_WrtTime, disk_write(), FATFS::drv, FIL::dsect, FA__DIRTY, FA__WRITTEN, FIL::flag, FR_DISK_ERR, FR_OK, FIL::fs, FIL::fsize, get_fattime(), LEAVE_FF, move_window(), RES_OK, FIL::sclust, st_clust(), ST_DWORD, ST_WORD, sync_fs(), validate(), and FATFS::wflag.

Referenced by f_close().

Here is the call graph for this function:

Here is the caller graph for this function:

FRESULT f_truncate ( FIL fp)
FRESULT f_utime ( const TCHAR path,
const FILINFO fno 
)
DWORD get_fattime ( void  )

Referenced by f_mkdir(), f_open(), and f_sync().

Here is the caller graph for this function: