MityDSP Documentation Index

tcDspStorageProxy

Introduction

The tcDspStorageProxy class is used to provide an interface to an underlying device derived from the tcDspStorageBase class. This is useful for using a small portion of a large-sector device for something like a FAT filesystem.

Using a device in this manner can cause multiple read-modify-write cycles, slowing performance and potentially wearing out the device prematurely. This can be mitigated by inserting an instance of tcDspStorageCache between the device and tcDspStorageProxy.

See also:
MityDSP::tcDspStorageBase Class Reference
MityDSP::tcDspStorageProxy Class Reference

Example

This is a simple example of tcDspStorageProxy creation and usage:

 {
     tcDspBankSelect   *MyClass::mpBankSel;
     tcDspFlash        *MyClass::mpFlash;
     tcDspStorageCache *MyClass::mpCache;
     tcDspStorageProxy *MyClass::mpProxy;
     tcDspConfig       *lpConfig;
     tsDevInfo          device;

     // create access to FLASH
     mpBankSel = new tcDspBankSelect((void*)0xB0000004);
     mpFlash   = new tcDspFlash((void *)0x90000000, mpBankSel);

     // point to configuration data (to get user data offset)
     lpConfig  = tcDspConfig::GetInstance(mpFlash);

     // create a cache and insert it in front of the FLASH object
     mpCache = new tcDspStorageCache(mpFlash, 4);

     // create a 512-byte sector proxy and insert in front of cache
     mpProxy = new tcDspStorageProxy(mpCache, (void *)lpConfig->GetAppDataOffset(),
                                     lpConfig->GetAppDataSize());

     // use the proxy just like the underlying device...

     //   for instance...
     rv = RegisterFATDriver((RAWREAD)tcDspStorageBase::readDispatch, 
                            (RAWWRITE)tcDspStorageBase::writeDispatch,
                            (GETTIME)NULL, &device, "C", (void *)mpProxy);

     ...
 } 

  
Generated on Fri Sep 23 16:33:45 2011 for MityDSP Core by  Doxygen Version 1.6.1
Copyright © 2009, Critical Link LLC, All rights reserved.