CMSIS2000  0.0.7
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ff.c File Reference
#include "ff.h"
#include "diskio.h"
Include dependency graph for ff.c:

Go to the source code of this file.

Macros

#define ABORT(fs, res)   { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }
#define BPB_BkBootSec   50 /* Offset of backup boot sector (2) */
#define BPB_BytsPerSec   11 /* Sector size [byte] (2) */
#define BPB_ExtFlags   40 /* Extended flags (2) */
#define BPB_FATSz16   22 /* FAT size [sector] (2) */
#define BPB_FATSz32   36 /* FAT size [sector] (4) */
#define BPB_FSInfo   48 /* Offset of FSInfo sector (2) */
#define BPB_FSVer   42 /* File system version (2) */
#define BPB_HiddSec   28 /* Number of special hidden sectors (4) */
#define BPB_Media   21 /* Media descriptor (1) */
#define BPB_NumFATs   16 /* Number of FAT copies (1) */
#define BPB_NumHeads   26 /* Number of heads (2) */
#define BPB_RootClus   44 /* Root dir first cluster (4) */
#define BPB_RootEntCnt   17 /* Number of root dir entries for FAT12/16 (2) */
#define BPB_RsvdSecCnt   14 /* Size of reserved area [sector] (2) */
#define BPB_SecPerClus   13 /* Cluster size [sector] (1) */
#define BPB_SecPerTrk   24 /* Track size [sector] (2) */
#define BPB_TotSec16   19 /* Volume size [sector] (2) */
#define BPB_TotSec32   32 /* Volume size [sector] (4) */
#define BS_55AA   510 /* Boot sector signature (2) */
#define BS_BootSig   38 /* Extended boot signature (1) */
#define BS_BootSig32   66 /* Extended boot signature (1) */
#define BS_DrvNum   36 /* Physical drive number (2) */
#define BS_DrvNum32   64 /* Physical drive number (2) */
#define BS_FilSysType   54 /* File system type (1) */
#define BS_FilSysType32   82 /* File system type (1) */
#define BS_jmpBoot   0 /* Jump instruction (3) */
#define BS_OEMName   3 /* OEM name (8) */
#define BS_VolID   39 /* Volume serial number (4) */
#define BS_VolID32   67 /* Volume serial number (4) */
#define BS_VolLab   43 /* Volume label (8) */
#define BS_VolLab32   71 /* Volume label (8) */
#define DDE   0xE5 /* Deleted directory entry mark in DIR_Name[0] */
#define DEF_NAMEBUF   BYTE sfn[12]
#define DIR_Attr   11 /* Attribute (1) */
#define DIR_CrtDate   16 /* Created date (2) */
#define DIR_CrtTime   14 /* Created time (2) */
#define DIR_CrtTimeTenth   13 /* Created time sub-second (1) */
#define DIR_FileSize   28 /* File size (4) */
#define DIR_FstClusHI   20 /* Higher 16-bit of first cluster (2) */
#define DIR_FstClusLO   26 /* Lower 16-bit of first cluster (2) */
#define DIR_LstAccDate   18 /* Last accessed date (2) */
#define DIR_Name   0 /* Short file name (11) */
#define DIR_NTres   12 /* NT flag (1) */
#define DIR_WrtDate   24 /* Modified date (2) */
#define DIR_WrtTime   22 /* Modified time (2) */
#define ENTER_FF(fs)
#define FREE_BUF()
#define FSI_Free_Count   488 /* FSI: Number of free clusters (4) */
#define FSI_LeadSig   0 /* FSI: Leading signature (4) */
#define FSI_Nxt_Free   492 /* FSI: Last allocated cluster (4) */
#define FSI_StrucSig   484 /* FSI: Structure signature (4) */
#define INIT_BUF(dobj)   (dobj).fn = sfn
#define IsDBCS1(c)   0
#define IsDBCS2(c)   0
#define IsDigit(c)   (((c)>='0')&&((c)<='9'))
#define IsLower(c)   (((c)>='a')&&((c)<='z'))
#define IsUpper(c)   (((c)>='A')&&((c)<='Z'))
#define LDIR_Attr   11 /* LFN attribute (1) */
#define LDIR_Chksum   13 /* Sum of corresponding SFN entry */
#define LDIR_FstClusLO   26 /* Filled by zero (0) */
#define LDIR_Ord   0 /* LFN entry order and LLE flag (1) */
#define LDIR_Type   12 /* LFN type (1) */
#define LEAVE_FF(fs, res)   return res
#define LLE   0x40 /* Last long entry flag in LDIR_Ord */
#define MBR_Table   446 /* MBR: Partition table offset (2) */
#define MIN_FAT16   4086 /* Minimum number of clusters for FAT16 */
#define MIN_FAT32   65526 /* Minimum number of clusters for FAT32 */
#define NDDE   0x05 /* Replacement of the character collides with DDE */
#define NS   11 /* Index of name status byte in fn[] */
#define NS_BODY   0x08 /* Lower case flag (body) */
#define NS_DOT   0x20 /* Dot entry */
#define NS_EXT   0x10 /* Lower case flag (ext) */
#define NS_LAST   0x04 /* Last segment */
#define NS_LFN   0x02 /* Force to create LFN entry */
#define NS_LOSS   0x01 /* Out of 8.3 format */
#define SS(fs)   ((fs)->ssize) /* Variable sector size */
#define SZ_DIR   32 /* Size of a directory entry */
#define SZ_PTE   16 /* MBR: Size of a partition table entry */

Functions

static BYTE check_fs (FATFS *fs, DWORD sect)
static int chk_chr (const char *str, int chr)
static FRESULT chk_mounted (const TCHAR **path, FATFS **rfs, BYTE wmode)
DWORD clust2sect (FATFS *fs, DWORD clst)
static DWORD create_chain (FATFS *fs, DWORD clst)
static FRESULT create_name (DIR *dj, const TCHAR **path)
static FRESULT dir_alloc (DIR *dj, UINT nent)
static FRESULT dir_find (DIR *dj)
static FRESULT dir_next (DIR *dj, int stretch)
static FRESULT dir_read (DIR *dj, int vol)
static FRESULT dir_register (DIR *dj)
static FRESULT dir_remove (DIR *dj)
static FRESULT dir_sdi (DIR *dj, WORD idx)
FRESULT f_chmod (const TCHAR *path, BYTE value, BYTE mask)
FRESULT f_close (FIL *fp)
FRESULT f_getfree (const TCHAR *path, DWORD *nclst, FATFS **fatfs)
FRESULT f_lseek (FIL *fp, DWORD ofs)
FRESULT f_mkdir (const TCHAR *path)
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)
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_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)
static FRESULT follow_path (DIR *dj, const TCHAR *path)
DWORD get_fat (FATFS *fs, DWORD clst)
static void get_fileinfo (DIR *dj, FILINFO *fno)
static DWORD ld_clust (FATFS *fs, BYTE *dir)
static int mem_cmp (const void *dst, const void *src, UINT cnt)
static void mem_cpy (void *dst, const void *src, UINT cnt)
static void mem_set (void *dst, int val, UINT cnt)
static FRESULT move_window (FATFS *fs, DWORD sector)
FRESULT put_fat (FATFS *fs, DWORD clst, DWORD val)
static FRESULT remove_chain (FATFS *fs, DWORD clst)
static void st_clust (BYTE *dir, DWORD cl)
static FRESULT sync_fs (FATFS *fs)
static FRESULT sync_window (FATFS *fs)
static FRESULT validate (void *obj)

Variables

static WORD Fsid

Macro Definition Documentation

#define ABORT (   fs,
  res 
)    { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }

Definition at line 137 of file ff.c.

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

#define BPB_BkBootSec   50 /* Offset of backup boot sector (2) */

Definition at line 423 of file ff.c.

#define BPB_BytsPerSec   11 /* Sector size [byte] (2) */

Definition at line 401 of file ff.c.

Referenced by chk_mounted().

#define BPB_ExtFlags   40 /* Extended flags (2) */

Definition at line 419 of file ff.c.

#define BPB_FATSz16   22 /* FAT size [sector] (2) */

Definition at line 408 of file ff.c.

Referenced by chk_mounted().

#define BPB_FATSz32   36 /* FAT size [sector] (4) */

Definition at line 418 of file ff.c.

Referenced by chk_mounted().

#define BPB_FSInfo   48 /* Offset of FSInfo sector (2) */

Definition at line 422 of file ff.c.

Referenced by chk_mounted().

#define BPB_FSVer   42 /* File system version (2) */

Definition at line 420 of file ff.c.

#define BPB_HiddSec   28 /* Number of special hidden sectors (4) */

Definition at line 411 of file ff.c.

#define BPB_Media   21 /* Media descriptor (1) */

Definition at line 407 of file ff.c.

#define BPB_NumFATs   16 /* Number of FAT copies (1) */

Definition at line 404 of file ff.c.

Referenced by chk_mounted().

#define BPB_NumHeads   26 /* Number of heads (2) */

Definition at line 410 of file ff.c.

#define BPB_RootClus   44 /* Root dir first cluster (4) */

Definition at line 421 of file ff.c.

Referenced by chk_mounted().

#define BPB_RootEntCnt   17 /* Number of root dir entries for FAT12/16 (2) */

Definition at line 405 of file ff.c.

Referenced by chk_mounted().

#define BPB_RsvdSecCnt   14 /* Size of reserved area [sector] (2) */

Definition at line 403 of file ff.c.

Referenced by chk_mounted().

#define BPB_SecPerClus   13 /* Cluster size [sector] (1) */

Definition at line 402 of file ff.c.

Referenced by chk_mounted().

#define BPB_SecPerTrk   24 /* Track size [sector] (2) */

Definition at line 409 of file ff.c.

#define BPB_TotSec16   19 /* Volume size [sector] (2) */

Definition at line 406 of file ff.c.

Referenced by chk_mounted().

#define BPB_TotSec32   32 /* Volume size [sector] (4) */

Definition at line 412 of file ff.c.

Referenced by chk_mounted().

#define BS_55AA   510 /* Boot sector signature (2) */

Definition at line 435 of file ff.c.

Referenced by check_fs(), chk_mounted(), and sync_fs().

#define BS_BootSig   38 /* Extended boot signature (1) */

Definition at line 414 of file ff.c.

#define BS_BootSig32   66 /* Extended boot signature (1) */

Definition at line 425 of file ff.c.

#define BS_DrvNum   36 /* Physical drive number (2) */

Definition at line 413 of file ff.c.

#define BS_DrvNum32   64 /* Physical drive number (2) */

Definition at line 424 of file ff.c.

#define BS_FilSysType   54 /* File system type (1) */

Definition at line 417 of file ff.c.

Referenced by check_fs().

#define BS_FilSysType32   82 /* File system type (1) */

Definition at line 428 of file ff.c.

Referenced by check_fs().

#define BS_jmpBoot   0 /* Jump instruction (3) */

Definition at line 399 of file ff.c.

#define BS_OEMName   3 /* OEM name (8) */

Definition at line 400 of file ff.c.

#define BS_VolID   39 /* Volume serial number (4) */

Definition at line 415 of file ff.c.

#define BS_VolID32   67 /* Volume serial number (4) */

Definition at line 426 of file ff.c.

#define BS_VolLab   43 /* Volume label (8) */

Definition at line 416 of file ff.c.

#define BS_VolLab32   71 /* Volume label (8) */

Definition at line 427 of file ff.c.

#define DDE   0xE5 /* Deleted directory entry mark in DIR_Name[0] */

Definition at line 456 of file ff.c.

Referenced by create_name(), dir_alloc(), dir_find(), dir_read(), dir_remove(), and get_fileinfo().

#define DEF_NAMEBUF   BYTE sfn[12]

Definition at line 489 of file ff.c.

Referenced by f_chmod(), f_mkdir(), f_open(), f_opendir(), f_readdir(), f_rename(), f_stat(), f_unlink(), and f_utime().

#define DIR_Attr   11 /* Attribute (1) */
#define DIR_CrtDate   16 /* Created date (2) */

Definition at line 442 of file ff.c.

#define DIR_CrtTime   14 /* Created time (2) */

Definition at line 441 of file ff.c.

Referenced by f_open().

#define DIR_CrtTimeTenth   13 /* Created time sub-second (1) */

Definition at line 440 of file ff.c.

#define DIR_FileSize   28 /* File size (4) */

Definition at line 448 of file ff.c.

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

#define DIR_FstClusHI   20 /* Higher 16-bit of first cluster (2) */

Definition at line 444 of file ff.c.

Referenced by ld_clust(), and st_clust().

#define DIR_FstClusLO   26 /* Lower 16-bit of first cluster (2) */

Definition at line 447 of file ff.c.

Referenced by ld_clust(), and st_clust().

#define DIR_LstAccDate   18 /* Last accessed date (2) */

Definition at line 443 of file ff.c.

Referenced by f_sync().

#define DIR_Name   0 /* Short file name (11) */

Definition at line 437 of file ff.c.

Referenced by dir_find(), dir_read(), and f_mkdir().

#define DIR_NTres   12 /* NT flag (1) */

Definition at line 439 of file ff.c.

Referenced by dir_register(), and get_fileinfo().

#define DIR_WrtDate   24 /* Modified date (2) */

Definition at line 446 of file ff.c.

Referenced by f_utime(), and get_fileinfo().

#define DIR_WrtTime   22 /* Modified time (2) */

Definition at line 445 of file ff.c.

Referenced by f_mkdir(), f_sync(), f_utime(), and get_fileinfo().

#define ENTER_FF (   fs)

Definition at line 133 of file ff.c.

Referenced by chk_mounted(), and validate().

#define FREE_BUF ( )

Definition at line 491 of file ff.c.

Referenced by f_chmod(), f_mkdir(), f_open(), f_opendir(), f_readdir(), f_rename(), f_stat(), f_unlink(), and f_utime().

#define FSI_Free_Count   488 /* FSI: Number of free clusters (4) */

Definition at line 431 of file ff.c.

Referenced by chk_mounted(), and sync_fs().

#define FSI_LeadSig   0 /* FSI: Leading signature (4) */

Definition at line 429 of file ff.c.

Referenced by chk_mounted(), and sync_fs().

#define FSI_Nxt_Free   492 /* FSI: Last allocated cluster (4) */

Definition at line 432 of file ff.c.

Referenced by chk_mounted(), and sync_fs().

#define FSI_StrucSig   484 /* FSI: Structure signature (4) */

Definition at line 430 of file ff.c.

Referenced by chk_mounted(), and sync_fs().

#define INIT_BUF (   dobj)    (dobj).fn = sfn

Definition at line 490 of file ff.c.

Referenced by f_chmod(), f_mkdir(), f_open(), f_opendir(), f_readdir(), f_rename(), f_stat(), f_unlink(), and f_utime().

#define IsDBCS1 (   c)    0

Definition at line 373 of file ff.c.

Referenced by create_name(), and get_fileinfo().

#define IsDBCS2 (   c)    0

Definition at line 374 of file ff.c.

Referenced by create_name(), and get_fileinfo().

#define IsDigit (   c)    (((c)>='0')&&((c)<='9'))

Definition at line 355 of file ff.c.

#define IsLower (   c)    (((c)>='a')&&((c)<='z'))

Definition at line 354 of file ff.c.

Referenced by create_name().

#define IsUpper (   c)    (((c)>='A')&&((c)<='Z'))

Definition at line 353 of file ff.c.

Referenced by create_name(), and get_fileinfo().

#define LDIR_Attr   11 /* LFN attribute (1) */

Definition at line 450 of file ff.c.

#define LDIR_Chksum   13 /* Sum of corresponding SFN entry */

Definition at line 452 of file ff.c.

Referenced by dir_find(), and dir_read().

#define LDIR_FstClusLO   26 /* Filled by zero (0) */

Definition at line 453 of file ff.c.

#define LDIR_Ord   0 /* LFN entry order and LLE flag (1) */

Definition at line 449 of file ff.c.

#define LDIR_Type   12 /* LFN type (1) */

Definition at line 451 of file ff.c.

#define LEAVE_FF (   fs,
  res 
)    return res
#define LLE   0x40 /* Last long entry flag in LDIR_Ord */

Definition at line 455 of file ff.c.

#define MBR_Table   446 /* MBR: Partition table offset (2) */

Definition at line 433 of file ff.c.

Referenced by chk_mounted().

#define MIN_FAT16   4086 /* Minimum number of clusters for FAT16 */

Definition at line 391 of file ff.c.

Referenced by chk_mounted().

#define MIN_FAT32   65526 /* Minimum number of clusters for FAT32 */

Definition at line 392 of file ff.c.

Referenced by chk_mounted().

#define NDDE   0x05 /* Replacement of the character collides with DDE */

Definition at line 457 of file ff.c.

Referenced by create_name(), and get_fileinfo().

#define NS   11 /* Index of name status byte in fn[] */
#define NS_BODY   0x08 /* Lower case flag (body) */

Definition at line 384 of file ff.c.

Referenced by create_name(), dir_register(), and get_fileinfo().

#define NS_DOT   0x20 /* Dot entry */

Definition at line 386 of file ff.c.

Referenced by create_name(), dir_register(), f_chmod(), f_mkdir(), f_rename(), f_unlink(), f_utime(), and follow_path().

#define NS_EXT   0x10 /* Lower case flag (ext) */

Definition at line 385 of file ff.c.

Referenced by create_name(), dir_register(), and get_fileinfo().

#define NS_LAST   0x04 /* Last segment */

Definition at line 383 of file ff.c.

Referenced by create_name(), and follow_path().

#define NS_LFN   0x02 /* Force to create LFN entry */

Definition at line 382 of file ff.c.

Referenced by create_name(), and dir_register().

#define NS_LOSS   0x01 /* Out of 8.3 format */

Definition at line 381 of file ff.c.

Referenced by create_name(), dir_find(), and dir_register().

#define SS (   fs)    ((fs)->ssize) /* Variable sector size */

Definition at line 119 of file ff.c.

Referenced by chk_mounted(), dir_next(), dir_sdi(), f_getfree(), f_lseek(), f_mkdir(), f_read(), f_write(), get_fat(), and put_fat().

#define SZ_DIR   32 /* Size of a directory entry */

Definition at line 454 of file ff.c.

Referenced by chk_mounted(), dir_next(), dir_register(), dir_sdi(), f_mkdir(), and f_rename().

#define SZ_PTE   16 /* MBR: Size of a partition table entry */

Definition at line 434 of file ff.c.

Referenced by chk_mounted().

Function Documentation

static BYTE check_fs ( FATFS fs,
DWORD  sect 
)
static

Definition at line 2041 of file ff.c.

References BS_55AA, BS_FilSysType, BS_FilSysType32, disk_read(), FATFS::drv, LD_DWORD, LD_WORD, RES_OK, and FATFS::win.

Referenced by chk_mounted().

Here is the call graph for this function:

Here is the caller graph for this function:

static int chk_chr ( const char *  str,
int  chr 
)
static

Definition at line 575 of file ff.c.

Referenced by create_name().

Here is the caller graph for this function:

DWORD clust2sect ( FATFS fs,
DWORD  clst 
)

Definition at line 824 of file ff.c.

References FATFS::csize, FATFS::database, and FATFS::n_fatent.

Referenced by dir_next(), dir_sdi(), f_lseek(), f_mkdir(), f_read(), f_rename(), f_write(), and remove_chain().

Here is the caller graph for this function:

static DWORD create_chain ( FATFS fs,
DWORD  clst 
)
static

Definition at line 1001 of file ff.c.

References FR_DISK_ERR, FR_OK, FATFS::free_clust, FATFS::fsi_flag, get_fat(), FATFS::last_clust, FATFS::n_fatent, and put_fat().

Referenced by dir_next(), f_lseek(), f_mkdir(), and f_write().

Here is the call graph for this function:

Here is the caller graph for this function:

static FRESULT create_name ( DIR dj,
const TCHAR **  path 
)
static

Definition at line 1687 of file ff.c.

References _MAX_LFN, chk_chr(), DDE, ff_convert(), ff_wtoupper(), DIR::fn, FR_INVALID_NAME, FR_OK, IsDBCS1, IsDBCS2, IsLower, IsUpper, mem_set(), NDDE, NS, NS_BODY, NS_DOT, NS_EXT, NS_LAST, NS_LFN, and NS_LOSS.

Referenced by follow_path().

Here is the call graph for this function:

Here is the caller graph for this function:

static FRESULT dir_alloc ( DIR dj,
UINT  nent 
)
static

Definition at line 1205 of file ff.c.

References DDE, DIR::dir, dir_next(), dir_sdi(), FR_OK, DIR::fs, move_window(), and DIR::sect.

Referenced by dir_register().

Here is the call graph for this function:

Here is the caller graph for this function:

static FRESULT dir_find ( DIR dj)
static

Definition at line 1445 of file ff.c.

References AM_LFN, AM_MASK, AM_VOL, DDE, DIR::dir, DIR_Attr, DIR_Name, dir_next(), dir_sdi(), DIR::fn, FR_NO_FILE, FR_OK, DIR::fs, DIR::index, LDIR_Chksum, mem_cmp(), move_window(), NS, NS_LOSS, and DIR::sect.

Referenced by dir_register(), and follow_path().

Here is the call graph for this function:

Here is the caller graph for this function:

static FRESULT dir_next ( DIR dj,
int  stretch 
)
static

Definition at line 1136 of file ff.c.

References DIR::clust, clust2sect(), create_chain(), FATFS::csize, DIR::dir, FR_DENIED, FR_DISK_ERR, FR_INT_ERR, FR_NO_FILE, FR_OK, DIR::fs, get_fat(), DIR::index, mem_set(), FATFS::n_fatent, FATFS::n_rootdir, DIR::sect, SS, sync_window(), SZ_DIR, FATFS::wflag, FATFS::win, and FATFS::winsect.

Referenced by dir_alloc(), dir_find(), dir_read(), dir_register(), dir_remove(), and f_readdir().

Here is the call graph for this function:

Here is the caller graph for this function:

static FRESULT dir_read ( DIR dj,
int  vol 
)
static

Definition at line 1506 of file ff.c.

References _FS_RPATH, AM_LFN, AM_MASK, AM_VOL, DDE, DIR::dir, DIR_Attr, DIR_Name, dir_next(), FR_NO_FILE, FR_OK, DIR::fs, DIR::index, LDIR_Chksum, move_window(), and DIR::sect.

Referenced by f_readdir(), and f_unlink().

Here is the call graph for this function:

Here is the caller graph for this function:

static FRESULT dir_register ( DIR dj)
static

Definition at line 1564 of file ff.c.

References _FS_RPATH, DIR::dir, dir_alloc(), dir_find(), dir_next(), DIR_NTres, dir_sdi(), DIR::fn, FR_DENIED, FR_INVALID_NAME, FR_NO_FILE, FR_OK, DIR::fs, DIR::index, mem_cpy(), mem_set(), move_window(), NS, NS_BODY, NS_DOT, NS_EXT, NS_LFN, NS_LOSS, DIR::sect, SZ_DIR, and FATFS::wflag.

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

Here is the call graph for this function:

Here is the caller graph for this function:

static FRESULT dir_remove ( DIR dj)
static

Definition at line 1642 of file ff.c.

References DDE, DIR::dir, dir_next(), dir_sdi(), FR_INT_ERR, FR_NO_FILE, FR_OK, DIR::fs, DIR::index, move_window(), DIR::sect, and FATFS::wflag.

Referenced by f_rename(), and f_unlink().

Here is the call graph for this function:

Here is the caller graph for this function:

static FRESULT dir_sdi ( DIR dj,
WORD  idx 
)
static

Definition at line 1088 of file ff.c.

References DIR::clust, clust2sect(), FATFS::csize, DIR::dir, FATFS::dirbase, FR_DISK_ERR, FR_INT_ERR, FR_OK, DIR::fs, FS_FAT32, FATFS::fs_type, get_fat(), DIR::index, FATFS::n_fatent, FATFS::n_rootdir, DIR::sclust, DIR::sect, SS, SZ_DIR, and FATFS::win.

Referenced by dir_alloc(), dir_find(), dir_register(), dir_remove(), f_opendir(), f_readdir(), f_unlink(), and follow_path().

Here is the call graph for this function:

Here is the caller graph for this function:

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_getfree ( const TCHAR path,
DWORD nclst,
FATFS **  fatfs 
)
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:

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_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 
)
static FRESULT follow_path ( DIR dj,
const TCHAR path 
)
static

Definition at line 1979 of file ff.c.

References _FS_RPATH, AM_DIR, create_name(), DIR::dir, DIR_Attr, dir_find(), dir_sdi(), DIR::fn, FR_NO_FILE, FR_NO_PATH, FR_OK, DIR::fs, ld_clust(), NS, NS_DOT, NS_LAST, and DIR::sclust.

Referenced by f_chmod(), f_mkdir(), f_open(), f_opendir(), f_rename(), f_stat(), f_unlink(), and f_utime().

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD get_fat ( FATFS fs,
DWORD  clst 
)

Definition at line 842 of file ff.c.

References FATFS::fatbase, FS_FAT12, FS_FAT16, FS_FAT32, FATFS::fs_type, LD_DWORD, LD_WORD, move_window(), FATFS::n_fatent, SS, and FATFS::win.

Referenced by create_chain(), dir_next(), dir_sdi(), f_getfree(), f_lseek(), f_read(), f_truncate(), and remove_chain().

Here is the call graph for this function:

Here is the caller graph for this function:

static void get_fileinfo ( DIR dj,
FILINFO fno 
)
static

Definition at line 1897 of file ff.c.

References _USE_LFN, DDE, DIR::dir, DIR_Attr, DIR_FileSize, DIR_NTres, DIR_WrtDate, DIR_WrtTime, FILINFO::fattrib, FILINFO::fdate, ff_convert(), FILINFO::fname, FILINFO::fsize, FILINFO::ftime, IsDBCS1, IsDBCS2, IsUpper, LD_DWORD, LD_WORD, NDDE, NS_BODY, NS_EXT, and DIR::sect.

Referenced by f_readdir(), and f_stat().

Here is the call graph for this function:

Here is the caller graph for this function:

static DWORD ld_clust ( FATFS fs,
BYTE dir 
)
static

Definition at line 1239 of file ff.c.

References DIR_FstClusHI, DIR_FstClusLO, FS_FAT32, FATFS::fs_type, and LD_WORD.

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

Here is the caller graph for this function:

static int mem_cmp ( const void *  dst,
const void *  src,
UINT  cnt 
)
static

Definition at line 565 of file ff.c.

Referenced by dir_find().

Here is the caller graph for this function:

static void mem_cpy ( void *  dst,
const void *  src,
UINT  cnt 
)
static

Definition at line 539 of file ff.c.

Referenced by dir_register(), f_mkdir(), f_read(), f_rename(), f_unlink(), and f_write().

Here is the caller graph for this function:

static void mem_set ( void *  dst,
int  val,
UINT  cnt 
)
static

Definition at line 556 of file ff.c.

Referenced by create_name(), dir_next(), dir_register(), f_mkdir(), and sync_fs().

Here is the caller graph for this function:

static FRESULT move_window ( FATFS fs,
DWORD  sector 
)
static

Definition at line 758 of file ff.c.

References disk_read(), FATFS::drv, FR_DISK_ERR, FR_OK, RES_OK, sync_window(), FATFS::win, and FATFS::winsect.

Referenced by dir_alloc(), dir_find(), dir_read(), dir_register(), dir_remove(), f_getfree(), f_open(), f_read(), f_rename(), f_sync(), f_write(), get_fat(), and put_fat().

Here is the call graph for this function:

Here is the caller graph for this function:

FRESULT put_fat ( FATFS fs,
DWORD  clst,
DWORD  val 
)

Definition at line 885 of file ff.c.

References FATFS::fatbase, FR_INT_ERR, FR_OK, FS_FAT12, FS_FAT16, FS_FAT32, FATFS::fs_type, LD_DWORD, move_window(), FATFS::n_fatent, SS, ST_DWORD, ST_WORD, FATFS::wflag, and FATFS::win.

Referenced by create_chain(), f_truncate(), and remove_chain().

Here is the call graph for this function:

Here is the caller graph for this function:

static FRESULT remove_chain ( FATFS fs,
DWORD  clst 
)
static

Definition at line 948 of file ff.c.

References clust2sect(), FATFS::csize, CTRL_ERASE_SECTOR, disk_ioctl(), FATFS::drv, FR_DISK_ERR, FR_INT_ERR, FR_OK, FATFS::free_clust, FATFS::fsi_flag, get_fat(), FATFS::n_fatent, and put_fat().

Referenced by f_mkdir(), f_open(), f_truncate(), and f_unlink().

Here is the call graph for this function:

Here is the caller graph for this function:

static void st_clust ( BYTE dir,
DWORD  cl 
)
static

Definition at line 1256 of file ff.c.

References DIR_FstClusHI, DIR_FstClusLO, and ST_WORD.

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

Here is the caller graph for this function:

static FRESULT sync_fs ( FATFS fs)
static
static FRESULT sync_window ( FATFS fs)
static

Definition at line 732 of file ff.c.

References disk_write(), FATFS::drv, FATFS::fatbase, FR_DISK_ERR, FR_OK, FATFS::fsize, FATFS::n_fats, RES_OK, FATFS::wflag, FATFS::win, and FATFS::winsect.

Referenced by dir_next(), f_mkdir(), f_write(), move_window(), and sync_fs().

Here is the call graph for this function:

Here is the caller graph for this function:

static FRESULT validate ( void *  obj)
static

Definition at line 2235 of file ff.c.

References disk_status(), FATFS::drv, ENTER_FF, FR_INVALID_OBJECT, FR_NOT_READY, FR_OK, FIL::fs, FATFS::fs_type, FATFS::id, FIL::id, and STA_NOINIT.

Referenced by f_close(), f_lseek(), f_read(), f_readdir(), f_sync(), f_truncate(), and f_write().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

WORD Fsid
static

Definition at line 476 of file ff.c.

Referenced by chk_mounted().