| author | William Roberts <williamr@symbian.org> | 
| Sat, 19 Jun 2010 09:54:56 +0100 | |
| branch | GCC_SURGE | 
| changeset 168 | c46cf809d044 | 
| parent 15 | 4122176ea935 | 
| permissions | -rw-r--r-- | 
| 0 | 1 | // Copyright (c) 1996-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\sl_bpb.h | |
| 15 | // @file | |
| 16 | // @internalTechnology | |
| 17 | // | |
| 18 | // | |
| 19 | ||
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 20 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 21 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 22 | //!! | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 23 | //!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 24 | //!! | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 25 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 26 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 27 | |
| 0 | 28 | |
| 29 | #ifndef SL_BPB_H | |
| 30 | #define SL_BPB_H | |
| 31 | ||
| 32 | ||
| 33 | #include "filesystem_fat.h" | |
| 34 | using FileSystem_FAT::TFatSubType; | |
| 35 | typedef TFatSubType TFatType; | |
| 36 | ||
| 37 | ||
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 38 | const TInt KVolumeLabelSize =11; ///< Volume lable size | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 39 | const TInt KFileSysTypeSize =8; ///< File system type parameter size | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 40 | const TInt KVendorIdSize =8; ///< Vendor ID parameter size | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 41 | const TInt KBootSectorSignature =0xAA55;///< File system Boot sector signiture | 
| 0 | 42 | |
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 43 | const TInt KSizeOfFatBootSector =62; ///< Size in bytes of Boot sector parameter block (BPB), 62 for fat16|12 | 
| 0 | 44 | const TInt KFat16VolumeLabelPos =43; ///< Position of volume lable in BPB for Fat12/16 | 
| 45 | ||
| 46 | const TUint32 KBootSectorNum =0; ///< Main Boot Sector number (always 0) | |
| 47 | ||
| 48 | //------------------------------------------------------------------------------------------------------------------- | |
| 49 | ||
| 50 | /** | |
| 51 | Boot sector parameter block, enables access to all file system parameters. | |
| 52 | Data is populated at mount time from the BPB sector | |
| 53 | */ | |
| 54 | class TFatBootSector | |
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 55 |     {
 | 
| 0 | 56 | public: | 
| 57 | //-- simple getters / setters | |
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 58 | inline const TPtrC8 VendorId() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 59 | inline TInt BytesPerSector() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 60 | inline TInt SectorsPerCluster() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 61 | inline TInt ReservedSectors() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 62 | inline TInt NumberOfFats() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 63 | inline TInt RootDirEntries() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 64 | inline TInt TotalSectors() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 65 | inline TUint8 MediaDescriptor() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 66 | inline TInt FatSectors() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 67 | inline TInt SectorsPerTrack() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 68 | inline TInt NumberOfHeads() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 69 | inline TInt HiddenSectors() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 70 | inline TInt HugeSectors() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 71 | inline TInt PhysicalDriveNumber() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 72 | inline TInt ExtendedBootSignature() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 73 | inline TUint32 UniqueID() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 74 | inline const TPtrC8 VolumeLabel() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 75 | inline const TPtrC8 FileSysType() const; | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 76 | inline TInt BootSectorSignature() const; | 
| 0 | 77 | |
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 78 |     inline TUint32 RootClusterNum() const  {return 0;} //-- dummy   
 | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 79 |     inline TUint16 FSInfoSectorNum() const {return 0;} //-- dummy   
 | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 80 |     inline TUint16 BkBootRecSector() const {return 0;} //-- dummy   
 | 
| 0 | 81 | |
| 82 | ||
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 83 | inline void SetJumpInstruction(); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 84 | inline void SetVendorID(const TDesC8& aDes); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 85 | inline void SetBytesPerSector(TInt aBytesPerSector); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 86 | inline void SetSectorsPerCluster(TInt aSectorsPerCluster); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 87 | inline void SetReservedSectors(TInt aReservedSectors); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 88 | inline void SetNumberOfFats(TInt aNumberOfFats); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 89 | inline void SetRootDirEntries(TInt aRootDirEntries); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 90 | inline void SetTotalSectors(TInt aTotalSectors); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 91 | inline void SetMediaDescriptor(TUint8 aMediaDescriptor); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 92 | inline void SetFatSectors(TInt aFatSectors); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 93 | inline void SetSectorsPerTrack(TInt aSectorsPerTrack); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 94 | inline void SetNumberOfHeads(TInt aNumberOfHeads); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 95 | inline void SetHiddenSectors(TUint32 aHiddenSectors); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 96 | inline void SetHugeSectors(TUint32 aTotalSectors); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 97 | inline void SetPhysicalDriveNumber(TInt aPhysicalDriveNumber); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 98 | inline void SetReservedByte(TUint8 aReservedByte); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 99 | inline void SetExtendedBootSignature(TInt anExtendedBootSignature); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 100 | inline void SetUniqueID(TUint32 anUniqueID); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 101 | inline void SetVolumeLabel(const TDesC8& aDes); | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 102 | inline void SetFileSysType(const TDesC8& aDes); | 
| 0 | 103 | |
| 104 | public: | |
| 105 | ||
| 106 | TFatBootSector(); | |
| 107 | ||
| 108 | void Initialise(); | |
| 109 | TBool IsValid() const; | |
| 110 | TFatType FatType(void) const; | |
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 111 | |
| 0 | 112 | void Internalize(const TDesC8& aBuf); | 
| 113 | void Externalize(TDes8& aBuf) const; | |
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 114 | void PrintDebugInfo() const; | 
| 0 | 115 | |
| 116 | //-- more advanced API, works for all FAT types | |
| 117 | TInt FirstFatSector() const; | |
| 118 | TInt RootDirStartSector() const; | |
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 119 | TInt FirstDataSector() const; | 
| 0 | 120 | |
| 121 | TUint32 VolumeTotalSectorNumber() const; | |
| 122 | TUint32 TotalFatSectors() const; | |
| 123 | TUint32 RootDirSectors() const; | |
| 124 | ||
| 125 | ||
| 126 | protected: | |
| 127 | ||
| 128 | TUint8 iJumpInstruction[3]; ///< +0 Jump instruction used for bootable volumes | |
| 129 | TUint8 iVendorId[KVendorIdSize]; ///< +3 Vendor ID of the file system that formatted the volume | |
| 130 | TUint16 iBytesPerSector; ///< +11/0x0b Bytes per sector | |
| 131 | TUint8 iSectorsPerCluster; ///< +13/0x0d Sectors per cluster ratio | |
| 132 | TUint16 iReservedSectors; ///< +14/0x0e Number of reserved sectors on the volume | |
| 133 | TUint8 iNumberOfFats; ///< +16/0x10 Number of Fats on the volume | |
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 134 | TUint16 iRootDirEntries; ///< +17/0x11 Number of entries allowed in the root directory, specific to Fat12/16, zero for FAT32 | 
| 0 | 135 | TUint16 iTotalSectors; ///< +19/0x13 Total sectors on the volume, zero for FAT32 | 
| 136 | TUint8 iMediaDescriptor; ///< +12/0x15 Media descriptor | |
| 137 | TUint16 iFatSectors; ///< +22/0x16 Sectors used for the Fat table, zero for FAT32 | |
| 138 | TUint16 iSectorsPerTrack; ///< +24/0x18 Sectors per track | |
| 139 | TUint16 iNumberOfHeads; ///< +26/0x1a Number of heads | |
| 140 | TUint32 iHiddenSectors; ///< +28/0x1c Number of hidden sectors in the volume | |
| 141 | TUint32 iHugeSectors; ///< +32/0x20 Total sectors in the volume, Used if totalSectors > 65535 | |
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 142 | //this is (boot sector) offset 36 for FAT12 and 16 but comes after additional FAT36 elements | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 143 | TUint8 iPhysicalDriveNumber; ///< +36/0x24 Physical drive number, not used in Symbian OS | 
| 0 | 144 | TUint8 iReserved; ///< +37/0x25 Reserved byte | 
| 145 | TUint8 iExtendedBootSignature; ///< +38/0x26 Extended boot signiture | |
| 146 | TUint32 iUniqueID; ///< +39/0x27 Unique volume ID | |
| 147 | TUint8 iVolumeLabel[KVolumeLabelSize]; ///< +43/0x2b The volume's label | |
| 15 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 148 | TUint8 iFileSysType[KFileSysTypeSize]; ///< +54/0x36 File system type | 
| 
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
 John Imhofe <john.imhofe@nokia.com> parents: 
0diff
changeset | 149 | }; | 
| 0 | 150 | |
| 151 | ||
| 152 | ||
| 153 | ||
| 154 | ||
| 155 | #endif //SL_BPB_H | |
| 156 |