#include <string.h>
#include "ff.h"
#include "diskio.h"
#include "fattime.h"
Go to the source code of this file.
Functions | |
static BOOL | move_window (FATFS *fs, DWORD sector) |
static FRESULT | sync (FATFS *fs) |
static DWORD | get_cluster (FATFS *fs, DWORD clust) |
static BOOL | put_cluster (FATFS *fs, DWORD clust, DWORD val) |
static BOOL | remove_chain (FATFS *fs, DWORD clust) |
static DWORD | create_chain (FATFS *fs, DWORD clust) |
static DWORD | clust2sect (FATFS *fs, DWORD clust) |
static BOOL | next_dir_entry (DIR *dj) |
static void | get_fileinfo (FILINFO *finfo, const BYTE *dir) |
static char | make_dirfile (const char **path, char *dirname) |
static FRESULT | trace_path (DIR *dj, char *fn, const char *path, BYTE **dir) |
static FRESULT | reserve_direntry (DIR *dj, BYTE **dir) |
static BYTE | check_fs (FATFS *fs, DWORD sect) |
static FRESULT | auto_mount (const char **path, FATFS **rfs, BYTE chk_wp) |
static FRESULT | validate (const FATFS *fs, WORD id) |
FRESULT | f_mount (BYTE drv, FATFS *fs) |
FRESULT | f_open (FIL *fp, const char *path, BYTE mode) |
FRESULT | f_read (FIL *fp, void *buff, UINT btr, UINT *br) |
FRESULT | f_write (FIL *fp, const void *buff, UINT btw, UINT *bw) |
FRESULT | f_sync (FIL *fp) |
FRESULT | f_close (FIL *fp) |
FRESULT | f_lseek (FIL *fp, DWORD ofs) |
FRESULT | f_opendir (DIR *dj, const char *path) |
FRESULT | f_readdir (DIR *dj, FILINFO *finfo) |
FRESULT | f_stat (const char *path, FILINFO *finfo) |
FRESULT | f_truncate (FIL *fp) |
FRESULT | f_getfree (const char *drv, DWORD *nclust, FATFS **fatfs) |
FRESULT | f_unlink (const char *path) |
FRESULT | f_mkdir (const char *path) |
FRESULT | f_chmod (const char *path, BYTE value, BYTE mask) |
FRESULT | f_utime (const char *path, const FILINFO *finfo) |
FRESULT | f_rename (const char *path_old, const char *path_new) |
Variables | |
static FATFS * | FatFs [_DRIVES] |
static WORD | fsid |
Definition at line 644 of file ff.c.
References _DRIVES, BPB_BytsPerSec, BPB_FATSz16, BPB_FATSz32, BPB_FSInfo, BPB_NumFATs, BPB_RootClus, BPB_RootEntCnt, BPB_RsvdSecCnt, BPB_SecPerClus, BPB_TotSec16, BPB_TotSec32, BS_55AA, check_fs(), _FATFS::csize, _FATFS::database, _FATFS::dirbase, disk_initialize(), disk_ioctl(), disk_read(), disk_status(), _FATFS::drive, _FATFS::fatbase, FR_INVALID_DRIVE, FR_NO_FILESYSTEM, FR_NOT_ENABLED, FR_NOT_READY, FR_OK, FR_WRITE_PROTECTED, _FATFS::free_clust, FS_FAT12, FS_FAT16, FS_FAT32, _FATFS::fs_type, FSI_Free_Count, FSI_LeadSig, FSI_Nxt_Free, FSI_StrucSig, fsid, GET_SECTOR_SIZE, _FATFS::id, _FATFS::last_clust, LD2PD, LD2PT, LD_DWORD, LD_WORD, _FATFS::max_clust, MBR_Table, memset(), _FATFS::n_fats, _FATFS::n_rootdir, RES_OK, S_MAX_SIZ, _FATFS::sects_fat, SS, STA_NOINIT, STA_PROTECT, and _FATFS::win.
Referenced by f_chmod(), f_getfree(), f_mkdir(), f_open(), f_opendir(), f_rename(), f_stat(), f_unlink(), and f_utime().
Definition at line 618 of file ff.c.
References BPB_ExtFlags, BS_55AA, BS_FilSysType, BS_FilSysType32, disk_read(), _FATFS::drive, LD_WORD, memcmp(), RES_OK, and _FATFS::win.
Referenced by auto_mount().
Definition at line 339 of file ff.c.
References _FATFS::csize, _FATFS::database, and _FATFS::max_clust.
Referenced by f_lseek(), f_mkdir(), f_opendir(), f_read(), f_unlink(), f_write(), next_dir_entry(), reserve_direntry(), and trace_path().
Definition at line 284 of file ff.c.
References _FATFS::free_clust, get_cluster(), _FATFS::last_clust, _FATFS::max_clust, and put_cluster().
Referenced by f_lseek(), f_mkdir(), f_write(), and reserve_direntry().
Definition at line 1556 of file ff.c.
References AM_ARC, AM_HID, AM_RDO, AM_SYS, auto_mount(), DIR_Attr, FR_INVALID_NAME, FR_OK, _DIR::fs, sync(), and trace_path().
Definition at line 1380 of file ff.c.
References auto_mount(), FR_OK, FR_RW_ERROR, FS_FAT12, FS_FAT16, FS_FAT32, get_cluster(), LD_DWORD, LD_WORD, and move_window().
Definition at line 1135 of file ff.c.
References _FS_READONLY, _FIL::buffer, clust2sect(), create_chain(), _FIL::csect, _FATFS::csize, _FIL::curr_clust, _FIL::curr_sect, disk_read(), disk_write(), _FATFS::drive, FA__DIRTY, FA__ERROR, FA__WRITTEN, FA_WRITE, _FIL::flag, _FIL::fptr, FR_OK, FR_RW_ERROR, _FIL::fs, _FIL::fsize, get_cluster(), _FIL::id, _FATFS::max_clust, _FIL::org_clust, RES_OK, SS, and validate().
FRESULT f_mkdir | ( | const char * | path | ) |
Definition at line 1491 of file ff.c.
References AM_DIR, auto_mount(), clust2sect(), create_chain(), _FATFS::csize, DIR_Attr, DIR_FstClusHI, DIR_FstClusLO, DIR_Name, DIR_NTres, DIR_WrtTime, _FATFS::dirbase, disk_write(), _FATFS::drive, FR_DENIED, FR_EXIST, FR_NO_FILE, FR_OK, FR_RW_ERROR, _DIR::fs, FS_FAT32, _FATFS::fs_type, get_fattime(), memcpy(), memset(), move_window(), RES_OK, reserve_direntry(), _DIR::sclust, SS, ST_DWORD, ST_WORD, sync(), trace_path(), _FATFS::win, _FATFS::winflag, and _FATFS::winsect.
Definition at line 795 of file ff.c.
References _DRIVES, FR_INVALID_DRIVE, FR_OK, and _FATFS::fs_type.
Referenced by MMCTask().
Definition at line 817 of file ff.c.
References AM_DIR, AM_RDO, auto_mount(), _FIL::csect, _FIL::curr_sect, DIR_Attr, DIR_CrtTime, DIR_FileSize, DIR_FstClusHI, DIR_FstClusLO, DIR_Name, DIR_NTres, _FIL::dir_ptr, _FIL::dir_sect, FA__WRITTEN, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYS, FA_READ, FA_WRITE, _FIL::flag, _FIL::fptr, FR_DENIED, FR_EXIST, FR_NO_FILE, FR_OK, FR_RW_ERROR, _DIR::fs, _FIL::fs, _FIL::fsize, get_fattime(), _FATFS::id, _FIL::id, _FATFS::last_clust, LD_DWORD, LD_WORD, memcpy(), memset(), move_window(), _FIL::org_clust, remove_chain(), reserve_direntry(), ST_DWORD, ST_WORD, trace_path(), _FATFS::winflag, and _FATFS::winsect.
Definition at line 1233 of file ff.c.
References AM_DIR, auto_mount(), _DIR::clust, clust2sect(), DIR_Attr, DIR_FstClusHI, DIR_FstClusLO, FR_NO_FILE, FR_OK, _DIR::fs, _FATFS::id, _DIR::id, _DIR::index, LD_WORD, _DIR::sect, and trace_path().
Definition at line 909 of file ff.c.
References _FIL::buffer, clust2sect(), _FIL::csect, _FATFS::csize, _FIL::curr_clust, _FIL::curr_sect, disk_read(), disk_write(), _FATFS::drive, FA__DIRTY, FA__ERROR, FA_READ, _FIL::flag, _FIL::fptr, FR_DENIED, FR_OK, FR_RW_ERROR, _FIL::fs, _FIL::fsize, get_cluster(), _FIL::id, _FATFS::max_clust, memcpy(), _FIL::org_clust, RES_OK, SS, and validate().
Referenced by DRead().
Definition at line 1270 of file ff.c.
References AM_VOL, DIR_Attr, DIR_Name, _FILINFO::fname, FR_OK, FR_RW_ERROR, _DIR::fs, get_fileinfo(), _DIR::id, _DIR::index, move_window(), next_dir_entry(), _DIR::sect, SS, validate(), and _FATFS::win.
FRESULT f_rename | ( | const char * | path_old, | |
const char * | path_new | |||
) |
Definition at line 1625 of file ff.c.
References auto_mount(), DIR_Attr, DIR_Name, DIR_NTres, FR_EXIST, FR_NO_FILE, FR_OK, FR_RW_ERROR, _DIR::fs, memcpy(), move_window(), reserve_direntry(), sync(), trace_path(), _FATFS::winflag, and _FATFS::winsect.
Definition at line 1305 of file ff.c.
References auto_mount(), FR_INVALID_NAME, FR_OK, _DIR::fs, get_fileinfo(), and trace_path().
Definition at line 1067 of file ff.c.
References AM_ARC, _FIL::buffer, _FIL::curr_sect, DIR_Attr, DIR_FileSize, DIR_FstClusHI, DIR_FstClusLO, _FIL::dir_ptr, _FIL::dir_sect, DIR_WrtTime, disk_write(), _FATFS::drive, FA__DIRTY, FA__WRITTEN, _FIL::flag, FR_OK, FR_RW_ERROR, _FIL::fs, _FIL::fsize, get_fattime(), _FIL::id, move_window(), _FIL::org_clust, RES_OK, ST_DWORD, ST_WORD, sync(), and validate().
Definition at line 1337 of file ff.c.
References _FIL::curr_clust, FA__ERROR, FA__WRITTEN, FA_WRITE, _FIL::flag, _FIL::fptr, FR_DENIED, FR_OK, FR_RW_ERROR, _FIL::fs, _FIL::fsize, get_cluster(), _FIL::id, _FIL::org_clust, put_cluster(), remove_chain(), and validate().
FRESULT f_unlink | ( | const char * | path | ) |
Definition at line 1443 of file ff.c.
References AM_DIR, AM_RDO, AM_VOL, auto_mount(), _DIR::clust, clust2sect(), DIR_Attr, DIR_FstClusHI, DIR_FstClusLO, DIR_Name, FR_DENIED, FR_INVALID_NAME, FR_OK, FR_RW_ERROR, _DIR::fs, _DIR::index, LD_WORD, move_window(), next_dir_entry(), remove_chain(), _DIR::sect, SS, sync(), trace_path(), _FATFS::win, _FATFS::winflag, and _FATFS::winsect.
Definition at line 1591 of file ff.c.
References auto_mount(), DIR_WrtDate, DIR_WrtTime, _FILINFO::fdate, FR_INVALID_NAME, FR_OK, _DIR::fs, _FILINFO::ftime, ST_WORD, sync(), and trace_path().
Definition at line 985 of file ff.c.
References _FIL::buffer, clust2sect(), create_chain(), _FIL::csect, _FATFS::csize, _FIL::curr_clust, _FIL::curr_sect, disk_read(), disk_write(), _FATFS::drive, FA__DIRTY, FA__ERROR, FA__WRITTEN, FA_WRITE, _FIL::flag, _FIL::fptr, FR_DENIED, FR_OK, FR_RW_ERROR, _FIL::fs, _FIL::fsize, _FIL::id, _FATFS::max_clust, memcpy(), _FIL::org_clust, RES_OK, SS, and validate().
Referenced by MMCTask().
Definition at line 157 of file ff.c.
References _FATFS::fatbase, FS_FAT12, FS_FAT16, FS_FAT32, _FATFS::fs_type, LD_DWORD, LD_WORD, move_window(), SS, and _FATFS::win.
Referenced by create_chain(), f_getfree(), f_lseek(), f_read(), f_truncate(), next_dir_entry(), and remove_chain().
Definition at line 393 of file ff.c.
References _USE_NTFLAG, DIR_Attr, DIR_FileSize, DIR_NTres, DIR_WrtDate, DIR_WrtTime, _FILINFO::fattrib, _FILINFO::fdate, _FILINFO::fname, _FILINFO::fsize, _FILINFO::ftime, LD_DWORD, and LD_WORD.
Referenced by f_readdir(), and f_stat().
static char make_dirfile | ( | const char ** | path, | |
char * | dirname | |||
) | [static] |
Definition at line 437 of file ff.c.
References _USE_NTFLAG, _USE_SJIS, and memset().
Referenced by trace_path().
Definition at line 80 of file ff.c.
References disk_read(), disk_write(), _FATFS::drive, FALSE, _FATFS::fatbase, _FATFS::n_fats, RES_OK, _FATFS::sects_fat, TRUE, _FATFS::win, _FATFS::winflag, and _FATFS::winsect.
Referenced by f_getfree(), f_mkdir(), f_open(), f_readdir(), f_rename(), f_sync(), f_unlink(), get_cluster(), put_cluster(), reserve_direntry(), sync(), and trace_path().
Definition at line 357 of file ff.c.
References _DIR::clust, clust2sect(), _FATFS::csize, FALSE, _DIR::fs, get_cluster(), _DIR::index, _FATFS::max_clust, _FATFS::n_rootdir, _DIR::sect, SS, and TRUE.
Referenced by f_readdir(), f_unlink(), reserve_direntry(), and trace_path().
Definition at line 199 of file ff.c.
References FALSE, _FATFS::fatbase, FS_FAT12, FS_FAT16, FS_FAT32, _FATFS::fs_type, move_window(), SS, ST_DWORD, ST_WORD, TRUE, _FATFS::win, and _FATFS::winflag.
Referenced by create_chain(), f_truncate(), and remove_chain().
Definition at line 251 of file ff.c.
References FALSE, _FATFS::free_clust, get_cluster(), put_cluster(), and TRUE.
Referenced by f_open(), f_truncate(), and f_unlink().
Definition at line 561 of file ff.c.
References _DIR::clust, clust2sect(), create_chain(), _FATFS::csize, DIR_Name, _FATFS::dirbase, disk_write(), _FATFS::drive, FR_DENIED, FR_OK, FR_RW_ERROR, _DIR::fs, _DIR::index, memset(), move_window(), next_dir_entry(), RES_OK, _DIR::sclust, _DIR::sect, SS, _FATFS::win, _FATFS::winflag, and _FATFS::winsect.
Referenced by f_mkdir(), f_open(), and f_rename().
Definition at line 122 of file ff.c.
References BS_55AA, CTRL_SYNC, disk_ioctl(), disk_write(), _FATFS::drive, FR_OK, FR_RW_ERROR, _FATFS::free_clust, FS_FAT32, _FATFS::fs_type, FSI_Free_Count, FSI_LeadSig, FSI_Nxt_Free, FSI_StrucSig, _FATFS::last_clust, memset(), move_window(), RES_OK, ST_DWORD, ST_WORD, _FATFS::win, _FATFS::winflag, and _FATFS::winsect.
Referenced by f_chmod(), f_mkdir(), f_rename(), f_sync(), f_unlink(), and f_utime().
Definition at line 501 of file ff.c.
References AM_DIR, AM_VOL, _DIR::clust, clust2sect(), DIR_Attr, DIR_FstClusHI, DIR_FstClusLO, DIR_Name, _FATFS::dirbase, FR_INVALID_NAME, FR_NO_FILE, FR_NO_PATH, FR_OK, FR_RW_ERROR, _DIR::fs, FS_FAT32, _FATFS::fs_type, _DIR::index, LD_WORD, make_dirfile(), memcmp(), move_window(), next_dir_entry(), _DIR::sclust, _DIR::sect, SS, and _FATFS::win.
Referenced by f_chmod(), f_mkdir(), f_open(), f_opendir(), f_rename(), f_stat(), f_unlink(), and f_utime().
Definition at line 767 of file ff.c.
References disk_status(), _FATFS::drive, FR_INVALID_OBJECT, FR_NOT_READY, FR_OK, _FATFS::fs_type, _FATFS::id, and STA_NOINIT.
Referenced by f_close(), f_lseek(), f_read(), f_readdir(), f_sync(), f_truncate(), and f_write().