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

Sector cache. More...

#include <ExFatPartition.h>

Public Member Functions

uint8_t * cacheBuffer ()
 
uint8_t * clear ()
 
void dirty ()
 
uint8_t * get (uint32_t sector, uint8_t option)
 
void init (BlockDevice *blockDev)
 
void invalidate ()
 
bool isDirty ()
 
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 = 2
 
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
 

Detailed Description

Sector cache.

Member Function Documentation

◆ cacheBuffer()

uint8_t* FsCache::cacheBuffer ( )
inline
Returns
Cache sector address.

◆ clear()

uint8_t* FsCache::clear ( )
inline
Returns
Clear the cache and returns a pointer to the cache.

◆ dirty()

void FsCache::dirty ( )
inline

Set current sector dirty.

◆ get()

uint8_t * FsCache::get ( uint32_t  sector,
uint8_t  option 
)

Fill cache with sector data.

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

◆ init()

void FsCache::init ( BlockDevice blockDev)
inline

Initialize the cache.

Parameters
[in]blockDevBlock device for this partition.

◆ invalidate()

void FsCache::invalidate ( )

Invalidate current cache sector.

◆ isDirty()

bool FsCache::isDirty ( )
inline
Returns
dirty status

◆ sector()

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

◆ sync()

bool FsCache::sync ( )

Write current sector if dirty.

Returns
true for success or false for failure.

Member Data Documentation

◆ CACHE_FOR_READ

const uint8_t FsCache::CACHE_FOR_READ = 0
static

Cache sector for read.

◆ CACHE_FOR_WRITE

const uint8_t FsCache::CACHE_FOR_WRITE = CACHE_STATUS_DIRTY
static

Cache sector for write.

◆ CACHE_OPTION_NO_READ

const uint8_t FsCache::CACHE_OPTION_NO_READ = 2
static

Sync existing sector but do not read new sector.

◆ CACHE_RESERVE_FOR_WRITE

const uint8_t FsCache::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 FsCache::CACHE_STATUS_DIRTY = 1
static

Cached sector is dirty

◆ CACHE_STATUS_MASK

const uint8_t FsCache::CACHE_STATUS_MASK = CACHE_STATUS_DIRTY
static

Cache sector status bits


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