MityDSP Documentation Index
Public Member Functions | Protected Attributes
MityDSP::tcDspStorageProxy Class Reference

The tcDspStorageProxy class is used with other tcDspStorageBase derived classes to provide an interface that presents a given sector size. More...

#include <core/DspStorageProxy.h>

Inheritance diagram for MityDSP::tcDspStorageProxy:
MityDSP::tcDspStorageBase

List of all members.

Public Member Functions

 tcDspStorageProxy (tcDspStorageBase *apDevice, void *apOffset, unsigned int anSize, unsigned int anSectorSize=512)
 This constructor is used to create a proxy with the specified sector size for the underlying tcDspStorageBase-derived class instance.
virtual ~tcDspStorageProxy ()
 Default destructor.
virtual int write (void *apAddr, void *apData, int anBytes)
 This routine writes an arbitrary amount of data to the underlying storage device, after offsetting the request to the proper location and ensuring that it fits in the available space.
virtual int write (unsigned int anSector, unsigned int anOffset, void *apData, int anBytes)
 Sector-based version of the write method.
virtual int read (void *apStartAddr, void *apBuffer, int anBytes)
 This routine reads an arbitrary amount of data from the underlying storage device, after offsetting the request to the proper location and ensuring that it fits in the available space.
virtual int read (unsigned int anSector, unsigned int anOffset, void *apBuffer, int anBytes)
 Sector-based version of the read method.
- Public Member Functions inherited from MityDSP::tcDspStorageBase
 tcDspStorageBase ()
 This constructor is used to initialize storage base class.
virtual ~tcDspStorageBase ()
 Default Destructor.
virtual bool erase (unsigned int anSector)
 This routine provides a default erase method.
virtual void registerISRCallback (tfIsrCallback afCallback, void *apUserArg)
 This method is used to register a callback that is activated whenever the device changes state.
virtual void * getAddress (unsigned int anSector, unsigned int anOffset)
 This routine uses the device's sector map to compute an offset address from a supplied sector and offset.
virtual unsigned int getSize (unsigned int anSector)
 This routine uses the device's sector map to determine the size of the specified sector.
virtual unsigned int getSector (void *apAddr)
 This routine uses the device's sector map to compute a sector from a from a supplied offset address.
virtual double getDeviceSizeKB (void)
 This routine returns the size of the device in kilobytes.
const tsSectorMapgetMap (int &anNumSectors)
 This routine returns a pointer to access the device's sector map.
virtual bool getMediaPresent ()

Protected Attributes

tcDspStorageBasempDevice
 Pointer to underlying device.
unsigned int mnDeviceOffset
 Offset on proxied device.
unsigned int mnSectorSize
 Sector size (bytes)
- Protected Attributes inherited from MityDSP::tcDspStorageBase
unsigned int mnNumSectors
 Number of sectors in this device.
double mnDeviceSize
 Overall device size (in bytes)
tsSectorMapmpSectorInfo
 Map of sectors and sizes.
bool mbMediaPresent
 True if device is loaded.
tfIsrCallback mfIsrCallback
void * mpUserArg
 User-supplied argument for ISR callback.

Additional Inherited Members

- Public Types inherited from MityDSP::tcDspStorageBase
typedef void(* tfIsrCallback )(bool, void *)
 prototype for the ISR callback
- Static Public Member Functions inherited from MityDSP::tcDspStorageBase
static int readDispatch (unsigned int anSector, unsigned int anOffset, char *apBuffer, unsigned int anLength, void *apInstance)
 Static dispatch routine to allow the read method to be registered as a callback.
static int writeDispatch (unsigned int anSector, unsigned int anOffset, char *apData, unsigned int anBytes, void *apInstance)
 Static dispatch routine to allow the write method to be registered as a callback.
- Public Attributes inherited from MityDSP::tcDspStorageBase
unsigned int mnTxBytes
 Count of bytes written (debug)
unsigned int mnRxBytes
 Count of bytes read (debug)

Detailed Description

The tcDspStorageProxy class is used with other tcDspStorageBase derived classes to provide an interface that presents a given sector size.

This is useful to allow something like a filesystem to be hosted on a couple of sectors of a larger-sectored device.

See also:
tcDspStorageProxy Page

Constructor & Destructor Documentation

tcDspStorageProxy::tcDspStorageProxy ( tcDspStorageBase apDevice,
void *  apOffset,
unsigned int  anSize,
unsigned int  anSectorSize = 512 
)

This constructor is used to create a proxy with the specified sector size for the underlying tcDspStorageBase-derived class instance.

Parameters:
[in]apDevicePointer to the underlying tcDspStorageBase device.
[in]apOffsetStarting offset on underlying device.
[in]anSizeBytes available on underlying device.
[in]anSectorSizeSector size to present externally.
Returns:
None.
See also:
DspStorageProxy.h
tcDspStorageProxy::~tcDspStorageProxy ( )
virtual

Default destructor.

Returns:
None.
See also:
DspStorageProxy.h

Member Function Documentation

int tcDspStorageProxy::write ( void *  apAddr,
void *  apData,
int  anBytes 
)
virtual

This routine writes an arbitrary amount of data to the underlying storage device, after offsetting the request to the proper location and ensuring that it fits in the available space.

Parameters:
[in]apAddrPointer to the offset position on the proxied device.
[in]apDataA buffer containing the data to be written.
[in]anBytesSize of the data to be written in bytes.
Returns:
The number of bytes successfully written.
See also:
DspStorageProxy.h

Implements MityDSP::tcDspStorageBase.

int tcDspStorageProxy::write ( unsigned int  anSector,
unsigned int  anOffset,
void *  apData,
int  anBytes 
)
virtual

Sector-based version of the write method.

Parameters:
[in]anSectorThe sector to write to.
[in]anOffsetThe offset from the start of the sector.
[in]apDataA buffer containing the data to be written.
[in]anBytesSize of the data to be written in bytes.
Returns:
The number of bytes successfully written.
See also:
DspStorageProxy.h

Implements MityDSP::tcDspStorageBase.

int tcDspStorageProxy::read ( void *  apStartAddr,
void *  apBuffer,
int  anBytes 
)
virtual

This routine reads an arbitrary amount of data from the underlying storage device, after offsetting the request to the proper location and ensuring that it fits in the available space.

Parameters:
[in]apStartAddrPointer to the data offset on the proxied device.
[out]apBufferA buffer to hold the data that is read.
[in]anBytesSize of the data to be read in bytes.
Returns:
The number of bytes successfully read.
See also:
DspStorageProxy.h

Implements MityDSP::tcDspStorageBase.

int tcDspStorageProxy::read ( unsigned int  anSector,
unsigned int  anOffset,
void *  apBuffer,
int  anBytes 
)
virtual

Sector-based version of the read method.

Parameters:
[in]anSectorThe sector to copy from.
[in]anOffsetThe offset from the start of the sector.
[out]apBufferA buffer to hold the data that is read.
[in]anBytesSize of the data to be read in bytes.
Returns:
The number of bytes successfully read.
See also:
DspStorageProxy.h

Implements MityDSP::tcDspStorageBase.


Member Data Documentation

tcDspStorageBase* MityDSP::tcDspStorageProxy::mpDevice
protected

Pointer to underlying device.

unsigned int MityDSP::tcDspStorageProxy::mnDeviceOffset
protected

Offset on proxied device.

unsigned int MityDSP::tcDspStorageProxy::mnSectorSize
protected

Sector size (bytes)


  
Generated on Mon Apr 22 2013 11:33:04 for MityDSP Core by  Doxygen Version 1.8.1.1
Copyright © 2009, Critical Link LLC, All rights reserved.