|
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32test\mediext\nfe.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __NFE_H__ |
|
19 #define __NFE_H__ |
|
20 |
|
21 #include <d32locd.h> |
|
22 |
|
23 |
|
24 |
|
25 // The following is stolen from the genuine NDE driver interface from nfe_interface.h |
|
26 // >>>>>nfe_interface.h |
|
27 enum TNfeCommands |
|
28 { |
|
29 ENfeDiskStatus = 0, // No longer used, preserved for SC/BC. |
|
30 ENfeEncryptDisk = 1, |
|
31 ENfeDecryptDisk = 2, |
|
32 ENfeWipeDisk = 3, |
|
33 // Debug commands below, enabled only in RnD compiled extension |
|
34 ENfePause = 128, |
|
35 ENfeContinue = 129, |
|
36 }; |
|
37 |
|
38 enum TNfeDiskStatus |
|
39 { |
|
40 ENfeUnmounted = 0, |
|
41 ENfeDecrypted = 8, |
|
42 ENfeDecrypting = 9, |
|
43 ENfeEncrypted = 10, |
|
44 ENfeEncrypting = 11, |
|
45 ENfeWiping = 12, |
|
46 ENfeCorrupted = 13, |
|
47 }; |
|
48 |
|
49 |
|
50 |
|
51 // The keys under the KNfeUID category are generated by combining the constants |
|
52 // below with drive number by using the NFE_KEY macro below. |
|
53 const TUint KNfeToThreadKey = 1; |
|
54 const TUint KNfeToUiKey = 2; |
|
55 const TUint KNfeToExtKey = 3; // No longer used, preserved for SC/BC. |
|
56 const TUint KNfeProgressToUiKey = 4; |
|
57 const TUint KNfeStatusToUiKey = 5; // Replaces ENfeDiskStatus command. |
|
58 |
|
59 //- Macros ------------------------------------------------------------------ |
|
60 // Calculates pub&sub key for given drive and id. Top 8 bits are used for the |
|
61 // drives. Bottom 8 bits are used for the ids. The rest of the bits are |
|
62 // reserved and use zero value. The key layout: |
|
63 // dddddddd0000000000000000kkkkkkkk |
|
64 // ^bit 31 ^bit 0 |
|
65 #define NFE_KEY(drive, id) (((drive) << 24) | (0xFF & (id))) |
|
66 // <<<<nfe_interface.h |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 // copy of TPartitionEntry from locmedia.h |
|
72 #ifndef __KERNEL_MODE__ |
|
73 class TPartitionEntry |
|
74 { |
|
75 public: |
|
76 Int64 iPartitionBaseAddr; |
|
77 Int64 iPartitionLen; |
|
78 TUint16 iBootIndicator; |
|
79 TUint16 iPartitionType; |
|
80 }; |
|
81 #endif |
|
82 |
|
83 enum |
|
84 { |
|
85 EQueryNfeDeviceInfo = RLocalDrive::EQuerySymbianNfeTestFirst+0, |
|
86 }; |
|
87 |
|
88 class TNfeDriveInfo |
|
89 { |
|
90 public: |
|
91 inline TBool IsUDADrive() |
|
92 {return PartitionIsFAT(iEntry.iPartitionType) || PartitionIsFAT32(iEntry.iPartitionType); } |
|
93 |
|
94 #ifdef __KERNEL_MODE__ |
|
95 void SetStatus(TNfeDiskStatus aStatus); |
|
96 #endif |
|
97 inline TNfeDiskStatus Status() { return iStatus; } |
|
98 |
|
99 private: |
|
100 TNfeDiskStatus iStatus; // @see TNfeDiskStatus |
|
101 |
|
102 public: |
|
103 TInt iLocalDriveNum; |
|
104 TInt iDriveLetter; |
|
105 TPartitionEntry iEntry; |
|
106 Int64 iCompositeSize; |
|
107 |
|
108 /** |
|
109 position of first encrypted byte - normally the same as |
|
110 iEntry.iPartitionBaseAddr unless the MBR has been changed |
|
111 */ |
|
112 TInt64 iEncryptStartPos; |
|
113 |
|
114 /** |
|
115 position of the last encrypted byte +1 - normally the same as |
|
116 iEntry.iPartitionBaseAddr+iEntry.iPartitionLen if the drive is fully |
|
117 encrypted |
|
118 */ |
|
119 TInt64 iEncryptEndPos; |
|
120 |
|
121 TInt iReadRequestCount; |
|
122 TInt iWriteRequestCount; |
|
123 TInt iCodePagingRequesCount; |
|
124 TInt iDataPagingReadRequestCount; |
|
125 TInt iDataPagingWriteRequestCount; |
|
126 |
|
127 TAny* iStatusToUiProperty; |
|
128 TAny* iToUiProperty; |
|
129 TAny* iProgressToUiProperty; |
|
130 TUint32 iUniqueID; // FAT volume ID |
|
131 TBool iDriveFinalised; |
|
132 }; |
|
133 |
|
134 /** |
|
135 NFE media details - for testing purposes only |
|
136 This is a structure used to communicate NFE-related information |
|
137 from the NFE media driver to a test application |
|
138 |
|
139 @internalTechnology |
|
140 @prototype |
|
141 */ |
|
142 class TNfeDeviceInfo |
|
143 { |
|
144 public: |
|
145 enum {ENfeMaxPartitionEntries = 2}; |
|
146 TNfeDriveInfo iDrives[ENfeMaxPartitionEntries]; |
|
147 |
|
148 TInt iDriveCount; |
|
149 |
|
150 TInt64 iMediaSizeInBytes; |
|
151 }; |
|
152 |
|
153 typedef TPckgBuf<TNfeDeviceInfo> TNfeDeviceInfoBuf; |
|
154 |
|
155 |
|
156 // Publish & Subscribe is used to initiate an encryption pass - to emulate the behaviour of the genuine NFE UI & driver |
|
157 //const TUid KNfeUID = TUid::Uid(0xA000E7C5); // UID of NFE test mdia driver (D_NFE.MMP) |
|
158 const TUid KNfeUID = {0x100039e3}; |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 #endif |