--- /dev/null
+/** @file\r
+\r
+ Fat file system structure and definition.\r
+\r
+Copyright 2006 - 2008, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+--*/\r
+\r
+#ifndef _FAT_BPB_H_\r
+#define _FAT_BPB_H_\r
+\r
+#include "CommonLib.h"\r
+\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+ //\r
+ // Fat common field\r
+ //\r
+ UINT8 BS_jmpBoot[3];\r
+ CHAR8 BS_OEMName[8];\r
+ UINT16 BPB_BytsPerSec;\r
+ UINT8 BPB_SecPerClus;\r
+ UINT16 BPB_RsvdSecCnt;\r
+ UINT8 BPB_NumFATs;\r
+ UINT16 BPB_RootEntCnt;\r
+ UINT16 BPB_TotSec16;\r
+ UINT8 BPB_Media;\r
+ UINT16 BPB_FATSz16;\r
+ UINT16 BPB_SecPerTrk;\r
+ UINT16 BPB_NumHeads;\r
+ UINT32 BPB_HiddSec;\r
+ UINT32 BPB_TotSec32;\r
+\r
+ //\r
+ // Fat12/16 specific field\r
+ //\r
+ UINT8 BS_DrvNum;\r
+ UINT8 BS_Reserved1;\r
+ UINT8 BS_BootSig;\r
+ UINT32 BS_VolID;\r
+ CHAR8 BS_VolLab[11];\r
+ CHAR8 BS_FilSysType[8];\r
+\r
+ //\r
+ // Boot Code and Data\r
+ //\r
+ UINT8 Reserved[448];\r
+\r
+ //\r
+ // Fat common signature - 0xAA55\r
+ //\r
+ UINT16 Signature;\r
+} FAT12_16_BPB_STRUCT;\r
+\r
+typedef struct {\r
+ //\r
+ // Fat common field\r
+ //\r
+ UINT8 BS_jmpBoot[3];\r
+ CHAR8 BS_OEMName[8];\r
+ UINT16 BPB_BytsPerSec;\r
+ UINT8 BPB_SecPerClus;\r
+ UINT16 BPB_RsvdSecCnt;\r
+ UINT8 BPB_NumFATs;\r
+ UINT16 BPB_RootEntCnt;\r
+ UINT16 BPB_TotSec16;\r
+ UINT8 BPB_Media;\r
+ UINT16 BPB_FATSz16;\r
+ UINT16 BPB_SecPerTrk;\r
+ UINT16 BPB_NumHeads;\r
+ UINT32 BPB_HiddSec;\r
+ UINT32 BPB_TotSec32;\r
+\r
+ //\r
+ // Fat32 specific field\r
+ //\r
+ UINT32 BPB_FATSz32;\r
+ UINT16 BPB_ExtFlags;\r
+ UINT16 BPB_FSVer;\r
+ UINT32 BPB_RootClus;\r
+ UINT16 BPB_FSInfo;\r
+ UINT16 BPB_BkBootSec;\r
+ UINT8 BPB_Reserved[12];\r
+ UINT8 BS_DrvNum;\r
+ UINT8 BS_Reserved1;\r
+ UINT8 BS_BootSig;\r
+ UINT32 BS_VolID;\r
+ CHAR8 BS_VolLab[11];\r
+ CHAR8 BS_FilSysType[8];\r
+\r
+ //\r
+ // Boot Code and Data\r
+ //\r
+ UINT8 Reserved[420];\r
+\r
+ //\r
+ // Fat common signature - 0xAA55\r
+ //\r
+ UINT16 Signature;\r
+} FAT32_BPB_STRUCT;\r
+\r
+typedef union {\r
+ FAT12_16_BPB_STRUCT Fat12_16;\r
+ FAT32_BPB_STRUCT Fat32;\r
+} FAT_BPB_STRUCT;\r
+\r
+typedef enum {\r
+ FatTypeUnknown,\r
+ FatTypeFat12,\r
+ FatTypeFat16,\r
+ FatTypeFat32,\r
+ FatTypeMax\r
+} FAT_TYPE;\r
+\r
+typedef struct {\r
+ CHAR8 DIR_Name[11];\r
+ UINT8 DIR_Attr;\r
+ UINT8 DIR_NTRes;\r
+ UINT8 DIR_CrtTimeTenth;\r
+ UINT16 DIR_CrtTime;\r
+ UINT16 DIR_CrtDate;\r
+ UINT16 DIR_LstAccDate;\r
+ UINT16 DIR_FstClusHI;\r
+ UINT16 DIR_WrtTime;\r
+ UINT16 DIR_WrtDate;\r
+ UINT16 DIR_FstClusLO;\r
+ UINT32 DIR_FileSize;\r
+} FAT_DIRECTORY_ENTRY;\r
+\r
+#pragma pack()\r
+\r
+#define FAT_MAX_FAT12_CLUSTER 0xFF5\r
+#define FAT_MAX_FAT16_CLUSTER 0xFFF5\r
+\r
+#define FAT_BS_SIGNATURE 0xAA55\r
+#define FAT_BS_BOOTSIG 0x29\r
+#define FAT_BS_JMP1 0xEB\r
+#define FAT_BS_JMP2 0xE9\r
+#define FAT_FILSYSTYPE "FAT "\r
+#define FAT12_FILSYSTYPE "FAT12 "\r
+#define FAT16_FILSYSTYPE "FAT16 "\r
+#define FAT32_FILSYSTYPE "FAT32 "\r
+\r
+#endif\r