sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of the License "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: // f32\sfat\inc\fat_table.h
sl@0: // FAT12/16 File Allocation Table classes definitions
sl@0: // 
sl@0: //
sl@0: 
sl@0: /**
sl@0:  @file
sl@0:  @internalTechnology
sl@0: */
sl@0: 
sl@0: //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sl@0: //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sl@0: //!!
sl@0: //!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
sl@0: //!!
sl@0: //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sl@0: //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sl@0: 
sl@0: 
sl@0: 
sl@0: #ifndef FAT_TABLE_H
sl@0: #define FAT_TABLE_H
sl@0: 
sl@0: 
sl@0: //---------------------------------------------------------------------------------------------------------------------------------------
sl@0: 
sl@0: /**
sl@0:     Fat table used for all media except RAM, manages the Fat table for all cluster requests.
sl@0: */
sl@0: class CAtaFatTable : public CFatTable
sl@0:     {
sl@0: public:
sl@0:     static CAtaFatTable* NewL(CFatMountCB& aOwner);
sl@0: 
sl@0:     //-- overrides from the base class
sl@0:     void FlushL();
sl@0:     void Dismount(TBool aDiscardDirtyData);
sl@0:     void ReMountL();
sl@0:     void InvalidateCacheL(TInt64 aPos, TUint32 aLength);
sl@0:     void InvalidateCacheL();
sl@0:     
sl@0:     TUint32 ReadL(TUint32 aFatIndex) const;
sl@0:     void WriteL(TUint32 aFatIndex, TUint32 aValue);
sl@0: 
sl@0:     TInt64 DataPositionInBytes(TUint32 aCluster) const;
sl@0: 
sl@0: private:
sl@0:     CAtaFatTable(CFatMountCB& aOwner);
sl@0:     void InitializeL();
sl@0:     void CreateCacheL();
sl@0: 
sl@0: private:
sl@0:     CFatCacheBase* iCache;  ///< FAT cache, fixed or LRU depending on the FAT type
sl@0:     };
sl@0: 
sl@0: //---------------------------------------------------------------------------------------------------------------------------------------
sl@0: 
sl@0: /**
sl@0:     Fat table used for RAM media, manages the Fat table for all cluster requests. 
sl@0:     RAM media only supports Fat12/16.
sl@0: */
sl@0: class CRamFatTable : public CFatTable
sl@0:     {
sl@0: public:
sl@0:     static CRamFatTable* NewL(CFatMountCB& aOwner);
sl@0: 
sl@0:     void ReMountL();
sl@0:     TUint32 ReadL(TUint32 aFatIndex) const;
sl@0:     void WriteL(TUint32 aFatIndex, TUint32 aValue);
sl@0:     TInt64 DataPositionInBytes(TUint32 aCluster) const;
sl@0:     void FreeClusterListL(TUint32 aCluster);
sl@0:     TUint32 AllocateSingleClusterL(TUint32 aNearestCluster);
sl@0:     void ExtendClusterListL(TUint32 aNumber,TInt& aCluster);
sl@0: 
sl@0: private:
sl@0:     CRamFatTable(CFatMountCB& aOwner);
sl@0: 
sl@0:     void InitializeL();
sl@0: 
sl@0:     inline TUint8 *RamDiskBase() const;
sl@0:     inline TInt AllocateClusterNumber();
sl@0:     inline void WriteFatTable(TInt aFatIndex,TInt aValue);
sl@0:     inline void WriteFatTable(TInt aFatIndex,TInt aFatValue,TInt anIndirectionTableValue);
sl@0:     inline void ReadIndirectionTable(TUint32& aCluster) const;
sl@0:     inline void WriteIndirectionTable(TInt aFatIndex,TInt aValue);
sl@0:     inline TUint8* MemCopy(TAny* aTrg,const TAny* aSrc,TInt aLength);
sl@0:     inline TUint8* MemCopyFillZ(TAny* aTrg, TAny* aSrc, TInt aLength);
sl@0:     inline void ZeroFillCluster(TInt aCluster); 
sl@0:     
sl@0:     void UpdateIndirectionTable(TUint32 aStartCluster,TUint32 anEndCluster,TInt aNum);
sl@0: 
sl@0: protected:
sl@0: 
sl@0:     TInt iFatTablePos;          ///< Current position in the fat table
sl@0:     TInt iIndirectionTablePos;  ///< Current position in indirection table, second fat used for this
sl@0:     TUint8* iRamDiskBase;       ///< Pointer to the Ram disk base
sl@0:     };
sl@0: 
sl@0: 
sl@0: 
sl@0: //---------------------------------------------------------------------------------------------------------------------------------
sl@0: 
sl@0: 
sl@0: #endif //FAT_TABLE_H
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: