Phoenard
Public Member Functions | Public Attributes | List of all members
SDMINFAT::directoryEntry Struct Reference

FAT short directory entry. More...

#include <PHNSDMinimal_fat.h>

Public Member Functions

uint32_t firstCluster ()
 
void setFirstCluster (uint32_t firstCluster)
 
uint8_t isFile ()
 
uint8_t isReadOnly ()
 

Public Attributes

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
 

Detailed Description

FAT short directory entry.

Short means short 8.3 name, not the entry size.

Date Format. A FAT directory entry date stamp is a 16-bit field that is basically a date relative to the MS-DOS epoch of 01/01/1980. Here is the format (bit 0 is the LSB of the 16-bit word, bit 15 is the MSB of the 16-bit word):

Bits 9-15: Count of years from 1980, valid value range 0-127 inclusive (1980-2107).

Bits 5-8: Month of year, 1 = January, valid value range 1-12 inclusive.

Bits 0-4: Day of month, valid value range 1-31 inclusive.

Time Format. A FAT directory entry time stamp is a 16-bit field that has a granularity of 2 seconds. Here is the format (bit 0 is the LSB of the 16-bit word, bit 15 is the MSB of the 16-bit word).

Bits 11-15: Hours, valid value range 0-23 inclusive.

Bits 5-10: Minutes, valid value range 0-59 inclusive.

Bits 0-4: 2-second count, valid value range 0-29 inclusive (0 - 58 seconds).

The valid time range is from Midnight 00:00:00 to 23:59:58.

Member Function Documentation

uint32_t SDMINFAT::directoryEntry::firstCluster ( )
inline

Combines the low and high part of the first cluster fields

uint8_t SDMINFAT::directoryEntry::isFile ( )
inline

Checks the attributes field to see if this is a file

uint8_t SDMINFAT::directoryEntry::isReadOnly ( )
inline

Checks the attributes field to see if the entry is readonly

void SDMINFAT::directoryEntry::setFirstCluster ( uint32_t  firstCluster)
inline

Sets the low and high part of the first cluster fields

Member Data Documentation

uint8_t SDMINFAT::directoryEntry::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_.

uint16_t SDMINFAT::directoryEntry::creationDate

Date file was created.

uint16_t SDMINFAT::directoryEntry::creationTime

Time file was created.

uint8_t SDMINFAT::directoryEntry::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)

uint32_t SDMINFAT::directoryEntry::fileSize

32-bit unsigned holding this file's size in bytes.

uint16_t SDMINFAT::directoryEntry::firstClusterHigh

High word of this entry's first cluster number (always 0 for a FAT12 or FAT16 volume).

uint16_t SDMINFAT::directoryEntry::firstClusterLow

Low word of this entry's first cluster number.

uint16_t SDMINFAT::directoryEntry::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 SDMINFAT::directoryEntry::lastWriteDate

Date of last write. File creation is considered a write.

uint16_t SDMINFAT::directoryEntry::lastWriteTime

Time of last write. File creation is considered a write.

uint8_t SDMINFAT::directoryEntry::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.

uint8_t SDMINFAT::directoryEntry::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.


The documentation for this struct was generated from the following file: