author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 0 | a41df078684a |
child 44 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1996-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\system\t_inf.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include <e32test.h> |
|
19 |
#include <e32hal.h> |
|
20 |
||
21 |
LOCAL_D RTest test(_L("T_INF")); |
|
22 |
||
23 |
LOCAL_C const TPtrC onOff(TBool aSwitch) |
|
24 |
// |
|
25 |
// Convert to On/Off text. |
|
26 |
// |
|
27 |
{ |
|
28 |
||
29 |
return(aSwitch ? _L("On") : _L("Off")); |
|
30 |
} |
|
31 |
||
32 |
LOCAL_C const TPtrC yesNo(TBool aSwitch) |
|
33 |
// |
|
34 |
// Convert to Yes/No text. |
|
35 |
// |
|
36 |
{ |
|
37 |
||
38 |
return(aSwitch ? _L("Yes") : _L("No")); |
|
39 |
} |
|
40 |
||
41 |
LOCAL_C void testInfo() |
|
42 |
// |
|
43 |
// Test the HAL info. |
|
44 |
// |
|
45 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
46 |
test.Next(_L("Test UserHal::MemoryInfo")); |
0 | 47 |
TInt pageSize=0; |
48 |
UserHal::PageSizeInBytes(pageSize); |
|
49 |
||
50 |
TMemoryInfoV1Buf membuf; |
|
51 |
UserHal::MemoryInfo(membuf); |
|
52 |
TMemoryInfoV1& memoryInfo=*(TMemoryInfoV1*)membuf.Ptr(); |
|
53 |
||
54 |
test.Printf(_L("Allocate some memory & check RAM goes down")); |
|
55 |
#if !defined(__WINS__) |
|
56 |
TInt freeMem=memoryInfo.iFreeRamInBytes; |
|
57 |
#endif |
|
58 |
TInt8* someMem = new TInt8[0x4000]; |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
// make an access to each page in order to get pages actually allocated also on data paged systems |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
someMem[0]=1; |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
someMem[0x1000]=2; |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
someMem[0x2000]=3; |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
someMem[0x3000]=4; |
0 | 64 |
UserHal::MemoryInfo(membuf); |
65 |
delete someMem; |
|
66 |
#if !defined(__WINS__) |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
67 |
if (!(freeMem>memoryInfo.iFreeRamInBytes)) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
68 |
test.Printf(_L("Warning: free RAM value didn't go down")); |
0 | 69 |
#endif |
70 |
||
71 |
test.Printf(_L("Total RAM size= %- 5dKBytes : Free RAM size = %- 5dKBytes\n"),memoryInfo.iTotalRamInBytes/1024,memoryInfo.iFreeRamInBytes/1024); |
|
72 |
test.Printf(_L("Max free RAM = %- 5dKBytes : ROM size = %- 5dKBytes\n"),memoryInfo.iMaxFreeRamInBytes/1024,memoryInfo.iTotalRomInBytes/1024); |
|
73 |
test.Printf(_L("RAM disk size = %- 5dKBytes\n"),memoryInfo.iInternalDiskRamInBytes/1024); |
|
74 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
test.Next(_L("Test UserHal::MachineInfo")); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
|
0 | 77 |
TMachineInfoV2Buf mbuf; |
78 |
UserHal::MachineInfo(mbuf); |
|
79 |
TMachineInfoV2& machineInfo=*(TMachineInfoV2*)mbuf.Ptr(); |
|
80 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
TName tn = machineInfo.iRomVersion.Name(); |
0 | 82 |
test.Printf(_L("Page Size = %- 16d : Rom version = %- 16S\n"),pageSize,&tn); |
83 |
test.Printf(_L("ScreenOffsetX = %- 16d : ScreenOffsetY = %- 16d\n"),machineInfo.iOffsetToDisplayInPixels.iX,machineInfo.iOffsetToDisplayInPixels.iY); |
|
84 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
TBool password=EFalse; // Password::IsEnabled(); This API was removed by __SECURE_API__ |
0 | 86 |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
TPtrC t1=onOff(password); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
TPtrC t2=yesNo(machineInfo.iBacklightPresent); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
|
0 | 90 |
test.Printf(_L("Password = %- 16S : BacklightPresent= %S\n"),&t1,&t2); |
91 |
test.Printf(_L("LanguageIndex = %- 16d : KeyboardIndex = %d\n"),machineInfo.iLanguageIndex,machineInfo.iKeyboardIndex); |
|
92 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
93 |
test.Next(_L("Test deprecated UserHal::RomInfo API")); |
0 | 94 |
TRomInfoV1Buf rombuf; |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
95 |
test(UserHal::RomInfo(rombuf)==KErrNotSupported); // kernel side API has been deprecated |
0 | 96 |
} |
97 |
||
98 |
GLDEF_C TInt E32Main() |
|
99 |
// |
|
100 |
// Display system information |
|
101 |
// |
|
102 |
{ |
|
103 |
test.Title(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
104 |
test.Start(_L("Test UserHal info APIs")); |
0 | 105 |
testInfo(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
106 |
test.End(); |
0 | 107 |
return(KErrNone); |
108 |
} |
|
109 |
||
110 |