userlibandfileserver/fileserver/sfat/inc/fat_table.h
changeset 15 4122176ea935
parent 0 a41df078684a
equal deleted inserted replaced
0:a41df078684a 15:4122176ea935
    19 /**
    19 /**
    20  @file
    20  @file
    21  @internalTechnology
    21  @internalTechnology
    22 */
    22 */
    23 
    23 
       
    24 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    25 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    26 //!!
       
    27 //!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
       
    28 //!!
       
    29 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    30 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    31 
       
    32 
       
    33 
    24 #ifndef FAT_TABLE_H
    34 #ifndef FAT_TABLE_H
    25 #define FAT_TABLE_H
    35 #define FAT_TABLE_H
    26 
    36 
    27 
    37 
    28 //---------------------------------------------------------------------------------------------------------------------------------------
    38 //---------------------------------------------------------------------------------------------------------------------------------------
    29 
    39 
    30 /**
    40 /**
    31     Fat table used for all media except RAM, manages the Fat table for all cluster requests.
    41     Fat table used for all media except RAM, manages the Fat table for all cluster requests.
    32 */
    42 */
    33 class CAtaFatTable : public CFatTable
    43 class CAtaFatTable : public CFatTable
    34 	{
    44     {
    35 public:
    45 public:
    36     static CAtaFatTable* NewL(CFatMountCB& aOwner);
    46     static CAtaFatTable* NewL(CFatMountCB& aOwner);
    37 
    47 
    38     //-- overrides from the base class
    48     //-- overrides from the base class
    39 	void FlushL();
    49     void FlushL();
    40 	void Dismount(TBool aDiscardDirtyData);
    50     void Dismount(TBool aDiscardDirtyData);
    41     void ReMountL();
    51     void ReMountL();
    42 	void InvalidateCacheL(TInt64 aPos, TUint32 aLength);
    52     void InvalidateCacheL(TInt64 aPos, TUint32 aLength);
    43 	void InvalidateCacheL();
    53     void InvalidateCacheL();
    44 	
    54     
    45 	TUint32 ReadL(TUint32 aFatIndex) const;
    55     TUint32 ReadL(TUint32 aFatIndex) const;
    46 	void WriteL(TUint32 aFatIndex, TUint32 aValue);
    56     void WriteL(TUint32 aFatIndex, TUint32 aValue);
    47 
    57 
    48 	TInt64 DataPositionInBytes(TUint32 aCluster) const;
    58     TInt64 DataPositionInBytes(TUint32 aCluster) const;
    49 
    59 
    50 private:
    60 private:
    51 	CAtaFatTable(CFatMountCB& aOwner);
    61     CAtaFatTable(CFatMountCB& aOwner);
    52     void InitializeL();
    62     void InitializeL();
    53     void CreateCacheL();
    63     void CreateCacheL();
    54 
    64 
    55 private:
    65 private:
    56     CFatCacheBase* iCache;  ///< FAT cache, fixed or LRU depending on the FAT type
    66     CFatCacheBase* iCache;  ///< FAT cache, fixed or LRU depending on the FAT type
    57 	};
    67     };
    58 
    68 
    59 //---------------------------------------------------------------------------------------------------------------------------------------
    69 //---------------------------------------------------------------------------------------------------------------------------------------
    60 
    70 
    61 /**
    71 /**
    62     Fat table used for RAM media, manages the Fat table for all cluster requests. 
    72     Fat table used for RAM media, manages the Fat table for all cluster requests. 
    63     RAM media only supports Fat12/16.
    73     RAM media only supports Fat12/16.
    64 */
    74 */
    65 class CRamFatTable : public CFatTable
    75 class CRamFatTable : public CFatTable
    66 	{
    76     {
    67 public:
    77 public:
    68     static CRamFatTable* NewL(CFatMountCB& aOwner);
    78     static CRamFatTable* NewL(CFatMountCB& aOwner);
    69 
    79 
    70     void ReMountL();
    80     void ReMountL();
    71 	TUint32 ReadL(TUint32 aFatIndex) const;
    81     TUint32 ReadL(TUint32 aFatIndex) const;
    72 	void WriteL(TUint32 aFatIndex, TUint32 aValue);
    82     void WriteL(TUint32 aFatIndex, TUint32 aValue);
    73 	TInt64 DataPositionInBytes(TUint32 aCluster) const;
    83     TInt64 DataPositionInBytes(TUint32 aCluster) const;
    74 	void FreeClusterListL(TUint32 aCluster);
    84     void FreeClusterListL(TUint32 aCluster);
    75 	TUint32 AllocateSingleClusterL(TUint32 aNearestCluster);
    85     TUint32 AllocateSingleClusterL(TUint32 aNearestCluster);
    76 	void ExtendClusterListL(TUint32 aNumber,TInt& aCluster);
    86     void ExtendClusterListL(TUint32 aNumber,TInt& aCluster);
    77 
    87 
    78 private:
    88 private:
    79 	CRamFatTable(CFatMountCB& aOwner);
    89     CRamFatTable(CFatMountCB& aOwner);
    80 
    90 
    81 	void InitializeL();
    91     void InitializeL();
    82 
    92 
    83 	inline TUint8 *RamDiskBase() const;
    93     inline TUint8 *RamDiskBase() const;
    84 	inline TInt AllocateClusterNumber();
    94     inline TInt AllocateClusterNumber();
    85 	inline void WriteFatTable(TInt aFatIndex,TInt aValue);
    95     inline void WriteFatTable(TInt aFatIndex,TInt aValue);
    86 	inline void WriteFatTable(TInt aFatIndex,TInt aFatValue,TInt anIndirectionTableValue);
    96     inline void WriteFatTable(TInt aFatIndex,TInt aFatValue,TInt anIndirectionTableValue);
    87 	inline void ReadIndirectionTable(TUint32& aCluster) const;
    97     inline void ReadIndirectionTable(TUint32& aCluster) const;
    88 	inline void WriteIndirectionTable(TInt aFatIndex,TInt aValue);
    98     inline void WriteIndirectionTable(TInt aFatIndex,TInt aValue);
    89 	inline TUint8* MemCopy(TAny* aTrg,const TAny* aSrc,TInt aLength);
    99     inline TUint8* MemCopy(TAny* aTrg,const TAny* aSrc,TInt aLength);
    90 	inline TUint8* MemCopyFillZ(TAny* aTrg, TAny* aSrc, TInt aLength);
   100     inline TUint8* MemCopyFillZ(TAny* aTrg, TAny* aSrc, TInt aLength);
    91 	inline void ZeroFillCluster(TInt aCluster); 
   101     inline void ZeroFillCluster(TInt aCluster); 
    92 	
   102     
    93 	void UpdateIndirectionTable(TUint32 aStartCluster,TUint32 anEndCluster,TInt aNum);
   103     void UpdateIndirectionTable(TUint32 aStartCluster,TUint32 anEndCluster,TInt aNum);
    94 
   104 
    95 protected:
   105 protected:
    96 
   106 
    97 	TInt iFatTablePos;          ///< Current position in the fat table
   107     TInt iFatTablePos;          ///< Current position in the fat table
    98 	TInt iIndirectionTablePos;  ///< Current position in indirection table, second fat used for this
   108     TInt iIndirectionTablePos;  ///< Current position in indirection table, second fat used for this
    99 	TUint8* iRamDiskBase;       ///< Pointer to the Ram disk base
   109     TUint8* iRamDiskBase;       ///< Pointer to the Ram disk base
   100 	};
   110     };
   101 
   111 
   102 
   112 
   103 
   113 
   104 //---------------------------------------------------------------------------------------------------------------------------------
   114 //---------------------------------------------------------------------------------------------------------------------------------
   105 
   115