-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfat32.h
94 lines (85 loc) · 1.91 KB
/
fat32.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef FAT32_H
#define FAT32_H
#include <inttypes.h>
/* boot sector constants */
#define BS_OEMName_LENGTH 8
#define BS_VolLab_LENGTH 11
#define BS_FilSysType_LENGTH 8
#pragma pack(push)
#pragma pack(1)
struct fat32BS_struct
{
char BS_jmpBoot[3];
char BS_OEMName[BS_OEMName_LENGTH];
uint16_t BPB_BytesPerSec;
uint8_t BPB_SecPerClus;
uint16_t BPB_RsvdSecCnt;
uint8_t BPB_NumFATs;
uint16_t BPB_RootEntCnt;
uint16_t BPB_TotSec16;
uint8_t BPB_Media;
uint16_t BPB_FATSz16;
uint16_t BPB_SecPerTrk;
uint16_t BPB_NumHeads;
uint32_t BPB_HiddSec;
uint32_t BPB_TotSec32;
uint32_t BPB_FATSz32;
uint16_t BPB_ExtFlags;
uint8_t BPB_FSVerLow;
uint8_t BPB_FSVerHigh;
uint32_t BPB_RootClus;
uint16_t BPB_FSInfo;
uint16_t BPB_BkBootSec;
char BPB_reserved[12];
uint8_t BS_DrvNum;
uint8_t BS_Reserved1;
uint8_t BS_BootSig;
uint32_t BS_VolID;
char BS_VolLab[BS_VolLab_LENGTH];
char BS_FilSysType[BS_FilSysType_LENGTH];
char BS_CodeReserved[420];
uint8_t BS_SigA;
uint8_t BS_SigB;
};
struct FSInfo_struct
{
uint32_t FSI_LeadSig;
char FSI_Reserved1[480];
uint32_t FSI_StrucSig;
uint32_t FSI_Free_Count;
uint32_t FSI_Nxt_Free;
char FSI_Reserved2[12];
uint32_t FSI_TrailSig;
};
struct fat32Dir_struct
{
unsigned char DIR_Name[11];
unsigned char DIR_Attr;
unsigned char DIR_NTRes;
unsigned char DIR_CrtTimeTenth;
uint16_t DIR_CrtTime;
uint16_t DIR_CrtDate;
uint16_t DIR_LstAccDate;
uint16_t DIR_FstClusHI;
uint16_t DIR_WrtTime;
uint16_t DIR_WrtDate;
uint16_t DIR_FstClusLO;
uint32_t DIR_FileSize;
};
struct fat32LDIR_struct
{
unsigned char LDIR_Ord;
char LDIR_Name1[10];
unsigned char LDIR_Attr;
unsigned char LDIR_Type;
unsigned char LDIR_Chksum;
char LDIR_Name2[12];
unsigned char LDIR_FstClusLO[2];
char LDIR_Name3[4];
};
#pragma pack(pop)
typedef struct fat32BS_struct fat32BS;
typedef struct FSInfo_struct FSInfo;
typedef struct fat32Dir_struct fat32Dir;
typedef struct fat32LDIR_struct fat32LDIR;
#endif