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>
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 tsSectorMap * | getMap (int &anNumSectors) |
This routine returns a pointer to access the device's sector map. | |
virtual bool | getMediaPresent () |
Protected Attributes | |
tcDspStorageBase * | mpDevice |
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) | |
tsSectorMap * | mpSectorInfo |
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) |
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.
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.
[in] | apDevice | Pointer to the underlying tcDspStorageBase device. |
[in] | apOffset | Starting offset on underlying device. |
[in] | anSize | Bytes available on underlying device. |
[in] | anSectorSize | Sector size to present externally. |
|
virtual |
|
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.
[in] | apAddr | Pointer to the offset position on the proxied device. |
[in] | apData | A buffer containing the data to be written. |
[in] | anBytes | Size of the data to be written in bytes. |
Implements MityDSP::tcDspStorageBase.
|
virtual |
Sector-based version of the write method.
[in] | anSector | The sector to write to. |
[in] | anOffset | The offset from the start of the sector. |
[in] | apData | A buffer containing the data to be written. |
[in] | anBytes | Size of the data to be written in bytes. |
Implements MityDSP::tcDspStorageBase.
|
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.
[in] | apStartAddr | Pointer to the data offset on the proxied device. |
[out] | apBuffer | A buffer to hold the data that is read. |
[in] | anBytes | Size of the data to be read in bytes. |
Implements MityDSP::tcDspStorageBase.
|
virtual |
Sector-based version of the read method.
[in] | anSector | The sector to copy from. |
[in] | anOffset | The offset from the start of the sector. |
[out] | apBuffer | A buffer to hold the data that is read. |
[in] | anBytes | Size of the data to be read in bytes. |
Implements MityDSP::tcDspStorageBase.
|
protected |
Pointer to underlying device.
|
protected |
Offset on proxied device.
|
protected |
Sector size (bytes)