SdFat
Public Member Functions | Static Public Attributes | List of all members
FatCache Class Reference

Sector cache. More...

#include <FatPartition.h>

Public Member Functions

cache_tbuffer ()
 
void dirty ()
 
void init (FatPartition *vol)
 
void invalidate ()
 
bool isDirty ()
 
cache_tread (uint32_t sector, uint8_t option)
 
uint32_t sector ()
 
bool sync ()
 

Static Public Attributes

static const uint8_t CACHE_FOR_READ = 0
 
static const uint8_t CACHE_FOR_WRITE = CACHE_STATUS_DIRTY
 
static const uint8_t CACHE_OPTION_NO_READ = 4
 
static const uint8_t CACHE_RESERVE_FOR_WRITE = CACHE_STATUS_DIRTY | CACHE_OPTION_NO_READ
 
static const uint8_t CACHE_STATUS_DIRTY = 1
 
static const uint8_t CACHE_STATUS_MASK = CACHE_STATUS_DIRTY | CACHE_STATUS_MIRROR_FAT
 
static const uint8_t CACHE_STATUS_MIRROR_FAT = 2
 

Detailed Description

Sector cache.

Member Function Documentation

◆ buffer()

cache_t* FatCache::buffer ( )
inline
Returns
Cache sector address.

◆ dirty()

void FatCache::dirty ( )
inline

Set current sector dirty.

◆ init()

void FatCache::init ( FatPartition vol)
inline

Initialize the cache.

Parameters
[in]volFatPartition that owns this FatCache.

◆ invalidate()

void FatCache::invalidate ( )
inline

Invalidate current cache sector.

◆ isDirty()

bool FatCache::isDirty ( )
inline
Returns
dirty status

◆ read()

cache_t * FatCache::read ( uint32_t  sector,
uint8_t  option 
)

Read a sector into the cache.

Parameters
[in]sectorSector to read.
[in]optionmode for cached sector.
Returns
Address of cached sector.

◆ sector()

uint32_t FatCache::sector ( )
inline
Returns
Logical sector number for cached sector.

◆ sync()

bool FatCache::sync ( )

Write current sector if dirty.

Returns
true for success or false for failure.

Member Data Documentation

◆ CACHE_FOR_READ

const uint8_t FatCache::CACHE_FOR_READ = 0
static

Cache sector for read.

◆ CACHE_FOR_WRITE

const uint8_t FatCache::CACHE_FOR_WRITE = CACHE_STATUS_DIRTY
static

Cache sector for write.

◆ CACHE_OPTION_NO_READ

const uint8_t FatCache::CACHE_OPTION_NO_READ = 4
static

Sync existing sector but do not read new sector.

◆ CACHE_RESERVE_FOR_WRITE

const uint8_t FatCache::CACHE_RESERVE_FOR_WRITE = CACHE_STATUS_DIRTY | CACHE_OPTION_NO_READ
static

Reserve cache sector for write - do not read from sector device.

◆ CACHE_STATUS_DIRTY

const uint8_t FatCache::CACHE_STATUS_DIRTY = 1
static

Cached sector is dirty

◆ CACHE_STATUS_MASK

const uint8_t FatCache::CACHE_STATUS_MASK = CACHE_STATUS_DIRTY | CACHE_STATUS_MIRROR_FAT
static

Cache sector status bits

◆ CACHE_STATUS_MIRROR_FAT

const uint8_t FatCache::CACHE_STATUS_MIRROR_FAT = 2
static

Cashed sector is FAT entry and must be mirrored in second FAT.


The documentation for this class was generated from the following files: