userlibandfileserver/fileserver/sfat/inc/sl_bpb.inl
changeset 15 4122176ea935
parent 0 a41df078684a
equal deleted inserted replaced
0:a41df078684a 15:4122176ea935
    13 // Description:
    13 // Description:
    14 // f32\sfat\inc\sl_bpb.inl
    14 // f32\sfat\inc\sl_bpb.inl
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
       
    18 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    19 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    20 //!!
       
    21 //!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
       
    22 //!!
       
    23 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    24 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    25 
    18 #ifndef SL_BPB_INL
    26 #ifndef SL_BPB_INL
    19 #define SL_BPB_INL
    27 #define SL_BPB_INL
    20 
    28 
    21 
    29 
    22 #define pDir ((SFatDirEntry*)&iData[0])
    30 #define pDir ((SFatDirEntry*)&iData[0])
    23 
    31 
    24 // class TFatBootSector
    32 // class TFatBootSector
    25 inline const TPtrC8 TFatBootSector::VendorId() const
    33 inline const TPtrC8 TFatBootSector::VendorId() const
    26 	{return TPtrC8(iVendorId,8);}
    34     {return TPtrC8(iVendorId,8);}
    27 inline TInt TFatBootSector::BytesPerSector() const
    35 inline TInt TFatBootSector::BytesPerSector() const
    28 	{return iBytesPerSector;}
    36     {return iBytesPerSector;}
    29 inline TInt TFatBootSector::SectorsPerCluster() const
    37 inline TInt TFatBootSector::SectorsPerCluster() const
    30 	{return iSectorsPerCluster;}
    38     {return iSectorsPerCluster;}
    31 inline TInt TFatBootSector::ReservedSectors() const
    39 inline TInt TFatBootSector::ReservedSectors() const
    32 	{return iReservedSectors;}
    40     {return iReservedSectors;}
    33 inline TInt TFatBootSector::NumberOfFats() const
    41 inline TInt TFatBootSector::NumberOfFats() const
    34 	{return iNumberOfFats;}
    42     {return iNumberOfFats;}
    35 inline TInt TFatBootSector::RootDirEntries() const
    43 inline TInt TFatBootSector::RootDirEntries() const
    36 	{return iRootDirEntries;}
    44     {return iRootDirEntries;}
    37 inline TInt TFatBootSector::TotalSectors() const
    45 inline TInt TFatBootSector::TotalSectors() const
    38 	{return iTotalSectors;}
    46     {return iTotalSectors;}
    39 inline TUint8 TFatBootSector::MediaDescriptor() const
    47 inline TUint8 TFatBootSector::MediaDescriptor() const
    40 	{return iMediaDescriptor;}
    48     {return iMediaDescriptor;}
    41 inline TInt TFatBootSector::FatSectors() const
    49 inline TInt TFatBootSector::FatSectors() const
    42 	{return iFatSectors;}
    50     {return iFatSectors;}
    43 inline TInt TFatBootSector::SectorsPerTrack() const
    51 inline TInt TFatBootSector::SectorsPerTrack() const
    44 	{return iSectorsPerTrack;}
    52     {return iSectorsPerTrack;}
    45 inline TInt TFatBootSector::NumberOfHeads() const
    53 inline TInt TFatBootSector::NumberOfHeads() const
    46 	{return iNumberOfHeads;}
    54     {return iNumberOfHeads;}
    47 inline TInt TFatBootSector::HiddenSectors() const
    55 inline TInt TFatBootSector::HiddenSectors() const
    48 	{return iHiddenSectors;}
    56     {return iHiddenSectors;}
    49 inline TInt TFatBootSector::HugeSectors() const
    57 inline TInt TFatBootSector::HugeSectors() const
    50 	{return iHugeSectors;}
    58     {return iHugeSectors;}
    51 inline TInt TFatBootSector::PhysicalDriveNumber() const
    59 inline TInt TFatBootSector::PhysicalDriveNumber() const
    52 	{return iPhysicalDriveNumber;}
    60     {return iPhysicalDriveNumber;}
    53 inline TInt TFatBootSector::ExtendedBootSignature() const
    61 inline TInt TFatBootSector::ExtendedBootSignature() const
    54 	{return iExtendedBootSignature;}
    62     {return iExtendedBootSignature;}
    55 inline TUint32 TFatBootSector::UniqueID() const
    63 inline TUint32 TFatBootSector::UniqueID() const
    56 	{return iUniqueID;}
    64     {return iUniqueID;}
    57 inline const TPtrC8 TFatBootSector::VolumeLabel() const
    65 inline const TPtrC8 TFatBootSector::VolumeLabel() const
    58 	{return TPtrC8(iVolumeLabel,KVolumeLabelSize);}
    66     {return TPtrC8(iVolumeLabel,KVolumeLabelSize);}
    59 inline const TPtrC8 TFatBootSector::FileSysType() const
    67 inline const TPtrC8 TFatBootSector::FileSysType() const
    60 	{return TPtrC8(iFileSysType,KFileSysTypeSize);}
    68     {return TPtrC8(iFileSysType,KFileSysTypeSize);}
    61 inline TInt TFatBootSector::BootSectorSignature() const
    69 inline TInt TFatBootSector::BootSectorSignature() const
    62 	{return KBootSectorSignature;}
    70     {return KBootSectorSignature;}
    63 
    71 
    64 inline void TFatBootSector::SetJumpInstruction()
    72 inline void TFatBootSector::SetJumpInstruction()
    65 	{
    73     {
    66 	iJumpInstruction[0]=0xE9;iJumpInstruction[2]=0x90;
    74     iJumpInstruction[0]=0xE9;iJumpInstruction[2]=0x90;
    67 	}
    75     }
    68 inline void TFatBootSector::SetVendorID(const TDesC8& aDes)
    76 inline void TFatBootSector::SetVendorID(const TDesC8& aDes)
    69 	{
    77     {
    70 	__ASSERT_DEBUG(aDes.Length()<=8,Fault(EFatBadBootSectorParameter));
    78     __ASSERT_DEBUG(aDes.Length()<=8,Fault(EFatBadBootSectorParameter));
    71 	TPtr8 buf(iVendorId,8);
    79     TPtr8 buf(iVendorId,8);
    72 	buf=aDes;
    80     buf=aDes;
    73 	}
    81     }
    74 inline void TFatBootSector::SetBytesPerSector(TInt aBytesPerSector)
    82 inline void TFatBootSector::SetBytesPerSector(TInt aBytesPerSector)
    75 	{
    83     {
    76 	__ASSERT_DEBUG(!(aBytesPerSector&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
    84     __ASSERT_DEBUG(!(aBytesPerSector&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
    77 	iBytesPerSector=(TUint16)aBytesPerSector;
    85     iBytesPerSector=(TUint16)aBytesPerSector;
    78 	}
    86     }
    79 inline void TFatBootSector::SetSectorsPerCluster(TInt aSectorsPerCluster)
    87 inline void TFatBootSector::SetSectorsPerCluster(TInt aSectorsPerCluster)
    80 	{
    88     {
    81 	__ASSERT_DEBUG(!(aSectorsPerCluster&~KMaxTUint8),Fault(EFatBadBootSectorParameter));
    89     __ASSERT_DEBUG(!(aSectorsPerCluster&~KMaxTUint8),Fault(EFatBadBootSectorParameter));
    82 	iSectorsPerCluster=(TUint8)aSectorsPerCluster;
    90     iSectorsPerCluster=(TUint8)aSectorsPerCluster;
    83 	}
    91     }
    84 inline void TFatBootSector::SetReservedSectors(TInt aReservedSectors)
    92 inline void TFatBootSector::SetReservedSectors(TInt aReservedSectors)
    85 	{
    93     {
    86 	__ASSERT_DEBUG(!(aReservedSectors&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
    94     __ASSERT_DEBUG(!(aReservedSectors&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
    87 	iReservedSectors=(TUint16)aReservedSectors;
    95     iReservedSectors=(TUint16)aReservedSectors;
    88 	}
    96     }
    89 inline void TFatBootSector::SetNumberOfFats(TInt aNumberOfFats)
    97 inline void TFatBootSector::SetNumberOfFats(TInt aNumberOfFats)
    90 	{
    98     {
    91 	__ASSERT_DEBUG(!(aNumberOfFats&~KMaxTUint8),Fault(EFatBadBootSectorParameter));
    99     __ASSERT_DEBUG(!(aNumberOfFats&~KMaxTUint8),Fault(EFatBadBootSectorParameter));
    92 	iNumberOfFats=(TUint8)aNumberOfFats;
   100     iNumberOfFats=(TUint8)aNumberOfFats;
    93 	}
   101     }
    94 inline void TFatBootSector::SetRootDirEntries(TInt aRootDirEntries)
   102 inline void TFatBootSector::SetRootDirEntries(TInt aRootDirEntries)
    95 	{
   103     {
    96 	__ASSERT_DEBUG(!(aRootDirEntries&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
   104     __ASSERT_DEBUG(!(aRootDirEntries&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
    97 	iRootDirEntries=(TUint16)aRootDirEntries;
   105     iRootDirEntries=(TUint16)aRootDirEntries;
    98 	}
   106     }
    99 inline void TFatBootSector::SetTotalSectors(TInt aTotalSectors)
   107 inline void TFatBootSector::SetTotalSectors(TInt aTotalSectors)
   100 	{
   108     {
   101 	__ASSERT_DEBUG(!(aTotalSectors&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
   109     __ASSERT_DEBUG(!(aTotalSectors&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
   102 	iTotalSectors=(TUint16)aTotalSectors;
   110     iTotalSectors=(TUint16)aTotalSectors;
   103 	}
   111     }
   104 inline void TFatBootSector::SetMediaDescriptor(TUint8 aMediaDescriptor)
   112 inline void TFatBootSector::SetMediaDescriptor(TUint8 aMediaDescriptor)
   105 	{iMediaDescriptor=aMediaDescriptor;}
   113     {iMediaDescriptor=aMediaDescriptor;}
   106 inline void TFatBootSector::SetFatSectors(TInt aFatSectors)
   114 inline void TFatBootSector::SetFatSectors(TInt aFatSectors)
   107 	{
   115     {
   108 	__ASSERT_DEBUG(!(aFatSectors&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
   116     __ASSERT_DEBUG(!(aFatSectors&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
   109 	iFatSectors=(TUint16)aFatSectors;
   117     iFatSectors=(TUint16)aFatSectors;
   110 	}
   118     }
   111 inline void TFatBootSector::SetSectorsPerTrack(TInt aSectorsPerTrack)
   119 inline void TFatBootSector::SetSectorsPerTrack(TInt aSectorsPerTrack)
   112 	{
   120     {
   113 	__ASSERT_DEBUG(!(aSectorsPerTrack&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
   121     __ASSERT_DEBUG(!(aSectorsPerTrack&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
   114 	iSectorsPerTrack=(TUint16)aSectorsPerTrack;
   122     iSectorsPerTrack=(TUint16)aSectorsPerTrack;
   115 	}
   123     }
   116 inline void TFatBootSector::SetNumberOfHeads(TInt aNumberOfHeads)
   124 inline void TFatBootSector::SetNumberOfHeads(TInt aNumberOfHeads)
   117 	{
   125     {
   118 	__ASSERT_DEBUG(!(aNumberOfHeads&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
   126     __ASSERT_DEBUG(!(aNumberOfHeads&~KMaxTUint16),Fault(EFatBadBootSectorParameter));
   119 	iNumberOfHeads=(TUint16)aNumberOfHeads;
   127     iNumberOfHeads=(TUint16)aNumberOfHeads;
   120 	}
   128     }
   121 inline void TFatBootSector::SetHiddenSectors(TUint32 aHiddenSectors)
   129 inline void TFatBootSector::SetHiddenSectors(TUint32 aHiddenSectors)
   122 	{
   130     {
   123 	iHiddenSectors=(TUint32)(aHiddenSectors);
   131     iHiddenSectors=(TUint32)(aHiddenSectors);
   124 	}
   132     }
   125 inline void TFatBootSector::SetHugeSectors(TUint32 aHugeSectors)
   133 inline void TFatBootSector::SetHugeSectors(TUint32 aHugeSectors)
   126 	{iHugeSectors=aHugeSectors;}
   134     {iHugeSectors=aHugeSectors;}
   127 inline void TFatBootSector::SetPhysicalDriveNumber(TInt aPhysicalDriveNumber)
   135 inline void TFatBootSector::SetPhysicalDriveNumber(TInt aPhysicalDriveNumber)
   128 	{
   136     {
   129 	__ASSERT_DEBUG(!(aPhysicalDriveNumber&~KMaxTUint8),Fault(EFatBadBootSectorParameter));
   137     __ASSERT_DEBUG(!(aPhysicalDriveNumber&~KMaxTUint8),Fault(EFatBadBootSectorParameter));
   130 	iPhysicalDriveNumber=(TUint8)aPhysicalDriveNumber;
   138     iPhysicalDriveNumber=(TUint8)aPhysicalDriveNumber;
   131 	}
   139     }
   132 inline void TFatBootSector::SetReservedByte(TUint8 aReservedByte)
   140 inline void TFatBootSector::SetReservedByte(TUint8 aReservedByte)
   133 	{iReserved=aReservedByte;}
   141     {iReserved=aReservedByte;}
   134 inline void TFatBootSector::SetExtendedBootSignature(TInt anExtendedBootSignature)
   142 inline void TFatBootSector::SetExtendedBootSignature(TInt anExtendedBootSignature)
   135 	{
   143     {
   136 	__ASSERT_DEBUG(!(anExtendedBootSignature&~KMaxTUint8),Fault(EFatBadBootSectorParameter));
   144     __ASSERT_DEBUG(!(anExtendedBootSignature&~KMaxTUint8),Fault(EFatBadBootSectorParameter));
   137 	iExtendedBootSignature=(TUint8)anExtendedBootSignature;
   145     iExtendedBootSignature=(TUint8)anExtendedBootSignature;
   138 	}
   146     }
   139 inline void TFatBootSector::SetUniqueID(TUint32 anUniqueID)
   147 inline void TFatBootSector::SetUniqueID(TUint32 anUniqueID)
   140 	{iUniqueID=anUniqueID;}
   148     {iUniqueID=anUniqueID;}
   141 inline void TFatBootSector::SetVolumeLabel(const TDesC8& aDes)
   149 inline void TFatBootSector::SetVolumeLabel(const TDesC8& aDes)
   142 	{
   150     {
   143 	__ASSERT_DEBUG(aDes.Length()<=KVolumeLabelSize,Fault(EFatBadBootSectorParameter));
   151     __ASSERT_DEBUG(aDes.Length()<=KVolumeLabelSize,Fault(EFatBadBootSectorParameter));
   144 	TPtr8 buf(iVolumeLabel,KVolumeLabelSize);
   152     TPtr8 buf(iVolumeLabel,KVolumeLabelSize);
   145 	buf=aDes;
   153     buf=aDes;
   146 	}
   154     }
   147 inline void TFatBootSector::SetFileSysType(const TDesC8& aDes)
   155 inline void TFatBootSector::SetFileSysType(const TDesC8& aDes)
   148 	{
   156     {
   149 	__ASSERT_DEBUG(aDes.Length()<=8,Fault(EFatBadBootSectorParameter));
   157     __ASSERT_DEBUG(aDes.Length()<=8,Fault(EFatBadBootSectorParameter));
   150 	TPtr8 buf(iFileSysType,8);
   158     TPtr8 buf(iFileSysType,8);
   151 	buf=aDes;
   159     buf=aDes;
   152 	}
   160     }
   153 
   161 
   154 
   162 
   155 #endif //SL_BPB_INL
   163 #endif //SL_BPB_INL