imgtools/imglib/inc/fatdefines.h
changeset 605 122d2b873fd1
child 626 ac03b93ca9c4
equal deleted inserted replaced
604:b33dd54aaa52 605:122d2b873fd1
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 #ifndef __FAT_DEFINES_HEADER__
       
    18 #define __FAT_DEFINES_HEADER__
       
    19 #include <e32std.h>
       
    20 struct TFATBootSector {
       
    21 	TUint8 BS_jmpBoot[3];
       
    22 	TUint8 BS_OEMName[8];
       
    23 	TUint8 BPB_BytsPerSec[2];
       
    24 	TUint8 BPB_SecPerClus;
       
    25 	TUint8 BPB_RsvdSecCnt[2];
       
    26 	TUint8 BPB_NumFATs;
       
    27 	TUint8 BPB_RootEntCnt[2];
       
    28 	TUint8 BPB_TotSec16[2];
       
    29 	TUint8 BPB_Media;
       
    30 	TUint8 BPB_FATSz16[2];
       
    31 	TUint8 BPB_SecPerTrk[2];
       
    32 	TUint8 BPB_NumHeads[2];
       
    33 	TUint8 BPB_HiddSec[4];
       
    34 	TUint8 BPB_TotSec32[4];	
       
    35 };
       
    36 struct TFAT32BSExt {
       
    37 	TUint8 BPB_FATSz32[4];
       
    38 	TUint8 BPB_ExtFlags[2];
       
    39 	TUint8 BPB_FSVer[2];
       
    40 	TUint8 BPB_RootClus[4];
       
    41 	TUint8 BPB_FSInfo[2];
       
    42 	TUint8 BPB_BkBootSec[2];
       
    43 	TUint8 BPB_Reserved[12];
       
    44 };
       
    45 
       
    46 struct TFATHeader {
       
    47 	TUint8 BS_DrvNum ;
       
    48 	TUint8 BS_Reserved1;
       
    49 	TUint8 BS_BootSig;
       
    50 	TUint8 BS_VolID[4];
       
    51 	TUint8 BS_VolLab[11];
       
    52 	TUint8 BS_FilSysType[8];
       
    53 };
       
    54 
       
    55 struct TFAT32FSInfoSector {
       
    56 	TUint8 FSI_LeadSig[4];
       
    57 	TUint8 FSI_Reserved1[480];
       
    58 	TUint8 FSI_StrucSig[4];
       
    59 	TUint8 FSI_Free_Count[4];
       
    60 	TUint8 FSI_Nxt_Free[4];
       
    61 	TUint8 FSI_Reserved2[12];
       
    62 	TUint8 FSI_TrailSig[4];
       
    63 };
       
    64 struct TShortDirEntry {
       
    65     TUint8 DIR_Name[11];
       
    66     TUint8 DIR_Attr ;
       
    67     TUint8 DIR_NTRes ;
       
    68     TUint8 DIR_CrtTimeTenth ;
       
    69     TUint8 DIR_CrtTime[2] ;
       
    70     TUint8 DIR_CrtDate[2] ;
       
    71     TUint8 DIR_LstAccDate[2] ;
       
    72     TUint8 DIR_FstClusHI[2] ;
       
    73     TUint8 DIR_WrtTime[2] ;
       
    74     TUint8 DIR_WrtDate[2];
       
    75     TUint8 DIR_FstClusLO[2];
       
    76     TUint8 DIR_FileSize[4] ;    
       
    77 };
       
    78 
       
    79 struct TLongDirEntry {
       
    80     TUint8 LDIR_Ord ;
       
    81     TUint8 LDIR_Name1[10] ;
       
    82     TUint8 LDIR_Attr ;
       
    83     TUint8 LDIR_Type ;
       
    84     TUint8 LDIR_Chksum ;
       
    85     TUint8 LDIR_Name2[12] ;
       
    86     TUint8 LDIR_FstClusLO[2] ; 
       
    87     TUint8 LDIR_Name3[4] ;
       
    88 };
       
    89 const TUint8 ATTR_READ_ONLY = 0x01 ;
       
    90 const TUint8 ATTR_HIDDEN = 0x02;
       
    91 const TUint8 ATTR_SYSTEM = 0x04;
       
    92 const TUint8 ATTR_VOLUME_ID = 0x08;
       
    93 const TUint8 ATTR_DIRECTORY = 0x10;
       
    94 const TUint8 ATTR_ARCHIVE = 0x20;
       
    95 const TUint8 ATTR_LONG_NAME = ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID;
       
    96 
       
    97 //Time format, should be written as a integer in FAT image
       
    98 struct FatTime
       
    99 {
       
   100 	TUint16 Seconds:5;
       
   101 	TUint16 Minute:6;
       
   102 	TUint16 Hour:5;
       
   103 };
       
   104 
       
   105 //Date format, should be written as a integer in FAT image
       
   106 struct FatDate
       
   107 {
       
   108 	TUint16 Day:5;
       
   109 	TUint16 Month:4;
       
   110 	TUint16 Year:7;
       
   111 };
       
   112 
       
   113 //This union convention used to convert bit fields into integer
       
   114 union TDateInteger
       
   115 {
       
   116 	FatDate iCurrentDate;
       
   117 	TUint16 iImageDate;
       
   118 };
       
   119 
       
   120 //This union convention used to convert bit fields into integer
       
   121 union TTimeInteger
       
   122 {	
       
   123 	FatTime iCurrentTime;
       
   124 	TUint16 iImageTime;
       
   125 };
       
   126 struct ConfigurableFatAttributes
       
   127 {
       
   128     char iDriveVolumeLabel[12];
       
   129     TInt64 iImageSize ;
       
   130     TUint16 iDriveSectorSize;
       
   131     TUint8 iSectorPerCluster ;
       
   132     TUint8 iDriveNoOfFATs;    
       
   133     ConfigurableFatAttributes():iImageSize(0),iDriveSectorSize(512),iSectorPerCluster(0),iDriveNoOfFATs(2){
       
   134         memcpy(iDriveVolumeLabel,"NO NAME    \0",12);
       
   135     }
       
   136 };
       
   137 #endif