Engduino
3.1.0
A fun device for learning coding
|
Go to the source code of this file.
Classes | |
struct | partitionTable |
MBR partition table entry. More... | |
struct | masterBootRecord |
Master Boot Record. More... | |
struct | biosParmBlock |
BIOS parameter block. More... | |
struct | fat32BootSector |
Boot sector for a FAT16 or FAT32 volume. More... | |
struct | directoryEntry |
FAT short directory entry. More... | |
Typedefs | |
typedef struct partitionTable | part_t |
typedef struct masterBootRecord | mbr_t |
typedef struct biosParmBlock | bpb_t |
typedef struct fat32BootSector | fbs_t |
typedef struct directoryEntry | dir_t |
Functions | |
struct partitionTable | __attribute__ ((packed)) |
Variables | |
uint8_t const | BOOTSIG0 = 0X55 |
uint8_t const | BOOTSIG1 = 0XAA |
uint8_t | boot |
uint8_t | beginHead |
unsigned | beginSector |
unsigned | beginCylinderHigh |
uint8_t | beginCylinderLow |
uint8_t | type |
uint8_t | endHead |
unsigned | endSector |
unsigned | endCylinderHigh |
uint8_t | endCylinderLow |
uint32_t | firstSector |
uint32_t | totalSectors |
uint8_t | codeArea [440] |
uint32_t | diskSignature |
uint16_t | usuallyZero |
part_t | part [4] |
uint8_t | mbrSig0 |
uint8_t | mbrSig1 |
uint16_t | bytesPerSector |
uint8_t | sectorsPerCluster |
uint16_t | reservedSectorCount |
uint8_t | fatCount |
uint16_t | rootDirEntryCount |
uint16_t | totalSectors16 |
uint8_t | mediaType |
uint16_t | sectorsPerFat16 |
uint16_t | sectorsPerTrtack |
uint16_t | headCount |
uint32_t | hidddenSectors |
uint32_t | totalSectors32 |
uint32_t | sectorsPerFat32 |
uint16_t | fat32Flags |
uint16_t | fat32Version |
uint32_t | fat32RootCluster |
uint16_t | fat32FSInfo |
uint16_t | fat32BackBootBlock |
uint8_t | fat32Reserved [12] |
uint8_t | jmpToBootCode [3] |
char | oemName [8] |
bpb_t | bpb |
uint8_t | driveNumber |
uint8_t | reserved1 |
uint8_t | bootSignature |
uint32_t | volumeSerialNumber |
char | volumeLabel [11] |
char | fileSystemType [8] |
uint8_t | bootCode [420] |
uint8_t | bootSectorSig0 |
uint8_t | bootSectorSig1 |
uint16_t const | FAT16EOC = 0XFFFF |
uint16_t const | FAT16EOC_MIN = 0XFFF8 |
uint32_t const | FAT32EOC = 0X0FFFFFFF |
uint32_t const | FAT32EOC_MIN = 0X0FFFFFF8 |
uint32_t const | FAT32MASK = 0X0FFFFFFF |
uint8_t | name [11] |
uint8_t | attributes |
uint8_t | reservedNT |
uint8_t | creationTimeTenths |
uint16_t | creationTime |
uint16_t | creationDate |
uint16_t | lastAccessDate |
uint16_t | firstClusterHigh |
uint16_t | lastWriteTime |
uint16_t | lastWriteDate |
uint16_t | firstClusterLow |
uint32_t | fileSize |
uint8_t const | DIR_NAME_0XE5 = 0X05 |
uint8_t const | DIR_NAME_DELETED = 0XE5 |
uint8_t const | DIR_NAME_FREE = 0X00 |
uint8_t const | DIR_ATT_READ_ONLY = 0X01 |
uint8_t const | DIR_ATT_HIDDEN = 0X02 |
uint8_t const | DIR_ATT_SYSTEM = 0X04 |
uint8_t const | DIR_ATT_VOLUME_ID = 0X08 |
uint8_t const | DIR_ATT_DIRECTORY = 0X10 |
uint8_t const | DIR_ATT_ARCHIVE = 0X20 |
uint8_t const | DIR_ATT_LONG_NAME = 0X0F |
uint8_t const | DIR_ATT_LONG_NAME_MASK = 0X3F |
uint8_t const | DIR_ATT_DEFINED_BITS = 0X3F |
uint8_t const | DIR_ATT_FILE_TYPE_MASK = (DIR_ATT_VOLUME_ID | DIR_ATT_DIRECTORY) |
FAT file structures
typedef struct biosParmBlock bpb_t |
Type name for biosParmBlock
typedef struct directoryEntry dir_t |
Type name for directoryEntry
typedef struct fat32BootSector fbs_t |
Type name for fat32BootSector
typedef struct masterBootRecord mbr_t |
Type name for masterBootRecord
typedef struct partitionTable part_t |
Type name for partitionTable
uint8_t attributes |
Entry attributes.
The upper two bits of the attribute byte are reserved and should always be set to 0 when a file is created and never modified or looked at after that. See defines that begin with DIR_ATT_.
unsigned beginCylinderHigh |
High bits cylinder for first block in partition.
uint8_t beginCylinderLow |
Combine beginCylinderLow with beginCylinderHigh. Legal values are 0-1023. Only used in old PC BIOS.
uint8_t beginHead |
Head part of Cylinder-head-sector address of the first block in the partition. Legal values are 0-255. Only used in old PC BIOS.
unsigned beginSector |
Sector part of Cylinder-head-sector address of the first block in the partition. Legal values are 1-63. Only used in old PC BIOS.
uint8_t boot |
Boot Indicator . Indicates whether the volume is the active partition. Legal values include: 0X00. Do not use for booting. 0X80 Active partition.
uint8_t bootCode[420] |
X86 boot code
uint8_t bootSectorSig0 |
must be 0X55
uint8_t bootSectorSig1 |
must be 0XAA
uint8_t const BOOTSIG0 = 0X55 |
Value for byte 510 of boot block or MBR
uint8_t const BOOTSIG1 = 0XAA |
Value for byte 511 of boot block or MBR
uint8_t bootSignature |
0X29 if next three fields are valid
bpb_t bpb |
BIOS Parameter Block
uint16_t bytesPerSector |
Count of bytes per sector. This value may take on only the following values: 512, 1024, 2048 or 4096
uint8_t codeArea[440] |
Code Area for master boot program.
uint16_t creationDate |
Date file was created.
uint16_t creationTime |
Time file was created.
uint8_t creationTimeTenths |
The granularity of the seconds part of creationTime is 2 seconds so this field is a count of tenths of a second and its valid value range is 0-199 inclusive. (WHG note - seems to be hundredths)
uint8_t const DIR_ATT_ARCHIVE = 0X20 |
Old DOS archive bit for backup support
uint8_t const DIR_ATT_DEFINED_BITS = 0X3F |
defined attribute bits
uint8_t const DIR_ATT_DIRECTORY = 0X10 |
Entry is for a directory
uint8_t const DIR_ATT_FILE_TYPE_MASK = (DIR_ATT_VOLUME_ID | DIR_ATT_DIRECTORY) |
Mask for file/subdirectory tests
uint8_t const DIR_ATT_HIDDEN = 0X02 |
File should hidden in directory listings
uint8_t const DIR_ATT_LONG_NAME = 0X0F |
Test value for long name entry. Test is (d->attributes & DIR_ATT_LONG_NAME_MASK) == DIR_ATT_LONG_NAME.
uint8_t const DIR_ATT_LONG_NAME_MASK = 0X3F |
Test mask for long name entry
uint8_t const DIR_ATT_READ_ONLY = 0X01 |
file is read-only
uint8_t const DIR_ATT_SYSTEM = 0X04 |
Entry is for a system file
uint8_t const DIR_ATT_VOLUME_ID = 0X08 |
Directory entry contains the volume label
uint8_t const DIR_NAME_0XE5 = 0X05 |
escape for name[0] = 0XE5
uint8_t const DIR_NAME_DELETED = 0XE5 |
name[0] value for entry that is free after being "deleted"
uint8_t const DIR_NAME_FREE = 0X00 |
name[0] value for entry that is free and no allocated entries follow
uint32_t diskSignature |
Optional WindowsNT disk signature. May contain more boot code.
uint8_t driveNumber |
for int0x13 use value 0X80 for hard drive
unsigned endCylinderHigh |
High bits of end cylinder
uint8_t endCylinderLow |
Combine endCylinderLow with endCylinderHigh. Legal values are 0-1023. Only used in old PC BIOS.
uint8_t endHead |
head part of cylinder-head-sector address of the last sector in the partition. Legal values are 0-255. Only used in old PC BIOS.
unsigned endSector |
Sector part of cylinder-head-sector address of the last sector in the partition. Legal values are 1-63. Only used in old PC BIOS.
uint16_t const FAT16EOC = 0XFFFF |
FAT16 end of chain value used by Microsoft.
uint16_t const FAT16EOC_MIN = 0XFFF8 |
Minimum value for FAT16 EOC. Use to test for EOC.
uint16_t fat32BackBootBlock |
If non-zero, indicates the sector number in the reserved area of the volume of a copy of the boot record. Usually 6. No value other than 6 is recommended.
uint32_t const FAT32EOC = 0X0FFFFFFF |
FAT32 end of chain value used by Microsoft.
uint32_t const FAT32EOC_MIN = 0X0FFFFFF8 |
Minimum value for FAT32 EOC. Use to test for EOC.
uint16_t fat32Flags |
This field is only defined for FAT32 media and does not exist on FAT12 and FAT16 media. Bits 0-3 – Zero-based number of active FAT. Only valid if mirroring is disabled. Bits 4-6 – Reserved. Bit 7 – 0 means the FAT is mirrored at runtime into all FATs. – 1 means only one FAT is active; it is the one referenced in bits 0-3. Bits 8-15 – Reserved.
uint16_t fat32FSInfo |
Sector number of FSINFO structure in the reserved area of the FAT32 volume. Usually 1.
uint32_t const FAT32MASK = 0X0FFFFFFF |
Mask a for FAT32 entry. Entries are 28 bits.
uint8_t fat32Reserved[12] |
Reserved for future expansion. Code that formats FAT32 volumes should always set all of the bytes of this field to 0.
uint32_t fat32RootCluster |
Cluster number of the first cluster of the root directory for FAT32. This usually 2 but not required to be 2.
uint16_t fat32Version |
FAT32 version. High byte is major revision number. Low byte is minor revision number. Only 0.0 define.
uint8_t fatCount |
The count of FAT data structures on the volume. This field should always contain the value 2 for any FAT volume of any type.
uint32_t fileSize |
32-bit unsigned holding this file's size in bytes.
char fileSystemType[8] |
informational only - don't depend on it
uint16_t firstClusterHigh |
High word of this entry's first cluster number (always 0 for a FAT12 or FAT16 volume).
uint16_t firstClusterLow |
Low word of this entry's first cluster number.
uint32_t firstSector |
Logical block address of the first block in the partition.
uint16_t headCount |
Number of heads for interrupt 0x13. Not used otherwise.
uint32_t hidddenSectors |
Count of hidden sectors preceding the partition that contains this FAT volume. This field is generally only relevant for media visible on interrupt 0x13.
uint8_t jmpToBootCode[3] |
X86 jmp to boot program
uint16_t lastAccessDate |
Last access date. Note that there is no last access time, only a date. This is the date of last read or write. In the case of a write, this should be set to the same date as lastWriteDate.
uint16_t lastWriteDate |
Date of last write. File creation is considered a write.
uint16_t lastWriteTime |
Time of last write. File creation is considered a write.
uint8_t mbrSig0 |
First MBR signature byte. Must be 0X55
uint8_t mbrSig1 |
Second MBR signature byte. Must be 0XAA
uint8_t mediaType |
This dates back to the old MS-DOS 1.x media determination and is no longer usually used for anything. 0xF8 is the standard value for fixed (non-removable) media. For removable media, 0xF0 is frequently used. Legal values are 0xF0 or 0xF8-0xFF.
uint8_t name[11] |
Short 8.3 name. The first eight bytes contain the file name with blank fill. The last three bytes contain the file extension with blank fill.
char oemName[8] |
informational only - don't depend on it
part_t part[4] |
Partition tables.
uint8_t reserved1 |
used by Windows NT - should be zero for FAT
uint8_t reservedNT |
Reserved for use by Windows NT. Set value to 0 when a file is created and never modify or look at it after that.
uint16_t reservedSectorCount |
Number of sectors before the first FAT. This value must not be zero.
uint16_t rootDirEntryCount |
For FAT12 and FAT16 volumes, this field contains the count of 32-byte directory entries in the root directory. For FAT32 volumes, this field must be set to 0. For FAT12 and FAT16 volumes, this value should always specify a count that when multiplied by 32 results in a multiple of bytesPerSector. FAT16 volumes should use the value 512.
uint8_t sectorsPerCluster |
Number of sectors per allocation unit. This value must be a power of 2 that is greater than 0. The legal values are 1, 2, 4, 8, 16, 32, 64, and 128.
uint16_t sectorsPerFat16 |
Count of sectors occupied by one FAT on FAT12/FAT16 volumes. On FAT32 volumes this field must be 0, and sectorsPerFat32 contains the FAT size count.
uint32_t sectorsPerFat32 |
Count of sectors occupied by one FAT on FAT32 volumes.
uint16_t sectorsPerTrtack |
Sectors per track for interrupt 0x13. Not used otherwise.
uint32_t totalSectors |
Length of the partition, in blocks.
uint16_t totalSectors16 |
This field is the old 16-bit total count of sectors on the volume. This count includes the count of all sectors in all four regions of the volume. This field can be 0; if it is 0, then totalSectors32 must be non-zero. For FAT32 volumes, this field must be 0. For FAT12 and FAT16 volumes, this field contains the sector count, and totalSectors32 is 0 if the total sector count fits (is less than 0x10000).
uint32_t totalSectors32 |
This field is the new 32-bit total count of sectors on the volume. This count includes the count of all sectors in all four regions of the volume. This field can be 0; if it is 0, then totalSectors16 must be non-zero.
uint8_t type |
Partition type. See defines that begin with PART_TYPE_ for some Microsoft partition types.
uint16_t usuallyZero |
Usually zero but may be more boot code.
char volumeLabel[11] |
should match volume label in root dir
uint32_t volumeSerialNumber |
usually generated by combining date and time