mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-22 18:26:39 +00:00
Revert "Rename FatFs functions to avoid linking issues with libusbhsfs."
This reverts commit 6715242fed
.
This commit is contained in:
parent
2632af43a0
commit
dff9b1defa
11 changed files with 206 additions and 206 deletions
|
@ -18,7 +18,7 @@
|
|||
/* Get Drive Status */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DSTATUS ff_disk_status (
|
||||
DSTATUS disk_status (
|
||||
BYTE pdrv /* Physical drive number to identify the drive */
|
||||
)
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ DSTATUS ff_disk_status (
|
|||
/* Inidialize a Drive */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DSTATUS ff_disk_initialize (
|
||||
DSTATUS disk_initialize (
|
||||
BYTE pdrv /* Physical drive number to identify the drive */
|
||||
)
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ DSTATUS ff_disk_initialize (
|
|||
/* Read Sector(s) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DRESULT ff_disk_read (
|
||||
DRESULT disk_read (
|
||||
BYTE pdrv, /* Physical drive number to identify the drive */
|
||||
BYTE *buff, /* Data buffer to store read data */
|
||||
LBA_t sector, /* Start sector in LBA */
|
||||
|
@ -74,7 +74,7 @@ DRESULT ff_disk_read (
|
|||
|
||||
#if FF_FS_READONLY == 0
|
||||
|
||||
DRESULT ff_disk_write (
|
||||
DRESULT disk_write (
|
||||
BYTE pdrv, /* Physical drive number to identify the drive */
|
||||
const BYTE *buff, /* Data to be written */
|
||||
LBA_t sector, /* Start sector in LBA */
|
||||
|
@ -96,7 +96,7 @@ DRESULT ff_disk_write (
|
|||
/* Miscellaneous Functions */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DRESULT ff_disk_ioctl (
|
||||
DRESULT disk_ioctl (
|
||||
BYTE pdrv, /* Physical drive nmuber (0..) */
|
||||
BYTE cmd, /* Control code */
|
||||
void *buff /* Buffer to send/receive control data */
|
||||
|
|
|
@ -26,11 +26,11 @@ typedef enum {
|
|||
/* Prototypes for disk control functions */
|
||||
|
||||
|
||||
DSTATUS ff_disk_initialize (BYTE pdrv);
|
||||
DSTATUS ff_disk_status (BYTE pdrv);
|
||||
DRESULT ff_disk_read (BYTE pdrv, BYTE* buff, LBA_t sector, UINT count);
|
||||
DRESULT ff_disk_write (BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count);
|
||||
DRESULT ff_disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||
DSTATUS disk_initialize (BYTE pdrv);
|
||||
DSTATUS disk_status (BYTE pdrv);
|
||||
DRESULT disk_read (BYTE pdrv, BYTE* buff, LBA_t sector, UINT count);
|
||||
DRESULT disk_write (BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count);
|
||||
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||
|
||||
|
||||
/* Disk Status Bits (DSTATUS) */
|
||||
|
@ -40,7 +40,7 @@ DRESULT ff_disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
|||
#define STA_PROTECT 0x04 /* Write protected */
|
||||
|
||||
|
||||
/* Command code for ff_disk_ioctrl fucntion */
|
||||
/* Command code for disk_ioctrl fucntion */
|
||||
|
||||
/* Generic command (Used by FatFs) */
|
||||
#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */
|
||||
|
|
|
@ -1077,10 +1077,10 @@ static FRESULT sync_window ( /* Returns FR_OK or FR_DISK_ERR */
|
|||
|
||||
|
||||
if (fs->wflag) { /* Is the disk access window dirty? */
|
||||
if (ff_disk_write(fs->pdrv, fs->win, fs->winsect, 1) == RES_OK) { /* Write it back into the volume */
|
||||
if (disk_write(fs->pdrv, fs->win, fs->winsect, 1) == RES_OK) { /* Write it back into the volume */
|
||||
fs->wflag = 0; /* Clear window dirty flag */
|
||||
if (fs->winsect - fs->fatbase < fs->fsize) { /* Is it in the 1st FAT? */
|
||||
if (fs->n_fats == 2) ff_disk_write(fs->pdrv, fs->win, fs->winsect + fs->fsize, 1); /* Reflect it to 2nd FAT if needed */
|
||||
if (fs->n_fats == 2) disk_write(fs->pdrv, fs->win, fs->winsect + fs->fsize, 1); /* Reflect it to 2nd FAT if needed */
|
||||
}
|
||||
} else {
|
||||
res = FR_DISK_ERR;
|
||||
|
@ -1104,7 +1104,7 @@ static FRESULT move_window ( /* Returns FR_OK or FR_DISK_ERR */
|
|||
res = sync_window(fs); /* Flush the window */
|
||||
#endif
|
||||
if (res == FR_OK) { /* Fill sector window with new data */
|
||||
if (ff_disk_read(fs->pdrv, fs->win, sect, 1) != RES_OK) {
|
||||
if (disk_read(fs->pdrv, fs->win, sect, 1) != RES_OK) {
|
||||
sect = (LBA_t)0 - 1; /* Invalidate window if read data is not valid */
|
||||
res = FR_DISK_ERR;
|
||||
}
|
||||
|
@ -1141,11 +1141,11 @@ static FRESULT sync_fs ( /* Returns FR_OK or FR_DISK_ERR */
|
|||
st_dword(fs->win + FSI_Nxt_Free, fs->last_clst);
|
||||
/* Write it into the FSInfo sector */
|
||||
fs->winsect = fs->volbase + 1;
|
||||
ff_disk_write(fs->pdrv, fs->win, fs->winsect, 1);
|
||||
disk_write(fs->pdrv, fs->win, fs->winsect, 1);
|
||||
fs->fsi_flag = 0;
|
||||
}
|
||||
/* Make sure that no pending write process in the lower layer */
|
||||
if (ff_disk_ioctl(fs->pdrv, CTRL_SYNC, 0) != RES_OK) res = FR_DISK_ERR;
|
||||
if (disk_ioctl(fs->pdrv, CTRL_SYNC, 0) != RES_OK) res = FR_DISK_ERR;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -1494,7 +1494,7 @@ static FRESULT remove_chain ( /* FR_OK(0):succeeded, !=0:error */
|
|||
#if FF_USE_TRIM
|
||||
rt[0] = clst2sect(fs, scl); /* Start of data area to be freed */
|
||||
rt[1] = clst2sect(fs, ecl) + fs->csize - 1; /* End of data area to be freed */
|
||||
ff_disk_ioctl(fs->pdrv, CTRL_TRIM, rt); /* Inform storage device that the data in the block may be erased */
|
||||
disk_ioctl(fs->pdrv, CTRL_TRIM, rt); /* Inform storage device that the data in the block may be erased */
|
||||
#endif
|
||||
scl = ecl = nxt;
|
||||
}
|
||||
|
@ -1691,13 +1691,13 @@ static FRESULT dir_clear ( /* Returns FR_OK or FR_DISK_ERR */
|
|||
if (szb > SS(fs)) { /* Buffer allocated? */
|
||||
mem_set(ibuf, 0, szb);
|
||||
szb /= SS(fs); /* Bytes -> Sectors */
|
||||
for (n = 0; n < fs->csize && ff_disk_write(fs->pdrv, ibuf, sect + n, szb) == RES_OK; n += szb) ; /* Fill the cluster with 0 */
|
||||
for (n = 0; n < fs->csize && disk_write(fs->pdrv, ibuf, sect + n, szb) == RES_OK; n += szb) ; /* Fill the cluster with 0 */
|
||||
ff_memfree(ibuf);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ibuf = fs->win; szb = 1; /* Use window buffer (many single-sector writes may take a time) */
|
||||
for (n = 0; n < fs->csize && ff_disk_write(fs->pdrv, ibuf, sect + n, szb) == RES_OK; n += szb) ; /* Fill the cluster with 0 */
|
||||
for (n = 0; n < fs->csize && disk_write(fs->pdrv, ibuf, sect + n, szb) == RES_OK; n += szb) ; /* Fill the cluster with 0 */
|
||||
}
|
||||
return (n == fs->csize) ? FR_OK : FR_DISK_ERR;
|
||||
}
|
||||
|
@ -3411,7 +3411,7 @@ static FRESULT mount_volume ( /* FR_OK(0): successful, !=0: an error occurred */
|
|||
|
||||
mode &= (BYTE)~FA_READ; /* Desired access mode, write access or not */
|
||||
if (fs->fs_type != 0) { /* If the volume has been mounted */
|
||||
stat = ff_disk_status(fs->pdrv);
|
||||
stat = disk_status(fs->pdrv);
|
||||
if (!(stat & STA_NOINIT)) { /* and the physical drive is kept initialized */
|
||||
if (!FF_FS_READONLY && mode && (stat & STA_PROTECT)) { /* Check write protection if needed */
|
||||
return FR_WRITE_PROTECTED;
|
||||
|
@ -3425,7 +3425,7 @@ static FRESULT mount_volume ( /* FR_OK(0): successful, !=0: an error occurred */
|
|||
|
||||
fs->fs_type = 0; /* Clear the filesystem object */
|
||||
fs->pdrv = LD2PD(vol); /* Volume hosting physical drive */
|
||||
stat = ff_disk_initialize(fs->pdrv); /* Initialize the physical drive */
|
||||
stat = disk_initialize(fs->pdrv); /* Initialize the physical drive */
|
||||
if (stat & STA_NOINIT) { /* Check if the initialization succeeded */
|
||||
return FR_NOT_READY; /* Failed to initialize due to no medium or hard error */
|
||||
}
|
||||
|
@ -3433,7 +3433,7 @@ static FRESULT mount_volume ( /* FR_OK(0): successful, !=0: an error occurred */
|
|||
return FR_WRITE_PROTECTED;
|
||||
}
|
||||
#if FF_MAX_SS != FF_MIN_SS /* Get sector size (multiple sector size cfg only) */
|
||||
if (ff_disk_ioctl(fs->pdrv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK) return FR_DISK_ERR;
|
||||
if (disk_ioctl(fs->pdrv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK) return FR_DISK_ERR;
|
||||
if (SS(fs) > FF_MAX_SS || SS(fs) < FF_MIN_SS || (SS(fs) & (SS(fs) - 1))) return FR_DISK_ERR;
|
||||
#endif
|
||||
|
||||
|
@ -3621,7 +3621,7 @@ static FRESULT validate ( /* Returns FR_OK or FR_INVALID_OBJECT */
|
|||
if (obj && obj->fs && obj->fs->fs_type && obj->id == obj->fs->id) { /* Test if the object is valid */
|
||||
#if FF_FS_REENTRANT
|
||||
if (lock_fs(obj->fs)) { /* Obtain the filesystem object */
|
||||
if (!(ff_disk_status(obj->fs->pdrv) & STA_NOINIT)) { /* Test if the phsical drive is kept initialized */
|
||||
if (!(disk_status(obj->fs->pdrv) & STA_NOINIT)) { /* Test if the phsical drive is kept initialized */
|
||||
res = FR_OK;
|
||||
} else {
|
||||
unlock_fs(obj->fs, FR_OK);
|
||||
|
@ -3630,7 +3630,7 @@ static FRESULT validate ( /* Returns FR_OK or FR_INVALID_OBJECT */
|
|||
res = FR_TIMEOUT;
|
||||
}
|
||||
#else
|
||||
if (!(ff_disk_status(obj->fs->pdrv) & STA_NOINIT)) { /* Test if the phsical drive is kept initialized */
|
||||
if (!(disk_status(obj->fs->pdrv) & STA_NOINIT)) { /* Test if the phsical drive is kept initialized */
|
||||
res = FR_OK;
|
||||
}
|
||||
#endif
|
||||
|
@ -3654,7 +3654,7 @@ static FRESULT validate ( /* Returns FR_OK or FR_INVALID_OBJECT */
|
|||
/* Mount/Unmount a Logical Drive */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_mount (
|
||||
FRESULT f_mount (
|
||||
FATFS* fs, /* Pointer to the filesystem object (NULL:unmount)*/
|
||||
const TCHAR* path, /* Logical drive number to be mounted/unmounted */
|
||||
BYTE opt /* Mode option 0:Do not mount (delayed mount), 1:Mount immediately */
|
||||
|
@ -3702,7 +3702,7 @@ FRESULT ff_mount (
|
|||
/* Open or Create a File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_open (
|
||||
FRESULT f_open (
|
||||
FIL* fp, /* Pointer to the blank file object */
|
||||
const TCHAR* path, /* Pointer to the file name */
|
||||
BYTE mode /* Access mode and file open mode flags */
|
||||
|
@ -3871,7 +3871,7 @@ FRESULT ff_open (
|
|||
} else {
|
||||
fp->sect = sc + (DWORD)(ofs / SS(fs));
|
||||
#if !FF_FS_TINY
|
||||
if (ff_disk_read(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) res = FR_DISK_ERR;
|
||||
if (disk_read(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) res = FR_DISK_ERR;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -3894,7 +3894,7 @@ FRESULT ff_open (
|
|||
/* Read File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_read (
|
||||
FRESULT f_read (
|
||||
FIL* fp, /* Pointer to the file object */
|
||||
void* buff, /* Pointer to data buffer */
|
||||
UINT btr, /* Number of bytes to read */
|
||||
|
@ -3946,7 +3946,7 @@ FRESULT ff_read (
|
|||
if (csect + cc > fs->csize) { /* Clip at cluster boundary */
|
||||
cc = fs->csize - csect;
|
||||
}
|
||||
if (ff_disk_read(fs->pdrv, rbuff, sect, cc) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
if (disk_read(fs->pdrv, rbuff, sect, cc) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
#if !FF_FS_READONLY && FF_FS_MINIMIZE <= 2 /* Replace one of the read sectors with cached data if it contains a dirty sector */
|
||||
#if FF_FS_TINY
|
||||
if (fs->wflag && fs->winsect - sect < cc) {
|
||||
|
@ -3965,11 +3965,11 @@ FRESULT ff_read (
|
|||
if (fp->sect != sect) { /* Load data sector if not in cache */
|
||||
#if !FF_FS_READONLY
|
||||
if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */
|
||||
if (ff_disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
fp->flag &= (BYTE)~FA_DIRTY;
|
||||
}
|
||||
#endif
|
||||
if (ff_disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); /* Fill sector cache */
|
||||
if (disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); /* Fill sector cache */
|
||||
}
|
||||
#endif
|
||||
fp->sect = sect;
|
||||
|
@ -3995,7 +3995,7 @@ FRESULT ff_read (
|
|||
/* Write File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_write (
|
||||
FRESULT f_write (
|
||||
FIL* fp, /* Pointer to the file object */
|
||||
const void* buff, /* Pointer to the data to be written */
|
||||
UINT btw, /* Number of bytes to write */
|
||||
|
@ -4050,7 +4050,7 @@ FRESULT ff_write (
|
|||
if (fs->winsect == fp->sect && sync_window(fs) != FR_OK) ABORT(fs, FR_DISK_ERR); /* Write-back sector cache */
|
||||
#else
|
||||
if (fp->flag & FA_DIRTY) { /* Write-back sector cache */
|
||||
if (ff_disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
fp->flag &= (BYTE)~FA_DIRTY;
|
||||
}
|
||||
#endif
|
||||
|
@ -4062,7 +4062,7 @@ FRESULT ff_write (
|
|||
if (csect + cc > fs->csize) { /* Clip at cluster boundary */
|
||||
cc = fs->csize - csect;
|
||||
}
|
||||
if (ff_disk_write(fs->pdrv, wbuff, sect, cc) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
if (disk_write(fs->pdrv, wbuff, sect, cc) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
#if FF_FS_MINIMIZE <= 2
|
||||
#if FF_FS_TINY
|
||||
if (fs->winsect - sect < cc) { /* Refill sector cache if it gets invalidated by the direct write */
|
||||
|
@ -4087,7 +4087,7 @@ FRESULT ff_write (
|
|||
#else
|
||||
if (fp->sect != sect && /* Fill sector cache with file data */
|
||||
fp->fptr < fp->obj.objsize &&
|
||||
ff_disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) {
|
||||
disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) {
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
#endif
|
||||
|
@ -4117,7 +4117,7 @@ FRESULT ff_write (
|
|||
/* Synchronize the File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_sync (
|
||||
FRESULT f_sync (
|
||||
FIL* fp /* Pointer to the file object */
|
||||
)
|
||||
{
|
||||
|
@ -4132,7 +4132,7 @@ FRESULT ff_sync (
|
|||
if (fp->flag & FA_MODIFIED) { /* Is there any change to the file? */
|
||||
#if !FF_FS_TINY
|
||||
if (fp->flag & FA_DIRTY) { /* Write-back cached data if needed */
|
||||
if (ff_disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) LEAVE_FF(fs, FR_DISK_ERR);
|
||||
if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) LEAVE_FF(fs, FR_DISK_ERR);
|
||||
fp->flag &= (BYTE)~FA_DIRTY;
|
||||
}
|
||||
#endif
|
||||
|
@ -4198,7 +4198,7 @@ FRESULT ff_sync (
|
|||
/* Close File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_close (
|
||||
FRESULT f_close (
|
||||
FIL* fp /* Pointer to the file object to be closed */
|
||||
)
|
||||
{
|
||||
|
@ -4234,7 +4234,7 @@ FRESULT ff_close (
|
|||
/* Change Current Directory or Current Drive, Get Current Directory */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_chdrive (
|
||||
FRESULT f_chdrive (
|
||||
const TCHAR* path /* Drive number to set */
|
||||
)
|
||||
{
|
||||
|
@ -4251,7 +4251,7 @@ FRESULT ff_chdrive (
|
|||
|
||||
|
||||
|
||||
FRESULT ff_chdir (
|
||||
FRESULT f_chdir (
|
||||
const TCHAR* path /* Pointer to the directory path */
|
||||
)
|
||||
{
|
||||
|
@ -4313,7 +4313,7 @@ FRESULT ff_chdir (
|
|||
|
||||
|
||||
#if FF_FS_RPATH >= 2
|
||||
FRESULT ff_getcwd (
|
||||
FRESULT f_getcwd (
|
||||
TCHAR* buff, /* Pointer to the directory path */
|
||||
UINT len /* Size of buff in unit of TCHAR */
|
||||
)
|
||||
|
@ -4413,7 +4413,7 @@ FRESULT ff_getcwd (
|
|||
/* Seek File Read/Write Pointer */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_lseek (
|
||||
FRESULT f_lseek (
|
||||
FIL* fp, /* Pointer to the file object */
|
||||
FSIZE_t ofs /* File pointer from top of file */
|
||||
)
|
||||
|
@ -4476,11 +4476,11 @@ FRESULT ff_lseek (
|
|||
#if !FF_FS_TINY
|
||||
#if !FF_FS_READONLY
|
||||
if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */
|
||||
if (ff_disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
fp->flag &= (BYTE)~FA_DIRTY;
|
||||
}
|
||||
#endif
|
||||
if (ff_disk_read(fs->pdrv, fp->buf, dsc, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); /* Load current sector */
|
||||
if (disk_read(fs->pdrv, fp->buf, dsc, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); /* Load current sector */
|
||||
#endif
|
||||
fp->sect = dsc;
|
||||
}
|
||||
|
@ -4556,11 +4556,11 @@ FRESULT ff_lseek (
|
|||
#if !FF_FS_TINY
|
||||
#if !FF_FS_READONLY
|
||||
if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */
|
||||
if (ff_disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
fp->flag &= (BYTE)~FA_DIRTY;
|
||||
}
|
||||
#endif
|
||||
if (ff_disk_read(fs->pdrv, fp->buf, nsect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); /* Fill sector cache */
|
||||
if (disk_read(fs->pdrv, fp->buf, nsect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); /* Fill sector cache */
|
||||
#endif
|
||||
fp->sect = nsect;
|
||||
}
|
||||
|
@ -4576,7 +4576,7 @@ FRESULT ff_lseek (
|
|||
/* Create a Directory Object */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_opendir (
|
||||
FRESULT f_opendir (
|
||||
DIR* dp, /* Pointer to directory object to create */
|
||||
const TCHAR* path /* Pointer to the directory path */
|
||||
)
|
||||
|
@ -4642,7 +4642,7 @@ FRESULT ff_opendir (
|
|||
/* Close Directory */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_closedir (
|
||||
FRESULT f_closedir (
|
||||
DIR *dp /* Pointer to the directory object to be closed */
|
||||
)
|
||||
{
|
||||
|
@ -4672,7 +4672,7 @@ FRESULT ff_closedir (
|
|||
/* Read Directory Entries in Sequence */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_readdir (
|
||||
FRESULT f_readdir (
|
||||
DIR* dp, /* Pointer to the open directory object */
|
||||
FILINFO* fno /* Pointer to file information to return */
|
||||
)
|
||||
|
@ -4708,7 +4708,7 @@ FRESULT ff_readdir (
|
|||
/* Find Next File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_findnext (
|
||||
FRESULT f_findnext (
|
||||
DIR* dp, /* Pointer to the open directory object */
|
||||
FILINFO* fno /* Pointer to the file information structure */
|
||||
)
|
||||
|
@ -4733,7 +4733,7 @@ FRESULT ff_findnext (
|
|||
/* Find First File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_findfirst (
|
||||
FRESULT f_findfirst (
|
||||
DIR* dp, /* Pointer to the blank directory object */
|
||||
FILINFO* fno, /* Pointer to the file information structure */
|
||||
const TCHAR* path, /* Pointer to the directory to open */
|
||||
|
@ -4760,7 +4760,7 @@ FRESULT ff_findfirst (
|
|||
/* Get File Status */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_stat (
|
||||
FRESULT f_stat (
|
||||
const TCHAR* path, /* Pointer to the file path */
|
||||
FILINFO* fno /* Pointer to file information to return */
|
||||
)
|
||||
|
@ -4795,7 +4795,7 @@ FRESULT ff_stat (
|
|||
/* Get Number of Free Clusters */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_getfree (
|
||||
FRESULT f_getfree (
|
||||
const TCHAR* path, /* Logical drive number */
|
||||
DWORD* nclst, /* Pointer to a variable to return number of free clusters */
|
||||
FATFS** fatfs /* Pointer to return pointer to corresponding filesystem object */
|
||||
|
@ -4885,7 +4885,7 @@ FRESULT ff_getfree (
|
|||
/* Truncate File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_truncate (
|
||||
FRESULT f_truncate (
|
||||
FIL* fp /* Pointer to the file object */
|
||||
)
|
||||
{
|
||||
|
@ -4915,7 +4915,7 @@ FRESULT ff_truncate (
|
|||
fp->flag |= FA_MODIFIED;
|
||||
#if !FF_FS_TINY
|
||||
if (res == FR_OK && (fp->flag & FA_DIRTY)) {
|
||||
if (ff_disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) {
|
||||
if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) {
|
||||
res = FR_DISK_ERR;
|
||||
} else {
|
||||
fp->flag &= (BYTE)~FA_DIRTY;
|
||||
|
@ -4935,7 +4935,7 @@ FRESULT ff_truncate (
|
|||
/* Delete a File/Directory */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_unlink (
|
||||
FRESULT f_unlink (
|
||||
const TCHAR* path /* Pointer to the file or directory path */
|
||||
)
|
||||
{
|
||||
|
@ -5029,7 +5029,7 @@ FRESULT ff_unlink (
|
|||
/* Create a Directory */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_mkdir (
|
||||
FRESULT f_mkdir (
|
||||
const TCHAR* path /* Pointer to the directory path */
|
||||
)
|
||||
{
|
||||
|
@ -5113,7 +5113,7 @@ FRESULT ff_mkdir (
|
|||
/* Rename a File/Directory */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_rename (
|
||||
FRESULT f_rename (
|
||||
const TCHAR* path_old, /* Pointer to the object name to be renamed */
|
||||
const TCHAR* path_new /* Pointer to the new name */
|
||||
)
|
||||
|
@ -5223,7 +5223,7 @@ FRESULT ff_rename (
|
|||
/* Change Attribute */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_chmod (
|
||||
FRESULT f_chmod (
|
||||
const TCHAR* path, /* Pointer to the file path */
|
||||
BYTE attr, /* Attribute bits */
|
||||
BYTE mask /* Attribute mask to change */
|
||||
|
@ -5270,7 +5270,7 @@ FRESULT ff_chmod (
|
|||
/* Change Timestamp */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_utime (
|
||||
FRESULT f_utime (
|
||||
const TCHAR* path, /* Pointer to the file/directory name */
|
||||
const FILINFO* fno /* Pointer to the timestamp to be set */
|
||||
)
|
||||
|
@ -5317,7 +5317,7 @@ FRESULT ff_utime (
|
|||
/* Get Volume Label */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_getlabel (
|
||||
FRESULT f_getlabel (
|
||||
const TCHAR* path, /* Logical drive number */
|
||||
TCHAR* label, /* Buffer to store the volume label */
|
||||
DWORD* vsn /* Variable to store the volume serial number */
|
||||
|
@ -5412,7 +5412,7 @@ FRESULT ff_getlabel (
|
|||
/* Set Volume Label */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_setlabel (
|
||||
FRESULT f_setlabel (
|
||||
const TCHAR* label /* Volume label to set with heading logical drive number */
|
||||
)
|
||||
{
|
||||
|
@ -5532,7 +5532,7 @@ FRESULT ff_setlabel (
|
|||
/* Allocate a Contiguous Blocks to the File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_expand (
|
||||
FRESULT f_expand (
|
||||
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 */
|
||||
|
@ -5622,7 +5622,7 @@ FRESULT ff_expand (
|
|||
/* Forward Data to the Stream Directly */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_forward (
|
||||
FRESULT f_forward (
|
||||
FIL* fp, /* Pointer to the file object */
|
||||
UINT (*func)(const BYTE*,UINT), /* Pointer to the streaming function */
|
||||
UINT btf, /* Number of bytes to forward */
|
||||
|
@ -5668,11 +5668,11 @@ FRESULT ff_forward (
|
|||
if (fp->sect != sect) { /* Fill sector cache with file data */
|
||||
#if !FF_FS_READONLY
|
||||
if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */
|
||||
if (ff_disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
fp->flag &= (BYTE)~FA_DIRTY;
|
||||
}
|
||||
#endif
|
||||
if (ff_disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
if (disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
dbuf = fp->buf;
|
||||
#endif
|
||||
|
@ -5714,7 +5714,7 @@ static FRESULT create_partition (
|
|||
BYTE *pte, hd, n_hd, sc, n_sc;
|
||||
|
||||
/* Get drive size */
|
||||
if (ff_disk_ioctl(drv, GET_SECTOR_COUNT, &sz_drv) != RES_OK) return FR_DISK_ERR;
|
||||
if (disk_ioctl(drv, GET_SECTOR_COUNT, &sz_drv) != RES_OK) return FR_DISK_ERR;
|
||||
|
||||
#if FF_LBA64
|
||||
if (sz_drv >= FF_MIN_GPT) { /* Create partitions in GPT */
|
||||
|
@ -5725,7 +5725,7 @@ static FRESULT create_partition (
|
|||
static const BYTE gpt_mbr[16] = {0x00, 0x00, 0x02, 0x00, 0xEE, 0xFE, 0xFF, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||
|
||||
#if FF_MAX_SS != FF_MIN_SS
|
||||
if (ff_disk_ioctl(drv, GET_SECTOR_SIZE, &ss) != RES_OK) return FR_DISK_ERR; /* Get sector size */
|
||||
if (disk_ioctl(drv, GET_SECTOR_SIZE, &ss) != RES_OK) return FR_DISK_ERR; /* Get sector size */
|
||||
if (ss > FF_MAX_SS || ss < FF_MIN_SS || (ss & (ss - 1))) return FR_DISK_ERR;
|
||||
#else
|
||||
ss = FF_MAX_SS;
|
||||
|
@ -5761,8 +5761,8 @@ static FRESULT create_partition (
|
|||
}
|
||||
if ((pi + 1) * SZ_GPTE % ss == 0) { /* Write the buffer if it is filled up */
|
||||
for (i = 0; i < ss; bcc = crc32(bcc, buf[i++])) ; /* Calculate table check sum */
|
||||
if (ff_disk_write(drv, buf, 2 + pi * SZ_GPTE / ss, 1) != RES_OK) return FR_DISK_ERR; /* Primary table */
|
||||
if (ff_disk_write(drv, buf, s_bpt + pi * SZ_GPTE / ss, 1) != RES_OK) return FR_DISK_ERR; /* Secondary table */
|
||||
if (disk_write(drv, buf, 2 + pi * SZ_GPTE / ss, 1) != RES_OK) return FR_DISK_ERR; /* Primary table */
|
||||
if (disk_write(drv, buf, s_bpt + pi * SZ_GPTE / ss, 1) != RES_OK) return FR_DISK_ERR; /* Secondary table */
|
||||
}
|
||||
} while (++pi < GPT_ITEMS);
|
||||
|
||||
|
@ -5780,7 +5780,7 @@ static FRESULT create_partition (
|
|||
rnd = make_rand(rnd, buf + GPTH_DskGuid, 16); /* Disk GUID */
|
||||
for (i = 0, bcc= 0xFFFFFFFF; i < 92; bcc = crc32(bcc, buf[i++])) ; /* Calculate header check sum */
|
||||
st_dword(buf + GPTH_Bcc, ~bcc); /* Header check sum */
|
||||
if (ff_disk_write(drv, buf, 1, 1) != RES_OK) return FR_DISK_ERR;
|
||||
if (disk_write(drv, buf, 1, 1) != RES_OK) return FR_DISK_ERR;
|
||||
|
||||
/* Create secondary GPT header */
|
||||
st_qword(buf + GPTH_CurLba, sz_drv - 1); /* LBA of this header */
|
||||
|
@ -5789,13 +5789,13 @@ static FRESULT create_partition (
|
|||
st_dword(buf + GPTH_Bcc, 0);
|
||||
for (i = 0, bcc= 0xFFFFFFFF; i < 92; bcc = crc32(bcc, buf[i++])) ; /* Calculate header check sum */
|
||||
st_dword(buf + GPTH_Bcc, ~bcc); /* Header check sum */
|
||||
if (ff_disk_write(drv, buf, sz_drv - 1, 1) != RES_OK) return FR_DISK_ERR;
|
||||
if (disk_write(drv, buf, sz_drv - 1, 1) != RES_OK) return FR_DISK_ERR;
|
||||
|
||||
/* Create protective MBR */
|
||||
mem_set(buf, 0, ss);
|
||||
mem_cpy(buf + MBR_Table, gpt_mbr, 16); /* Create a GPT partition */
|
||||
st_word(buf + BS_55AA, 0xAA55);
|
||||
if (ff_disk_write(drv, buf, 0, 1) != RES_OK) return FR_DISK_ERR;
|
||||
if (disk_write(drv, buf, 0, 1) != RES_OK) return FR_DISK_ERR;
|
||||
|
||||
} else
|
||||
#endif
|
||||
|
@ -5835,7 +5835,7 @@ static FRESULT create_partition (
|
|||
}
|
||||
|
||||
st_word(buf + BS_55AA, 0xAA55); /* MBR signature */
|
||||
if (ff_disk_write(drv, buf, 0, 1) != RES_OK) return FR_DISK_ERR; /* Write it to the MBR */
|
||||
if (disk_write(drv, buf, 0, 1) != RES_OK) return FR_DISK_ERR; /* Write it to the MBR */
|
||||
}
|
||||
|
||||
return FR_OK;
|
||||
|
@ -5843,7 +5843,7 @@ static FRESULT create_partition (
|
|||
|
||||
|
||||
|
||||
FRESULT ff_mkfs (
|
||||
FRESULT f_mkfs (
|
||||
const TCHAR* path, /* Logical drive number */
|
||||
const MKFS_PARM* opt, /* Format options */
|
||||
void* work, /* Pointer to working buffer (null: use heap memory) */
|
||||
|
@ -5874,14 +5874,14 @@ FRESULT ff_mkfs (
|
|||
if (!opt) opt = &defopt; /* Use default parameter if it is not given */
|
||||
|
||||
/* Get physical drive status (sz_drv, sz_blk, ss) */
|
||||
ds = ff_disk_initialize(pdrv);
|
||||
ds = disk_initialize(pdrv);
|
||||
if (ds & STA_NOINIT) return FR_NOT_READY;
|
||||
if (ds & STA_PROTECT) return FR_WRITE_PROTECTED;
|
||||
sz_blk = opt->align;
|
||||
if (sz_blk == 0 && ff_disk_ioctl(pdrv, GET_BLOCK_SIZE, &sz_blk) != RES_OK) sz_blk = 1;
|
||||
if (sz_blk == 0 && disk_ioctl(pdrv, GET_BLOCK_SIZE, &sz_blk) != RES_OK) sz_blk = 1;
|
||||
if (sz_blk == 0 || sz_blk > 0x8000 || (sz_blk & (sz_blk - 1))) sz_blk = 1;
|
||||
#if FF_MAX_SS != FF_MIN_SS
|
||||
if (ff_disk_ioctl(pdrv, GET_SECTOR_SIZE, &ss) != RES_OK) return FR_DISK_ERR;
|
||||
if (disk_ioctl(pdrv, GET_SECTOR_SIZE, &ss) != RES_OK) return FR_DISK_ERR;
|
||||
if (ss > FF_MAX_SS || ss < FF_MIN_SS || (ss & (ss - 1))) return FR_DISK_ERR;
|
||||
#else
|
||||
ss = FF_MAX_SS;
|
||||
|
@ -5906,7 +5906,7 @@ FRESULT ff_mkfs (
|
|||
b_vol = sz_vol = 0;
|
||||
if (FF_MULTI_PARTITION && ipart != 0) { /* Is the volume associated with any specific partition? */
|
||||
/* Get partition location from the existing partition table */
|
||||
if (ff_disk_read(pdrv, buf, 0, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Load MBR */
|
||||
if (disk_read(pdrv, buf, 0, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Load MBR */
|
||||
if (ld_word(buf + BS_55AA) != 0xAA55) LEAVE_MKFS(FR_MKFS_ABORTED); /* Check if MBR is valid */
|
||||
#if FF_LBA64
|
||||
if (buf[MBR_Table + PTE_System] == 0xEE) { /* GPT protective MBR? */
|
||||
|
@ -5914,13 +5914,13 @@ FRESULT ff_mkfs (
|
|||
QWORD pt_lba;
|
||||
|
||||
/* Get the partition location from GPT */
|
||||
if (ff_disk_read(pdrv, buf, 1, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Load GPT header sector (next to MBR) */
|
||||
if (disk_read(pdrv, buf, 1, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Load GPT header sector (next to MBR) */
|
||||
if (!test_gpt_header(buf)) LEAVE_MKFS(FR_MKFS_ABORTED); /* Check if GPT header is valid */
|
||||
n_ent = ld_dword(buf + GPTH_PtNum); /* Number of entries */
|
||||
pt_lba = ld_qword(buf + GPTH_PtOfs); /* Table start sector */
|
||||
ofs = i = 0;
|
||||
while (n_ent) { /* Find MS Basic partition with order of ipart */
|
||||
if (ofs == 0 && ff_disk_read(pdrv, buf, pt_lba++, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Get PT sector */
|
||||
if (ofs == 0 && disk_read(pdrv, buf, pt_lba++, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Get PT sector */
|
||||
if (!mem_cmp(buf + ofs + GPTE_PtGuid, GUID_MS_Basic, 16) && ++i == ipart) { /* MS basic data partition? */
|
||||
b_vol = ld_qword(buf + ofs + GPTE_FstLba);
|
||||
sz_vol = ld_qword(buf + ofs + GPTE_LstLba) - b_vol + 1;
|
||||
|
@ -5939,7 +5939,7 @@ FRESULT ff_mkfs (
|
|||
sz_vol = ld_dword(pte + PTE_SizLba); /* Get volume size */
|
||||
}
|
||||
} else { /* The volume is associated with a physical drive */
|
||||
if (ff_disk_ioctl(pdrv, GET_SECTOR_COUNT, &sz_vol) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_ioctl(pdrv, GET_SECTOR_COUNT, &sz_vol) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (!(fsopt & FM_SFD)) { /* To be partitioned? */
|
||||
/* Create a single-partition on the drive in this function */
|
||||
#if FF_LBA64
|
||||
|
@ -5988,7 +5988,7 @@ FRESULT ff_mkfs (
|
|||
if (sz_vol < 0x1000) LEAVE_MKFS(FR_MKFS_ABORTED); /* Too small volume for exFAT? */
|
||||
#if FF_USE_TRIM
|
||||
lba[0] = b_vol; lba[1] = b_vol + sz_vol - 1; /* Inform storage device that the volume area may be erased */
|
||||
ff_disk_ioctl(pdrv, CTRL_TRIM, lba);
|
||||
disk_ioctl(pdrv, CTRL_TRIM, lba);
|
||||
#endif
|
||||
/* Determine FAT location, data location and number of clusters */
|
||||
if (sz_au == 0) { /* AU auto-selection */
|
||||
|
@ -6038,7 +6038,7 @@ FRESULT ff_mkfs (
|
|||
i += 2; szb_case += 2;
|
||||
if (si == 0 || i == sz_buf * ss) { /* Write buffered data when buffer full or end of process */
|
||||
n = (i + ss - 1) / ss;
|
||||
if (ff_disk_write(pdrv, buf, sect, n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_write(pdrv, buf, sect, n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
sect += n; i = 0;
|
||||
}
|
||||
} while (si);
|
||||
|
@ -6053,7 +6053,7 @@ FRESULT ff_mkfs (
|
|||
for (i = 0; nb >= 8 && i < sz_buf * ss; buf[i++] = 0xFF, nb -= 8) ;
|
||||
for (b = 1; nb != 0 && i < sz_buf * ss; buf[i] |= b, b <<= 1, nb--) ;
|
||||
n = (nsect > sz_buf) ? sz_buf : nsect; /* Write the buffered data */
|
||||
if (ff_disk_write(pdrv, buf, sect, n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_write(pdrv, buf, sect, n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
sect += n; nsect -= n;
|
||||
} while (nsect);
|
||||
|
||||
|
@ -6074,7 +6074,7 @@ FRESULT ff_mkfs (
|
|||
if (nb == 0 && j < 3) nb = tbl[j++]; /* Next chain */
|
||||
} while (nb != 0 && i < sz_buf * ss);
|
||||
n = (nsect > sz_buf) ? sz_buf : nsect; /* Write the buffered data */
|
||||
if (ff_disk_write(pdrv, buf, sect, n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_write(pdrv, buf, sect, n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
sect += n; nsect -= n;
|
||||
} while (nsect);
|
||||
|
||||
|
@ -6091,7 +6091,7 @@ FRESULT ff_mkfs (
|
|||
sect = b_data + sz_au * (tbl[0] + tbl[1]); nsect = sz_au; /* Start of the root directory and number of sectors */
|
||||
do { /* Fill root directory sectors */
|
||||
n = (nsect > sz_buf) ? sz_buf : nsect;
|
||||
if (ff_disk_write(pdrv, buf, sect, n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_write(pdrv, buf, sect, n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
mem_set(buf, 0, ss);
|
||||
sect += n; nsect -= n;
|
||||
} while (nsect);
|
||||
|
@ -6120,23 +6120,23 @@ FRESULT ff_mkfs (
|
|||
for (i = sum = 0; i < ss; i++) { /* VBR checksum */
|
||||
if (i != BPB_VolFlagEx && i != BPB_VolFlagEx + 1 && i != BPB_PercInUseEx) sum = xsum32(buf[i], sum);
|
||||
}
|
||||
if (ff_disk_write(pdrv, buf, sect++, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_write(pdrv, buf, sect++, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
/* Extended bootstrap record (+1..+8) */
|
||||
mem_set(buf, 0, ss);
|
||||
st_word(buf + ss - 2, 0xAA55); /* Signature (placed at end of sector) */
|
||||
for (j = 1; j < 9; j++) {
|
||||
for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) ; /* VBR checksum */
|
||||
if (ff_disk_write(pdrv, buf, sect++, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_write(pdrv, buf, sect++, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
}
|
||||
/* OEM/Reserved record (+9..+10) */
|
||||
mem_set(buf, 0, ss);
|
||||
for ( ; j < 11; j++) {
|
||||
for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) ; /* VBR checksum */
|
||||
if (ff_disk_write(pdrv, buf, sect++, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_write(pdrv, buf, sect++, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
}
|
||||
/* Sum record (+11) */
|
||||
for (i = 0; i < ss; i += 4) st_dword(buf + i, sum); /* Fill with checksum value */
|
||||
if (ff_disk_write(pdrv, buf, sect++, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_write(pdrv, buf, sect++, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
}
|
||||
|
||||
} else
|
||||
|
@ -6218,7 +6218,7 @@ FRESULT ff_mkfs (
|
|||
|
||||
#if FF_USE_TRIM
|
||||
lba[0] = b_vol; lba[1] = b_vol + sz_vol - 1; /* Inform storage device that the volume area may be erased */
|
||||
ff_disk_ioctl(pdrv, CTRL_TRIM, lba);
|
||||
disk_ioctl(pdrv, CTRL_TRIM, lba);
|
||||
#endif
|
||||
/* Create FAT VBR */
|
||||
mem_set(buf, 0, ss);
|
||||
|
@ -6254,19 +6254,19 @@ FRESULT ff_mkfs (
|
|||
mem_cpy(buf + BS_VolLab, "NO NAME " "FAT ", 19); /* Volume label, FAT signature */
|
||||
}
|
||||
st_word(buf + BS_55AA, 0xAA55); /* Signature (offset is fixed here regardless of sector size) */
|
||||
if (ff_disk_write(pdrv, buf, b_vol, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Write it to the VBR sector */
|
||||
if (disk_write(pdrv, buf, b_vol, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Write it to the VBR sector */
|
||||
|
||||
/* Create FSINFO record if needed */
|
||||
if (fsty == FS_FAT32) {
|
||||
ff_disk_write(pdrv, buf, b_vol + 6, 1); /* Write backup VBR (VBR + 6) */
|
||||
disk_write(pdrv, buf, b_vol + 6, 1); /* Write backup VBR (VBR + 6) */
|
||||
mem_set(buf, 0, ss);
|
||||
st_dword(buf + FSI_LeadSig, 0x41615252);
|
||||
st_dword(buf + FSI_StrucSig, 0x61417272);
|
||||
st_dword(buf + FSI_Free_Count, n_clst - 1); /* Number of free clusters */
|
||||
st_dword(buf + FSI_Nxt_Free, 2); /* Last allocated cluster# */
|
||||
st_word(buf + BS_55AA, 0xAA55);
|
||||
ff_disk_write(pdrv, buf, b_vol + 7, 1); /* Write backup FSINFO (VBR + 7) */
|
||||
ff_disk_write(pdrv, buf, b_vol + 1, 1); /* Write original FSINFO (VBR + 1) */
|
||||
disk_write(pdrv, buf, b_vol + 7, 1); /* Write backup FSINFO (VBR + 7) */
|
||||
disk_write(pdrv, buf, b_vol + 1, 1); /* Write original FSINFO (VBR + 1) */
|
||||
}
|
||||
|
||||
/* Initialize FAT area */
|
||||
|
@ -6283,7 +6283,7 @@ FRESULT ff_mkfs (
|
|||
nsect = sz_fat; /* Number of FAT sectors */
|
||||
do { /* Fill FAT sectors */
|
||||
n = (nsect > sz_buf) ? sz_buf : nsect;
|
||||
if (ff_disk_write(pdrv, buf, sect, (UINT)n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_write(pdrv, buf, sect, (UINT)n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
mem_set(buf, 0, ss); /* Rest of FAT all are cleared */
|
||||
sect += n; nsect -= n;
|
||||
} while (nsect);
|
||||
|
@ -6293,7 +6293,7 @@ FRESULT ff_mkfs (
|
|||
nsect = (fsty == FS_FAT32) ? pau : sz_dir; /* Number of root directory sectors */
|
||||
do {
|
||||
n = (nsect > sz_buf) ? sz_buf : nsect;
|
||||
if (ff_disk_write(pdrv, buf, sect, (UINT)n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_write(pdrv, buf, sect, (UINT)n) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
sect += n; nsect -= n;
|
||||
} while (nsect);
|
||||
}
|
||||
|
@ -6319,9 +6319,9 @@ FRESULT ff_mkfs (
|
|||
if (FF_MULTI_PARTITION && ipart != 0) { /* Volume is in the existing partition */
|
||||
if (!FF_LBA64 || !(fsopt & 0x80)) {
|
||||
/* Update system ID in the partition table */
|
||||
if (ff_disk_read(pdrv, buf, 0, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Read the MBR */
|
||||
if (disk_read(pdrv, buf, 0, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Read the MBR */
|
||||
buf[MBR_Table + (ipart - 1) * SZ_PTE + PTE_System] = sys; /* Set system ID */
|
||||
if (ff_disk_write(pdrv, buf, 0, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Write it back to the MBR */
|
||||
if (disk_write(pdrv, buf, 0, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Write it back to the MBR */
|
||||
}
|
||||
} else { /* Volume as a new single partition */
|
||||
if (!(fsopt & FM_SFD)) { /* Create partition table if not in SFD */
|
||||
|
@ -6331,7 +6331,7 @@ FRESULT ff_mkfs (
|
|||
}
|
||||
}
|
||||
|
||||
if (ff_disk_ioctl(pdrv, CTRL_SYNC, 0) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
if (disk_ioctl(pdrv, CTRL_SYNC, 0) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
|
||||
LEAVE_MKFS(FR_OK);
|
||||
}
|
||||
|
@ -6344,7 +6344,7 @@ FRESULT ff_mkfs (
|
|||
/* Create Partition Table on the Physical Drive */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_fdisk (
|
||||
FRESULT f_fdisk (
|
||||
BYTE pdrv, /* Physical drive number */
|
||||
const LBA_t ptbl[], /* Pointer to the size table for each partitions */
|
||||
void* work /* Pointer to the working buffer (null: use heap memory) */
|
||||
|
@ -6354,7 +6354,7 @@ FRESULT ff_fdisk (
|
|||
DSTATUS stat;
|
||||
|
||||
|
||||
stat = ff_disk_initialize(pdrv);
|
||||
stat = disk_initialize(pdrv);
|
||||
if (stat & STA_NOINIT) return FR_NOT_READY;
|
||||
if (stat & STA_PROTECT) return FR_WRITE_PROTECTED;
|
||||
#if FF_USE_LFN == 3
|
||||
|
@ -6379,7 +6379,7 @@ FRESULT ff_fdisk (
|
|||
/* Get a String from the File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
TCHAR* ff_gets (
|
||||
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 */
|
||||
|
@ -6678,7 +6678,7 @@ static void putc_init (putbuff* pb, FIL* fp)
|
|||
|
||||
|
||||
|
||||
int ff_putc (
|
||||
int f_putc (
|
||||
TCHAR c, /* A character to be output */
|
||||
FIL* fp /* Pointer to the file object */
|
||||
)
|
||||
|
@ -6698,7 +6698,7 @@ int ff_putc (
|
|||
/* Put a String to the File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
int ff_puts (
|
||||
int f_puts (
|
||||
const TCHAR* str, /* Pointer to the string to be output */
|
||||
FIL* fp /* Pointer to the file object */
|
||||
)
|
||||
|
@ -6718,7 +6718,7 @@ int ff_puts (
|
|||
/* Put a Formatted String to the File */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
int ff_printf (
|
||||
int f_printf (
|
||||
FIL* fp, /* Pointer to the file object */
|
||||
const TCHAR* fmt, /* Pointer to the format string */
|
||||
... /* Optional arguments... */
|
||||
|
@ -6836,7 +6836,7 @@ int ff_printf (
|
|||
/* Set Active Codepage for the Path Name */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
FRESULT ff_setcp (
|
||||
FRESULT f_setcp (
|
||||
WORD cp /* Value to be set as active code page */
|
||||
)
|
||||
{
|
||||
|
|
|
@ -288,7 +288,7 @@ typedef enum {
|
|||
FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
|
||||
FR_NOT_ENABLED, /* (12) The volume has no work area */
|
||||
FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
|
||||
FR_MKFS_ABORTED, /* (14) The ff_mkfs() aborted due to any problem */
|
||||
FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any problem */
|
||||
FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
|
||||
FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
|
||||
FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
|
||||
|
@ -301,49 +301,49 @@ typedef enum {
|
|||
/*--------------------------------------------------------------*/
|
||||
/* FatFs module application interface */
|
||||
|
||||
FRESULT ff_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
|
||||
FRESULT ff_close (FIL* fp); /* Close an open file object */
|
||||
FRESULT ff_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */
|
||||
FRESULT ff_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */
|
||||
FRESULT ff_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */
|
||||
FRESULT ff_truncate (FIL* fp); /* Truncate the file */
|
||||
FRESULT ff_sync (FIL* fp); /* Flush cached data of the writing file */
|
||||
FRESULT ff_opendir (DIR* dp, const TCHAR* path); /* Open a directory */
|
||||
FRESULT ff_closedir (DIR* dp); /* Close an open directory */
|
||||
FRESULT ff_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */
|
||||
FRESULT ff_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */
|
||||
FRESULT ff_findnext (DIR* dp, FILINFO* fno); /* Find next file */
|
||||
FRESULT ff_mkdir (const TCHAR* path); /* Create a sub directory */
|
||||
FRESULT ff_unlink (const TCHAR* path); /* Delete an existing file or directory */
|
||||
FRESULT ff_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
|
||||
FRESULT ff_stat (const TCHAR* path, FILINFO* fno); /* Get file status */
|
||||
FRESULT ff_chmod (const TCHAR* path, BYTE attr, BYTE mask); /* Change attribute of a file/dir */
|
||||
FRESULT ff_utime (const TCHAR* path, const FILINFO* fno); /* Change timestamp of a file/dir */
|
||||
FRESULT ff_chdir (const TCHAR* path); /* Change current directory */
|
||||
FRESULT ff_chdrive (const TCHAR* path); /* Change current drive */
|
||||
FRESULT ff_getcwd (TCHAR* buff, UINT len); /* Get current directory */
|
||||
FRESULT ff_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
|
||||
FRESULT ff_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */
|
||||
FRESULT ff_setlabel (const TCHAR* label); /* Set volume label */
|
||||
FRESULT ff_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */
|
||||
FRESULT ff_expand (FIL* fp, FSIZE_t fsz, BYTE opt); /* Allocate a contiguous block to the file */
|
||||
FRESULT ff_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */
|
||||
FRESULT ff_mkfs (const TCHAR* path, const MKFS_PARM* opt, void* work, UINT len); /* Create a FAT volume */
|
||||
FRESULT ff_fdisk (BYTE pdrv, const LBA_t ptbl[], void* work); /* Divide a physical drive into some partitions */
|
||||
FRESULT ff_setcp (WORD cp); /* Set current code page */
|
||||
int ff_putc (TCHAR c, FIL* fp); /* Put a character to the file */
|
||||
int ff_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */
|
||||
int ff_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
|
||||
TCHAR* ff_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
|
||||
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_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_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_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_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_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 */
|
||||
|
||||
#define ff_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
|
||||
#define ff_error(fp) ((fp)->err)
|
||||
#define ff_tell(fp) ((fp)->fptr)
|
||||
#define ff_size(fp) ((fp)->obj.objsize)
|
||||
#define ff_rewind(fp) ff_lseek((fp), 0)
|
||||
#define ff_rewinddir(dp) ff_readdir((dp), 0)
|
||||
#define ff_rmdir(path) ff_unlink(path)
|
||||
#define ff_unmount(path) ff_mount(0, path, 0)
|
||||
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
|
||||
#define f_error(fp) ((fp)->err)
|
||||
#define f_tell(fp) ((fp)->fptr)
|
||||
#define f_size(fp) ((fp)->obj.objsize)
|
||||
#define f_rewind(fp) f_lseek((fp), 0)
|
||||
#define f_rewinddir(dp) f_readdir((dp), 0)
|
||||
#define f_rmdir(path) f_unlink(path)
|
||||
#define f_unmount(path) f_mount(0, path, 0)
|
||||
|
||||
#ifndef EOF
|
||||
#define EOF (-1)
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
#define FF_FS_READONLY 1
|
||||
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
||||
/ Read-only configuration removes writing API functions, ff_write(), ff_sync(),
|
||||
/ ff_unlink(), ff_mkdir(), ff_chmod(), ff_rename(), ff_truncate(), ff_getfree()
|
||||
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
|
||||
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
|
||||
/ and optional writing functions as well. */
|
||||
|
||||
|
||||
|
@ -19,14 +19,14 @@
|
|||
/* This option defines minimization level to remove some basic API functions.
|
||||
/
|
||||
/ 0: Basic functions are fully enabled.
|
||||
/ 1: ff_stat(), ff_getfree(), ff_unlink(), ff_mkdir(), ff_truncate() and ff_rename()
|
||||
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
|
||||
/ are removed.
|
||||
/ 2: ff_opendir(), ff_readdir() and ff_closedir() are removed in addition to 1.
|
||||
/ 3: ff_lseek() function is removed in addition to 2. */
|
||||
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
|
||||
/ 3: f_lseek() function is removed in addition to 2. */
|
||||
|
||||
|
||||
#define FF_USE_STRFUNC 0
|
||||
/* This option switches string functions, ff_gets(), ff_putc(), ff_puts() and ff_printf().
|
||||
/* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf().
|
||||
/
|
||||
/ 0: Disable string functions.
|
||||
/ 1: Enable without LF-CRLF conversion.
|
||||
|
@ -34,12 +34,12 @@
|
|||
|
||||
|
||||
#define FF_USE_FIND 0
|
||||
/* This option switches filtered directory read functions, ff_findfirst() and
|
||||
/ ff_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
||||
/* This option switches filtered directory read functions, f_findfirst() and
|
||||
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
||||
|
||||
|
||||
#define FF_USE_MKFS 0
|
||||
/* This option switches ff_mkfs() function. (0:Disable or 1:Enable) */
|
||||
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_FASTSEEK 0
|
||||
|
@ -47,21 +47,21 @@
|
|||
|
||||
|
||||
#define FF_USE_EXPAND 0
|
||||
/* This option switches ff_expand function. (0:Disable or 1:Enable) */
|
||||
/* This option switches f_expand function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_CHMOD 0
|
||||
/* This option switches attribute manipulation functions, ff_chmod() and ff_utime().
|
||||
/* This option switches attribute manipulation functions, f_chmod() and f_utime().
|
||||
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
|
||||
|
||||
|
||||
#define FF_USE_LABEL 0
|
||||
/* This option switches volume label functions, ff_getlabel() and ff_setlabel().
|
||||
/* This option switches volume label functions, f_getlabel() and f_setlabel().
|
||||
/ (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_FORWARD 0
|
||||
/* This option switches ff_forward() function. (0:Disable or 1:Enable) */
|
||||
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
|
@ -138,8 +138,8 @@
|
|||
|
||||
|
||||
#define FF_STRF_ENCODE 0
|
||||
/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, ff_gets(),
|
||||
/ ff_putc(), ff_puts and ff_printf() convert the character encoding in it.
|
||||
/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(),
|
||||
/ f_putc(), f_puts and f_printf() convert the character encoding in it.
|
||||
/ This option selects assumption of character encoding ON THE FILE to be
|
||||
/ read/written via those functions.
|
||||
/
|
||||
|
@ -154,8 +154,8 @@
|
|||
/* This option configures support for relative path.
|
||||
/
|
||||
/ 0: Disable relative path and remove related functions.
|
||||
/ 1: Enable relative path. ff_chdir() and ff_chdrive() are available.
|
||||
/ 2: ff_getcwd() function is available in addition to 1.
|
||||
/ 1: Enable relative path. f_chdir() and f_chdrive() are available.
|
||||
/ 2: f_getcwd() function is available in addition to 1.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -196,7 +196,7 @@
|
|||
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
||||
/ harddisk. But a larger value may be required for on-board flash memory and some
|
||||
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
|
||||
/ for variable sector size mode and ff_disk_ioctl() function needs to implement
|
||||
/ for variable sector size mode and disk_ioctl() function needs to implement
|
||||
/ GET_SECTOR_SIZE command. */
|
||||
|
||||
|
||||
|
@ -213,7 +213,7 @@
|
|||
#define FF_USE_TRIM 0
|
||||
/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
|
||||
/ To enable Trim function, also CTRL_TRIM command should be implemented to the
|
||||
/ ff_disk_ioctl() function. */
|
||||
/ disk_ioctl() function. */
|
||||
|
||||
|
||||
|
||||
|
@ -250,7 +250,7 @@
|
|||
|
||||
#define FF_FS_NOFSINFO 0
|
||||
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
||||
/ option, and ff_getfree() function at first time after volume mount will force
|
||||
/ option, and f_getfree() function at first time after volume mount will force
|
||||
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
||||
/
|
||||
/ bit0=0: Use free cluster count in the FSINFO if available.
|
||||
|
@ -278,8 +278,8 @@
|
|||
#define FF_SYNC_t HANDLE
|
||||
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
||||
/ module itself. Note that regardless of this option, file access to different
|
||||
/ volume is always re-entrant and volume control functions, ff_mount(), ff_mkfs()
|
||||
/ and ff_fdisk() function, are always not re-entrant. Only file/directory access
|
||||
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
||||
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
|
||||
/ to the same volume is under control of this function.
|
||||
/
|
||||
/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
|
||||
|
|
|
@ -201,10 +201,10 @@ bool gamecardInitialize(void)
|
|||
|
||||
g_loadKernelEvent = true;
|
||||
|
||||
/* Create user-mode exit event. */
|
||||
/* Create usermode exit event. */
|
||||
ueventCreate(&g_gameCardDetectionThreadExitEvent, true);
|
||||
|
||||
/* Create user-mode gamecard status change event. */
|
||||
/* Create usermode gamecard status change event. */
|
||||
ueventCreate(&g_gameCardStatusChangeEvent, true);
|
||||
|
||||
/* Create gamecard detection thread. */
|
||||
|
|
|
@ -187,7 +187,7 @@ bool gamecardInitialize(void);
|
|||
/// This includes destroying the background gamecard detection thread and freeing all cached gamecard data.
|
||||
void gamecardExit(void);
|
||||
|
||||
/// Returns a user-mode gamecard status change event that can be used to wait for status changes on other threads.
|
||||
/// Returns a usermode gamecard status change event that can be used to wait for status changes on other threads.
|
||||
/// If the gamecard interface hasn't been initialized, this returns NULL.
|
||||
UEvent *gamecardGetStatusChangeUserEvent(void);
|
||||
|
||||
|
|
|
@ -266,14 +266,14 @@ static u32 save_remap_read(remap_storage_ctx_t *ctx, void *buffer, u64 offset, s
|
|||
switch (ctx->type)
|
||||
{
|
||||
case STORAGE_BYTES:
|
||||
fr = ff_lseek(ctx->file, ctx->base_storage_offset + entry->physical_offset + entry_pos);
|
||||
if (fr || ff_tell(ctx->file) != (ctx->base_storage_offset + entry->physical_offset + entry_pos))
|
||||
fr = f_lseek(ctx->file, ctx->base_storage_offset + entry->physical_offset + entry_pos);
|
||||
if (fr || f_tell(ctx->file) != (ctx->base_storage_offset + entry->physical_offset + entry_pos))
|
||||
{
|
||||
LOGFILE("Failed to seek to offset 0x%lX in savefile! (%u).", ctx->base_storage_offset + entry->physical_offset + entry_pos, fr);
|
||||
return out_pos;
|
||||
}
|
||||
|
||||
fr = ff_read(ctx->file, (u8*)buffer + out_pos, bytes_to_read, &br);
|
||||
fr = f_read(ctx->file, (u8*)buffer + out_pos, bytes_to_read, &br);
|
||||
if (fr || br != bytes_to_read)
|
||||
{
|
||||
LOGFILE("Failed to read %u bytes chunk from offset 0x%lX in savefile! (%u).", bytes_to_read, ctx->base_storage_offset + entry->physical_offset + entry_pos, fr);
|
||||
|
@ -467,14 +467,14 @@ static size_t save_ivfc_level_fread(ivfc_level_save_ctx_t *ctx, void *buffer, u6
|
|||
switch (ctx->type)
|
||||
{
|
||||
case STORAGE_BYTES:
|
||||
fr = ff_lseek(ctx->save_ctx->file, ctx->hash_offset + offset);
|
||||
if (fr || ff_tell(ctx->save_ctx->file) != (ctx->hash_offset + offset))
|
||||
fr = f_lseek(ctx->save_ctx->file, ctx->hash_offset + offset);
|
||||
if (fr || f_tell(ctx->save_ctx->file) != (ctx->hash_offset + offset))
|
||||
{
|
||||
LOGFILE("Failed to seek to offset 0x%lX in savefile! (%u).", ctx->hash_offset + offset, fr);
|
||||
return (size_t)br;
|
||||
}
|
||||
|
||||
fr = ff_read(ctx->save_ctx->file, buffer, count, &br);
|
||||
fr = f_read(ctx->save_ctx->file, buffer, count, &br);
|
||||
if (fr || br != count)
|
||||
{
|
||||
LOGFILE("Failed to read IVFC level data from offset 0x%lX in savefile! (%u).", ctx->hash_offset + offset, fr);
|
||||
|
@ -1228,9 +1228,9 @@ bool save_process(save_ctx_t *ctx)
|
|||
bool success = false;
|
||||
|
||||
/* Try to parse Header A. */
|
||||
ff_rewind(ctx->file);
|
||||
f_rewind(ctx->file);
|
||||
|
||||
fr = ff_read(ctx->file, &ctx->header, sizeof(ctx->header), &br);
|
||||
fr = f_read(ctx->file, &ctx->header, sizeof(ctx->header), &br);
|
||||
if (fr || br != sizeof(ctx->header))
|
||||
{
|
||||
LOGFILE("Failed to read savefile header A! (%u).", fr);
|
||||
|
@ -1240,14 +1240,14 @@ bool save_process(save_ctx_t *ctx)
|
|||
if (!save_process_header(ctx) || ctx->header_hash_validity == VALIDITY_INVALID)
|
||||
{
|
||||
/* Try to parse Header B. */
|
||||
fr = ff_lseek(ctx->file, 0x4000);
|
||||
if (fr || ff_tell(ctx->file) != 0x4000)
|
||||
fr = f_lseek(ctx->file, 0x4000);
|
||||
if (fr || f_tell(ctx->file) != 0x4000)
|
||||
{
|
||||
LOGFILE("Failed to seek to offset 0x4000 in savefile! (%u).", fr);
|
||||
return success;
|
||||
}
|
||||
|
||||
fr = ff_read(ctx->file, &ctx->header, sizeof(ctx->header), &br);
|
||||
fr = f_read(ctx->file, &ctx->header, sizeof(ctx->header), &br);
|
||||
if (fr || br != sizeof(ctx->header))
|
||||
{
|
||||
LOGFILE("Failed to read savefile header B! (%u).", fr);
|
||||
|
@ -1279,8 +1279,8 @@ bool save_process(save_ctx_t *ctx)
|
|||
return success;
|
||||
}
|
||||
|
||||
fr = ff_lseek(ctx->file, ctx->header.layout.file_map_entry_offset);
|
||||
if (fr || ff_tell(ctx->file) != ctx->header.layout.file_map_entry_offset)
|
||||
fr = f_lseek(ctx->file, ctx->header.layout.file_map_entry_offset);
|
||||
if (fr || f_tell(ctx->file) != ctx->header.layout.file_map_entry_offset)
|
||||
{
|
||||
LOGFILE("Failed to seek to file map entry offset 0x%lX in savefile! (%u).", ctx->header.layout.file_map_entry_offset, fr);
|
||||
return success;
|
||||
|
@ -1288,7 +1288,7 @@ bool save_process(save_ctx_t *ctx)
|
|||
|
||||
for(u32 i = 0; i < ctx->data_remap_storage.header->map_entry_count; i++)
|
||||
{
|
||||
fr = ff_read(ctx->file, &ctx->data_remap_storage.map_entries[i], 0x20, &br);
|
||||
fr = f_read(ctx->file, &ctx->data_remap_storage.map_entries[i], 0x20, &br);
|
||||
if (fr || br != 0x20)
|
||||
{
|
||||
LOGFILE("Failed to read data remap storage entry #%u! (%u).", i, fr);
|
||||
|
@ -1416,8 +1416,8 @@ bool save_process(save_ctx_t *ctx)
|
|||
goto end;
|
||||
}
|
||||
|
||||
fr = ff_lseek(ctx->file, ctx->header.layout.meta_map_entry_offset);
|
||||
if (fr || ff_tell(ctx->file) != ctx->header.layout.meta_map_entry_offset)
|
||||
fr = f_lseek(ctx->file, ctx->header.layout.meta_map_entry_offset);
|
||||
if (fr || f_tell(ctx->file) != ctx->header.layout.meta_map_entry_offset)
|
||||
{
|
||||
LOGFILE("Failed to seek to meta map entry offset 0x%lX in savefile! (%u).", ctx->header.layout.meta_map_entry_offset, fr);
|
||||
goto end;
|
||||
|
@ -1425,7 +1425,7 @@ bool save_process(save_ctx_t *ctx)
|
|||
|
||||
for(u32 i = 0; i < ctx->meta_remap_storage.header->map_entry_count; i++)
|
||||
{
|
||||
fr = ff_read(ctx->file, &ctx->meta_remap_storage.map_entries[i], 0x20, &br);
|
||||
fr = f_read(ctx->file, &ctx->meta_remap_storage.map_entries[i], 0x20, &br);
|
||||
if (fr || br != 0x20)
|
||||
{
|
||||
LOGFILE("Failed to read meta remap storage entry #%u! (%u).", i, fr);
|
||||
|
@ -1737,7 +1737,7 @@ save_ctx_t *save_open_savefile(const char *path, u32 action)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
fr = ff_open(save_fd, path, FA_READ | FA_OPEN_EXISTING);
|
||||
fr = f_open(save_fd, path, FA_READ | FA_OPEN_EXISTING);
|
||||
if (fr != FR_OK)
|
||||
{
|
||||
LOGFILE("Failed to open \"%s\" savefile from BIS System partition! (%u).", path, fr);
|
||||
|
@ -1756,7 +1756,7 @@ save_ctx_t *save_open_savefile(const char *path, u32 action)
|
|||
|
||||
if (buf && fd)
|
||||
{
|
||||
u64 size = ff_size(save_fd);
|
||||
u64 size = f_size(save_fd);
|
||||
UINT br = 0;
|
||||
|
||||
for(u64 i = 0; i < size; i += blksize)
|
||||
|
@ -1766,7 +1766,7 @@ save_ctx_t *save_open_savefile(const char *path, u32 action)
|
|||
fwrite(buf, 1, blksize, fd);
|
||||
}
|
||||
|
||||
ff_rewind(save_fd);
|
||||
f_rewind(save_fd);
|
||||
}
|
||||
|
||||
if (fd) fclose(fd);
|
||||
|
@ -1796,7 +1796,7 @@ end:
|
|||
|
||||
if (save_fd)
|
||||
{
|
||||
if (open_savefile) ff_close(save_fd);
|
||||
if (open_savefile) f_close(save_fd);
|
||||
free(save_fd);
|
||||
}
|
||||
}
|
||||
|
@ -1810,7 +1810,7 @@ void save_close_savefile(save_ctx_t *ctx)
|
|||
|
||||
if (ctx->file)
|
||||
{
|
||||
ff_close(ctx->file);
|
||||
f_close(ctx->file);
|
||||
free(ctx->file);
|
||||
}
|
||||
|
||||
|
|
|
@ -467,7 +467,7 @@ bool titleInitialize(void)
|
|||
goto end;
|
||||
}
|
||||
|
||||
/* Create user-mode exit event. */
|
||||
/* Create usermode exit event. */
|
||||
ueventCreate(&g_titleGameCardInfoThreadExitEvent, true);
|
||||
|
||||
/* Retrieve gamecard status change user event. */
|
||||
|
@ -478,7 +478,7 @@ bool titleInitialize(void)
|
|||
goto end;
|
||||
}
|
||||
|
||||
/* Create user-mode gamecard update info event. */
|
||||
/* Create usermode gamecard update info event. */
|
||||
ueventCreate(&g_titleGameCardUpdateInfoUserEvent, true);
|
||||
|
||||
/* Create gamecard title info thread. */
|
||||
|
|
|
@ -181,10 +181,10 @@ bool usbInitialize(void)
|
|||
goto end;
|
||||
}
|
||||
|
||||
/* Create user-mode exit event. */
|
||||
/* Create usermode exit event. */
|
||||
ueventCreate(&g_usbDetectionThreadExitEvent, true);
|
||||
|
||||
/* Create user-mode USB timeout event. */
|
||||
/* Create usermode USB timeout event. */
|
||||
ueventCreate(&g_usbTimeoutEvent, true);
|
||||
|
||||
/* Create USB detection thread. */
|
||||
|
@ -455,7 +455,7 @@ void usbCancelFileTransfer(void)
|
|||
/* This will force the client to stop the current session, so a new one will have to be established. */
|
||||
usbDsEndpoint_Stall(g_usbDeviceInterface.endpoint_in);
|
||||
|
||||
/* Signal user-mode USB timeout event. */
|
||||
/* Signal usermode USB timeout event. */
|
||||
/* This will "reset" the USB connection by making the background thread wait until a new session is established. */
|
||||
ueventSignal(&g_usbTimeoutEvent);
|
||||
|
||||
|
@ -1222,7 +1222,7 @@ static bool usbTransferData(void *buf, u64 size, UsbDsEndpoint *endpoint)
|
|||
eventWait(&(endpoint->CompletionEvent), UINT64_MAX);
|
||||
eventClear(&(endpoint->CompletionEvent));
|
||||
|
||||
/* Signal user-mode USB timeout event if needed. */
|
||||
/* Signal usermode USB timeout event if needed. */
|
||||
/* This will "reset" the USB connection by making the background thread wait until a new session is established. */
|
||||
if (g_usbSessionStarted) ueventSignal(&g_usbTimeoutEvent);
|
||||
|
||||
|
|
|
@ -794,7 +794,7 @@ static bool utilsMountEmmcBisSystemPartitionStorage(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
fr = ff_mount(g_emmcBisSystemPartitionFatFsObj, BIS_SYSTEM_PARTITION_MOUNT_NAME, 1);
|
||||
fr = f_mount(g_emmcBisSystemPartitionFatFsObj, BIS_SYSTEM_PARTITION_MOUNT_NAME, 1);
|
||||
if (fr != FR_OK)
|
||||
{
|
||||
LOGFILE("Failed to mount eMMC BIS System partition! (%u).", fr);
|
||||
|
@ -808,7 +808,7 @@ static void utilsUnmountEmmcBisSystemPartitionStorage(void)
|
|||
{
|
||||
if (g_emmcBisSystemPartitionFatFsObj)
|
||||
{
|
||||
ff_unmount(BIS_SYSTEM_PARTITION_MOUNT_NAME);
|
||||
f_unmount(BIS_SYSTEM_PARTITION_MOUNT_NAME);
|
||||
free(g_emmcBisSystemPartitionFatFsObj);
|
||||
g_emmcBisSystemPartitionFatFsObj = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue