14
14
* See the License for the specific language governing permissions and
15
15
* limitations under the License.
16
16
*/
17
- #include " fat/ChaN/diskio.h"
18
17
#include " fat/ChaN/ffconf.h"
19
18
#include " fat/ChaN/ff.h"
19
+ #include " fat/ChaN/diskio.h"
20
20
#include " platform/mbed_debug.h"
21
21
#include " platform/mbed_critical.h"
22
22
#include " filesystem/mbed_filesystem.h"
@@ -199,7 +199,7 @@ extern "C" DSTATUS disk_initialize(BYTE pdrv)
199
199
return (DSTATUS)_ffs[pdrv]->init ();
200
200
}
201
201
202
- extern " C" DRESULT disk_read (BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
202
+ extern " C" DRESULT disk_read (BYTE pdrv, BYTE *buff, LBA_t sector, UINT count)
203
203
{
204
204
debug_if (FFS_DBG, " disk_read(sector %lu, count %u) on pdrv [%d]\n " , sector, count, pdrv);
205
205
DWORD ssize = disk_get_sector_size (pdrv);
@@ -209,7 +209,7 @@ extern "C" DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
209
209
return err ? RES_PARERR : RES_OK;
210
210
}
211
211
212
- extern " C" DRESULT disk_write (BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
212
+ extern " C" DRESULT disk_write (BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count)
213
213
{
214
214
debug_if (FFS_DBG, " disk_write(sector %lu, count %u) on pdrv [%d]\n " , sector, count, pdrv);
215
215
DWORD ssize = disk_get_sector_size (pdrv);
@@ -409,7 +409,15 @@ int FATFileSystem::format(BlockDevice *bd, bd_size_t cluster_size)
409
409
}
410
410
411
411
// Logical drive number, Partitioning rule, Allocation unit size (bytes per cluster)
412
- FRESULT res = f_mkfs (fs._fsid , FM_ANY | FM_SFD, cluster_size, NULL , 0 );
412
+ MKFS_PARM opt;
413
+ FRESULT res;
414
+ opt.fmt = (FM_ANY | FM_SFD);
415
+ opt.n_fat = 0U ;
416
+ opt.align = 0U ;
417
+ opt.n_root = 0U ;
418
+ opt.au_size = (DWORD)cluster_size;
419
+
420
+ res = f_mkfs ((const TCHAR*)fs._fsid , &opt, NULL , FF_MAX_SS);
413
421
if (res != FR_OK) {
414
422
fs.unmount ();
415
423
fs.unlock ();
0 commit comments