sl@0: // Copyright (c) 1996-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\common_constants.h sl@0: // Declarations of the constants etc. commom for FAT16/32 Fsy. 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: #ifndef COMMON_CONSTANTS_H sl@0: #define COMMON_CONSTANTS_H sl@0: sl@0: sl@0: sl@0: #include sl@0: #include sl@0: sl@0: sl@0: IMPORT_C TUint32 DebugRegister(); sl@0: sl@0: sl@0: //-- define this for having logs disregarding DebugRegister() settings sl@0: //#define FORCE_LOGS sl@0: sl@0: sl@0: #if defined(_DEBUG) || defined(_DEBUG_RELEASE) sl@0: sl@0: #ifndef FORCE_LOGS sl@0: #define __PRINT(t) {if (DebugRegister()&KFSYS) RDebug::Print(t);} sl@0: #define __PRINT1(t,a) {if (DebugRegister()&KFSYS) RDebug::Print(t,a);} sl@0: #define __PRINT2(t,a,b) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b);} sl@0: #define __PRINT3(t,a,b,c) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c);} sl@0: #define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d);} sl@0: #define __PRINT5(t,a,b,c,d,e) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e);} sl@0: #define __PRINT6(t,a,b,c,d,e,f) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e,f);} sl@0: #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: #define __PRINT8BIT1(t,a) {if (DebugRegister()&KFSYS){TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}} sl@0: #define __PRINT1TEMP(t,a) {if (DebugRegister()&KFSERV) {TBuftemp(a);RDebug::Print(t,&temp);}} sl@0: #else //FORCE_LOGS sl@0: #define __PRINT(t) {RDebug::Print(t);} sl@0: #define __PRINT1(t,a) {RDebug::Print(t,a);} sl@0: #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} sl@0: #define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} sl@0: #define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} sl@0: #define __PRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} sl@0: #define __PRINT6(t,a,b,c,d,e,f) {RDebug::Print(t,a,b,c,d,e,f);} sl@0: #define __PRINT7(t,a,b,c,d,e,f,g) {RDebug::Print(t,a,b,c,d,e,f,g);} sl@0: #define __PRINT8BIT1(t,a) {{TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}} sl@0: #define __PRINT1TEMP(t,a) {{TBuftemp(a);RDebug::Print(t,&temp);}} sl@0: #endif//FORCE_LOGS sl@0: sl@0: #define DBG_STATEMENT(text) text sl@0: sl@0: #else sl@0: sl@0: #define __PRINT(t) sl@0: #define __PRINT1(t,a) sl@0: #define __PRINT2(t,a,b) sl@0: #define __PRINT3(t,a,b,c) sl@0: #define __PRINT4(t,a,b,c,d) sl@0: #define __PRINT5(t,a,b,c,d,e) sl@0: #define __PRINT6(t,a,b,c,d,e,f) sl@0: #define __PRINT7(t,a,b,c,d,e,f,g) sl@0: #define __PRINT8BIT1(t,a) sl@0: #define __PRINT1TEMP(t,a) sl@0: sl@0: #define DBG_STATEMENT(text) sl@0: sl@0: #endif sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: //-- define this macro in order to enable the DEMAND PAGING DIRECTORY CACHE. sl@0: #define USE_DP_DIR_CACHE sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: typedef TUint32 TLinAddr; sl@0: typedef TUint32 TFat32Entry; sl@0: typedef TUint16 TFat16Entry; sl@0: sl@0: const TUint16 K1KiloByteLog2 = 10; sl@0: const TUint32 K1KiloByte = 1<<10; sl@0: const TUint32 K1MegaByte = 1<<20; sl@0: sl@0: const TUint32 K1uSec = 1; ///< 1 misrosecond in TTimeIntervalMicroSeconds32 sl@0: const TUint32 K1mSec = 1000; ///< 1 millisecond in TTimeIntervalMicroSeconds32 sl@0: const TUint32 K1Sec = 1000*K1mSec; ///< 1 second in TTimeIntervalMicroSeconds32 sl@0: sl@0: _LIT8(KLit8ReplacementForUnconvertibleUnicodeCharacters, "_"); sl@0: _LIT8(KFileSystemName12,"FAT12 "); ///< Name in BPB given to a Fat12 volume sl@0: _LIT8(KFileSystemName16,"FAT16 "); ///< Name in BPB given to a Fat16 volume sl@0: _LIT8(KFileSystemName32,"FAT32 "); ///< Name in BPB given to a Fat32 volume sl@0: _LIT8(KDefaultVendorID, "EPOC"); ///< Vendor Name for BPB for any volume formated using a Symbian OS device sl@0: sl@0: const TInt KMaxFatFileNameExt=3; ///< Maximum Fat file system file/directory name extension length sl@0: const TInt KNumberOfFatsInternal=1; ///< Number of FATs for an internal drive sl@0: const TInt KNumberOfFatsExternal=2; ///< Number of FATs for an internal drive sl@0: const TInt KMaxFatFileName=12; ///< Maximum Fat file system file/directory name length sl@0: const TInt KMaxFatFileNameWithoutExt=8; ///< Maximum Fat file system file/directory name length without extension sl@0: const TInt KMaxDuplicateShortName=0xFFFF; sl@0: const TInt KMaxVFatEntryName=13; ///< Maximum entries in a VFat name sl@0: const TInt KMaxFAT16Entries=0xFFF0; ///< Maximum number of clusters in a Fat16 Fat table, 65520 sl@0: const TInt KMaxFAT12Entries=0xFF0; ///< Maximum number of clusters in a Fat12 Fat table, 4080 sl@0: const TUint8 KBootSectorMediaDescriptor=0xF8; ///< Media descriptor for a Fat volume, Generic disk sl@0: const TUint8 KEntryErasedMarker=0xE5; ///< Erased entry marker for a directory entry sl@0: sl@0: const TUint KDefSectorSzLog2=9; ///< Log2 of the default sector size for FAT sl@0: const TUint KDefaultSectorSize = 1 << KDefSectorSzLog2; ///< Default sector size for FAT, 512 bytes sl@0: sl@0: sl@0: const TInt EOF_32Bit =0x0fffffff; ///< End of cluster chain value for Fat32 sl@0: const TInt EOF_16Bit =0xffff; ///< End of cluster chain value for Fat16 sl@0: const TInt EOF_12Bit =0xfff; ///< End of cluster chain value for Fat12 sl@0: const TInt KBad_32Bit=0x0ffffff7; ///< Bad cluster value for Fat32 sl@0: const TInt KBad_16Bit=0xfff7; ///< Bad cluster value for Fat16 sl@0: const TInt KBad_12Bit=0xff7; ///< bad cluster value for Fat12 sl@0: sl@0: const TUint KSpareCluster = 0; ///< FAT entry value for the spare cluster sl@0: const TUint32 KFatFirstSearchCluster = 2; ///< FAT usable clusters start from 2; FAT[0] and FAT[1] are reserved sl@0: sl@0: const TUint KFat16EntrySzLog2 = 1; ///< Log2(sizeof(TFat16Entry)); FAT16 entry is 2 bytes sl@0: const TUint KFat32EntrySzLog2 = 2; ///< Log2(sizeof(TFat32Entry)); FAT32 entry is 4 bytes sl@0: sl@0: sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: /** sl@0: Internal fault codes for FAT fsy sl@0: */ sl@0: enum TFault sl@0: { sl@0: EVFatNoLongName, // 0 sl@0: EFatBadParameter, // 1 sl@0: EFatBadLocalDrive, // 2 sl@0: EFatBadBootSectorParameter, // 3 sl@0: EFatBadDirEntryParameter, // 4 sl@0: EFatBadStdFormatName, // 5 sl@0: EFatBadDosFormatName, // 6 sl@0: EFatCorrupt, // 7 sl@0: EFatChkDskIllegalClusterNumber, // 8 sl@0: EFatChkDskClusterAlreadyInUse, // 9 sl@0: EFatChkDskBadCluster, // 10 sl@0: EFatChkDskInvalidEntrySize, // 11 sl@0: EFatFilePosBeyondEnd, // 12 sl@0: EFatFileSeekIndexTooSmall, // 13 sl@0: EFatFileSeekIndexTooSmall2, // 14 sl@0: ELruCacheBadGranularity, // 15 sl@0: EFatRawReadTooBig, // 16 sl@0: EFatReadUidFailed, // 17 sl@0: ELruCacheFlushNotSupported, // 18 sl@0: EReadFileSectionFailed, // 19 sl@0: EBadReplacementForUnconvertibleUnicodeCharacters, // 20 sl@0: sl@0: EFatRAMDriveSizeInvalid, // 21 sl@0: EFatRAMDriveFreeInvalid, // 22 sl@0: ECheckFatIndexZero, // 23 sl@0: sl@0: EFatCache_BadGranularity, // 24 sl@0: EFatCache_DiscardingDirtyData, // 25 sl@0: EFatCache_NotImplemented, // 26 sl@0: EFatCache_BadFatType, // 27 sl@0: sl@0: EFatTable_InvalidIndex, // 28 sl@0: sl@0: }; sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: sl@0: #if defined(_DEBUG) sl@0: sl@0: /** debug IO control functions */ sl@0: enum TControlIO sl@0: { sl@0: ECriticalWriteFailOn, ///< 0 sl@0: ECriticalWriteFailOff, ///< 1 sl@0: ERuggedFSysOn, ///< 2 sl@0: ERuggedFSysOff, ///< 3 sl@0: EIsRuggedFSys, ///< 4 sl@0: ENCNotifierHang, ///< 5 sl@0: ENCNotifierClear, ///< 6 sl@0: ECNotifier, ///< 7 sl@0: ECNotifierCancel, ///< 8 sl@0: ENCNotifierRepeat, ///< 9 sl@0: sl@0: ELocalTimeForRemovableMediaOn, ///< 10 sl@0: ELocalTimeForRemovableMediaOff, ///< 11 sl@0: ELocalTimeUsedOnRemovableMedia, ///< 12 sl@0: ECreationTime, ///< 13 sl@0: sl@0: EDisableFATDirCache, ///<14 sl@0: EDumpFATDirCache, ///<15 sl@0: EFATDirCacheInfo, ///<16 sl@0: sl@0: EExtCustom=KMaxTInt/2 sl@0: }; sl@0: sl@0: sl@0: const TUid KSID_Test1={0x10210EB3}; ///< SID of the test that will define and set test property to control volume mounting sl@0: sl@0: //-- bit flags passed by test property value. Used to control some volume mounting features. sl@0: const TUint32 KMntDisable_FsInfo = 0x00000001; //-- mask for disabling/enabling FSInfo information sl@0: const TUint32 KMntDisable_FatBkGndScan = 0x00000002; //-- mask for disabling/enabling FAT background scanner sl@0: sl@0: #endif //#if defined(_DEBUG) sl@0: sl@0: sl@0: sl@0: sl@0: #endif //COMMON_CONSTANTS_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: