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