]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/GnuGenBootSector/FatFormat.h
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / C / GnuGenBootSector / FatFormat.h
CommitLineData
30fdf114
LG
1/** @file\r
2\r
3 Fat file system structure and definition.\r
4\r
f7496d71
LG
5Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
30fdf114
LG
13\r
14--*/\r
15\r
16#ifndef _FAT_BPB_H_\r
17#define _FAT_BPB_H_\r
18\r
19#include "CommonLib.h"\r
20\r
21#pragma pack(1)\r
22\r
23typedef struct {\r
24 //\r
25 // Fat common field\r
26 //\r
27 UINT8 BS_jmpBoot[3];\r
28 CHAR8 BS_OEMName[8];\r
29 UINT16 BPB_BytsPerSec;\r
30 UINT8 BPB_SecPerClus;\r
31 UINT16 BPB_RsvdSecCnt;\r
32 UINT8 BPB_NumFATs;\r
33 UINT16 BPB_RootEntCnt;\r
34 UINT16 BPB_TotSec16;\r
35 UINT8 BPB_Media;\r
36 UINT16 BPB_FATSz16;\r
37 UINT16 BPB_SecPerTrk;\r
38 UINT16 BPB_NumHeads;\r
39 UINT32 BPB_HiddSec;\r
40 UINT32 BPB_TotSec32;\r
41\r
42 //\r
43 // Fat12/16 specific field\r
44 //\r
45 UINT8 BS_DrvNum;\r
46 UINT8 BS_Reserved1;\r
47 UINT8 BS_BootSig;\r
48 UINT32 BS_VolID;\r
49 CHAR8 BS_VolLab[11];\r
50 CHAR8 BS_FilSysType[8];\r
51\r
52 //\r
53 // Boot Code and Data\r
54 //\r
55 UINT8 Reserved[448];\r
56\r
57 //\r
58 // Fat common signature - 0xAA55\r
59 //\r
60 UINT16 Signature;\r
61} FAT12_16_BPB_STRUCT;\r
62\r
63typedef struct {\r
64 //\r
65 // Fat common field\r
66 //\r
67 UINT8 BS_jmpBoot[3];\r
68 CHAR8 BS_OEMName[8];\r
69 UINT16 BPB_BytsPerSec;\r
70 UINT8 BPB_SecPerClus;\r
71 UINT16 BPB_RsvdSecCnt;\r
72 UINT8 BPB_NumFATs;\r
73 UINT16 BPB_RootEntCnt;\r
74 UINT16 BPB_TotSec16;\r
75 UINT8 BPB_Media;\r
76 UINT16 BPB_FATSz16;\r
77 UINT16 BPB_SecPerTrk;\r
78 UINT16 BPB_NumHeads;\r
79 UINT32 BPB_HiddSec;\r
80 UINT32 BPB_TotSec32;\r
81\r
82 //\r
83 // Fat32 specific field\r
84 //\r
85 UINT32 BPB_FATSz32;\r
86 UINT16 BPB_ExtFlags;\r
87 UINT16 BPB_FSVer;\r
88 UINT32 BPB_RootClus;\r
89 UINT16 BPB_FSInfo;\r
90 UINT16 BPB_BkBootSec;\r
91 UINT8 BPB_Reserved[12];\r
92 UINT8 BS_DrvNum;\r
93 UINT8 BS_Reserved1;\r
94 UINT8 BS_BootSig;\r
95 UINT32 BS_VolID;\r
96 CHAR8 BS_VolLab[11];\r
97 CHAR8 BS_FilSysType[8];\r
98\r
99 //\r
100 // Boot Code and Data\r
101 //\r
102 UINT8 Reserved[420];\r
103\r
104 //\r
105 // Fat common signature - 0xAA55\r
106 //\r
107 UINT16 Signature;\r
108} FAT32_BPB_STRUCT;\r
109\r
110typedef union {\r
111 FAT12_16_BPB_STRUCT Fat12_16;\r
112 FAT32_BPB_STRUCT Fat32;\r
113} FAT_BPB_STRUCT;\r
114\r
115typedef enum {\r
116 FatTypeUnknown,\r
117 FatTypeFat12,\r
118 FatTypeFat16,\r
119 FatTypeFat32,\r
120 FatTypeMax\r
121} FAT_TYPE;\r
122\r
123typedef struct {\r
124 CHAR8 DIR_Name[11];\r
125 UINT8 DIR_Attr;\r
126 UINT8 DIR_NTRes;\r
127 UINT8 DIR_CrtTimeTenth;\r
128 UINT16 DIR_CrtTime;\r
129 UINT16 DIR_CrtDate;\r
130 UINT16 DIR_LstAccDate;\r
131 UINT16 DIR_FstClusHI;\r
132 UINT16 DIR_WrtTime;\r
133 UINT16 DIR_WrtDate;\r
134 UINT16 DIR_FstClusLO;\r
135 UINT32 DIR_FileSize;\r
136} FAT_DIRECTORY_ENTRY;\r
137\r
138#pragma pack()\r
139\r
140#define FAT_MAX_FAT12_CLUSTER 0xFF5\r
141#define FAT_MAX_FAT16_CLUSTER 0xFFF5\r
142\r
143#define FAT_BS_SIGNATURE 0xAA55\r
144#define FAT_BS_BOOTSIG 0x29\r
145#define FAT_BS_JMP1 0xEB\r
146#define FAT_BS_JMP2 0xE9\r
147#define FAT_FILSYSTYPE "FAT "\r
148#define FAT12_FILSYSTYPE "FAT12 "\r
149#define FAT16_FILSYSTYPE "FAT16 "\r
150#define FAT32_FILSYSTYPE "FAT32 "\r
151\r
152#endif\r