![]() |
Soldered SD Card Arduino Library 1.0.0
Easily read and write files to and form the SD card breakout! A fork of the original SDFat library by Bill Greiman.
|
Sector cache. More...
#include <FsCache.h>
Public Member Functions | |
| uint8_t * | cacheBuffer () |
| bool | cacheSafeRead (uint32_t sector, uint8_t *dst) |
| bool | cacheSafeRead (uint32_t sector, uint8_t *dst, size_t count) |
| bool | cacheSafeWrite (uint32_t sector, const uint8_t *src) |
| bool | cacheSafeWrite (uint32_t sector, const uint8_t *src, size_t count) |
| uint8_t * | clear () |
| void | dirty () |
| void | init (BlockDevice *blockDev) |
| void | invalidate () |
| bool | isCached (uint32_t sector) const |
| bool | isCached (uint32_t sector, size_t count) |
| bool | isDirty () |
| uint32_t | sector () |
| void | setMirrorOffset (uint32_t offset) |
| uint8_t * | get (uint32_t sector, uint8_t option) |
| bool | sync () |
Static Public Attributes | |
| static const uint8_t | CACHE_STATUS_DIRTY = 1 |
| static const uint8_t | CACHE_STATUS_MIRROR_FAT = 2 |
| static const uint8_t | CACHE_STATUS_MASK = CACHE_STATUS_DIRTY | CACHE_STATUS_MIRROR_FAT |
| static const uint8_t | CACHE_OPTION_NO_READ = 4 |
| static const uint8_t | CACHE_FOR_READ = 0 |
| static const uint8_t | CACHE_FOR_WRITE = CACHE_STATUS_DIRTY |
| static const uint8_t | CACHE_RESERVE_FOR_WRITE = CACHE_STATUS_DIRTY | CACHE_OPTION_NO_READ |
Private Attributes | |
| uint8_t | m_status |
| BlockDevice * | m_blockDev |
| uint32_t | m_mirrorOffset |
| uint32_t | m_sector |
| uint8_t | m_buffer [512] |
Sector cache.
|
inline |
|
inline |
Cache safe read of a sector.
| [in] | sector | Logical sector to be read. |
| [out] | dst | Pointer to the location that will receive the data. |
|
inline |
Cache safe read of multiple sectors.
| [in] | sector | Logical sector to be read. |
| [in] | count | Number of sectors to be read. |
| [out] | dst | Pointer to the location that will receive the data. |
|
inline |
Cache safe write of a sectors.
| [in] | sector | Logical sector to be written. |
| [in] | src | Pointer to the location of the data to be written. |
|
inline |
Cache safe write of multiple sectors.
| [in] | sector | Logical sector to be written. |
| [in] | src | Pointer to the location of the data to be written. |
| [in] | count | Number of sectors to be written. |
|
inline |
|
inline |
Set current sector dirty.
| uint8_t * FsCache::get | ( | uint32_t | sector, |
| uint8_t | option ) |
Fill cache with sector data.
| [in] | sector | Sector to read. |
| [in] | option | mode for cached sector. |
|
inline |
Initialize the cache.
| [in] | blockDev | Block device for this cache. |
|
inline |
Invalidate current cache sector.
|
inline |
Check if a sector is in the cache.
| [in] | sector | Sector to checked. |
|
inline |
Check if the cache contains a sector from a range.
| [in] | sector | Start sector of the range. |
| [in] | count | Number of sectors in the range. |
|
inline |
|
inline |
|
inline |
Set the offset to the second FAT for mirroring.
| [in] | offset | Sector offset to second FAT. |
| bool FsCache::sync | ( | ) |
Write current sector if dirty.
|
static |
Cache sector for read.
|
static |
Cache sector for write.
|
static |
Sync existing sector but do not read new sector.
|
static |
Reserve cache sector for write - do not read from sector device.
|
static |
Cached sector is dirty
|
static |
Cache sector status bits
|
static |
Cashed sector is FAT entry and must be mirrored in second FAT.
|
private |
|
private |
|
private |
|
private |
|
private |