SdFat

- Main Page
- Classes
- Files

- File List
- File Members

Classes | Typedefs | Functions | Variables
FatStructs.h File Reference

FAT file structures. More...

This graph shows which files directly or indirectly include this file:

## Classes
struct | biosParmBlock
| BIOS parameter block. More...
struct | directoryEntry
| FAT short directory entry. More...
struct | fat32_boot
| Boot sector for a FAT32 volume. More...
struct | fat32_fsinfo
| FSINFO sector for a FAT32 volume. More...
struct | fat_boot
| Boot sector for a FAT12/FAT16 volume. More...
struct | longDirectoryEntry
| FAT long directory entry. More...
struct | masterBootRecord
| Master Boot Record. More...
struct | partitionTable
| MBR partition table entry. More...

## Typedefs
typedef struct biosParmBlock | bpb_t
typedef struct directoryEntry | dir_t
typedef struct fat32_boot | fat32_boot_t
typedef struct fat32_fsinfo | fat32_fsinfo_t
typedef struct fat_boot | fat_boot_t
typedef struct longDirectoryEntry | ldir_t
typedef struct masterBootRecord | mbr_t
typedef struct partitionTable | part_t

## Functions
static uint8_t | DIR_IS_FILE (const dir_t *dir)
static uint8_t | DIR_IS_FILE_OR_SUBDIR (const dir_t *dir)
static uint8_t | DIR_IS_HIDDEN (const dir_t *dir)
static uint8_t | DIR_IS_LONG_NAME (const dir_t *dir)
static uint8_t | DIR_IS_SUBDIR (const dir_t *dir)
static uint8_t | DIR_IS_SYSTEM (const dir_t *dir)
static uint16_t | FAT_DATE (uint16_t year, uint8_t month, uint8_t day)
static uint8_t | FAT_DAY (uint16_t fatDate)
static uint8_t | FAT_HOUR (uint16_t fatTime)
static uint8_t | FAT_MINUTE (uint16_t fatTime)
static uint8_t | FAT_MONTH (uint16_t fatDate)
static uint8_t | FAT_SECOND (uint16_t fatTime)
static uint16_t | FAT_TIME (uint8_t hour, uint8_t minute, uint8_t second)
static uint16_t | FAT_YEAR (uint16_t fatDate)

## Variables
const uint8_t | BOOTSIG0 = 0X55
const uint8_t | BOOTSIG1 = 0XAA
const uint8_t | DIR_ATT_ARCHIVE = 0X20
const uint8_t | DIR_ATT_DEFINED_BITS = 0X3F
const uint8_t | DIR_ATT_DIRECTORY = 0X10
const uint8_t | DIR_ATT_FILE_TYPE_MASK = (DIR_ATT_VOLUME_ID | DIR_ATT_DIRECTORY)
const uint8_t | DIR_ATT_HIDDEN = 0X02
const uint8_t | DIR_ATT_LONG_NAME = 0X0F
const uint8_t | DIR_ATT_LONG_NAME_MASK = 0X3F
const uint8_t | DIR_ATT_READ_ONLY = 0X01
const uint8_t | DIR_ATT_SYSTEM = 0X04
const uint8_t | DIR_ATT_VOLUME_ID = 0X08
const uint8_t | DIR_NAME_0XE5 = 0X05
const uint8_t | DIR_NAME_DELETED = 0XE5
const uint8_t | DIR_NAME_FREE = 0X00
const uint8_t | DIR_NT_LC_BASE = 0X08
const uint8_t | DIR_NT_LC_EXT = 0X10
const uint8_t | EXTENDED_BOOT_SIG = 0X29
const uint16_t | FAT12EOC = 0XFFF
const uint16_t | FAT12EOC_MIN = 0XFF8
const uint16_t | FAT16EOC = 0XFFFF
const uint16_t | FAT16EOC_MIN = 0XFFF8
const uint32_t | FAT32EOC = 0X0FFFFFFF
const uint32_t | FAT32EOC_MIN = 0X0FFFFFF8
const uint32_t | FAT32MASK = 0X0FFFFFFF
const uint16_t | FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1
const uint16_t | FAT_DEFAULT_TIME = (1 << 11)
const uint32_t | FSINFO_LEAD_SIG = 0x41615252
const uint32_t | FSINFO_STRUCT_SIG = 0x61417272
const uint8_t | LDIR_NAME1_DIM = 5
const uint8_t | LDIR_NAME2_DIM = 6
const uint8_t | LDIR_NAME3_DIM = 2
const uint8_t | LDIR_ORD_LAST_LONG_ENTRY = 0X40

## Detailed Description

FAT file structures.

## Typedef Documentation

typedef struct biosParmBlock bpb_t

Type name for biosParmBlock

typedef struct directoryEntry dir_t

Type name for directoryEntry

typedef struct fat32_boot fat32_boot_t

Type name for FAT32 Boot Sector

typedef struct fat32_fsinfo fat32_fsinfo_t

Type name for FAT32 FSINFO Sector

typedef struct fat_boot fat_boot_t

Type name for FAT Boot Sector

typedef struct longDirectoryEntry ldir_t

Type name for longDirectoryEntry

typedef struct masterBootRecord mbr_t

Type name for masterBootRecord

typedef struct partitionTable part_t

Type name for partitionTable

## Function Documentation

static uint8_t DIR_IS_FILE | ( | const dir_t * | dir | ) |
| inline static

Directory entry is for a file

Parameters

  [in] | dir | Pointer to a directory entry.

Returns
  true if the entry is for a normal file else false.

static uint8_t DIR_IS_FILE_OR_SUBDIR | ( | const dir_t * | dir | ) |
| inline static

Directory entry is for a file or subdirectory

Parameters

  [in] | dir | Pointer to a directory entry.

Returns
  true if the entry is for a normal file or subdirectory else false.

static uint8_t DIR_IS_HIDDEN | ( | const dir_t * | dir | ) |
| inline static

Directory entry is hidden

Parameters

  [in] | dir | Pointer to a directory entry.

Returns
  true if the entry is hidden else false.

static uint8_t DIR_IS_LONG_NAME | ( | const dir_t * | dir | ) |
| inline static

Directory entry is part of a long name

Parameters

  [in] | dir | Pointer to a directory entry.

Returns
  true if the entry is for part of a long name else false.

static uint8_t DIR_IS_SUBDIR | ( | const dir_t * | dir | ) |
| inline static

Directory entry is for a subdirectory

Parameters

  [in] | dir | Pointer to a directory entry.

Returns
  true if the entry is for a subdirectory else false.

static uint8_t DIR_IS_SYSTEM | ( | const dir_t * | dir | ) |
| inline static

Directory entry is system type

Parameters

  [in] | dir | Pointer to a directory entry.

Returns
  true if the entry is system else false.

static uint16_t FAT_DATE | ( | uint16_t | year,
|  | uint8_t | month,
|  | uint8_t | day
| ) |  |
| inline static

date field for FAT directory entry

Parameters

  [in] | year | [1980,2107]
  [in] | month | [1,12]
  [in] | day | [1,31]

Returns
  Packed date for dir_t entry.

static uint8_t FAT_DAY | ( | uint16_t | fatDate | ) |
| inline static

day part of FAT directory date field

Parameters

  [in] | fatDate | Date in packed dir format.

Returns
  Extracted day [1,31]

static uint8_t FAT_HOUR | ( | uint16_t | fatTime | ) |
| inline static

hour part of FAT directory time field

Parameters

  [in] | fatTime | Time in packed dir format.

Returns
  Extracted hour [0,23]

static uint8_t FAT_MINUTE | ( | uint16_t | fatTime | ) |
| inline static

minute part of FAT directory time field

Parameters

  [in] | fatTime | Time in packed dir format.

Returns
  Extracted minute [0,59]

static uint8_t FAT_MONTH | ( | uint16_t | fatDate | ) |
| inline static

month part of FAT directory date field

Parameters

  [in] | fatDate | Date in packed dir format.

Returns
  Extracted month [1,12]

static uint8_t FAT_SECOND | ( | uint16_t | fatTime | ) |
| inline static

second part of FAT directory time field Note second/2 is stored in packed time.

Parameters

  [in] | fatTime | Time in packed dir format.

Returns
  Extracted second [0,58]

static uint16_t FAT_TIME | ( | uint8_t | hour,
|  | uint8_t | minute,
|  | uint8_t | second
| ) |  |
| inline static

time field for FAT directory entry

Parameters

  [in] | hour | [0,23]
  [in] | minute | [0,59]
  [in] | second | [0,59]

Returns
  Packed time for dir_t entry.

static uint16_t FAT_YEAR | ( | uint16_t | fatDate | ) |
| inline static

year part of FAT directory date field

Parameters

  [in] | fatDate | Date in packed dir format.

Returns
  Extracted year [1980,2107]

## Variable Documentation

const uint8_t BOOTSIG0 = 0X55

Value for byte 510 of boot block or MBR

const uint8_t BOOTSIG1 = 0XAA

Value for byte 511 of boot block or MBR

const uint8_t DIR_ATT_ARCHIVE = 0X20

Old DOS archive bit for backup support

const uint8_t DIR_ATT_DEFINED_BITS = 0X3F

defined attribute bits

const uint8_t DIR_ATT_DIRECTORY = 0X10

Entry is for a directory

const uint8_t DIR_ATT_FILE_TYPE_MASK = (DIR_ATT_VOLUME_ID | DIR_ATT_DIRECTORY)

Mask for file/subdirectory tests

const uint8_t DIR_ATT_HIDDEN = 0X02

File should e hidden in directory listings

const uint8_t DIR_ATT_LONG_NAME = 0X0F

Test value for long name entry. Test is (d->attributes & DIR_ATT_LONG_NAME_MASK) == DIR_ATT_LONG_NAME.

const uint8_t DIR_ATT_LONG_NAME_MASK = 0X3F

Test mask for long name entry

const uint8_t DIR_ATT_READ_ONLY = 0X01

file is read-only

const uint8_t DIR_ATT_SYSTEM = 0X04

Entry is for a system file

const uint8_t DIR_ATT_VOLUME_ID = 0X08

Directory entry contains the volume label

const uint8_t DIR_NAME_0XE5 = 0X05

escape for name[0] = 0XE5

const uint8_t DIR_NAME_DELETED = 0XE5

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

const uint8_t DIR_NAME_FREE = 0X00

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

const uint8_t DIR_NT_LC_BASE = 0X08

Filename base-name is all lower case

const uint8_t DIR_NT_LC_EXT = 0X10

Filename extension is all lower case.

const uint8_t EXTENDED_BOOT_SIG = 0X29

Value for bootSignature field int FAT/FAT32 boot sector

const uint16_t FAT12EOC = 0XFFF

FAT12 end of chain value used by Microsoft.

const uint16_t FAT12EOC_MIN = 0XFF8

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

const uint16_t FAT16EOC = 0XFFFF

FAT16 end of chain value used by Microsoft.

const uint16_t FAT16EOC_MIN = 0XFFF8

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

const uint32_t FAT32EOC = 0X0FFFFFFF

FAT32 end of chain value used by Microsoft.

const uint32_t FAT32EOC_MIN = 0X0FFFFFF8

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

const uint32_t FAT32MASK = 0X0FFFFFFF

Mask a for FAT32 entry. Entries are 28 bits.

const uint16_t FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1

Default date for file timestamps is 1 Jan 2000

const uint16_t FAT_DEFAULT_TIME = (1 << 11)

Default time for file timestamp is 1 am

const uint32_t FSINFO_LEAD_SIG = 0x41615252

Lead signature for a FSINFO sector

const uint32_t FSINFO_STRUCT_SIG = 0x61417272

Struct signature for a FSINFO sector

const uint8_t LDIR_NAME1_DIM = 5

Dimension of first name field in long directory entry

const uint8_t LDIR_NAME2_DIM = 6

Dimension of first name field in long directory entry

const uint8_t LDIR_NAME3_DIM = 2

Dimension of first name field in long directory entry

const uint8_t LDIR_ORD_LAST_LONG_ENTRY = 0X40

Ord mast that indicates the entry is the last long dir entry in a set of long dir entries. All valid sets of long dir entries must begin with an entry having this mask.