summaryrefslogtreecommitdiff
path: root/firmware/drivers/fat.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r--firmware/drivers/fat.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 88d13c3eab..91019faf0e 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -114,6 +114,49 @@ struct fsinfo {
114#define FSINFO_FREECOUNT 488 114#define FSINFO_FREECOUNT 488
115#define FSINFO_NEXTFREE 492 115#define FSINFO_NEXTFREE 492
116 116
117struct bpb
118{
119 char bs_oemname[9]; /* OEM string, ending with \0 */
120 int bpb_bytspersec; /* Bytes per sectory, typically 512 */
121 int bpb_secperclus; /* Sectors per cluster */
122 int bpb_rsvdseccnt; /* Number of reserved sectors */
123 int bpb_numfats; /* Number of FAT structures, typically 2 */
124 int bpb_rootentcnt; /* Number of dir entries in the root */
125 int bpb_totsec16; /* Number of sectors on the volume (old 16-bit) */
126 int bpb_media; /* Media type (typically 0xf0 or 0xf8) */
127 int bpb_fatsz16; /* Number of used sectors per FAT structure */
128 int bpb_secpertrk; /* Number of sectors per track */
129 int bpb_numheads; /* Number of heads */
130 int bpb_hiddsec; /* Hidden sectors before the volume */
131 unsigned int bpb_totsec32; /* Number of sectors on the volume
132 (new 32-bit) */
133 int last_word; /* 0xAA55 */
134
135 /**** FAT12/16 specific *****/
136 int bs_drvnum; /* Drive number */
137 int bs_bootsig; /* Is 0x29 if the following 3 fields are valid */
138 unsigned int bs_volid; /* Volume ID */
139 char bs_vollab[12]; /* Volume label, 11 chars plus \0 */
140 char bs_filsystype[9]; /* File system type, 8 chars plus \0 */
141
142 /**** FAT32 specific *****/
143 int bpb_fatsz32;
144 int bpb_extflags;
145 int bpb_fsver;
146 int bpb_rootclus;
147 int bpb_fsinfo;
148 int bpb_bkbootsec;
149
150 /* variables for internal use */
151 int fatsize;
152 int totalsectors;
153 int rootdirsector;
154 int firstdatasector;
155 int startsector;
156};
157
158struct bpb fat_bpb;
159
117static int first_sector_of_cluster(int cluster); 160static int first_sector_of_cluster(int cluster);
118static int bpb_is_sane(void); 161static int bpb_is_sane(void);
119static void *cache_fat_sector(int secnum); 162static void *cache_fat_sector(int secnum);