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