imgtools/imglib/inc/fatdefines.h
author Zheng Shen <zheng.shen@nokia.com>
Tue, 26 Oct 2010 11:12:31 +0800
changeset 654 7c11c3d8d025
parent 626 ac03b93ca9c4
permissions -rw-r--r--
romtools 13.2.0.1
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__
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
    19
#include <time.h>
605
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    20
#include <e32std.h>
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    21
struct TFATBootSector {
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    22
	TUint8 BS_jmpBoot[3];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    23
	TUint8 BS_OEMName[8];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    24
	TUint8 BPB_BytsPerSec[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    25
	TUint8 BPB_SecPerClus;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    26
	TUint8 BPB_RsvdSecCnt[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    27
	TUint8 BPB_NumFATs;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    28
	TUint8 BPB_RootEntCnt[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    29
	TUint8 BPB_TotSec16[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    30
	TUint8 BPB_Media;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    31
	TUint8 BPB_FATSz16[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    32
	TUint8 BPB_SecPerTrk[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    33
	TUint8 BPB_NumHeads[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    34
	TUint8 BPB_HiddSec[4];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    35
	TUint8 BPB_TotSec32[4];	
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    36
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    37
struct TFAT32BSExt {
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    38
	TUint8 BPB_FATSz32[4];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    39
	TUint8 BPB_ExtFlags[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    40
	TUint8 BPB_FSVer[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    41
	TUint8 BPB_RootClus[4];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    42
	TUint8 BPB_FSInfo[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    43
	TUint8 BPB_BkBootSec[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    44
	TUint8 BPB_Reserved[12];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    45
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    46
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    47
struct TFATHeader {
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    48
	TUint8 BS_DrvNum ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    49
	TUint8 BS_Reserved1;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    50
	TUint8 BS_BootSig;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    51
	TUint8 BS_VolID[4];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    52
	TUint8 BS_VolLab[11];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    53
	TUint8 BS_FilSysType[8];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    54
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    55
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    56
struct TFAT32FSInfoSector {
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    57
	TUint8 FSI_LeadSig[4];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    58
	TUint8 FSI_Reserved1[480];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    59
	TUint8 FSI_StrucSig[4];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    60
	TUint8 FSI_Free_Count[4];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    61
	TUint8 FSI_Nxt_Free[4];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    62
	TUint8 FSI_Reserved2[12];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    63
	TUint8 FSI_TrailSig[4];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    64
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    65
struct TShortDirEntry {
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    66
    TUint8 DIR_Name[11];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    67
    TUint8 DIR_Attr ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    68
    TUint8 DIR_NTRes ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    69
    TUint8 DIR_CrtTimeTenth ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    70
    TUint8 DIR_CrtTime[2] ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    71
    TUint8 DIR_CrtDate[2] ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    72
    TUint8 DIR_LstAccDate[2] ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    73
    TUint8 DIR_FstClusHI[2] ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    74
    TUint8 DIR_WrtTime[2] ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    75
    TUint8 DIR_WrtDate[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    76
    TUint8 DIR_FstClusLO[2];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    77
    TUint8 DIR_FileSize[4] ;    
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    78
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    79
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    80
struct TLongDirEntry {
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    81
    TUint8 LDIR_Ord ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    82
    TUint8 LDIR_Name1[10] ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    83
    TUint8 LDIR_Attr ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    84
    TUint8 LDIR_Type ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    85
    TUint8 LDIR_Chksum ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    86
    TUint8 LDIR_Name2[12] ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    87
    TUint8 LDIR_FstClusLO[2] ; 
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    88
    TUint8 LDIR_Name3[4] ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    89
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    90
const TUint8 ATTR_READ_ONLY = 0x01 ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    91
const TUint8 ATTR_HIDDEN = 0x02;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    92
const TUint8 ATTR_SYSTEM = 0x04;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    93
const TUint8 ATTR_VOLUME_ID = 0x08;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    94
const TUint8 ATTR_DIRECTORY = 0x10;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    95
const TUint8 ATTR_ARCHIVE = 0x20;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    96
const TUint8 ATTR_LONG_NAME = ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    97
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    98
//Time format, should be written as a integer in FAT image
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
    99
struct FatTime
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   100
{
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   101
	TUint16 Seconds:5;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   102
	TUint16 Minute:6;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   103
	TUint16 Hour:5;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   104
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   105
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   106
//Date format, should be written as a integer in FAT image
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   107
struct FatDate
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   108
{
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   109
	TUint16 Day:5;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   110
	TUint16 Month:4;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   111
	TUint16 Year:7;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   112
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   113
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   114
//This union convention used to convert bit fields into integer
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   115
union TDateInteger
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   116
{
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   117
	FatDate iCurrentDate;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   118
	TUint16 iImageDate;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   119
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   120
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   121
//This union convention used to convert bit fields into integer
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   122
union TTimeInteger
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   123
{	
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   124
	FatTime iCurrentTime;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   125
	TUint16 iImageTime;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   126
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   127
struct ConfigurableFatAttributes
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   128
{
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   129
    char iDriveVolumeLabel[12];
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   130
    TInt64 iImageSize ;
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   131
    TUint16 iDriveSectorSize;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 605
diff changeset
   132
    TUint32 iDriveClusterSize;
605
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   133
    TUint8 iDriveNoOfFATs;    
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
   134
    TUint32 iVolumeId;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 605
diff changeset
   135
    ConfigurableFatAttributes():iImageSize(0),iDriveSectorSize(512),iDriveClusterSize(0),iDriveNoOfFATs(2){
605
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   136
        memcpy(iDriveVolumeLabel,"NO NAME    \0",12);
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
   137
				time_t rawtime;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
   138
				time(&rawtime);
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
   139
				iVolumeId = (TUint32)rawtime;
605
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   140
    }
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   141
};
122d2b873fd1 Minor changes: rofsbuild
jjkang
parents:
diff changeset
   142
#endif