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

Block cache. More...

#include <FatVolume.h>

Public Member Functions

cache_tblock ()
 
void dirty ()
 
void init (FatVolume *vol)
 
void invalidate ()
 
uint32_t lbn ()
 
cache_tread (uint32_t lbn, uint8_t option)
 
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

Block cache.

Member Function Documentation

cache_t* FatCache::block ( )
inline
Returns
Cache block address.
void FatCache::dirty ( )
inline

Set current block dirty.

void FatCache::init ( FatVolume vol)
inline

Initialize the cache.

Parameters
[in]volFatVolume that owns this FatCache.
void FatCache::invalidate ( )
inline

Invalidate current cache block.

uint32_t FatCache::lbn ( )
inline
Returns
Logical block number for cached block.
cache_t * FatCache::read ( uint32_t  lbn,
uint8_t  option 
)

Read a block into the cache.

Parameters
[in]lbnBlock to read.
[in]optionmode for cached block.
Returns
Address of cached block.
bool FatCache::sync ( )

Write current block if dirty.

Returns
true for success else false.

Member Data Documentation

const uint8_t FatCache::CACHE_FOR_READ = 0
static

Cache block for read.

const uint8_t FatCache::CACHE_FOR_WRITE = CACHE_STATUS_DIRTY
static

Cache block for write.

const uint8_t FatCache::CACHE_OPTION_NO_READ = 4
static

Sync existing block but do not read new block.

const uint8_t FatCache::CACHE_RESERVE_FOR_WRITE = CACHE_STATUS_DIRTY | CACHE_OPTION_NO_READ
static

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

const uint8_t FatCache::CACHE_STATUS_DIRTY = 1
static

Cached block is dirty

const uint8_t FatCache::CACHE_STATUS_MASK = CACHE_STATUS_DIRTY | CACHE_STATUS_MIRROR_FAT
static

Cache block status bits

const uint8_t FatCache::CACHE_STATUS_MIRROR_FAT = 2
static

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


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