Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | /* |
2 | * Written by Paul Popelka (paulp@uts.amdahl.com) | |
3 | * | |
4 | * You can do anything you want with this software, | |
5 | * just don't say you wrote it, | |
6 | * and don't remove this notice. | |
7 | * | |
8 | * This software is provided "as is". | |
9 | * | |
10 | * The author supplies this software to be publicly | |
11 | * redistributed on the understanding that the author | |
12 | * is not responsible for the correct functioning of | |
13 | * this software in any circumstances and is not liable | |
14 | * for any damages caused by this software. | |
15 | * | |
16 | * October 1992 | |
17 | * | |
bbc3f849 | 18 | * $Id: bpb.h,v 1.2 1993/10/16 19:29:25 rgrimes Exp $ |
15637ed4 RG |
19 | */ |
20 | ||
bbc3f849 GW |
21 | #ifndef _PCFS_BPB_H_ |
22 | #define _PCFS_BPB_H_ 1 | |
23 | ||
15637ed4 RG |
24 | /* |
25 | * BIOS Parameter Block (BPB) for DOS 3.3 | |
26 | */ | |
27 | struct bpb33 { | |
28 | u_short bpbBytesPerSec; /* bytes per sector */ | |
29 | u_char bpbSecPerClust; /* sectors per cluster */ | |
30 | u_short bpbResSectors; /* number of reserved sectors */ | |
31 | u_char bpbFATs; /* number of FATs */ | |
32 | u_short bpbRootDirEnts; /* number of root directory entries */ | |
33 | u_short bpbSectors; /* total number of sectors */ | |
34 | u_char bpbMedia; /* media descriptor */ | |
35 | u_short bpbFATsecs; /* number of sectors per FAT */ | |
36 | u_short bpbSecPerTrack; /* sectors per track */ | |
37 | u_short bpbHeads; /* number of heads */ | |
38 | u_short bpbHiddenSecs; /* number of hidden sectors */ | |
39 | }; | |
40 | ||
41 | /* | |
42 | * BPB for DOS 5.0 | |
43 | * The difference is bpbHiddenSecs is a short for DOS 3.3, | |
44 | * and bpbHugeSectors is not in the 3.3 bpb. | |
45 | */ | |
46 | struct bpb50 { | |
47 | u_short bpbBytesPerSec; /* bytes per sector */ | |
48 | u_char bpbSecPerClust; /* sectors per cluster */ | |
49 | u_short bpbResSectors; /* number of reserved sectors */ | |
50 | u_char bpbFATs; /* number of FATs */ | |
51 | u_short bpbRootDirEnts; /* number of root directory entries */ | |
52 | u_short bpbSectors; /* total number of sectors */ | |
53 | u_char bpbMedia; /* media descriptor */ | |
54 | u_short bpbFATsecs; /* number of sectors per FAT */ | |
55 | u_short bpbSecPerTrack; /* sectors per track */ | |
56 | u_short bpbHeads; /* number of heads */ | |
57 | u_long bpbHiddenSecs; /* number of hidden sectors */ | |
58 | u_long bpbHugeSectors; /* number of sectrs if bpbSectors == 0 */ | |
59 | }; | |
60 | ||
61 | /* | |
62 | * The following structures represent how the bpb's look | |
63 | * on disk. shorts and longs are just character arrays | |
64 | * of the appropriate length. This is because the compiler | |
65 | * forces shorts and longs to align on word or halfword | |
66 | * boundaries. | |
67 | */ | |
68 | #include <machine/endian.h> | |
69 | #if BYTE_ORDER == LITTLE_ENDIAN | |
70 | #define getushort(x) *((u_short *)(x)) | |
71 | #define getulong(x) *((u_long *)(x)) | |
72 | #define putushort(p, v) (*((u_short *)(p)) = (v)) | |
73 | #define putulong(p, v) (*((u_long *)(p)) = (v)) | |
74 | #else | |
75 | ||
76 | #endif | |
77 | ||
78 | /* | |
79 | * BIOS Parameter Block (BPB) for DOS 3.3 | |
80 | */ | |
81 | struct byte_bpb33 { | |
82 | char bpbBytesPerSec[2]; /* bytes per sector */ | |
83 | char bpbSecPerClust; /* sectors per cluster */ | |
84 | char bpbResSectors[2]; /* number of reserved sectors */ | |
85 | char bpbFATs; /* number of FATs */ | |
86 | char bpbRootDirEnts[2]; /* number of root directory entries */ | |
87 | char bpbSectors[2]; /* total number of sectors */ | |
88 | char bpbMedia; /* media descriptor */ | |
89 | char bpbFATsecs[2]; /* number of sectors per FAT */ | |
90 | char bpbSecPerTrack[2]; /* sectors per track */ | |
91 | char bpbHeads[2]; /* number of heads */ | |
92 | char bpbHiddenSecs[2]; /* number of hidden sectors */ | |
93 | }; | |
94 | ||
95 | /* | |
96 | * BPB for DOS 5.0 | |
97 | * The difference is bpbHiddenSecs is a short for DOS 3.3, | |
98 | * and bpbHugeSectors is not in the 3.3 bpb. | |
99 | */ | |
100 | struct byte_bpb50 { | |
101 | char bpbBytesPerSec[2]; /* bytes per sector */ | |
102 | char bpbSecPerClust; /* sectors per cluster */ | |
103 | char bpbResSectors[2]; /* number of reserved sectors */ | |
104 | char bpbFATs; /* number of FATs */ | |
105 | char bpbRootDirEnts[2]; /* number of root directory entries */ | |
106 | char bpbSectors[2]; /* total number of sectors */ | |
107 | char bpbMedia; /* media descriptor */ | |
108 | char bpbFATsecs[2]; /* number of sectors per FAT */ | |
109 | char bpbSecPerTrack[2]; /* sectors per track */ | |
110 | char bpbHeads[2]; /* number of heads */ | |
111 | char bpbHiddenSecs[4]; /* number of hidden sectors */ | |
112 | char bpbHugeSectors[4]; /* number of sectrs if bpbSectors == 0 */ | |
113 | }; | |
bbc3f849 | 114 | #endif /* _PCFS_BPB_H_ */ |