FatFs R0.12, released April 12, 2016

This commit is contained in:
Christopher Williams
2017-05-10 19:03:44 -07:00
parent 95374bbf12
commit 73b919bedf
79 changed files with 3843 additions and 2278 deletions
+11 -8
View File
@@ -4,11 +4,11 @@
/ This function checks if the file is contiguous with desired size.
/ If not, a block of contiguous sectors is allocated to the file.
/ If the file has been opened without FA_WRITE flag, it only checks if
/ the file is contiguous and returns the resulut. */
#if _FATFS != 32020 /* Check if R0.11 */
#error This function may not be compatible with this revision of FatFs module.
#endif
/ the file is contiguous and returns the resulut.
/-----------------------------------------------------------------------/
/ This function can work with FatFs R0.09 - R0.11a.
/ It is incompatible with R0.12+. Use f_expand function instead.
/----------------------------------------------------------------------*/
/* Declarations of FatFs internal functions accessible from applications.
/ This is intended to be used for disk checking/fixing or dirty hacks :-) */
@@ -37,18 +37,20 @@ DWORD allocate_contiguous_clusters ( /* Returns the first sector in LBA (0:er
do {
cl = get_fat(fp->fs, ccl); /* Get the cluster status */
if (cl + 1 < 3) return 0; /* Hard error? */
if (cl != ccl + 1 &&; cl < fp->fs->n_fatent) break; /* Not contiguous? */
if (cl != ccl + 1 && cl < fp->fs->n_fatent) break; /* Not contiguous? */
ccl = cl;
} while (++ncl < tcl);
if (ncl == tcl) /* Is the file contiguous? */
return clust2sect(fp->fs, fp->sclust); /* File is contiguous. Return the start sector */
}
/* File is not contiguous */
#if _FS_READONLY
return 0;
return 0; /* Exit if in read-only cfg. */
#else
if (!(fp->flag & FA_WRITE)) return 0; /* Exit if the file object is for read-only */
if (f_truncate(fp)) return 0; /* Remove the existing chain */
if (f_truncate(fp)) return 0; /* Remove the non-contiguous chain */
/* Find a free contiguous area */
ccl = cl = 2; ncl = 0;
@@ -100,6 +102,7 @@ int main (void)
...
dr = disk_write(fil.fs->drv, Buff, org, 1024); /* Write 512KiB from top of the file */
...
f_close(&fil);
return 0;
}
+3 -4
View File
@@ -48,7 +48,6 @@ int test_diskio (
DRESULT dr;
printf("test_diskio(%u, %u, 0x%08X, 0x%08X)\n", pdrv, ncyc, (UINT)buff, sz_buff);
if (sz_buff < _MAX_SS + 4) {
@@ -306,11 +305,11 @@ int main (int argc, char* argv[])
DWORD buff[512]; /* 2048 byte working buffer */
/* Check function/compatibility of the physical drive #0 */
rc = test_diskio(0, 1, buff, sizeof buff);
rc = test_diskio(0, 3, buff, sizeof buff);
if (rc) {
printf("Sorry the function/compatibility test failed.\nFatFs will not work on this disk driver.\n");
printf("Sorry the function/compatibility test failed. (rc=%d)\nFatFs will not work on this disk driver.\n", rc);
} else {
printf("Congratulations! The disk I/O layer works well.\n");
printf("Congratulations! The disk driver works well.\n");
}
return rc;
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB