mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-26 07:39:56 -06:00
DLDI/SD folder-sync apparatus (#1251)
guess we can finally have DLDI that isn't obtuse
This commit is contained in:
@ -13,15 +13,17 @@
|
||||
|
||||
static ff_disk_read_cb ReadCb;
|
||||
static ff_disk_write_cb WriteCb;
|
||||
static LBA_t SectorCount;
|
||||
static DSTATUS Status = STA_NOINIT | STA_NODISK;
|
||||
|
||||
|
||||
void ff_disk_open(ff_disk_read_cb readcb, ff_disk_write_cb writecb)
|
||||
void ff_disk_open(ff_disk_read_cb readcb, ff_disk_write_cb writecb, LBA_t seccnt)
|
||||
{
|
||||
if (!readcb) return;
|
||||
|
||||
ReadCb = readcb;
|
||||
WriteCb = writecb;
|
||||
SectorCount = seccnt;
|
||||
|
||||
Status &= ~STA_NODISK;
|
||||
if (!writecb) Status |= STA_PROTECT;
|
||||
@ -32,6 +34,7 @@ void ff_disk_close()
|
||||
{
|
||||
ReadCb = (void*)0;
|
||||
WriteCb = (void*)0;
|
||||
SectorCount = 0;
|
||||
|
||||
Status &= ~STA_PROTECT;
|
||||
Status |= STA_NODISK;
|
||||
@ -123,12 +126,28 @@ DRESULT disk_ioctl (
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case 0: // sync
|
||||
case CTRL_SYNC:
|
||||
// TODO: fflush?
|
||||
return RES_OK;
|
||||
|
||||
case GET_SECTOR_COUNT:
|
||||
*(LBA_t*)buff = SectorCount;
|
||||
return RES_OK;
|
||||
|
||||
case GET_SECTOR_SIZE:
|
||||
*(WORD*)buff = 0x200;
|
||||
return RES_OK;
|
||||
|
||||
case GET_BLOCK_SIZE:
|
||||
*(DWORD*)buff = 1;
|
||||
return RES_OK;
|
||||
|
||||
case CTRL_TRIM:
|
||||
// TODO??
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
//printf("disk_ioctl(%02X, %02X, %p)\n", pdrv, cmd, buff);
|
||||
//printf("FatFS: unknown disk_ioctl(%02X, %02X, %p)\n", pdrv, cmd, buff);
|
||||
return RES_PARERR;
|
||||
}
|
||||
|
||||
|
@ -1595,7 +1595,7 @@ static DWORD create_chain ( /* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:D
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static DWORD clmt_clust ( /* <2:Error, >=2:Cluster number */
|
||||
FIL* fp, /* Pointer to the file object */
|
||||
FF_FIL* fp, /* Pointer to the file object */
|
||||
FSIZE_t ofs /* File offset to be converted to cluster# */
|
||||
)
|
||||
{
|
||||
@ -1664,7 +1664,7 @@ static FRESULT dir_clear ( /* Returns FR_OK or FR_DISK_ERR */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static FRESULT dir_sdi ( /* FR_OK(0):succeeded, !=0:error */
|
||||
DIR* dp, /* Pointer to directory object */
|
||||
FF_DIR* dp, /* Pointer to directory object */
|
||||
DWORD ofs /* Offset of directory table */
|
||||
)
|
||||
{
|
||||
@ -1712,7 +1712,7 @@ static FRESULT dir_sdi ( /* FR_OK(0):succeeded, !=0:error */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static FRESULT dir_next ( /* FR_OK(0):succeeded, FR_NO_FILE:End of table, FR_DENIED:Could not stretch */
|
||||
DIR* dp, /* Pointer to the directory object */
|
||||
FF_DIR* dp, /* Pointer to the directory object */
|
||||
int stretch /* 0: Do not stretch table, 1: Stretch table if needed */
|
||||
)
|
||||
{
|
||||
@ -1773,7 +1773,7 @@ static FRESULT dir_next ( /* FR_OK(0):succeeded, FR_NO_FILE:End of table, FR_DEN
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static FRESULT dir_alloc ( /* FR_OK(0):succeeded, !=0:error */
|
||||
DIR* dp, /* Pointer to the directory object */
|
||||
FF_DIR* dp, /* Pointer to the directory object */
|
||||
UINT n_ent /* Number of contiguous entries to allocate */
|
||||
)
|
||||
{
|
||||
@ -2273,7 +2273,7 @@ static void create_xdir (
|
||||
#define DIR_READ_LABEL(dp) dir_read(dp, 1)
|
||||
|
||||
static FRESULT dir_read (
|
||||
DIR* dp, /* Pointer to the directory object */
|
||||
FF_DIR* dp, /* Pointer to the directory object */
|
||||
int vol /* Filtered by 0:file/directory or 1:volume label */
|
||||
)
|
||||
{
|
||||
@ -2351,7 +2351,7 @@ static FRESULT dir_read (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static FRESULT dir_find ( /* FR_OK(0):succeeded, !=0:error */
|
||||
DIR* dp /* Pointer to the directory object with the file name */
|
||||
FF_DIR* dp /* Pointer to the directory object with the file name */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
@ -2432,7 +2432,7 @@ static FRESULT dir_find ( /* FR_OK(0):succeeded, !=0:error */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static FRESULT dir_register ( /* FR_OK:succeeded, FR_DENIED:no free entry or too many SFN collision, FR_DISK_ERR:disk error */
|
||||
DIR* dp /* Target directory with object name to be created */
|
||||
FF_DIR* dp /* Target directory with object name to be created */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
@ -2538,7 +2538,7 @@ static FRESULT dir_register ( /* FR_OK:succeeded, FR_DENIED:no free entry or too
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static FRESULT dir_remove ( /* FR_OK:Succeeded, FR_DISK_ERR:A disk error */
|
||||
DIR* dp /* Directory object pointing the entry to be removed */
|
||||
FF_DIR* dp /* Directory object pointing the entry to be removed */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
@ -2584,8 +2584,8 @@ static FRESULT dir_remove ( /* FR_OK:Succeeded, FR_DISK_ERR:A disk error */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static void get_fileinfo (
|
||||
DIR* dp, /* Pointer to the directory object */
|
||||
FILINFO* fno /* Pointer to the file information to be filled */
|
||||
FF_DIR* dp, /* Pointer to the directory object */
|
||||
FF_FILINFO* fno /* Pointer to the file information to be filled */
|
||||
)
|
||||
{
|
||||
UINT si, di;
|
||||
@ -2799,7 +2799,7 @@ static int pattern_match ( /* 0:mismatched, 1:matched */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static FRESULT create_name ( /* FR_OK: successful, FR_INVALID_NAME: could not create */
|
||||
DIR* dp, /* Pointer to the directory object */
|
||||
FF_DIR* dp, /* Pointer to the directory object */
|
||||
const TCHAR** path /* Pointer to pointer to the segment in the path string */
|
||||
)
|
||||
{
|
||||
@ -3001,7 +3001,7 @@ static FRESULT create_name ( /* FR_OK: successful, FR_INVALID_NAME: could not cr
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */
|
||||
DIR* dp, /* Directory object to return last directory and found object */
|
||||
FF_DIR* dp, /* Directory object to return last directory and found object */
|
||||
const TCHAR* path /* Full-path string to find a file or directory */
|
||||
)
|
||||
{
|
||||
@ -3651,13 +3651,13 @@ FRESULT f_mount (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_open (
|
||||
FIL* fp, /* Pointer to the blank file object */
|
||||
FF_FIL* fp, /* Pointer to the blank file object */
|
||||
const TCHAR* path, /* Pointer to the file name */
|
||||
BYTE mode /* Access mode and open mode flags */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
DIR dj;
|
||||
FF_DIR dj;
|
||||
FATFS *fs;
|
||||
#if !FF_FS_READONLY
|
||||
DWORD cl, bcs, clst, tm;
|
||||
@ -3848,7 +3848,7 @@ FRESULT f_open (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_read (
|
||||
FIL* fp, /* Open file to be read */
|
||||
FF_FIL* fp, /* Open file to be read */
|
||||
void* buff, /* Data buffer to store the read data */
|
||||
UINT btr, /* Number of bytes to read */
|
||||
UINT* br /* Number of bytes read */
|
||||
@ -3948,7 +3948,7 @@ FRESULT f_read (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_write (
|
||||
FIL* fp, /* Open file to be written */
|
||||
FF_FIL* fp, /* Open file to be written */
|
||||
const void* buff, /* Data to be written */
|
||||
UINT btw, /* Number of bytes to write */
|
||||
UINT* bw /* Number of bytes written */
|
||||
@ -4069,7 +4069,7 @@ FRESULT f_write (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_sync (
|
||||
FIL* fp /* Open file to be synced */
|
||||
FF_FIL* fp /* Open file to be synced */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
@ -4150,7 +4150,7 @@ FRESULT f_sync (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_close (
|
||||
FIL* fp /* Open file to be closed */
|
||||
FF_FIL* fp /* Open file to be closed */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
@ -4365,7 +4365,7 @@ FRESULT f_getcwd (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_lseek (
|
||||
FIL* fp, /* Pointer to the file object */
|
||||
FF_FIL* fp, /* Pointer to the file object */
|
||||
FSIZE_t ofs /* File pointer from top of file */
|
||||
)
|
||||
{
|
||||
@ -4529,7 +4529,7 @@ FRESULT f_lseek (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_opendir (
|
||||
DIR* dp, /* Pointer to directory object to create */
|
||||
FF_DIR* dp, /* Pointer to directory object to create */
|
||||
const TCHAR* path /* Pointer to the directory path */
|
||||
)
|
||||
{
|
||||
@ -4595,7 +4595,7 @@ FRESULT f_opendir (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_closedir (
|
||||
DIR *dp /* Pointer to the directory object to be closed */
|
||||
FF_DIR *dp /* Pointer to the directory object to be closed */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
@ -4625,8 +4625,8 @@ FRESULT f_closedir (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_readdir (
|
||||
DIR* dp, /* Pointer to the open directory object */
|
||||
FILINFO* fno /* Pointer to file information to return */
|
||||
FF_DIR* dp, /* Pointer to the open directory object */
|
||||
FF_FILINFO* fno /* Pointer to file information to return */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
@ -4661,8 +4661,8 @@ FRESULT f_readdir (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_findnext (
|
||||
DIR* dp, /* Pointer to the open directory object */
|
||||
FILINFO* fno /* Pointer to the file information structure */
|
||||
FF_DIR* dp, /* Pointer to the open directory object */
|
||||
FF_FILINFO* fno /* Pointer to the file information structure */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
@ -4686,8 +4686,8 @@ FRESULT f_findnext (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_findfirst (
|
||||
DIR* dp, /* Pointer to the blank directory object */
|
||||
FILINFO* fno, /* Pointer to the file information structure */
|
||||
FF_DIR* dp, /* Pointer to the blank directory object */
|
||||
FF_FILINFO* fno, /* Pointer to the file information structure */
|
||||
const TCHAR* path, /* Pointer to the directory to open */
|
||||
const TCHAR* pattern /* Pointer to the matching pattern */
|
||||
)
|
||||
@ -4714,11 +4714,11 @@ FRESULT f_findfirst (
|
||||
|
||||
FRESULT f_stat (
|
||||
const TCHAR* path, /* Pointer to the file path */
|
||||
FILINFO* fno /* Pointer to file information to return */
|
||||
FF_FILINFO* fno /* Pointer to file information to return */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
DIR dj;
|
||||
FF_DIR dj;
|
||||
DEF_NAMBUF
|
||||
|
||||
|
||||
@ -4840,7 +4840,7 @@ FRESULT f_getfree (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_truncate (
|
||||
FIL* fp /* Pointer to the file object */
|
||||
FF_FIL* fp /* Pointer to the file object */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
@ -4894,7 +4894,7 @@ FRESULT f_unlink (
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
DIR dj, sdj;
|
||||
FF_DIR dj, sdj;
|
||||
DWORD dclst = 0;
|
||||
FATFS *fs;
|
||||
#if FF_FS_EXFAT
|
||||
@ -4988,7 +4988,7 @@ FRESULT f_mkdir (
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
DIR dj;
|
||||
FF_DIR dj;
|
||||
FFOBJID sobj;
|
||||
FATFS *fs;
|
||||
DWORD dcl, pcl, tm;
|
||||
@ -5073,7 +5073,7 @@ FRESULT f_rename (
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
DIR djo, djn;
|
||||
FF_DIR djo, djn;
|
||||
FATFS *fs;
|
||||
BYTE buf[FF_FS_EXFAT ? SZDIRE * 2 : SZDIRE], *dir;
|
||||
LBA_t sect;
|
||||
@ -5121,7 +5121,7 @@ FRESULT f_rename (
|
||||
#endif
|
||||
{ /* At FAT/FAT32 volume */
|
||||
memcpy(buf, djo.dir, SZDIRE); /* Save directory entry of the object */
|
||||
memcpy(&djn, &djo, sizeof (DIR)); /* Duplicate the directory object */
|
||||
memcpy(&djn, &djo, sizeof (FF_DIR)); /* Duplicate the directory object */
|
||||
res = follow_path(&djn, path_new); /* Make sure if new object name is not in use */
|
||||
if (res == FR_OK) { /* Is new name already in use by any other object? */
|
||||
res = (djn.obj.sclust == djo.obj.sclust && djn.dptr == djo.dptr) ? FR_NO_FILE : FR_EXIST;
|
||||
@ -5184,7 +5184,7 @@ FRESULT f_chmod (
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
DIR dj;
|
||||
FF_DIR dj;
|
||||
FATFS *fs;
|
||||
DEF_NAMBUF
|
||||
|
||||
@ -5226,11 +5226,11 @@ FRESULT f_chmod (
|
||||
|
||||
FRESULT f_utime (
|
||||
const TCHAR* path, /* Pointer to the file/directory name */
|
||||
const FILINFO* fno /* Pointer to the timestamp to be set */
|
||||
const FF_FILINFO* fno /* Pointer to the timestamp to be set */
|
||||
)
|
||||
{
|
||||
FRESULT res;
|
||||
DIR dj;
|
||||
FF_DIR dj;
|
||||
FATFS *fs;
|
||||
DEF_NAMBUF
|
||||
|
||||
@ -5489,7 +5489,7 @@ FRESULT f_setlabel (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_expand (
|
||||
FIL* fp, /* Pointer to the file object */
|
||||
FF_FIL* fp, /* Pointer to the file object */
|
||||
FSIZE_t fsz, /* File size to be expanded to */
|
||||
BYTE opt /* Operation mode 0:Find and prepare or 1:Find and allocate */
|
||||
)
|
||||
@ -5579,7 +5579,7 @@ FRESULT f_expand (
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_forward (
|
||||
FIL* fp, /* Pointer to the file object */
|
||||
FF_FIL* fp, /* Pointer to the file object */
|
||||
UINT (*func)(const BYTE*,UINT), /* Pointer to the streaming function */
|
||||
UINT btf, /* Number of bytes to forward */
|
||||
UINT* bf /* Pointer to number of bytes forwarded */
|
||||
@ -5801,14 +5801,14 @@ static FRESULT create_partition (
|
||||
|
||||
FRESULT f_mkfs (
|
||||
const TCHAR* path, /* Logical drive number */
|
||||
const MKFS_PARM* opt, /* Format options */
|
||||
const FF_MKFS_PARM* opt, /* Format options */
|
||||
void* work, /* Pointer to working buffer (null: use heap memory) */
|
||||
UINT len /* Size of working buffer [byte] */
|
||||
)
|
||||
{
|
||||
static const WORD cst[] = {1, 4, 16, 64, 256, 512, 0}; /* Cluster size boundary for FAT volume (4Ks unit) */
|
||||
static const WORD cst32[] = {1, 2, 4, 8, 16, 32, 0}; /* Cluster size boundary for FAT32 volume (128Ks unit) */
|
||||
static const MKFS_PARM defopt = {FM_ANY, 0, 0, 0, 0}; /* Default parameter */
|
||||
static const FF_MKFS_PARM defopt = {FM_ANY, 0, 0, 0, 0}; /* Default parameter */
|
||||
BYTE fsopt, fsty, sys, *buf, *pte, pdrv, ipart;
|
||||
WORD ss; /* Sector size */
|
||||
DWORD sz_buf, sz_blk, n_clst, pau, nsect, n, vsn;
|
||||
@ -6338,7 +6338,7 @@ FRESULT f_fdisk (
|
||||
TCHAR* f_gets (
|
||||
TCHAR* buff, /* Pointer to the buffer to store read string */
|
||||
int len, /* Size of string buffer (items) */
|
||||
FIL* fp /* Pointer to the file object */
|
||||
FF_FIL* fp /* Pointer to the file object */
|
||||
)
|
||||
{
|
||||
int nc = 0;
|
||||
@ -6629,7 +6629,7 @@ static int putc_flush (putbuff* pb)
|
||||
|
||||
/* Initialize write buffer */
|
||||
|
||||
static void putc_init (putbuff* pb, FIL* fp)
|
||||
static void putc_init (putbuff* pb, FF_FIL* fp)
|
||||
{
|
||||
memset(pb, 0, sizeof (putbuff));
|
||||
pb->fp = fp;
|
||||
@ -6639,7 +6639,7 @@ static void putc_init (putbuff* pb, FIL* fp)
|
||||
|
||||
int f_putc (
|
||||
TCHAR c, /* A character to be output */
|
||||
FIL* fp /* Pointer to the file object */
|
||||
FF_FIL* fp /* Pointer to the file object */
|
||||
)
|
||||
{
|
||||
putbuff pb;
|
||||
@ -6659,7 +6659,7 @@ int f_putc (
|
||||
|
||||
int f_puts (
|
||||
const TCHAR* str, /* Pointer to the string to be output */
|
||||
FIL* fp /* Pointer to the file object */
|
||||
FF_FIL* fp /* Pointer to the file object */
|
||||
)
|
||||
{
|
||||
putbuff pb;
|
||||
@ -6799,7 +6799,7 @@ static void ftoa (
|
||||
|
||||
|
||||
int f_printf (
|
||||
FIL* fp, /* Pointer to the file object */
|
||||
FF_FIL* fp, /* Pointer to the file object */
|
||||
const TCHAR* fmt, /* Pointer to the format string */
|
||||
... /* Optional arguments... */
|
||||
)
|
||||
|
@ -219,7 +219,7 @@ typedef struct {
|
||||
#if !FF_FS_TINY
|
||||
BYTE buf[FF_MAX_SS]; /* File private data read/write window */
|
||||
#endif
|
||||
} FIL;
|
||||
} FF_FIL;
|
||||
|
||||
|
||||
|
||||
@ -238,7 +238,7 @@ typedef struct {
|
||||
#if FF_USE_FIND
|
||||
const TCHAR* pat; /* Pointer to the name matching pattern */
|
||||
#endif
|
||||
} DIR;
|
||||
} FF_DIR;
|
||||
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ typedef struct {
|
||||
#else
|
||||
TCHAR fname[12 + 1]; /* File name */
|
||||
#endif
|
||||
} FILINFO;
|
||||
} FF_FILINFO;
|
||||
|
||||
|
||||
|
||||
@ -267,7 +267,7 @@ typedef struct {
|
||||
UINT align; /* Data area alignment (sector) */
|
||||
UINT n_root; /* Number of root directory entries */
|
||||
DWORD au_size; /* Cluster size (byte) */
|
||||
} MKFS_PARM;
|
||||
} FF_MKFS_PARM;
|
||||
|
||||
|
||||
|
||||
@ -301,40 +301,40 @@ typedef enum {
|
||||
/*--------------------------------------------------------------*/
|
||||
/* FatFs module application interface */
|
||||
|
||||
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
|
||||
FRESULT f_close (FIL* fp); /* Close an open file object */
|
||||
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_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */
|
||||
FRESULT f_truncate (FIL* fp); /* Truncate the file */
|
||||
FRESULT f_sync (FIL* fp); /* Flush cached data of the writing file */
|
||||
FRESULT f_opendir (DIR* dp, const TCHAR* path); /* Open a directory */
|
||||
FRESULT f_closedir (DIR* dp); /* Close an open directory */
|
||||
FRESULT f_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */
|
||||
FRESULT f_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */
|
||||
FRESULT f_findnext (DIR* dp, FILINFO* fno); /* Find next file */
|
||||
FRESULT f_open (FF_FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
|
||||
FRESULT f_close (FF_FIL* fp); /* Close an open file object */
|
||||
FRESULT f_read (FF_FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */
|
||||
FRESULT f_write (FF_FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */
|
||||
FRESULT f_lseek (FF_FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */
|
||||
FRESULT f_truncate (FF_FIL* fp); /* Truncate the file */
|
||||
FRESULT f_sync (FF_FIL* fp); /* Flush cached data of the writing file */
|
||||
FRESULT f_opendir (FF_DIR* dp, const TCHAR* path); /* Open a directory */
|
||||
FRESULT f_closedir (FF_DIR* dp); /* Close an open directory */
|
||||
FRESULT f_readdir (FF_DIR* dp, FF_FILINFO* fno); /* Read a directory item */
|
||||
FRESULT f_findfirst (FF_DIR* dp, FF_FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */
|
||||
FRESULT f_findnext (FF_DIR* dp, FF_FILINFO* fno); /* Find next file */
|
||||
FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */
|
||||
FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */
|
||||
FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
|
||||
FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */
|
||||
FRESULT f_stat (const TCHAR* path, FF_FILINFO* fno); /* Get file status */
|
||||
FRESULT f_chmod (const TCHAR* path, BYTE attr, BYTE mask); /* Change attribute of a file/dir */
|
||||
FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change timestamp of a file/dir */
|
||||
FRESULT f_utime (const TCHAR* path, const FF_FILINFO* fno); /* Change timestamp of a file/dir */
|
||||
FRESULT f_chdir (const TCHAR* path); /* Change current directory */
|
||||
FRESULT f_chdrive (const TCHAR* path); /* Change current drive */
|
||||
FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */
|
||||
FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
|
||||
FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */
|
||||
FRESULT f_setlabel (const TCHAR* label); /* Set volume label */
|
||||
FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */
|
||||
FRESULT f_expand (FIL* fp, FSIZE_t fsz, BYTE opt); /* Allocate a contiguous block to the file */
|
||||
FRESULT f_forward (FF_FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */
|
||||
FRESULT f_expand (FF_FIL* fp, FSIZE_t fsz, BYTE opt); /* Allocate a contiguous block to the file */
|
||||
FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */
|
||||
FRESULT f_mkfs (const TCHAR* path, const MKFS_PARM* opt, void* work, UINT len); /* Create a FAT volume */
|
||||
FRESULT f_mkfs (const TCHAR* path, const FF_MKFS_PARM* opt, void* work, UINT len); /* Create a FAT volume */
|
||||
FRESULT f_fdisk (BYTE pdrv, const LBA_t ptbl[], void* work); /* Divide a physical drive into some partitions */
|
||||
FRESULT f_setcp (WORD cp); /* Set current code page */
|
||||
int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */
|
||||
int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */
|
||||
int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
|
||||
TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
|
||||
int f_putc (TCHAR c, FF_FIL* fp); /* Put a character to the file */
|
||||
int f_puts (const TCHAR* str, FF_FIL* cp); /* Put a string to the file */
|
||||
int f_printf (FF_FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
|
||||
TCHAR* f_gets (TCHAR* buff, int len, FF_FIL* fp); /* Get a string from the file */
|
||||
|
||||
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
|
||||
#define f_error(fp) ((fp)->err)
|
||||
@ -420,7 +420,7 @@ int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */
|
||||
typedef UINT (*ff_disk_read_cb)(BYTE* buff, LBA_t sector, UINT count);
|
||||
typedef UINT (*ff_disk_write_cb)(BYTE* buff, LBA_t sector, UINT count);
|
||||
|
||||
void ff_disk_open(ff_disk_read_cb readcb, ff_disk_write_cb writecb);
|
||||
void ff_disk_open(ff_disk_read_cb readcb, ff_disk_write_cb writecb, LBA_t seccnt);
|
||||
void ff_disk_close();
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user