Repetier-Firmware  0.91
SdVolume Class Reference

Access FAT16 and FAT32 volumes on SD and SDHC cards. More...

#include <SdFat.h>

Public Member Functions

 SdVolume ()
cache_tcacheClear ()
bool init (Sd2Card *dev)
bool init (Sd2Card *dev, uint8_t part)
uint8_t blocksPerCluster () const
uint32_t blocksPerFat () const
uint32_t clusterCount () const
uint8_t clusterSizeShift () const
uint32_t dataStartBlock () const
uint8_t fatCount () const
uint32_t fatStartBlock () const
uint8_t fatType () const
int32_t freeClusterCount ()
uint32_t rootDirEntryCount () const
uint32_t rootDirStart () const
Sd2CardsdCard ()
bool dbgFat (uint32_t n, uint32_t *v)

Private Member Functions

cache_tcacheAddress ()
uint32_t cacheBlockNumber ()
bool allocContiguous (uint32_t count, uint32_t *curCluster)
uint8_t blockOfCluster (uint32_t position) const
uint32_t clusterStartBlock (uint32_t cluster) const
bool fatGet (uint32_t cluster, uint32_t *value)
bool fatPut (uint32_t cluster, uint32_t value)
bool fatPutEOC (uint32_t cluster)
bool freeChain (uint32_t cluster)
bool isEOC (uint32_t cluster) const
bool readBlock (uint32_t block, uint8_t *dst)
bool writeBlock (uint32_t block, const uint8_t *dst)

Static Private Member Functions

static cache_tcacheFetch (uint32_t blockNumber, uint8_t options)
static cache_tcacheFetchData (uint32_t blockNumber, uint8_t options)
static cache_tcacheFetchFat (uint32_t blockNumber, uint8_t options)
static void cacheInvalidate ()
static bool cacheSync ()
static bool cacheWriteData ()
static bool cacheWriteFat ()

Private Attributes

uint32_t allocSearchStart_
uint8_t blocksPerCluster_
uint32_t blocksPerFat_
uint32_t clusterCount_
uint8_t clusterSizeShift_
uint32_t dataStartBlock_
uint8_t fatCount_
uint32_t fatStartBlock_
uint8_t fatType_
uint16_t rootDirEntryCount_
uint32_t rootDirStart_

Static Private Attributes

static const uint8_t CACHE_STATUS_DIRTY = 1
static const uint8_t CACHE_STATUS_FAT_BLOCK = 2
static const uint8_t CACHE_STATUS_MASK = CACHE_STATUS_DIRTY | CACHE_STATUS_FAT_BLOCK
static const uint8_t CACHE_OPTION_NO_READ = 4
static uint8_t const CACHE_FOR_READ = 0
static uint8_t const CACHE_FOR_WRITE = CACHE_STATUS_DIRTY
static uint8_t const CACHE_RESERVE_FOR_WRITE = CACHE_STATUS_DIRTY | CACHE_OPTION_NO_READ
static cache_t cacheBuffer_
static uint32_t cacheBlockNumber_
static uint32_t cacheFatOffset_
static uint8_t cacheStatus_
static Sd2CardsdCard_

Friends

class SdBaseFile

Detailed Description

Access FAT16 and FAT32 volumes on SD and SDHC cards.


Constructor & Destructor Documentation

SdVolume ( ) [inline]

Create an instance of SdVolume


Member Function Documentation

bool allocContiguous ( uint32_t  count,
uint32_t *  curCluster 
) [private]
uint8_t blockOfCluster ( uint32_t  position) const [inline, private]
uint8_t blocksPerCluster ( ) const [inline]
Returns:
The volume's cluster size in blocks.
uint32_t blocksPerFat ( ) const [inline]
Returns:
The number of blocks in one FAT.
cache_t* cacheAddress ( ) [inline, private]
uint32_t cacheBlockNumber ( ) [inline, private]
cache_t* cacheClear ( ) [inline]

Clear the cache and returns a pointer to the cache. Used by the WaveRP recorder to do raw write to the SD card. Not for normal apps.

Returns:
A pointer to the cache buffer or zero if an error occurs.
static cache_t* cacheFetch ( uint32_t  blockNumber,
uint8_t  options 
) [static, private]
static cache_t* cacheFetchData ( uint32_t  blockNumber,
uint8_t  options 
) [static, private]
static cache_t* cacheFetchFat ( uint32_t  blockNumber,
uint8_t  options 
) [static, private]
static void cacheInvalidate ( ) [static, private]
static bool cacheSync ( ) [static, private]
static bool cacheWriteData ( ) [static, private]
static bool cacheWriteFat ( ) [static, private]
uint32_t clusterCount ( ) const [inline]
Returns:
The total number of clusters in the volume.
uint8_t clusterSizeShift ( ) const [inline]
Returns:
The shift count required to multiply by blocksPerCluster.
uint32_t clusterStartBlock ( uint32_t  cluster) const [private]
uint32_t dataStartBlock ( ) const [inline]
Returns:
The logical block number for the start of file data.
bool dbgFat ( uint32_t  n,
uint32_t *  v 
) [inline]

Debug access to FAT table

Parameters:
[in]ncluster number.
[out]vvalue of entry
Returns:
true for success or false for failure
uint8_t fatCount ( ) const [inline]
Returns:
The number of FAT structures on the volume.
bool fatGet ( uint32_t  cluster,
uint32_t *  value 
) [private]
bool fatPut ( uint32_t  cluster,
uint32_t  value 
) [private]
bool fatPutEOC ( uint32_t  cluster) [inline, private]
uint32_t fatStartBlock ( ) const [inline]
Returns:
The logical block number for the start of the first FAT.
uint8_t fatType ( ) const [inline]
Returns:
The FAT type of the volume. Values are 12, 16 or 32.
bool freeChain ( uint32_t  cluster) [private]
int32_t freeClusterCount ( )
bool init ( Sd2Card dev) [inline]

Initialize a FAT volume. Try partition one first then try super floppy format.

Parameters:
[in]devThe Sd2Card where the volume is located.
Returns:
The value one, true, is returned for success and the value zero, false, is returned for failure. Reasons for failure include not finding a valid partition, not finding a valid FAT file system or an I/O error.
bool init ( Sd2Card dev,
uint8_t  part 
)
bool isEOC ( uint32_t  cluster) const [inline, private]
bool readBlock ( uint32_t  block,
uint8_t *  dst 
) [inline, private]
uint32_t rootDirEntryCount ( ) const [inline]
Returns:
The number of entries in the root directory for FAT16 volumes.
uint32_t rootDirStart ( ) const [inline]
Returns:
The logical block number for the start of the root directory on FAT16 volumes or the first cluster number on FAT32 volumes.
Sd2Card* sdCard ( ) [inline]

Sd2Card object for this volume

Returns:
pointer to Sd2Card object.
bool writeBlock ( uint32_t  block,
const uint8_t *  dst 
) [inline, private]

Friends And Related Function Documentation

friend class SdBaseFile [friend]

Field Documentation

uint32_t allocSearchStart_ [private]
uint8_t blocksPerCluster_ [private]
uint32_t blocksPerFat_ [private]
uint8_t const CACHE_FOR_READ = 0 [static, private]
uint8_t const CACHE_FOR_WRITE = CACHE_STATUS_DIRTY [static, private]
const uint8_t CACHE_OPTION_NO_READ = 4 [static, private]
const uint8_t CACHE_STATUS_DIRTY = 1 [static, private]
const uint8_t CACHE_STATUS_FAT_BLOCK = 2 [static, private]
const uint8_t CACHE_STATUS_MASK = CACHE_STATUS_DIRTY | CACHE_STATUS_FAT_BLOCK [static, private]
uint32_t cacheBlockNumber_ [static, private]
cache_t cacheBuffer_ [static, private]
uint32_t cacheFatOffset_ [static, private]
uint8_t cacheStatus_ [static, private]
uint32_t clusterCount_ [private]
uint8_t clusterSizeShift_ [private]
uint32_t dataStartBlock_ [private]
uint8_t fatCount_ [private]
uint32_t fatStartBlock_ [private]
uint8_t fatType_ [private]
uint16_t rootDirEntryCount_ [private]
uint32_t rootDirStart_ [private]
Sd2Card* sdCard_ [static, private]

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Defines