121 uint8_t codeArea[440];
262 uint8_t fat32Reserved[12];
272 uint8_t jmpToBootCode[3];
300 char volumeLabel[11];
304 char fileSystemType[8];
308 uint8_t bootCode[420];
320 static uint16_t
const EOC16 = 0XFFFF;
326 static uint32_t
const EOC32 = 0X0FFFFFFF;
443 return (dir->
attributes & DIR_ATT_FILE_TYPE_MASK) == 0;
459 return (dir->
attributes & DIR_ATT_VOLUME_ID) == 0;
504 date_t(uint16_t date) { as_uint16 = date; }
505 uint16_t
YEAR() {
return (1980 + year); }
507 uint8_t
DAY() {
return (day); }
508 operator uint16_t() {
return (as_uint16); }
540 time_t(uint16_t now) { as_uint16 = now; }
541 uint16_t
HOURS() {
return (hours); }
544 operator uint16_t() {
return (as_uint16); }
551 static const uint16_t
DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1;
578 bool open(
const char* fileName, uint8_t oflag);
615 if (!sync())
return false;
627 bool seek(uint32_t pos, uint8_t whence =
SEEK_SET);
632 uint32_t
tell() {
return (m_curPosition); }
637 void rewind() { m_curPosition = m_curCluster = 0; }
642 uint32_t
size() {
return (m_fileSize); }
654 bool truncate(uint32_t size);
662 virtual int putchar(
char c);
674 virtual int write(
const void *buf,
size_t size);
681 virtual int getchar();
693 virtual int read(
void* buf,
size_t size);
703 static uint8_t
isEOC(fat_t cluster) {
return cluster >= 0XFFF8; }
705 bool freeChain(fat_t cluster);
706 bool open(uint16_t entry, uint8_t oflag);
707 bool dirEntry(
dir_t* dir);
716 } __attribute__((packed));
731 static bool begin(
SD* sd, uint8_t partion);
752 static void ls(
IOStream& outs, uint8_t flags = 0);
767 static bool rm(
const char* fileName)
798 static void (*
dateTime)(uint16_t* date, uint16_t* time);
804 static bool make83Name(
const char* str, uint8_t* name);
808 return (position >> 9) & (blocksPerCluster - 1);
812 return position & 0X1FF;
815 static uint8_t
cacheRawBlock(uint32_t blockNumber, uint8_t action = 0);
823 return (dataStartBlock +
824 (uint32_t)(cluster - 2) * blocksPerCluster +
828 static bool fatGet(fat_t cluster, fat_t* value);
829 static bool fatPut(fat_t cluster, fat_t value);
831 static bool read(
dir_t* dir, uint16_t* index, uint8_t skip = DIR_ATT_SKIP);
static uint16_t const EOC16
static void(* dateTime)(uint16_t *date, uint16_t *time)
static uint32_t const EOC32
static uint8_t const F_OFLAG
static uint8_t cacheDirty
static uint8_t isEOC(fat_t cluster)
static uint16_t const EOC16_MIN
static uint8_t const CACHE_FOR_READ
static bool volumeInitialized
static bool rm(const char *fileName)
static uint8_t const BOOTSIG1
static uint8_t const DIR_ATT_DIRECTORY
static uint8_t const CACHE_FOR_WRITE
uint32_t fat32RootCluster
uint16_t firstClusterHigh
static uint8_t const DIR_ATT_FILE_TYPE_MASK
uint16_t rootDirEntryCount
virtual int write(const void *buf, size_t size)
static uint8_t const DIR_NAME_FREE
virtual int read(void *buf, size_t size)
bool open(const char *fileName, uint8_t oflag)
unsigned beginCylinderHigh
static uint8_t blockOfCluster(uint32_t position)
static uint32_t const EOC32_MIN
time_t(uint16_t h, uint8_t m, uint8_t s)
static uint32_t rootDirStartBlock
static const uint16_t DEFAULT_TIME
static const uint16_t DEFAULT_DATE
static uint8_t const DIR_ATT_VOLUME_ID
static uint8_t const DIR_ATT_READ_ONLY
static fat_t clusterCount
static uint8_t const DIR_ATT_DEFINED_BITS
static uint32_t dataBlockLba(fat_t cluster, uint8_t blockOfCluster)
static uint32_t fatStartBlock
uint16_t fat32BackBootBlock
static uint8_t const DIR_ATT_ARCHIVE
date_t(uint16_t y, uint8_t m, uint8_t d)
static uint8_t const BOOTSIG0
static uint32_t cacheMirrorBlock
static uint8_t const DIR_NAME_DELETED
static bool fatGet(fat_t cluster, fat_t *value)
static void printDirName(IOStream &outs, const dir_t &dir, uint8_t width)
static uint8_t blocksPerCluster
static uint8_t const DIR_ATT_HIDDEN
uint8_t sectorsPerCluster
static uint8_t const DIR_ATT_LONG_NAME
static fat_t blocksPerFat
uint8_t creationTimeTenths
static bool begin(SD *sd, uint8_t partion)
Open for reading and writing.
static uint8_t const DIR_ATT_SYSTEM
static uint8_t cacheRawBlock(uint32_t blockNumber, uint8_t action=0)
static uint8_t DIR_IS_FILE(const dir_t *dir)
uint16_t sectorsPerTrtack
static uint8_t DIR_IS_SUBDIR(const dir_t *dir)
static bool make83Name(const char *str, uint8_t *name)
static void cacheSetDirty(void)
static uint8_t cacheFlush(void)
static void ls(IOStream &outs, uint8_t flags=0)
friend IOStream & operator<<(IOStream &outs, date_t &date)
static uint8_t const DIR_NAME_0XE5
static uint32_t dataStartBlock
static uint16_t rootDirEntryCount
static uint8_t const DIR_ATT_LONG_NAME_MASK
static uint8_t DIR_IS_FILE_OR_SUBDIR(const dir_t *dir)
static uint32_t cacheBlockNumber
static bool fatPut(fat_t cluster, fat_t value)
static bool read(dir_t *dir, uint16_t *index, uint8_t skip=DIR_ATT_SKIP)
uint16_t reservedSectorCount
static uint32_t const ENTRY32_MASK
uint32_t volumeSerialNumber
static dir_t * cacheDirEntry(uint16_t index, uint8_t action=0)
static uint8_t DIR_IS_LONG_NAME(const dir_t *dir)
static uint8_t const F_FILE_DIR_DIRTY
static uint8_t const DIR_ATT_SKIP
static cache16_t cacheBuffer
static uint16_t cacheDataOffset(uint32_t position)