fatfs检查DBR,判断文件系统类型
//判断DBR是不是fat、fat32文件系统。
//返回值
//0:表示fat、fat32
//1:表示exfat
//2:表示DBR有效,但不是上述文件系统
//3:表示DBR无效
//4:磁盘错误
static UINT check_fs ( /* 0:FAT/FAT32 VBR, 1:exFAT VBR, 2:Not FAT and valid BS, 3:Not FAT and invalid BS, 4:Disk error */
FATFS* fs, /* Filesystem object */
LBA_t sect /* Sector to load and check if it is an FAT-VBR or not */
)
{
WORD w, sign;
BYTE b;
fs->wflag = 0; //脏标志清零
fs->winsect = (LBA_t)0 - 1;//扇区号配置为无效值。/* Invaidate window */
if (move_window(fs, sect) != FR_OK) //根据sect扇区号,读取一个扇区数据到win中
return 4; /* Load the boot sector */
sign