SdFs
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

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

Set current sector dirty.

void FatCache::init ( FatPartition vol)
inline

Initialize the cache.

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

Invalidate current cache sector.

bool FatCache::isDirty ( )
inline
Returns
dirty status
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.

Copyright (c) 20011-2017 Bill Greiman This file is part of the SdFs library for SD memory cards.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

Write current sector if dirty.

Returns
true for success else false.

Member Data Documentation

const uint8_t FatCache::CACHE_FOR_READ = 0
static

Cache sector for read.

const uint8_t FatCache::CACHE_FOR_WRITE = CACHE_STATUS_DIRTY
static

Cache sector for write.

const uint8_t FatCache::CACHE_OPTION_NO_READ = 4
static

Sync existing sector but do not read new sector.

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.

const uint8_t FatCache::CACHE_STATUS_DIRTY = 1
static

Cached sector is dirty

const uint8_t FatCache::CACHE_STATUS_MASK = CACHE_STATUS_DIRTY | CACHE_STATUS_MIRROR_FAT
static

Cache sector status bits

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: