|
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // f32\sfat\inc\fat_table.h |
|
15 // FAT12/16 File Allocation Table classes definitions |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalTechnology |
|
22 */ |
|
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 |
|
34 #ifndef FAT_TABLE_H |
|
35 #define FAT_TABLE_H |
|
36 |
|
37 |
|
38 //--------------------------------------------------------------------------------------------------------------------------------------- |
|
39 |
|
40 /** |
|
41 Fat table used for all media except RAM, manages the Fat table for all cluster requests. |
|
42 */ |
|
43 class CAtaFatTable : public CFatTable |
|
44 { |
|
45 public: |
|
46 static CAtaFatTable* NewL(CFatMountCB& aOwner); |
|
47 |
|
48 //-- overrides from the base class |
|
49 void FlushL(); |
|
50 void Dismount(TBool aDiscardDirtyData); |
|
51 void ReMountL(); |
|
52 void InvalidateCacheL(TInt64 aPos, TUint32 aLength); |
|
53 void InvalidateCacheL(); |
|
54 |
|
55 TUint32 ReadL(TUint32 aFatIndex) const; |
|
56 void WriteL(TUint32 aFatIndex, TUint32 aValue); |
|
57 |
|
58 TInt64 DataPositionInBytes(TUint32 aCluster) const; |
|
59 |
|
60 private: |
|
61 CAtaFatTable(CFatMountCB& aOwner); |
|
62 void InitializeL(); |
|
63 void CreateCacheL(); |
|
64 |
|
65 private: |
|
66 CFatCacheBase* iCache; ///< FAT cache, fixed or LRU depending on the FAT type |
|
67 }; |
|
68 |
|
69 //--------------------------------------------------------------------------------------------------------------------------------------- |
|
70 |
|
71 /** |
|
72 Fat table used for RAM media, manages the Fat table for all cluster requests. |
|
73 RAM media only supports Fat12/16. |
|
74 */ |
|
75 class CRamFatTable : public CFatTable |
|
76 { |
|
77 public: |
|
78 static CRamFatTable* NewL(CFatMountCB& aOwner); |
|
79 |
|
80 void ReMountL(); |
|
81 TUint32 ReadL(TUint32 aFatIndex) const; |
|
82 void WriteL(TUint32 aFatIndex, TUint32 aValue); |
|
83 TInt64 DataPositionInBytes(TUint32 aCluster) const; |
|
84 void FreeClusterListL(TUint32 aCluster); |
|
85 TUint32 AllocateSingleClusterL(TUint32 aNearestCluster); |
|
86 void ExtendClusterListL(TUint32 aNumber,TInt& aCluster); |
|
87 |
|
88 private: |
|
89 CRamFatTable(CFatMountCB& aOwner); |
|
90 |
|
91 void InitializeL(); |
|
92 |
|
93 inline TUint8 *RamDiskBase() const; |
|
94 inline TInt AllocateClusterNumber(); |
|
95 inline void WriteFatTable(TInt aFatIndex,TInt aValue); |
|
96 inline void WriteFatTable(TInt aFatIndex,TInt aFatValue,TInt anIndirectionTableValue); |
|
97 inline void ReadIndirectionTable(TUint32& aCluster) const; |
|
98 inline void WriteIndirectionTable(TInt aFatIndex,TInt aValue); |
|
99 inline TUint8* MemCopy(TAny* aTrg,const TAny* aSrc,TInt aLength); |
|
100 inline TUint8* MemCopyFillZ(TAny* aTrg, TAny* aSrc, TInt aLength); |
|
101 inline void ZeroFillCluster(TInt aCluster); |
|
102 |
|
103 void UpdateIndirectionTable(TUint32 aStartCluster,TUint32 anEndCluster,TInt aNum); |
|
104 |
|
105 protected: |
|
106 |
|
107 TInt iFatTablePos; ///< Current position in the fat table |
|
108 TInt iIndirectionTablePos; ///< Current position in indirection table, second fat used for this |
|
109 TUint8* iRamDiskBase; ///< Pointer to the Ram disk base |
|
110 }; |
|
111 |
|
112 |
|
113 |
|
114 //--------------------------------------------------------------------------------------------------------------------------------- |
|
115 |
|
116 |
|
117 #endif //FAT_TABLE_H |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |