sl@0
|
1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\system\t_inf.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32test.h>
|
sl@0
|
19 |
#include <e32hal.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
LOCAL_D RTest test(_L("T_INF"));
|
sl@0
|
22 |
|
sl@0
|
23 |
LOCAL_C const TPtrC onOff(TBool aSwitch)
|
sl@0
|
24 |
//
|
sl@0
|
25 |
// Convert to On/Off text.
|
sl@0
|
26 |
//
|
sl@0
|
27 |
{
|
sl@0
|
28 |
|
sl@0
|
29 |
return(aSwitch ? _L("On") : _L("Off"));
|
sl@0
|
30 |
}
|
sl@0
|
31 |
|
sl@0
|
32 |
LOCAL_C const TPtrC yesNo(TBool aSwitch)
|
sl@0
|
33 |
//
|
sl@0
|
34 |
// Convert to Yes/No text.
|
sl@0
|
35 |
//
|
sl@0
|
36 |
{
|
sl@0
|
37 |
|
sl@0
|
38 |
return(aSwitch ? _L("Yes") : _L("No"));
|
sl@0
|
39 |
}
|
sl@0
|
40 |
|
sl@0
|
41 |
LOCAL_C void testInfo()
|
sl@0
|
42 |
//
|
sl@0
|
43 |
// Test the HAL info.
|
sl@0
|
44 |
//
|
sl@0
|
45 |
{
|
sl@0
|
46 |
|
sl@0
|
47 |
TInt pageSize=0;
|
sl@0
|
48 |
UserHal::PageSizeInBytes(pageSize);
|
sl@0
|
49 |
|
sl@0
|
50 |
TMemoryInfoV1Buf membuf;
|
sl@0
|
51 |
UserHal::MemoryInfo(membuf);
|
sl@0
|
52 |
TMemoryInfoV1& memoryInfo=*(TMemoryInfoV1*)membuf.Ptr();
|
sl@0
|
53 |
|
sl@0
|
54 |
test.Printf(_L("Allocate some memory & check RAM goes down"));
|
sl@0
|
55 |
#if !defined(__WINS__)
|
sl@0
|
56 |
TInt freeMem=memoryInfo.iFreeRamInBytes;
|
sl@0
|
57 |
#endif
|
sl@0
|
58 |
TInt8* someMem = new TInt8[0x4000];
|
sl@0
|
59 |
UserHal::MemoryInfo(membuf);
|
sl@0
|
60 |
delete someMem;
|
sl@0
|
61 |
#if !defined(__WINS__)
|
sl@0
|
62 |
test(freeMem>memoryInfo.iFreeRamInBytes);
|
sl@0
|
63 |
#endif
|
sl@0
|
64 |
|
sl@0
|
65 |
test.Printf(_L("Total RAM size= %- 5dKBytes : Free RAM size = %- 5dKBytes\n"),memoryInfo.iTotalRamInBytes/1024,memoryInfo.iFreeRamInBytes/1024);
|
sl@0
|
66 |
test.Printf(_L("Max free RAM = %- 5dKBytes : ROM size = %- 5dKBytes\n"),memoryInfo.iMaxFreeRamInBytes/1024,memoryInfo.iTotalRomInBytes/1024);
|
sl@0
|
67 |
test.Printf(_L("RAM disk size = %- 5dKBytes\n"),memoryInfo.iInternalDiskRamInBytes/1024);
|
sl@0
|
68 |
|
sl@0
|
69 |
TMachineInfoV2Buf mbuf;
|
sl@0
|
70 |
UserHal::MachineInfo(mbuf);
|
sl@0
|
71 |
TMachineInfoV2& machineInfo=*(TMachineInfoV2*)mbuf.Ptr();
|
sl@0
|
72 |
|
sl@0
|
73 |
TName tn = machineInfo.iRomVersion.Name();
|
sl@0
|
74 |
test.Printf(_L("Page Size = %- 16d : Rom version = %- 16S\n"),pageSize,&tn);
|
sl@0
|
75 |
test.Printf(_L("ScreenOffsetX = %- 16d : ScreenOffsetY = %- 16d\n"),machineInfo.iOffsetToDisplayInPixels.iX,machineInfo.iOffsetToDisplayInPixels.iY);
|
sl@0
|
76 |
|
sl@0
|
77 |
TBool password=EFalse; // Password::IsEnabled(); This API was removed by __SECURE_API__
|
sl@0
|
78 |
|
sl@0
|
79 |
TPtrC t1=onOff(password);
|
sl@0
|
80 |
TPtrC t2=yesNo(machineInfo.iBacklightPresent);
|
sl@0
|
81 |
test.Printf(_L("Password = %- 16S : BacklightPresent= %S\n"),&t1,&t2);
|
sl@0
|
82 |
test.Printf(_L("LanguageIndex = %- 16d : KeyboardIndex = %d\n"),machineInfo.iLanguageIndex,machineInfo.iKeyboardIndex);
|
sl@0
|
83 |
|
sl@0
|
84 |
TRomInfoV1Buf rombuf;
|
sl@0
|
85 |
TRomInfoV1& rom=rombuf();
|
sl@0
|
86 |
if (UserHal::RomInfo(rombuf)==KErrNone) // KErrNotSupported in WINS
|
sl@0
|
87 |
{
|
sl@0
|
88 |
test.Getch();
|
sl@0
|
89 |
TInt i, j;
|
sl@0
|
90 |
j=0;
|
sl@0
|
91 |
for( i=2; i<8; i++ )
|
sl@0
|
92 |
{
|
sl@0
|
93 |
j |= rom.iEntry[i].iSize;
|
sl@0
|
94 |
j |= rom.iEntry[i].iWidth;
|
sl@0
|
95 |
j |= rom.iEntry[i].iSpeed;
|
sl@0
|
96 |
j |= (TInt)rom.iEntry[i].iType;
|
sl@0
|
97 |
}
|
sl@0
|
98 |
test(j==0); // check that CS2-7 entries left blank
|
sl@0
|
99 |
test.Printf(_L("CS0 ROM size %08X\n"), rom.iEntry[0].iSize );
|
sl@0
|
100 |
test.Printf(_L("CS0 ROM width %d\n"), rom.iEntry[0].iWidth );
|
sl@0
|
101 |
test.Printf(_L("CS0 ROM speed %d\n"), rom.iEntry[0].iSpeed );
|
sl@0
|
102 |
test.Printf(_L("CS0 ROM type %d\n"), rom.iEntry[0].iType );
|
sl@0
|
103 |
test.Printf(_L("CS1 ROM size %08X\n"), rom.iEntry[1].iSize );
|
sl@0
|
104 |
test.Printf(_L("CS1 ROM width %d\n"), rom.iEntry[1].iWidth );
|
sl@0
|
105 |
test.Printf(_L("CS1 ROM speed %d\n"), rom.iEntry[1].iSpeed );
|
sl@0
|
106 |
test.Printf(_L("CS1 ROM type %d\n"), rom.iEntry[1].iType );
|
sl@0
|
107 |
}
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
GLDEF_C TInt E32Main()
|
sl@0
|
111 |
//
|
sl@0
|
112 |
// Display system information
|
sl@0
|
113 |
//
|
sl@0
|
114 |
{
|
sl@0
|
115 |
|
sl@0
|
116 |
test.Title();
|
sl@0
|
117 |
testInfo();
|
sl@0
|
118 |
test.Getch();
|
sl@0
|
119 |
return(KErrNone);
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
|