1 // Copyright (c) 2006-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 // |
|
15 |
|
16 #ifndef BASETESTFAT32BASE_H |
|
17 #define BASETESTFAT32BASE_H |
|
18 |
|
19 #include <testexecutestepbase.h> |
|
20 #include <testexecuteserverbase.h> |
|
21 |
|
22 enum TDiskType |
|
23 { |
|
24 EFat12, |
|
25 EFat16, |
|
26 EFat32, |
|
27 EFatUnknown |
|
28 }; |
|
29 /* |
|
30 *temporary macro to dump the test result. |
|
31 *should be moved a common header file. |
|
32 */ |
|
33 #define FAT_TEST(cond, text) {\ |
|
34 if (cond) \ |
|
35 { \ |
|
36 INFO_PRINTF1(text); \ |
|
37 INFO_PRINTF1(_L("...passed"));\ |
|
38 } \ |
|
39 else \ |
|
40 { \ |
|
41 ERR_PRINTF1(text); \ |
|
42 ERR_PRINTF1(_L("...failed"));\ |
|
43 SetTestStepResult(EFail);\ |
|
44 return TestStepResult();\ |
|
45 }\ |
|
46 } |
|
47 |
|
48 #define FAT_TEST_VAL(cond, text, errval) {\ |
|
49 if (cond) \ |
|
50 { \ |
|
51 INFO_PRINTF1(text); \ |
|
52 INFO_PRINTF1(_L("...passed"));\ |
|
53 } \ |
|
54 else \ |
|
55 { \ |
|
56 ERR_PRINTF1(text); \ |
|
57 ERR_PRINTF2(_L("...failed: %d "), errval);\ |
|
58 SetTestStepResult(EFail);\ |
|
59 return TestStepResult();\ |
|
60 }\ |
|
61 } |
|
62 /** |
|
63 Fat32 ReadRaw Class. Inherits from the CTestStep. |
|
64 Contains functions needed to set up all tests. |
|
65 |
|
66 |
|
67 */ |
|
68 class CBaseTestFat32Base : public CTestStep |
|
69 { |
|
70 public: |
|
71 CBaseTestFat32Base(); |
|
72 ~CBaseTestFat32Base(); |
|
73 virtual TVerdict doTestStepPreambleL(); |
|
74 TBool IsFileSystemFAT(RFs &aFsSession,TInt aDrive); |
|
75 TBool IsFileSystemFAT32(); |
|
76 void ParseCommandArguments(void); |
|
77 TInt CBaseTestFat32Base::CurrentDrive(); |
|
78 TInt CheckSecPerClus(); |
|
79 TInt CalculateClusCount(); |
|
80 TInt Convert(TInt aLen, TUint8 *aBuffer, TUint32 *aField); |
|
81 TInt ReadField(TInt aLen, TInt aOffSet, TUint32 *aName); |
|
82 void CheckDebug(); |
|
83 |
|
84 //****KARTHIK RE-WORK***** |
|
85 TInt PosInBytes(TInt aFatIndex); |
|
86 TInt64 ClusterToByte(TInt aCluster); |
|
87 TInt64 getBytesPerCluster(TUint32 aSecPerClus); |
|
88 |
|
89 public: |
|
90 |
|
91 RFs iTheFs; // The file server session |
|
92 TFileName iSessionPath; // The session path |
|
93 TChar iDriveToTest; // The drive to run the tests on |
|
94 TUint32 iClusterCount; // The cluster count of the volume |
|
95 TUint32 iBPB_TotSec32; // Value of the field BPB_TotSec32 |
|
96 TUint32 iBPB_ResvdSecCnt; // Value of the field BPB_ResvdSecCnt |
|
97 TUint32 iBPB_NumFATs; // Value of the field BPB_NumFATs |
|
98 TUint32 iBPB_FATSz32; // Value of the field BPB_FATSz32 |
|
99 TUint32 iBPB_SecPerClus; // Value of the field BPB_SecPerClus |
|
100 TInt64 iDiskSize; // Size of the disk from TVolumeInfo |
|
101 TInt64 iDriveSize; // Size of the disk from the media driver |
|
102 TInt iMedia; // 0 for MMC, 1 for SD |
|
103 |
|
104 }; |
|
105 |
|
106 _LIT(KTestStepBase, "Base"); |
|
107 |
|
108 #endif // BASETESTFAT32BASE_H |
|