[mw_shl_code=c,true]/*-----------------------------------------------------------------------*/
/* Load a sector and check if it is an FAT Volume Boot Record */
/*-----------------------------------------------------------------------*/
static
BYTE check_fs ( /* 0:FAT-VBR, 1:Valid BR but not FAT, 2:Not a BR, 3
isk error */
FATFS *fs, /* File system object */
DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */
)
{
if (disk_read(fs->drv, fs->win, sect, 1) != RES_OK) /* Load boot record */
return 3;
if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check record signature (always placed at offset 510 even if the sector size is >512) */
return 2;
if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146) /* Check "FAT" string */
return 0;
if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
return 0;
return 1;
}[/mw_shl_code]
走了这步之后if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55)
就return 2了;
---------------------------------
仿真看下文件系统函数返回什么错误
一周热门 更多>