95 lines
2.4 KiB
C
95 lines
2.4 KiB
C
#ifndef FSCTL_FUGUE_BITS_FAT_H
|
|
#define FSCTL_FUGUE_BITS_FAT_H 1
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
/* struct fugue_fat_vbr : Volume Boot Record (hardcoded for Fugue) */
|
|
struct fugue_fat_vbr
|
|
{
|
|
// common boot structure
|
|
uint8_t BS_jmpBoot[3];
|
|
uint8_t BS_OEMName[8];
|
|
|
|
// BIOS parameter Block
|
|
uint16_t BPB_BytsPerSec;
|
|
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;
|
|
|
|
// Extended BIOS Parameter Block
|
|
uint8_t BS_DrvNum;
|
|
uint8_t BS_Reserved1;
|
|
uint8_t BS_BootSig;
|
|
uint8_t BS_VolID[4];
|
|
uint8_t BS_VolLab[11];
|
|
uint8_t BS_FilSysType[8];
|
|
uint8_t _unused[448];
|
|
|
|
// Signature
|
|
uint8_t Signature_word[2];
|
|
} __attribute__((packed));
|
|
|
|
/* FUGUE_DIR_ATTR_* : Attribute information */
|
|
#define FUGUE_DIR_ATTR_RDONLY 0x01
|
|
#define FUGUE_DIR_ATTR_HIDDEN 0x02
|
|
#define FUGUE_DIR_ATTR_SYSTEM 0x04
|
|
#define FUGUE_DIR_ATTR_VOLUME 0x08
|
|
#define FUGUE_DIR_ATTR_DIR 0x10
|
|
#define FUGUE_DIR_ATTR_ARCHIVE 0x20
|
|
#define FUGUE_DIR_ATTR_DEVICE 0x40
|
|
#define FUGUE_DIR_ATTR_LFN 0x0f
|
|
|
|
/* fugue_fat_dir : directory strcuture information */
|
|
struct fugue_fat_dir
|
|
{
|
|
uint8_t DIR_Name[8];
|
|
uint8_t DIR_Exts[3];
|
|
uint8_t DIR_Attr;
|
|
uint8_t _unknown0[1+1+2+2+2];
|
|
uint16_t DIR_FstClusHI;
|
|
uint8_t _unknown1[2+2];
|
|
uint16_t DIR_FstClusLO;
|
|
uint32_t DIR_FileSize;
|
|
} __attribute__((packed));
|
|
|
|
/* fugue_fat_dir_name : Fugue directory name strcuture */
|
|
struct fugue_fat_dir_name
|
|
{
|
|
struct {
|
|
uint8_t _low0 :1; // must be 0
|
|
uint8_t last :1;
|
|
uint8_t _low1 :1; // must be 0
|
|
uint8_t id :5;
|
|
} DIR_Sequence;
|
|
uint16_t DIR_Char0;
|
|
uint16_t DIR_Char1;
|
|
uint16_t DIR_Char2;
|
|
uint16_t DIR_Char3;
|
|
uint16_t DIR_Char4;
|
|
uint8_t DIR_Attr; // must be 0x0f
|
|
uint8_t DIR_Type; // must be 0x00
|
|
uint8_t checksum;
|
|
uint16_t DIR_Char5;
|
|
uint16_t DIR_Char6;
|
|
uint16_t DIR_Char7;
|
|
uint16_t DIR_Char8;
|
|
uint16_t DIR_Char9;
|
|
uint16_t DIR_Char10;
|
|
uint16_t DIR_FstClus; // must be 0x0000
|
|
uint16_t DIR_Char11;
|
|
uint16_t DIR_Char12;
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
#endif /* FSCTL_FUGUE_BITS_FAT_H */
|