① | root directory sectors: RootDirSectors = ((BPB_RootEntCnt * 32) + (BPB_BytsPerSec – 1)) / BPB_BytsPerSec; /* For FAT32,BPB_RootEntCnt == 0 ,so RootDirSectors is always 0 */ |
② | count of sectors in the data region of the volume: If(BPB_FATSz16 != 0) FATSz = BPB_FATSz16; Else FATSz = BPB_FATSz32; If(BPB_TotSec16 != 0) TotSec = BPB_TotSec16; Else TotSec = BPB_TotSec32; DataSec = TotSec – (BPB_ResvdSecCnt + (BPB_NumFATs * FATSz) + RootDirSectors); |
③ | count of clusters: CountofClusters = DataSec / BPB_SecPerClus; |
④ | If(CountofClusters < 4085) { /* Volume is FAT12 */ } else if(CountofClusters < 65525) { /* Volume is FAT16 */ } else { /* Volume is FAT32 */ } |