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 |
{
|
|
46 |
|
|
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];
|
|
59 |
UserHal::MemoryInfo(membuf);
|
|
60 |
delete someMem;
|
|
61 |
#if !defined(__WINS__)
|
|
62 |
test(freeMem>memoryInfo.iFreeRamInBytes);
|
|
63 |
#endif
|
|
64 |
|
|
65 |
test.Printf(_L("Total RAM size= %- 5dKBytes : Free RAM size = %- 5dKBytes\n"),memoryInfo.iTotalRamInBytes/1024,memoryInfo.iFreeRamInBytes/1024);
|
|
66 |
test.Printf(_L("Max free RAM = %- 5dKBytes : ROM size = %- 5dKBytes\n"),memoryInfo.iMaxFreeRamInBytes/1024,memoryInfo.iTotalRomInBytes/1024);
|
|
67 |
test.Printf(_L("RAM disk size = %- 5dKBytes\n"),memoryInfo.iInternalDiskRamInBytes/1024);
|
|
68 |
|
|
69 |
TMachineInfoV2Buf mbuf;
|
|
70 |
UserHal::MachineInfo(mbuf);
|
|
71 |
TMachineInfoV2& machineInfo=*(TMachineInfoV2*)mbuf.Ptr();
|
|
72 |
|
|
73 |
TName tn = machineInfo.iRomVersion.Name();
|
|
74 |
test.Printf(_L("Page Size = %- 16d : Rom version = %- 16S\n"),pageSize,&tn);
|
|
75 |
test.Printf(_L("ScreenOffsetX = %- 16d : ScreenOffsetY = %- 16d\n"),machineInfo.iOffsetToDisplayInPixels.iX,machineInfo.iOffsetToDisplayInPixels.iY);
|
|
76 |
|
|
77 |
TBool password=EFalse; // Password::IsEnabled(); This API was removed by __SECURE_API__
|
|
78 |
|
|
79 |
TPtrC t1=onOff(password);
|
|
80 |
TPtrC t2=yesNo(machineInfo.iBacklightPresent);
|
|
81 |
test.Printf(_L("Password = %- 16S : BacklightPresent= %S\n"),&t1,&t2);
|
|
82 |
test.Printf(_L("LanguageIndex = %- 16d : KeyboardIndex = %d\n"),machineInfo.iLanguageIndex,machineInfo.iKeyboardIndex);
|
|
83 |
|
|
84 |
TRomInfoV1Buf rombuf;
|
|
85 |
TRomInfoV1& rom=rombuf();
|
|
86 |
if (UserHal::RomInfo(rombuf)==KErrNone) // KErrNotSupported in WINS
|
|
87 |
{
|
|
88 |
test.Getch();
|
|
89 |
TInt i, j;
|
|
90 |
j=0;
|
|
91 |
for( i=2; i<8; i++ )
|
|
92 |
{
|
|
93 |
j |= rom.iEntry[i].iSize;
|
|
94 |
j |= rom.iEntry[i].iWidth;
|
|
95 |
j |= rom.iEntry[i].iSpeed;
|
|
96 |
j |= (TInt)rom.iEntry[i].iType;
|
|
97 |
}
|
|
98 |
test(j==0); // check that CS2-7 entries left blank
|
|
99 |
test.Printf(_L("CS0 ROM size %08X\n"), rom.iEntry[0].iSize );
|
|
100 |
test.Printf(_L("CS0 ROM width %d\n"), rom.iEntry[0].iWidth );
|
|
101 |
test.Printf(_L("CS0 ROM speed %d\n"), rom.iEntry[0].iSpeed );
|
|
102 |
test.Printf(_L("CS0 ROM type %d\n"), rom.iEntry[0].iType );
|
|
103 |
test.Printf(_L("CS1 ROM size %08X\n"), rom.iEntry[1].iSize );
|
|
104 |
test.Printf(_L("CS1 ROM width %d\n"), rom.iEntry[1].iWidth );
|
|
105 |
test.Printf(_L("CS1 ROM speed %d\n"), rom.iEntry[1].iSpeed );
|
|
106 |
test.Printf(_L("CS1 ROM type %d\n"), rom.iEntry[1].iType );
|
|
107 |
}
|
|
108 |
}
|
|
109 |
|
|
110 |
GLDEF_C TInt E32Main()
|
|
111 |
//
|
|
112 |
// Display system information
|
|
113 |
//
|
|
114 |
{
|
|
115 |
|
|
116 |
test.Title();
|
|
117 |
testInfo();
|
|
118 |
test.Getch();
|
|
119 |
return(KErrNone);
|
|
120 |
}
|
|
121 |
|
|
122 |
|