Prusa3d Marlin fork
Classes | Typedefs | Functions | Variables
SdFatStructs.h File Reference

FAT file structures. More...

Go to the source code of this file.

Classes

struct  partitionTable
 MBR partition table entry. More...
 
struct  masterBootRecord
 Master Boot Record. More...
 
struct  fat_boot
 Boot sector for a FAT12/FAT16 volume. More...
 
struct  fat32_boot
 Boot sector for a FAT32 volume. More...
 
struct  fat32_fsinfo
 FSINFO sector for a FAT32 volume. More...
 
struct  directoryEntry
 FAT short directory entry. More...
 
struct  directoryVFATEntry
 VFAT long filename directory entry. More...
 

Typedefs

typedef struct partitionTable part_t
 
typedef struct masterBootRecord mbr_t
 
typedef struct fat_boot fat_boot_t
 
typedef struct fat32_boot fat32_boot_t
 
typedef struct fat32_fsinfo fat32_fsinfo_t
 
typedef struct directoryEntry dir_t
 
typedef struct directoryVFATEntry vfat_t
 

Functions

static uint8_t DIR_IS_LONG_NAME (const dir_t *dir)
 
static uint8_t DIR_IS_FILE (const dir_t *dir)
 
static uint8_t DIR_IS_SUBDIR (const dir_t *dir)
 
static uint8_t DIR_IS_FILE_OR_SUBDIR (const dir_t *dir)
 

Variables

uint8_t const BOOTSIG0 = 0X55
 
uint8_t const BOOTSIG1 = 0XAA
 
uint8_t const EXTENDED_BOOT_SIG = 0X29
 
struct partitionTable PACKED
 
uint32_t const FSINFO_LEAD_SIG = 0x41615252
 
uint32_t const FSINFO_STRUCT_SIG = 0x61417272
 
uint16_t const FAT12EOC = 0XFFF
 
uint16_t const FAT12EOC_MIN = 0XFF8
 
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 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)
 

Typedef Documentation

◆ dir_t

typedef struct directoryEntry dir_t

Type name for directoryEntry

◆ fat32_boot_t

typedef struct fat32_boot fat32_boot_t

Type name for FAT32 Boot Sector

◆ fat32_fsinfo_t

typedef struct fat32_fsinfo fat32_fsinfo_t

Type name for FAT32 FSINFO Sector

◆ fat_boot_t

typedef struct fat_boot fat_boot_t

Type name for FAT Boot Sector

◆ mbr_t

typedef struct masterBootRecord mbr_t

Type name for masterBootRecord

◆ part_t

typedef struct partitionTable part_t

Type name for partitionTable

◆ vfat_t

typedef struct directoryVFATEntry vfat_t

Type name for directoryVFATEntry

Function Documentation

◆ DIR_IS_FILE()

static uint8_t DIR_IS_FILE ( const dir_t dir)
inlinestatic

Directory entry is for a file

Parameters
[in]dirPointer to a directory entry.
Returns
true if the entry is for a normal file else false.

◆ DIR_IS_FILE_OR_SUBDIR()

static uint8_t DIR_IS_FILE_OR_SUBDIR ( const dir_t dir)
inlinestatic

Directory entry is for a file or subdirectory

Parameters
[in]dirPointer to a directory entry.
Returns
true if the entry is for a normal file or subdirectory else false.

◆ DIR_IS_LONG_NAME()

static uint8_t DIR_IS_LONG_NAME ( const dir_t dir)
inlinestatic

Directory entry is part of a long name

Parameters
[in]dirPointer to a directory entry.
Returns
true if the entry is for part of a long name else false.

◆ DIR_IS_SUBDIR()

static uint8_t DIR_IS_SUBDIR ( const dir_t dir)
inlinestatic

Directory entry is for a subdirectory

Parameters
[in]dirPointer to a directory entry.
Returns
true if the entry is for a subdirectory else false.

Variable Documentation

◆ BOOTSIG0

uint8_t const BOOTSIG0 = 0X55

Value for byte 510 of boot block or MBR

◆ BOOTSIG1

uint8_t const BOOTSIG1 = 0XAA

Value for byte 511 of boot block or MBR

◆ DIR_ATT_ARCHIVE

uint8_t const DIR_ATT_ARCHIVE = 0X20

Old DOS archive bit for backup support

◆ DIR_ATT_DEFINED_BITS

uint8_t const DIR_ATT_DEFINED_BITS = 0X3F

defined attribute bits

◆ DIR_ATT_DIRECTORY

uint8_t const DIR_ATT_DIRECTORY = 0X10

Entry is for a directory

◆ DIR_ATT_FILE_TYPE_MASK

uint8_t const DIR_ATT_FILE_TYPE_MASK = (DIR_ATT_VOLUME_ID | DIR_ATT_DIRECTORY)

Mask for file/subdirectory tests

◆ DIR_ATT_HIDDEN

uint8_t const DIR_ATT_HIDDEN = 0X02

File should hidden in directory listings

◆ DIR_ATT_LONG_NAME

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.

◆ DIR_ATT_LONG_NAME_MASK

uint8_t const DIR_ATT_LONG_NAME_MASK = 0X3F

Test mask for long name entry

◆ DIR_ATT_READ_ONLY

uint8_t const DIR_ATT_READ_ONLY = 0X01

file is read-only

◆ DIR_ATT_SYSTEM

uint8_t const DIR_ATT_SYSTEM = 0X04

Entry is for a system file

◆ DIR_ATT_VOLUME_ID

uint8_t const DIR_ATT_VOLUME_ID = 0X08

Directory entry contains the volume label

◆ DIR_NAME_0XE5

uint8_t const DIR_NAME_0XE5 = 0X05

escape for name[0] = 0XE5

◆ DIR_NAME_DELETED

uint8_t const DIR_NAME_DELETED = 0XE5

name[0] value for entry that is free after being "deleted"

◆ DIR_NAME_FREE

uint8_t const DIR_NAME_FREE = 0X00

name[0] value for entry that is free and no allocated entries follow

◆ EXTENDED_BOOT_SIG

uint8_t const EXTENDED_BOOT_SIG = 0X29

Value for bootSignature field int FAT/FAT32 boot sector

◆ FAT12EOC

uint16_t const FAT12EOC = 0XFFF

FAT12 end of chain value used by Microsoft.

◆ FAT12EOC_MIN

uint16_t const FAT12EOC_MIN = 0XFF8

Minimum value for FAT12 EOC. Use to test for EOC.

◆ FAT16EOC

uint16_t const FAT16EOC = 0XFFFF

FAT16 end of chain value used by Microsoft.

◆ FAT16EOC_MIN

uint16_t const FAT16EOC_MIN = 0XFFF8

Minimum value for FAT16 EOC. Use to test for EOC.

◆ FAT32EOC

uint32_t const FAT32EOC = 0X0FFFFFFF

FAT32 end of chain value used by Microsoft.

◆ FAT32EOC_MIN

uint32_t const FAT32EOC_MIN = 0X0FFFFFF8

Minimum value for FAT32 EOC. Use to test for EOC.

◆ FAT32MASK

uint32_t const FAT32MASK = 0X0FFFFFFF

Mask a for FAT32 entry. Entries are 28 bits.

◆ FSINFO_LEAD_SIG

uint32_t const FSINFO_LEAD_SIG = 0x41615252

Lead signature for a FSINFO sector

◆ FSINFO_STRUCT_SIG

uint32_t const FSINFO_STRUCT_SIG = 0x61417272

Struct signature for a FSINFO sector