bugfixes for SD card compatibility in DMA mode
This commit is contained in:
7
src/ff.c
7
src/ff.c
@@ -1504,8 +1504,6 @@ FRESULT f_open (
|
||||
}
|
||||
|
||||
fp->dir_sect = FSBUF.sect; /* Pointer to the directory entry */
|
||||
/* Moved sync from mode & FA_CREATE_ALWAYS because it can reset FSBUF.sect */
|
||||
sync(fs); /* not sure if this is needed in all cases, but kept */
|
||||
fp->dir_ptr = dir;
|
||||
#endif
|
||||
fp->flag = mode; /* File access mode */
|
||||
@@ -1516,6 +1514,11 @@ FRESULT f_open (
|
||||
fp->csect = 1; /* Sector counter */
|
||||
fp->fs = fs; //fp->id = fs->id; /* Owner file system object of the file */
|
||||
|
||||
#if !_FS_READONLY
|
||||
if (mode & (FA_CREATE_ALWAYS|FA_OPEN_ALWAYS|FA_CREATE_NEW))
|
||||
sync(fs); /* sync buffer in case the file was just created */
|
||||
/* can't sync earlier, modifies FSBUF.sect */
|
||||
#endif
|
||||
return FR_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user