在学习ISO上的FatFs教程,不是很懂文件系统接口和磁盘物理层是怎么建立联系的?我大概知道是通过diskio文件,但我并没有看到例程中的调用。fire给的例程main函数中有一句“/* function disk_initialize() has been called in f_open */”,but...我没看到f_open有调用disk_Initialization啊,ff.c里只有f_mkfs看起来像是建立物理层连接,但例程中并未调用,求解!!
FRESULT f_mount (
BYTE vol, /* Logical drive number to be mounted/unmounted */
FATFS *fs /* Pointer to new file system object (NULL for unmount)*/
)
{
FATFS *rfs;
if (vol >= _VOLUMES) /* Check if the drive number is valid */
return FR_INVALID_DRIVE;
rfs = FatFs[vol]; /* Get current fs object */
if (rfs) {
#if _FS_SHARE
clear_lock(rfs);
#endif
#if _FS_REENTRANT /* Discard sync object of the current volume */
if (!ff_del_syncobj(rfs->sobj)) return FR_INT_ERR;
#endif
rfs->fs_type = 0; /* Clear old fs object */
}
if (fs) {
fs->fs_type = 0; /* Clear new fs object */
#if _FS_REENTRANT /* Create sync object for the new volume */
if (!ff_cre_syncobj(vol, &fs->sobj)) return FR_INT_ERR;
#endif
}
FatFs[vol] = fs; /* Register new fs object */