sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\system\t_inf.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: LOCAL_D RTest test(_L("T_INF")); sl@0: sl@0: LOCAL_C const TPtrC onOff(TBool aSwitch) sl@0: // sl@0: // Convert to On/Off text. sl@0: // sl@0: { sl@0: sl@0: return(aSwitch ? _L("On") : _L("Off")); sl@0: } sl@0: sl@0: LOCAL_C const TPtrC yesNo(TBool aSwitch) sl@0: // sl@0: // Convert to Yes/No text. sl@0: // sl@0: { sl@0: sl@0: return(aSwitch ? _L("Yes") : _L("No")); sl@0: } sl@0: sl@0: LOCAL_C void testInfo() sl@0: // sl@0: // Test the HAL info. sl@0: // sl@0: { sl@0: sl@0: TInt pageSize=0; sl@0: UserHal::PageSizeInBytes(pageSize); sl@0: sl@0: TMemoryInfoV1Buf membuf; sl@0: UserHal::MemoryInfo(membuf); sl@0: TMemoryInfoV1& memoryInfo=*(TMemoryInfoV1*)membuf.Ptr(); sl@0: sl@0: test.Printf(_L("Allocate some memory & check RAM goes down")); sl@0: #if !defined(__WINS__) sl@0: TInt freeMem=memoryInfo.iFreeRamInBytes; sl@0: #endif sl@0: TInt8* someMem = new TInt8[0x4000]; sl@0: UserHal::MemoryInfo(membuf); sl@0: delete someMem; sl@0: #if !defined(__WINS__) sl@0: test(freeMem>memoryInfo.iFreeRamInBytes); sl@0: #endif sl@0: sl@0: test.Printf(_L("Total RAM size= %- 5dKBytes : Free RAM size = %- 5dKBytes\n"),memoryInfo.iTotalRamInBytes/1024,memoryInfo.iFreeRamInBytes/1024); sl@0: test.Printf(_L("Max free RAM = %- 5dKBytes : ROM size = %- 5dKBytes\n"),memoryInfo.iMaxFreeRamInBytes/1024,memoryInfo.iTotalRomInBytes/1024); sl@0: test.Printf(_L("RAM disk size = %- 5dKBytes\n"),memoryInfo.iInternalDiskRamInBytes/1024); sl@0: sl@0: TMachineInfoV2Buf mbuf; sl@0: UserHal::MachineInfo(mbuf); sl@0: TMachineInfoV2& machineInfo=*(TMachineInfoV2*)mbuf.Ptr(); sl@0: sl@0: TName tn = machineInfo.iRomVersion.Name(); sl@0: test.Printf(_L("Page Size = %- 16d : Rom version = %- 16S\n"),pageSize,&tn); sl@0: test.Printf(_L("ScreenOffsetX = %- 16d : ScreenOffsetY = %- 16d\n"),machineInfo.iOffsetToDisplayInPixels.iX,machineInfo.iOffsetToDisplayInPixels.iY); sl@0: sl@0: TBool password=EFalse; // Password::IsEnabled(); This API was removed by __SECURE_API__ sl@0: sl@0: TPtrC t1=onOff(password); sl@0: TPtrC t2=yesNo(machineInfo.iBacklightPresent); sl@0: test.Printf(_L("Password = %- 16S : BacklightPresent= %S\n"),&t1,&t2); sl@0: test.Printf(_L("LanguageIndex = %- 16d : KeyboardIndex = %d\n"),machineInfo.iLanguageIndex,machineInfo.iKeyboardIndex); sl@0: sl@0: TRomInfoV1Buf rombuf; sl@0: TRomInfoV1& rom=rombuf(); sl@0: if (UserHal::RomInfo(rombuf)==KErrNone) // KErrNotSupported in WINS sl@0: { sl@0: test.Getch(); sl@0: TInt i, j; sl@0: j=0; sl@0: for( i=2; i<8; i++ ) sl@0: { sl@0: j |= rom.iEntry[i].iSize; sl@0: j |= rom.iEntry[i].iWidth; sl@0: j |= rom.iEntry[i].iSpeed; sl@0: j |= (TInt)rom.iEntry[i].iType; sl@0: } sl@0: test(j==0); // check that CS2-7 entries left blank sl@0: test.Printf(_L("CS0 ROM size %08X\n"), rom.iEntry[0].iSize ); sl@0: test.Printf(_L("CS0 ROM width %d\n"), rom.iEntry[0].iWidth ); sl@0: test.Printf(_L("CS0 ROM speed %d\n"), rom.iEntry[0].iSpeed ); sl@0: test.Printf(_L("CS0 ROM type %d\n"), rom.iEntry[0].iType ); sl@0: test.Printf(_L("CS1 ROM size %08X\n"), rom.iEntry[1].iSize ); sl@0: test.Printf(_L("CS1 ROM width %d\n"), rom.iEntry[1].iWidth ); sl@0: test.Printf(_L("CS1 ROM speed %d\n"), rom.iEntry[1].iSpeed ); sl@0: test.Printf(_L("CS1 ROM type %d\n"), rom.iEntry[1].iType ); sl@0: } sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: // sl@0: // Display system information sl@0: // sl@0: { sl@0: sl@0: test.Title(); sl@0: testInfo(); sl@0: test.Getch(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: