sl@0
|
1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32\sfat\common_constants.h
|
sl@0
|
15 |
// Declarations of the constants etc. commom for FAT16/32 Fsy.
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@internalTechnology
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
sl@0
|
25 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
sl@0
|
26 |
//!!
|
sl@0
|
27 |
//!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
|
sl@0
|
28 |
//!!
|
sl@0
|
29 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
sl@0
|
30 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
sl@0
|
31 |
|
sl@0
|
32 |
|
sl@0
|
33 |
#ifndef COMMON_CONSTANTS_H
|
sl@0
|
34 |
#define COMMON_CONSTANTS_H
|
sl@0
|
35 |
|
sl@0
|
36 |
|
sl@0
|
37 |
|
sl@0
|
38 |
#include <f32fsys.h>
|
sl@0
|
39 |
#include <f32dbg.h>
|
sl@0
|
40 |
|
sl@0
|
41 |
|
sl@0
|
42 |
IMPORT_C TUint32 DebugRegister();
|
sl@0
|
43 |
|
sl@0
|
44 |
|
sl@0
|
45 |
//-- define this for having logs disregarding DebugRegister() settings
|
sl@0
|
46 |
//#define FORCE_LOGS
|
sl@0
|
47 |
|
sl@0
|
48 |
|
sl@0
|
49 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
|
sl@0
|
50 |
|
sl@0
|
51 |
#ifndef FORCE_LOGS
|
sl@0
|
52 |
#define __PRINT(t) {if (DebugRegister()&KFSYS) RDebug::Print(t);}
|
sl@0
|
53 |
#define __PRINT1(t,a) {if (DebugRegister()&KFSYS) RDebug::Print(t,a);}
|
sl@0
|
54 |
#define __PRINT2(t,a,b) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b);}
|
sl@0
|
55 |
#define __PRINT3(t,a,b,c) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c);}
|
sl@0
|
56 |
#define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d);}
|
sl@0
|
57 |
#define __PRINT5(t,a,b,c,d,e) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e);}
|
sl@0
|
58 |
#define __PRINT6(t,a,b,c,d,e,f) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e,f);}
|
sl@0
|
59 |
#define __PRINT7(t,a,b,c,d,e,f,g) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e,f,g);}
|
sl@0
|
60 |
#define __PRINT8BIT1(t,a) {if (DebugRegister()&KFSYS){TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}}
|
sl@0
|
61 |
#define __PRINT1TEMP(t,a) {if (DebugRegister()&KFSERV) {TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
|
sl@0
|
62 |
#else //FORCE_LOGS
|
sl@0
|
63 |
#define __PRINT(t) {RDebug::Print(t);}
|
sl@0
|
64 |
#define __PRINT1(t,a) {RDebug::Print(t,a);}
|
sl@0
|
65 |
#define __PRINT2(t,a,b) {RDebug::Print(t,a,b);}
|
sl@0
|
66 |
#define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
|
sl@0
|
67 |
#define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
|
sl@0
|
68 |
#define __PRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);}
|
sl@0
|
69 |
#define __PRINT6(t,a,b,c,d,e,f) {RDebug::Print(t,a,b,c,d,e,f);}
|
sl@0
|
70 |
#define __PRINT7(t,a,b,c,d,e,f,g) {RDebug::Print(t,a,b,c,d,e,f,g);}
|
sl@0
|
71 |
#define __PRINT8BIT1(t,a) {{TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}}
|
sl@0
|
72 |
#define __PRINT1TEMP(t,a) {{TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
|
sl@0
|
73 |
#endif//FORCE_LOGS
|
sl@0
|
74 |
|
sl@0
|
75 |
#define DBG_STATEMENT(text) text
|
sl@0
|
76 |
|
sl@0
|
77 |
#else
|
sl@0
|
78 |
|
sl@0
|
79 |
#define __PRINT(t)
|
sl@0
|
80 |
#define __PRINT1(t,a)
|
sl@0
|
81 |
#define __PRINT2(t,a,b)
|
sl@0
|
82 |
#define __PRINT3(t,a,b,c)
|
sl@0
|
83 |
#define __PRINT4(t,a,b,c,d)
|
sl@0
|
84 |
#define __PRINT5(t,a,b,c,d,e)
|
sl@0
|
85 |
#define __PRINT6(t,a,b,c,d,e,f)
|
sl@0
|
86 |
#define __PRINT7(t,a,b,c,d,e,f,g)
|
sl@0
|
87 |
#define __PRINT8BIT1(t,a)
|
sl@0
|
88 |
#define __PRINT1TEMP(t,a)
|
sl@0
|
89 |
|
sl@0
|
90 |
#define DBG_STATEMENT(text)
|
sl@0
|
91 |
|
sl@0
|
92 |
#endif
|
sl@0
|
93 |
|
sl@0
|
94 |
//-----------------------------------------------------------------------------
|
sl@0
|
95 |
|
sl@0
|
96 |
//-- define this macro in order to enable the DEMAND PAGING DIRECTORY CACHE.
|
sl@0
|
97 |
#define USE_DP_DIR_CACHE
|
sl@0
|
98 |
|
sl@0
|
99 |
//-----------------------------------------------------------------------------
|
sl@0
|
100 |
|
sl@0
|
101 |
typedef TUint32 TLinAddr;
|
sl@0
|
102 |
typedef TUint32 TFat32Entry;
|
sl@0
|
103 |
typedef TUint16 TFat16Entry;
|
sl@0
|
104 |
|
sl@0
|
105 |
const TUint16 K1KiloByteLog2 = 10;
|
sl@0
|
106 |
const TUint32 K1KiloByte = 1<<10;
|
sl@0
|
107 |
const TUint32 K1MegaByte = 1<<20;
|
sl@0
|
108 |
|
sl@0
|
109 |
const TUint32 K1uSec = 1; ///< 1 misrosecond in TTimeIntervalMicroSeconds32
|
sl@0
|
110 |
const TUint32 K1mSec = 1000; ///< 1 millisecond in TTimeIntervalMicroSeconds32
|
sl@0
|
111 |
const TUint32 K1Sec = 1000*K1mSec; ///< 1 second in TTimeIntervalMicroSeconds32
|
sl@0
|
112 |
|
sl@0
|
113 |
_LIT8(KLit8ReplacementForUnconvertibleUnicodeCharacters, "_");
|
sl@0
|
114 |
_LIT8(KFileSystemName12,"FAT12 "); ///< Name in BPB given to a Fat12 volume
|
sl@0
|
115 |
_LIT8(KFileSystemName16,"FAT16 "); ///< Name in BPB given to a Fat16 volume
|
sl@0
|
116 |
_LIT8(KFileSystemName32,"FAT32 "); ///< Name in BPB given to a Fat32 volume
|
sl@0
|
117 |
_LIT8(KDefaultVendorID, "EPOC"); ///< Vendor Name for BPB for any volume formated using a Symbian OS device
|
sl@0
|
118 |
|
sl@0
|
119 |
const TInt KMaxFatFileNameExt=3; ///< Maximum Fat file system file/directory name extension length
|
sl@0
|
120 |
const TInt KNumberOfFatsInternal=1; ///< Number of FATs for an internal drive
|
sl@0
|
121 |
const TInt KNumberOfFatsExternal=2; ///< Number of FATs for an internal drive
|
sl@0
|
122 |
const TInt KMaxFatFileName=12; ///< Maximum Fat file system file/directory name length
|
sl@0
|
123 |
const TInt KMaxFatFileNameWithoutExt=8; ///< Maximum Fat file system file/directory name length without extension
|
sl@0
|
124 |
const TInt KMaxDuplicateShortName=0xFFFF;
|
sl@0
|
125 |
const TInt KMaxVFatEntryName=13; ///< Maximum entries in a VFat name
|
sl@0
|
126 |
const TInt KMaxFAT16Entries=0xFFF0; ///< Maximum number of clusters in a Fat16 Fat table, 65520
|
sl@0
|
127 |
const TInt KMaxFAT12Entries=0xFF0; ///< Maximum number of clusters in a Fat12 Fat table, 4080
|
sl@0
|
128 |
const TUint8 KBootSectorMediaDescriptor=0xF8; ///< Media descriptor for a Fat volume, Generic disk
|
sl@0
|
129 |
const TUint8 KEntryErasedMarker=0xE5; ///< Erased entry marker for a directory entry
|
sl@0
|
130 |
|
sl@0
|
131 |
const TUint KDefSectorSzLog2=9; ///< Log2 of the default sector size for FAT
|
sl@0
|
132 |
const TUint KDefaultSectorSize = 1 << KDefSectorSzLog2; ///< Default sector size for FAT, 512 bytes
|
sl@0
|
133 |
|
sl@0
|
134 |
|
sl@0
|
135 |
const TInt EOF_32Bit =0x0fffffff; ///< End of cluster chain value for Fat32
|
sl@0
|
136 |
const TInt EOF_16Bit =0xffff; ///< End of cluster chain value for Fat16
|
sl@0
|
137 |
const TInt EOF_12Bit =0xfff; ///< End of cluster chain value for Fat12
|
sl@0
|
138 |
const TInt KBad_32Bit=0x0ffffff7; ///< Bad cluster value for Fat32
|
sl@0
|
139 |
const TInt KBad_16Bit=0xfff7; ///< Bad cluster value for Fat16
|
sl@0
|
140 |
const TInt KBad_12Bit=0xff7; ///< bad cluster value for Fat12
|
sl@0
|
141 |
|
sl@0
|
142 |
const TUint KSpareCluster = 0; ///< FAT entry value for the spare cluster
|
sl@0
|
143 |
const TUint32 KFatFirstSearchCluster = 2; ///< FAT usable clusters start from 2; FAT[0] and FAT[1] are reserved
|
sl@0
|
144 |
|
sl@0
|
145 |
const TUint KFat16EntrySzLog2 = 1; ///< Log2(sizeof(TFat16Entry)); FAT16 entry is 2 bytes
|
sl@0
|
146 |
const TUint KFat32EntrySzLog2 = 2; ///< Log2(sizeof(TFat32Entry)); FAT32 entry is 4 bytes
|
sl@0
|
147 |
|
sl@0
|
148 |
|
sl@0
|
149 |
|
sl@0
|
150 |
//-----------------------------------------------------------------------------
|
sl@0
|
151 |
|
sl@0
|
152 |
/**
|
sl@0
|
153 |
Internal fault codes for FAT fsy
|
sl@0
|
154 |
*/
|
sl@0
|
155 |
enum TFault
|
sl@0
|
156 |
{
|
sl@0
|
157 |
EVFatNoLongName, // 0
|
sl@0
|
158 |
EFatBadParameter, // 1
|
sl@0
|
159 |
EFatBadLocalDrive, // 2
|
sl@0
|
160 |
EFatBadBootSectorParameter, // 3
|
sl@0
|
161 |
EFatBadDirEntryParameter, // 4
|
sl@0
|
162 |
EFatBadStdFormatName, // 5
|
sl@0
|
163 |
EFatBadDosFormatName, // 6
|
sl@0
|
164 |
EFatCorrupt, // 7
|
sl@0
|
165 |
EFatChkDskIllegalClusterNumber, // 8
|
sl@0
|
166 |
EFatChkDskClusterAlreadyInUse, // 9
|
sl@0
|
167 |
EFatChkDskBadCluster, // 10
|
sl@0
|
168 |
EFatChkDskInvalidEntrySize, // 11
|
sl@0
|
169 |
EFatFilePosBeyondEnd, // 12
|
sl@0
|
170 |
EFatFileSeekIndexTooSmall, // 13
|
sl@0
|
171 |
EFatFileSeekIndexTooSmall2, // 14
|
sl@0
|
172 |
ELruCacheBadGranularity, // 15
|
sl@0
|
173 |
EFatRawReadTooBig, // 16
|
sl@0
|
174 |
EFatReadUidFailed, // 17
|
sl@0
|
175 |
ELruCacheFlushNotSupported, // 18
|
sl@0
|
176 |
EReadFileSectionFailed, // 19
|
sl@0
|
177 |
EBadReplacementForUnconvertibleUnicodeCharacters, // 20
|
sl@0
|
178 |
|
sl@0
|
179 |
EFatRAMDriveSizeInvalid, // 21
|
sl@0
|
180 |
EFatRAMDriveFreeInvalid, // 22
|
sl@0
|
181 |
ECheckFatIndexZero, // 23
|
sl@0
|
182 |
|
sl@0
|
183 |
EFatCache_BadGranularity, // 24
|
sl@0
|
184 |
EFatCache_DiscardingDirtyData, // 25
|
sl@0
|
185 |
EFatCache_NotImplemented, // 26
|
sl@0
|
186 |
EFatCache_BadFatType, // 27
|
sl@0
|
187 |
|
sl@0
|
188 |
EFatTable_InvalidIndex, // 28
|
sl@0
|
189 |
|
sl@0
|
190 |
};
|
sl@0
|
191 |
|
sl@0
|
192 |
//-----------------------------------------------------------------------------
|
sl@0
|
193 |
|
sl@0
|
194 |
|
sl@0
|
195 |
#if defined(_DEBUG)
|
sl@0
|
196 |
|
sl@0
|
197 |
/** debug IO control functions */
|
sl@0
|
198 |
enum TControlIO
|
sl@0
|
199 |
{
|
sl@0
|
200 |
ECriticalWriteFailOn, ///< 0
|
sl@0
|
201 |
ECriticalWriteFailOff, ///< 1
|
sl@0
|
202 |
ERuggedFSysOn, ///< 2
|
sl@0
|
203 |
ERuggedFSysOff, ///< 3
|
sl@0
|
204 |
EIsRuggedFSys, ///< 4
|
sl@0
|
205 |
ENCNotifierHang, ///< 5
|
sl@0
|
206 |
ENCNotifierClear, ///< 6
|
sl@0
|
207 |
ECNotifier, ///< 7
|
sl@0
|
208 |
ECNotifierCancel, ///< 8
|
sl@0
|
209 |
ENCNotifierRepeat, ///< 9
|
sl@0
|
210 |
|
sl@0
|
211 |
ELocalTimeForRemovableMediaOn, ///< 10
|
sl@0
|
212 |
ELocalTimeForRemovableMediaOff, ///< 11
|
sl@0
|
213 |
ELocalTimeUsedOnRemovableMedia, ///< 12
|
sl@0
|
214 |
ECreationTime, ///< 13
|
sl@0
|
215 |
|
sl@0
|
216 |
EDisableFATDirCache, ///<14
|
sl@0
|
217 |
EDumpFATDirCache, ///<15
|
sl@0
|
218 |
EFATDirCacheInfo, ///<16
|
sl@0
|
219 |
|
sl@0
|
220 |
EExtCustom=KMaxTInt/2
|
sl@0
|
221 |
};
|
sl@0
|
222 |
|
sl@0
|
223 |
|
sl@0
|
224 |
const TUid KSID_Test1={0x10210EB3}; ///< SID of the test that will define and set test property to control volume mounting
|
sl@0
|
225 |
|
sl@0
|
226 |
//-- bit flags passed by test property value. Used to control some volume mounting features.
|
sl@0
|
227 |
const TUint32 KMntDisable_FsInfo = 0x00000001; //-- mask for disabling/enabling FSInfo information
|
sl@0
|
228 |
const TUint32 KMntDisable_FatBkGndScan = 0x00000002; //-- mask for disabling/enabling FAT background scanner
|
sl@0
|
229 |
|
sl@0
|
230 |
#endif //#if defined(_DEBUG)
|
sl@0
|
231 |
|
sl@0
|
232 |
|
sl@0
|
233 |
|
sl@0
|
234 |
|
sl@0
|
235 |
#endif //COMMON_CONSTANTS_H
|
sl@0
|
236 |
|
sl@0
|
237 |
|
sl@0
|
238 |
|
sl@0
|
239 |
|
sl@0
|
240 |
|
sl@0
|
241 |
|
sl@0
|
242 |
|
sl@0
|
243 |
|
sl@0
|
244 |
|
sl@0
|
245 |
|
sl@0
|
246 |
|
sl@0
|
247 |
|
sl@0
|
248 |
|
sl@0
|
249 |
|
sl@0
|
250 |
|
sl@0
|
251 |
|
sl@0
|
252 |
|
sl@0
|
253 |
|