Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\system\t_inf.cpp
21 LOCAL_D RTest test(_L("T_INF"));
23 LOCAL_C const TPtrC onOff(TBool aSwitch)
25 // Convert to On/Off text.
29 return(aSwitch ? _L("On") : _L("Off"));
32 LOCAL_C const TPtrC yesNo(TBool aSwitch)
34 // Convert to Yes/No text.
38 return(aSwitch ? _L("Yes") : _L("No"));
41 LOCAL_C void testInfo()
48 UserHal::PageSizeInBytes(pageSize);
50 TMemoryInfoV1Buf membuf;
51 UserHal::MemoryInfo(membuf);
52 TMemoryInfoV1& memoryInfo=*(TMemoryInfoV1*)membuf.Ptr();
54 test.Printf(_L("Allocate some memory & check RAM goes down"));
55 #if !defined(__WINS__)
56 TInt freeMem=memoryInfo.iFreeRamInBytes;
58 TInt8* someMem = new TInt8[0x4000];
59 UserHal::MemoryInfo(membuf);
61 #if !defined(__WINS__)
62 test(freeMem>memoryInfo.iFreeRamInBytes);
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);
69 TMachineInfoV2Buf mbuf;
70 UserHal::MachineInfo(mbuf);
71 TMachineInfoV2& machineInfo=*(TMachineInfoV2*)mbuf.Ptr();
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);
77 TBool password=EFalse; // Password::IsEnabled(); This API was removed by __SECURE_API__
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);
85 TRomInfoV1& rom=rombuf();
86 if (UserHal::RomInfo(rombuf)==KErrNone) // KErrNotSupported in WINS
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;
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 );
110 GLDEF_C TInt E32Main()
112 // Display system information